summaryrefslogtreecommitdiff
path: root/editor/script_editor_debugger.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/script_editor_debugger.cpp')
-rw-r--r--editor/script_editor_debugger.cpp75
1 files changed, 57 insertions, 18 deletions
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 38cb8d654e..ebf4b1cf3a 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -90,11 +90,13 @@ public:
return "";
}
- void add_property(const String &p_name, const Variant &p_value) {
+ void add_property(const String &p_name, const Variant &p_value, const PropertyHint &p_hint, const String p_hint_string) {
PropertyInfo pinfo;
pinfo.name = p_name;
pinfo.type = p_value.get_type();
+ pinfo.hint = p_hint;
+ pinfo.hint_string = p_hint_string;
props.push_back(pinfo);
values[p_name] = p_value;
}
@@ -437,7 +439,11 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
inspected_object->last_edited_id = id;
- inspect_properties->edit(inspected_object);
+ if (tabs->get_current_tab() == 2) {
+ inspect_properties->edit(inspected_object);
+ } else {
+ editor->push_item(inspected_object);
+ }
} else if (p_msg == "message:video_mem") {
@@ -499,13 +505,20 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String n = p_data[ofs + i * 2 + 0];
Variant v = p_data[ofs + i * 2 + 1];
+ PropertyHint h = PROPERTY_HINT_NONE;
+ String hs = String();
if (n.begins_with("*")) {
n = n.substr(1, n.length());
+ h = PROPERTY_HINT_OBJECT_ID;
+ String s = v;
+ s = s.replace("[", "");
+ hs = s.get_slice(":", 0);
+ v = s.get_slice(":", 1).to_int();
}
- variables->add_property("members/" + n, v);
+ variables->add_property("members/" + n, v, h, hs);
}
ofs += mcount * 2;
@@ -516,13 +529,20 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String n = p_data[ofs + i * 2 + 0];
Variant v = p_data[ofs + i * 2 + 1];
+ PropertyHint h = PROPERTY_HINT_NONE;
+ String hs = String();
if (n.begins_with("*")) {
n = n.substr(1, n.length());
+ h = PROPERTY_HINT_OBJECT_ID;
+ String s = v;
+ s = s.replace("[", "");
+ hs = s.get_slice(":", 0);
+ v = s.get_slice(":", 1).to_int();
}
- variables->add_property("locals/" + n, v);
+ variables->add_property("locals/" + n, v, h, hs);
}
variables->update();
@@ -1056,6 +1076,9 @@ void ScriptEditorDebugger::stop() {
EditorNode::get_singleton()->get_pause_button()->set_pressed(false);
EditorNode::get_singleton()->get_pause_button()->set_disabled(true);
+ //avoid confusion when stopped debugging but an object is still edited
+ EditorNode::get_singleton()->push_item(NULL);
+
if (hide_on_stop) {
if (is_visible_in_tree())
EditorNode::get_singleton()->hide_bottom_panel();
@@ -1551,6 +1574,9 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
editor = p_editor;
tabs = memnew(TabContainer);
+ tabs->add_style_override("panel", editor->get_gui_base()->get_stylebox("EditorPanelDebugger", "EditorStyles"));
+ tabs->add_style_override("tab_fg", editor->get_gui_base()->get_stylebox("EditorTabFGDebugger", "EditorStyles"));
+ tabs->add_style_override("tab_bg", editor->get_gui_base()->get_stylebox("EditorTabBGDebugger", "EditorStyles"));
tabs->set_v_size_flags(SIZE_EXPAND_FILL);
tabs->set_area_as_parent_rect();
add_child(tabs);
@@ -1575,11 +1601,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
hbc->add_child(memnew(VSeparator));
step = memnew(Button);
+ step->set_flat(true);
hbc->add_child(step);
step->set_tooltip(TTR("Step Into"));
step->connect("pressed", this, "debug_step");
next = memnew(Button);
+ next->set_flat(true);
hbc->add_child(next);
next->set_tooltip(TTR("Step Over"));
next->connect("pressed", this, "debug_next");
@@ -1587,11 +1615,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
hbc->add_child(memnew(VSeparator));
dobreak = memnew(Button);
+ dobreak->set_flat(true);
hbc->add_child(dobreak);
dobreak->set_tooltip(TTR("Break"));
dobreak->connect("pressed", this, "debug_break");
docontinue = memnew(Button);
+ docontinue->set_flat(true);
hbc->add_child(docontinue);
docontinue->set_tooltip(TTR("Continue"));
docontinue->connect("pressed", this, "debug_continue");
@@ -1599,11 +1629,13 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
//hbc->add_child( memnew( VSeparator) );
back = memnew(Button);
+ back->set_flat(true);
hbc->add_child(back);
back->set_tooltip(TTR("Inspect Previous Instance"));
back->hide();
forward = memnew(Button);
+ forward->set_flat(true);
hbc->add_child(forward);
forward->set_tooltip(TTR("Inspect Next Instance"));
forward->hide();
@@ -1625,8 +1657,9 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
inspector->set_h_size_flags(SIZE_EXPAND_FILL);
inspector->hide_top_label();
inspector->get_scene_tree()->set_column_title(0, TTR("Variable"));
- inspector->set_capitalize_paths(false);
+ inspector->set_enable_capitalize_paths(false);
inspector->set_read_only(true);
+ inspector->connect("object_id_selected", this, "_scene_tree_property_select_object");
sc->add_child(inspector);
server = TCP_Server::create_ref();
@@ -1765,6 +1798,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
vmem_total->set_custom_minimum_size(Size2(100, 1) * EDSCALE);
vmem_hb->add_child(vmem_total);
vmem_refresh = memnew(Button);
+ vmem_refresh->set_flat(true);
vmem_hb->add_child(vmem_refresh);
vmem_vb->add_child(vmem_hb);
vmem_refresh->connect("pressed", this, "_video_mem_request");
@@ -1797,30 +1831,35 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
}
{ // misc
- VBoxContainer *info_left = memnew(VBoxContainer);
- info_left->set_h_size_flags(SIZE_EXPAND_FILL);
- info_left->set_name(TTR("Misc"));
- tabs->add_child(info_left);
+
+ GridContainer *grid_cont = memnew(GridContainer);
+ grid_cont->set_h_size_flags(SIZE_EXPAND_FILL);
+ grid_cont->set_name(TTR("Misc"));
+ grid_cont->set_columns(2);
+ tabs->add_child(grid_cont);
+
+ grid_cont->add_child(memnew(Label(TTR("Clicked Control:"))));
clicked_ctrl = memnew(LineEdit);
- info_left->add_margin_child(TTR("Clicked Control:"), clicked_ctrl);
+ grid_cont->add_child(clicked_ctrl);
+
+ grid_cont->add_child(memnew(Label(TTR("Clicked Control Type:"))));
clicked_ctrl_type = memnew(LineEdit);
- info_left->add_margin_child(TTR("Clicked Control Type:"), clicked_ctrl_type);
+ grid_cont->add_child(clicked_ctrl_type);
live_edit_root = memnew(LineEdit);
+ live_edit_root->set_h_size_flags(SIZE_EXPAND_FILL);
{
+ grid_cont->add_child(memnew(Label(TTR("Live Edit Root:"))));
+
HBoxContainer *lehb = memnew(HBoxContainer);
- Label *l = memnew(Label(TTR("Live Edit Root:")));
- lehb->add_child(l);
- l->set_h_size_flags(SIZE_EXPAND_FILL);
+ lehb->set_h_size_flags(SIZE_EXPAND_FILL);
+ lehb->add_child(live_edit_root);
le_set = memnew(Button(TTR("Set From Tree")));
lehb->add_child(le_set);
le_clear = memnew(Button(TTR("Clear")));
lehb->add_child(le_clear);
- info_left->add_child(lehb);
- MarginContainer *mc = memnew(MarginContainer);
- mc->add_child(live_edit_root);
- info_left->add_child(mc);
+ grid_cont->add_child(lehb);
le_set->set_disabled(true);
le_clear->set_disabled(true);
}