Send inherited variables and constants from remote debugger
This commit is contained in:
parent
1c419531a0
commit
7e499683a2
1 changed files with 40 additions and 14 deletions
|
@ -554,22 +554,46 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
|
||||||
if (ScriptInstance *si = obj->get_script_instance()) {
|
if (ScriptInstance *si = obj->get_script_instance()) {
|
||||||
if (!si->get_script().is_null()) {
|
if (!si->get_script().is_null()) {
|
||||||
|
|
||||||
Set<StringName> members;
|
typedef Map<const Script *, Set<StringName> > ScriptMemberMap;
|
||||||
si->get_script()->get_members(&members);
|
typedef Map<const Script *, Map<StringName, Variant> > ScriptConstantsMap;
|
||||||
for (Set<StringName>::Element *E = members.front(); E; E = E->next()) {
|
|
||||||
|
|
||||||
Variant m;
|
ScriptMemberMap members;
|
||||||
if (si->get(E->get(), m)) {
|
members[si->get_script().ptr()] = Set<StringName>();
|
||||||
PropertyInfo pi(m.get_type(), String("Members/") + E->get());
|
si->get_script()->get_members(&(members[si->get_script().ptr()]));
|
||||||
properties.push_back(PropertyDesc(pi, m));
|
|
||||||
|
ScriptConstantsMap constants;
|
||||||
|
constants[si->get_script().ptr()] = Map<StringName, Variant>();
|
||||||
|
si->get_script()->get_constants(&(constants[si->get_script().ptr()]));
|
||||||
|
|
||||||
|
Ref<Script> base = si->get_script()->get_base_script();
|
||||||
|
while (base.is_valid()) {
|
||||||
|
|
||||||
|
members[base.ptr()] = Set<StringName>();
|
||||||
|
base->get_members(&(members[base.ptr()]));
|
||||||
|
|
||||||
|
constants[base.ptr()] = Map<StringName, Variant>();
|
||||||
|
base->get_constants(&(constants[base.ptr()]));
|
||||||
|
|
||||||
|
base = base->get_base_script();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ScriptMemberMap::Element *sm = members.front(); sm; sm = sm->next()) {
|
||||||
|
for (Set<StringName>::Element *E = sm->get().front(); E; E = E->next()) {
|
||||||
|
Variant m;
|
||||||
|
if (si->get(E->get(), m)) {
|
||||||
|
String script_path = sm->key() == si->get_script().ptr() ? "" : sm->key()->get_path().get_file() + "/";
|
||||||
|
PropertyInfo pi(m.get_type(), "Members/" + script_path + E->get());
|
||||||
|
properties.push_back(PropertyDesc(pi, m));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<StringName, Variant> constants;
|
for (ScriptConstantsMap::Element *sc = constants.front(); sc; sc = sc->next()) {
|
||||||
si->get_script()->get_constants(&constants);
|
for (Map<StringName, Variant>::Element *E = sc->get().front(); E; E = E->next()) {
|
||||||
for (Map<StringName, Variant>::Element *E = constants.front(); E; E = E->next()) {
|
String script_path = sc->key() == si->get_script().ptr() ? "" : sc->key()->get_path().get_file() + "/";
|
||||||
PropertyInfo pi(E->value().get_type(), (String("Constants/") + E->key()));
|
PropertyInfo pi(E->value().get_type(), "Constants/" + script_path + E->key());
|
||||||
properties.push_back(PropertyDesc(pi, E->value()));
|
properties.push_back(PropertyDesc(pi, E->value()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -645,8 +669,10 @@ void ScriptDebuggerRemote::_set_object_property(ObjectID p_id, const String &p_p
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String prop_name = p_property;
|
String prop_name = p_property;
|
||||||
if (p_property.begins_with("Members/"))
|
if (p_property.begins_with("Members/")) {
|
||||||
prop_name = p_property.substr(8, p_property.length());
|
Vector<String> ss = p_property.split("/");
|
||||||
|
prop_name = ss[ss.size() - 1];
|
||||||
|
}
|
||||||
|
|
||||||
obj->set(prop_name, p_value);
|
obj->set(prop_name, p_value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue