You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Cleaned up/Fixed some bugs in the remote inspector code.
Cleaned up/Fixed some bugs in the remote inspector code. This makes some of my previous code cleaner while resolving a bunch of bugs.
This commit is contained in:
@@ -578,12 +578,18 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
|
|||||||
for (ScriptConstantsMap::Element *sc = constants.front(); sc; sc = sc->next()) {
|
for (ScriptConstantsMap::Element *sc = constants.front(); sc; sc = sc->next()) {
|
||||||
for (Map<StringName, Variant>::Element *E = sc->get().front(); E; E = E->next()) {
|
for (Map<StringName, Variant>::Element *E = sc->get().front(); E; E = E->next()) {
|
||||||
String script_path = sc->key() == si->get_script().ptr() ? "" : sc->key()->get_path().get_file() + "/";
|
String script_path = sc->key() == si->get_script().ptr() ? "" : sc->key()->get_path().get_file() + "/";
|
||||||
|
if (E->value().get_type() == Variant::OBJECT) {
|
||||||
|
Variant id = ((Object *)E->value())->get_instance_id();
|
||||||
|
PropertyInfo pi(id.get_type(), "Constants/" + E->key(), PROPERTY_HINT_OBJECT_ID, "Object");
|
||||||
|
properties.push_back(PropertyDesc(pi, id));
|
||||||
|
} else {
|
||||||
PropertyInfo pi(E->value().get_type(), "Constants/" + script_path + 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()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (Node *node = Object::cast_to<Node>(obj)) {
|
if (Node *node = Object::cast_to<Node>(obj)) {
|
||||||
PropertyInfo pi(Variant::NODE_PATH, String("Node/path"));
|
PropertyInfo pi(Variant::NODE_PATH, String("Node/path"));
|
||||||
properties.push_front(PropertyDesc(pi, node->get_path()));
|
properties.push_front(PropertyDesc(pi, node->get_path()));
|
||||||
@@ -592,11 +598,17 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
|
|||||||
Map<StringName, Variant> constants;
|
Map<StringName, Variant> constants;
|
||||||
s->get_constants(&constants);
|
s->get_constants(&constants);
|
||||||
for (Map<StringName, Variant>::Element *E = constants.front(); E; E = E->next()) {
|
for (Map<StringName, Variant>::Element *E = constants.front(); E; E = E->next()) {
|
||||||
|
if (E->value().get_type() == Variant::OBJECT) {
|
||||||
|
Variant id = ((Object *)E->value())->get_instance_id();
|
||||||
|
PropertyInfo pi(id.get_type(), "Constants/" + E->key(), PROPERTY_HINT_OBJECT_ID, "Object");
|
||||||
|
properties.push_front(PropertyDesc(pi, E->value()));
|
||||||
|
} else {
|
||||||
PropertyInfo pi(E->value().get_type(), String("Constants/") + E->key());
|
PropertyInfo pi(E->value().get_type(), String("Constants/") + E->key());
|
||||||
properties.push_front(PropertyDesc(pi, E->value()));
|
properties.push_front(PropertyDesc(pi, E->value()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<PropertyInfo> pinfo;
|
List<PropertyInfo> pinfo;
|
||||||
obj->get_property_list(&pinfo, true);
|
obj->get_property_list(&pinfo, true);
|
||||||
@@ -634,10 +646,9 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
|
|||||||
prop.push_back(pi.hint);
|
prop.push_back(pi.hint);
|
||||||
prop.push_back(pi.hint_string);
|
prop.push_back(pi.hint_string);
|
||||||
prop.push_back(pi.usage);
|
prop.push_back(pi.usage);
|
||||||
|
|
||||||
if (!res.is_null()) {
|
if (!res.is_null()) {
|
||||||
var = String("PATH") + res->get_path();
|
var = res->get_path();
|
||||||
} else if (var.get_type() == Variant::STRING) {
|
|
||||||
var = String("DATA") + var;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prop.push_back(var);
|
prop.push_back(var);
|
||||||
|
|||||||
@@ -493,23 +493,29 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
|
|||||||
pinfo.usage = PropertyUsageFlags(int(prop[4]));
|
pinfo.usage = PropertyUsageFlags(int(prop[4]));
|
||||||
Variant var = prop[5];
|
Variant var = prop[5];
|
||||||
|
|
||||||
|
if (pinfo.type == Variant::OBJECT) {
|
||||||
|
if (var.is_zero()) {
|
||||||
|
var = RES();
|
||||||
|
} else if (var.get_type() == Variant::STRING) {
|
||||||
|
var = ResourceLoader::load(var);
|
||||||
|
|
||||||
|
if (pinfo.hint_string == "Script")
|
||||||
|
debugObj->set_script(var);
|
||||||
|
} else if (var.get_type() == Variant::OBJECT) {
|
||||||
|
if (((Object *)var)->is_class("EncodedObjectAsID")) {
|
||||||
|
var = Object::cast_to<EncodedObjectAsID>(var)->get_object_id();
|
||||||
|
pinfo.type = var.get_type();
|
||||||
|
pinfo.hint = PROPERTY_HINT_OBJECT_ID;
|
||||||
|
pinfo.hint_string = "Object";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (is_new_object) {
|
if (is_new_object) {
|
||||||
//don't update.. it's the same, instead refresh
|
//don't update.. it's the same, instead refresh
|
||||||
debugObj->prop_list.push_back(pinfo);
|
debugObj->prop_list.push_back(pinfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var.get_type() == Variant::STRING) {
|
|
||||||
String str = var;
|
|
||||||
var = str.substr(4, str.length());
|
|
||||||
|
|
||||||
if (str.begins_with("PATH")) {
|
|
||||||
if (String(var).empty())
|
|
||||||
var = RES();
|
|
||||||
else
|
|
||||||
var = ResourceLoader::load(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
debugObj->prop_values[pinfo.name] = var;
|
debugObj->prop_values[pinfo.name] = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user