You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Enhanced debugger. ake 2.1 more productive!
Allow access more informations from remote debugger. Refector more debugger related code to allow full access to variables. Array Property Editor now can edit with more objects including remote objects. Implements `GDInstance::debug_get_globals` to query all gloabl constants avaliable in GDScriptLanguage. Show globals in debug stack variable panel. Disabe capitalize property name for remote object. Add DictionaryPropertyEdit to edit with Dictionaries. The serialization/unserialization workflow use binary data instead of dictionary to avoid send too large data. Do not stop debugger if curent break point stack has error fix #9034. Don't send all content of strings but first 80 characters from remote debugger. Add constants into the break point stack tree and remote object instance edit inspector. Remote GDScript resource object instance list constants in the property inspector. Add `self` to the local in the break point stack as a remote object. Move some functions for GDScript related to thier base classes so debugger don't rely on the gdscript module any more. The slef in the debugger tree now expanded as the instance of script instead of the script resource.
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
/*************************************************************************/
|
||||
#include "property_editor.h"
|
||||
#include "array_property_edit.h"
|
||||
#include "dictionary_property_edit.h"
|
||||
#include "editor_file_system.h"
|
||||
#include "editor_help.h"
|
||||
#include "editor_import_export.h"
|
||||
@@ -2885,7 +2886,7 @@ void PropertyEditor::update_tree() {
|
||||
if (type == "")
|
||||
type = "Object";
|
||||
|
||||
ObjectID id = obj->get(p.name);
|
||||
ObjectID id = _get_curent_remote_object_id(p.name);
|
||||
if (id != 0) {
|
||||
item->set_text(1, type + " ID: " + itos(id));
|
||||
item->add_button(1, get_icon("EditResource", "EditorIcons"));
|
||||
@@ -2993,10 +2994,10 @@ void PropertyEditor::update_tree() {
|
||||
} break;
|
||||
case Variant::DICTIONARY: {
|
||||
|
||||
item->set_cell_mode(1, TreeItem::CELL_MODE_STRING);
|
||||
item->set_editable(1, false);
|
||||
item->set_text(1, obj->get(p.name).operator String());
|
||||
|
||||
item->set_cell_mode(1, TreeItem::CELL_MODE_CUSTOM);
|
||||
item->add_button(1, get_icon("EditResource", "EditorIcons"));
|
||||
Dictionary d = obj->get(p.name);
|
||||
item->set_text(1, "Dictionary{" + itos(d.size()) + "}");
|
||||
} break;
|
||||
|
||||
case Variant::INT_ARRAY: {
|
||||
@@ -3208,8 +3209,16 @@ void PropertyEditor::update_tree() {
|
||||
type = p.hint_string;
|
||||
|
||||
if (obj->get(p.name).get_type() == Variant::NIL || obj->get(p.name).operator RefPtr().is_null()) {
|
||||
item->set_text(1, "<null>");
|
||||
item->set_icon(1, Ref<Texture>());
|
||||
|
||||
if (Object *_o = obj->get(p.name)) {
|
||||
if (_o->is_type("ScriptEditorDebuggerInspectedObject"))
|
||||
item->set_text(1, _o->call("get_title"));
|
||||
else
|
||||
item->set_text(1, String(_o->get_type_name()) + " ID: " + itos(obj->get_instance_ID()));
|
||||
} else {
|
||||
item->set_text(1, "<null>");
|
||||
item->set_icon(1, Ref<Texture>());
|
||||
}
|
||||
|
||||
} else {
|
||||
RES res = obj->get(p.name).operator RefPtr();
|
||||
@@ -3331,6 +3340,35 @@ void PropertyEditor::_draw_transparency(Object *t, const Rect2 &p_rect) {
|
||||
tree->draw_rect(area, color);
|
||||
}
|
||||
|
||||
ObjectID PropertyEditor::_get_curent_remote_object_id(const StringName &p_name) {
|
||||
|
||||
ObjectID id = 0;
|
||||
if (obj) {
|
||||
id = obj->get(p_name);
|
||||
if (id == 0) {
|
||||
|
||||
Object *debugObj = NULL;
|
||||
|
||||
if (obj->is_type("ScriptEditorDebuggerVariables")) {
|
||||
if (Object *oo = obj->call("get_var_value", p_name)) {
|
||||
if (oo->is_type("ScriptEditorDebuggerInspectedObject"))
|
||||
debugObj = oo;
|
||||
}
|
||||
} else if (obj->is_type("ScriptEditorDebuggerInspectedObject")) {
|
||||
if (Object *oo = obj->call("get_variant", p_name)) {
|
||||
if (oo->is_type("ScriptEditorDebuggerInspectedObject"))
|
||||
debugObj = oo;
|
||||
}
|
||||
}
|
||||
if (debugObj) {
|
||||
id = debugObj->call("get_remote_object_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
void PropertyEditor::_item_selected() {
|
||||
|
||||
TreeItem *item = tree->get_selected();
|
||||
@@ -3573,12 +3611,16 @@ void PropertyEditor::edit(Object *p_object) {
|
||||
|
||||
if (obj == p_object)
|
||||
return;
|
||||
|
||||
obj = p_object;
|
||||
|
||||
if (obj) {
|
||||
|
||||
obj->remove_change_receptor(this);
|
||||
}
|
||||
|
||||
obj = p_object;
|
||||
if (obj->is_type("ScriptEditorDebuggerInspectedObject"))
|
||||
set_enable_capitalize_paths(false);
|
||||
}
|
||||
|
||||
evaluator->edit(p_object);
|
||||
|
||||
@@ -3687,15 +3729,24 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
|
||||
|
||||
} else if (t == Variant::OBJECT) {
|
||||
|
||||
RES r = obj->get(n);
|
||||
if (r.is_valid()) {
|
||||
Variant var = obj->get(n);
|
||||
|
||||
RES r = var;
|
||||
if (r.is_valid()) {
|
||||
emit_signal("resource_selected", r, n);
|
||||
} else if (Object *o = var) {
|
||||
// Remote object clicked form property editor cell
|
||||
if (o->is_type("ScriptEditorDebuggerInspectedObject")) {
|
||||
ObjectID id = o->call("get_remote_object_id");
|
||||
emit_signal("object_id_selected", id);
|
||||
print_line(String("OBJ ID SELECTED: ") + itos(id));
|
||||
}
|
||||
}
|
||||
} else if (t == Variant::INT && h == PROPERTY_HINT_OBJECT_ID) {
|
||||
|
||||
emit_signal("object_id_selected", obj->get(n));
|
||||
print_line("OBJ ID SELECTED");
|
||||
ObjectID id = _get_curent_remote_object_id(n);
|
||||
emit_signal("object_id_selected", id);
|
||||
print_line(String("OBJ ID SELECTED: ") + itos(id));
|
||||
|
||||
} else if (t == Variant::ARRAY || t == Variant::INT_ARRAY || t == Variant::REAL_ARRAY || t == Variant::STRING_ARRAY || t == Variant::VECTOR2_ARRAY || t == Variant::VECTOR3_ARRAY || t == Variant::COLOR_ARRAY || t == Variant::RAW_ARRAY) {
|
||||
|
||||
@@ -3710,6 +3761,11 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) {
|
||||
ape->edit(obj, n, Variant::Type(t));
|
||||
|
||||
EditorNode::get_singleton()->push_item(ape.ptr());
|
||||
} else if (t == Variant::DICTIONARY) {
|
||||
|
||||
Ref<DictionaryPropertyEdit> dpe = memnew(DictionaryPropertyEdit);
|
||||
dpe->edit(obj, n);
|
||||
EditorNode::get_singleton()->push_item(dpe.ptr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user