aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeequlim2017-11-16 17:18:36 +0800
committerGeequlim2017-11-17 12:01:54 +0800
commitfab66af7e99eb71ea6a2df30bea46835f749896a (patch)
treebfd8b19219ba48ca311d47f2914b7b474ce95195
parentc655fc7cd89d17eb858b3c99e82402de61571bb0 (diff)
downloadgodot-fab66af7e99eb71ea6a2df30bea46835f749896a.tar.gz
godot-fab66af7e99eb71ea6a2df30bea46835f749896a.tar.zst
godot-fab66af7e99eb71ea6a2df30bea46835f749896a.zip
Move the remote scene tree to the scene tree dock.
Ignore all script constants in the global section of the breakpoint stack. Check property size before send to avoid too large of data be sent. Fix crash while clear the remote objects from the debugger.
Diffstat (limited to '')
-rw-r--r--core/script_debugger_remote.cpp25
-rw-r--r--editor/scene_tree_dock.cpp2
-rw-r--r--editor/script_editor_debugger.cpp19
-rw-r--r--editor/script_editor_debugger.h4
-rw-r--r--modules/gdscript/gdscript_editor.cpp21
5 files changed, 47 insertions, 24 deletions
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 14f0cddb9..56056268f 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -609,13 +609,24 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
Array prop;
prop.push_back(pi.name);
prop.push_back(pi.type);
- prop.push_back(pi.hint);
- if (res.is_null())
- prop.push_back(pi.hint_string);
- else
- prop.push_back(String("RES:") + res->get_path());
- prop.push_back(pi.usage);
- prop.push_back(var);
+
+ //only send information that can be sent..
+ int len = 0; //test how big is this to encode
+ encode_variant(var, NULL, len);
+ if (len > packet_peer_stream->get_output_buffer_max_size()) { //limit to max size
+ prop.push_back(PROPERTY_HINT_OBJECT_TOO_BIG);
+ prop.push_back("");
+ prop.push_back(pi.usage);
+ prop.push_back(Variant());
+ } else {
+ prop.push_back(pi.hint);
+ if (res.is_null())
+ prop.push_back(pi.hint_string);
+ else
+ prop.push_back(String("RES:") + res->get_path());
+ prop.push_back(pi.usage);
+ prop.push_back(var);
+ }
send_props.push_back(prop);
}
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index 816156ef0..94f218757 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -1923,6 +1923,8 @@ void SceneTreeDock::_local_tree_selected() {
remote_tree->hide();
edit_remote->set_pressed(false);
edit_local->set_pressed(true);
+
+ _node_selected();
}
void SceneTreeDock::_bind_methods() {
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index c2ef16571..2a3e47b2a 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1150,6 +1150,8 @@ void ScriptEditorDebugger::start() {
EditorNode::get_log()->add_message(String("Error listening on port ") + itos(remote_port), true);
return;
}
+
+ EditorNode::get_singleton()->get_scene_tree_dock()->show_remote_tree();
set_process(true);
}
@@ -1186,6 +1188,7 @@ void ScriptEditorDebugger::stop() {
EditorNode::get_singleton()->get_pause_button()->set_pressed(false);
EditorNode::get_singleton()->get_pause_button()->set_disabled(true);
+ EditorNode::get_singleton()->get_scene_tree_dock()->hide_remote_tree();
if (hide_on_stop) {
if (is_visible_in_tree())
@@ -1662,6 +1665,9 @@ void ScriptEditorDebugger::_set_remote_object(ObjectID p_id, ScriptEditorDebugge
void ScriptEditorDebugger::_clear_remote_objects() {
for (Map<ObjectID, ScriptEditorDebuggerInspectedObject *>::Element *E = remote_objects.front(); E; E = E->next()) {
+ if (editor->get_editor_history()->get_current() == E->value()->get_instance_id()) {
+ editor->push_item(NULL);
+ }
memdelete(E->value());
}
remote_objects.clear();
@@ -1825,18 +1831,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
tabs->add_child(error_split);
}
- { // inquire
-
- inspect_info = memnew(HSplitContainer);
- inspect_info->set_name(TTR("Remote Inspector"));
- tabs->add_child(inspect_info);
-
- VBoxContainer *info_left = memnew(VBoxContainer);
- info_left->set_h_size_flags(SIZE_EXPAND_FILL);
- inspect_info->add_child(info_left);
+ { // remote scene tree
inspect_scene_tree = memnew(Tree);
- info_left->add_margin_child(TTR("Live Scene Tree:"), inspect_scene_tree, true);
+ EditorNode::get_singleton()->get_scene_tree_dock()->add_remote_tree_editor(inspect_scene_tree);
+ inspect_scene_tree->set_v_size_flags(SIZE_EXPAND_FILL);
inspect_scene_tree->connect("cell_selected", this, "_scene_tree_selected");
inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded");
diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h
index d13048ce2..dc851dd57 100644
--- a/editor/script_editor_debugger.h
+++ b/editor/script_editor_debugger.h
@@ -72,9 +72,6 @@ class ScriptEditorDebugger : public Control {
Button *le_set;
Button *le_clear;
- Tree *inspect_scene_tree;
- HSplitContainer *inspect_info;
-
bool updating_scene_tree;
float inspect_scene_tree_timeout;
float inspect_edited_object_timeout;
@@ -86,6 +83,7 @@ class ScriptEditorDebugger : public Control {
HSplitContainer *error_split;
ItemList *error_list;
ItemList *error_stack;
+ Tree *inspect_scene_tree;
int error_count;
int last_error_count;
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index de7adc7e4..5a76acea6 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -33,7 +33,7 @@
#include "gdscript_compiler.h"
#include "global_constants.h"
#include "os/file_access.h"
-#include "project_settings.h"
+#include "core/engine.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_file_system.h"
@@ -287,7 +287,7 @@ ScriptInstance *GDScriptLanguage::debug_get_stack_level_instance(int p_level) {
ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, NULL);
int l = _debug_call_stack_pos - p_level - 1;
- GDInstance *instance = _call_stack[l].instance;
+ ScriptInstance *instance = _call_stack[l].instance;
return instance;
}
@@ -297,14 +297,27 @@ void GDScriptLanguage::debug_get_globals(List<String> *p_globals, List<Variant>
const Map<StringName, int> &name_idx = GDScriptLanguage::get_singleton()->get_global_map();
const Variant *globals = GDScriptLanguage::get_singleton()->get_global_array();
+ List<Pair<String, Variant> > cinfo;
+ get_public_constants(&cinfo);
+
for (const Map<StringName, int>::Element *E = name_idx.front(); E; E = E->next()) {
- if (ClassDB::class_exists(E->key()) || ProjectSettings::get_singleton()->has_singleton(E->key()) || E->key() == "PI" || E->key() == "INF" || E->key() == "NAN")
+ if (ClassDB::class_exists(E->key()) || Engine::get_singleton()->has_singleton(E->key()))
+ continue;
+
+ bool is_script_constant = false;
+ for (List<Pair<String, Variant> >::Element *CE = cinfo.front(); CE; CE = CE->next()) {
+ if (CE->get().first == E->key()) {
+ is_script_constant = true;
+ break;
+ }
+ }
+ if (is_script_constant)
continue;
const Variant &var = globals[E->value()];
if (Object *obj = var) {
- if (Object::cast_to<GDNativeClass>(obj))
+ if (Object::cast_to<GDScriptNativeClass>(obj))
continue;
}