You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
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.
This commit is contained in:
@@ -609,6 +609,16 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
|
|||||||
Array prop;
|
Array prop;
|
||||||
prop.push_back(pi.name);
|
prop.push_back(pi.name);
|
||||||
prop.push_back(pi.type);
|
prop.push_back(pi.type);
|
||||||
|
|
||||||
|
//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);
|
prop.push_back(pi.hint);
|
||||||
if (res.is_null())
|
if (res.is_null())
|
||||||
prop.push_back(pi.hint_string);
|
prop.push_back(pi.hint_string);
|
||||||
@@ -616,6 +626,7 @@ void ScriptDebuggerRemote::_send_object_id(ObjectID p_id) {
|
|||||||
prop.push_back(String("RES:") + res->get_path());
|
prop.push_back(String("RES:") + res->get_path());
|
||||||
prop.push_back(pi.usage);
|
prop.push_back(pi.usage);
|
||||||
prop.push_back(var);
|
prop.push_back(var);
|
||||||
|
}
|
||||||
send_props.push_back(prop);
|
send_props.push_back(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1923,6 +1923,8 @@ void SceneTreeDock::_local_tree_selected() {
|
|||||||
remote_tree->hide();
|
remote_tree->hide();
|
||||||
edit_remote->set_pressed(false);
|
edit_remote->set_pressed(false);
|
||||||
edit_local->set_pressed(true);
|
edit_local->set_pressed(true);
|
||||||
|
|
||||||
|
_node_selected();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneTreeDock::_bind_methods() {
|
void SceneTreeDock::_bind_methods() {
|
||||||
|
|||||||
@@ -1150,6 +1150,8 @@ void ScriptEditorDebugger::start() {
|
|||||||
EditorNode::get_log()->add_message(String("Error listening on port ") + itos(remote_port), true);
|
EditorNode::get_log()->add_message(String("Error listening on port ") + itos(remote_port), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditorNode::get_singleton()->get_scene_tree_dock()->show_remote_tree();
|
||||||
set_process(true);
|
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_pressed(false);
|
||||||
EditorNode::get_singleton()->get_pause_button()->set_disabled(true);
|
EditorNode::get_singleton()->get_pause_button()->set_disabled(true);
|
||||||
|
EditorNode::get_singleton()->get_scene_tree_dock()->hide_remote_tree();
|
||||||
|
|
||||||
if (hide_on_stop) {
|
if (hide_on_stop) {
|
||||||
if (is_visible_in_tree())
|
if (is_visible_in_tree())
|
||||||
@@ -1662,6 +1665,9 @@ void ScriptEditorDebugger::_set_remote_object(ObjectID p_id, ScriptEditorDebugge
|
|||||||
void ScriptEditorDebugger::_clear_remote_objects() {
|
void ScriptEditorDebugger::_clear_remote_objects() {
|
||||||
|
|
||||||
for (Map<ObjectID, ScriptEditorDebuggerInspectedObject *>::Element *E = remote_objects.front(); E; E = E->next()) {
|
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());
|
memdelete(E->value());
|
||||||
}
|
}
|
||||||
remote_objects.clear();
|
remote_objects.clear();
|
||||||
@@ -1825,18 +1831,11 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) {
|
|||||||
tabs->add_child(error_split);
|
tabs->add_child(error_split);
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // inquire
|
{ // remote scene tree
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
inspect_scene_tree = memnew(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("cell_selected", this, "_scene_tree_selected");
|
||||||
inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded");
|
inspect_scene_tree->connect("item_collapsed", this, "_scene_tree_folded");
|
||||||
|
|
||||||
|
|||||||
@@ -72,9 +72,6 @@ class ScriptEditorDebugger : public Control {
|
|||||||
Button *le_set;
|
Button *le_set;
|
||||||
Button *le_clear;
|
Button *le_clear;
|
||||||
|
|
||||||
Tree *inspect_scene_tree;
|
|
||||||
HSplitContainer *inspect_info;
|
|
||||||
|
|
||||||
bool updating_scene_tree;
|
bool updating_scene_tree;
|
||||||
float inspect_scene_tree_timeout;
|
float inspect_scene_tree_timeout;
|
||||||
float inspect_edited_object_timeout;
|
float inspect_edited_object_timeout;
|
||||||
@@ -86,6 +83,7 @@ class ScriptEditorDebugger : public Control {
|
|||||||
HSplitContainer *error_split;
|
HSplitContainer *error_split;
|
||||||
ItemList *error_list;
|
ItemList *error_list;
|
||||||
ItemList *error_stack;
|
ItemList *error_stack;
|
||||||
|
Tree *inspect_scene_tree;
|
||||||
|
|
||||||
int error_count;
|
int error_count;
|
||||||
int last_error_count;
|
int last_error_count;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "gdscript_compiler.h"
|
#include "gdscript_compiler.h"
|
||||||
#include "global_constants.h"
|
#include "global_constants.h"
|
||||||
#include "os/file_access.h"
|
#include "os/file_access.h"
|
||||||
#include "project_settings.h"
|
#include "core/engine.h"
|
||||||
|
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
#include "editor/editor_file_system.h"
|
#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);
|
ERR_FAIL_INDEX_V(p_level, _debug_call_stack_pos, NULL);
|
||||||
|
|
||||||
int l = _debug_call_stack_pos - p_level - 1;
|
int l = _debug_call_stack_pos - p_level - 1;
|
||||||
GDInstance *instance = _call_stack[l].instance;
|
ScriptInstance *instance = _call_stack[l].instance;
|
||||||
|
|
||||||
return 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 Map<StringName, int> &name_idx = GDScriptLanguage::get_singleton()->get_global_map();
|
||||||
const Variant *globals = GDScriptLanguage::get_singleton()->get_global_array();
|
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()) {
|
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;
|
continue;
|
||||||
|
|
||||||
const Variant &var = globals[E->value()];
|
const Variant &var = globals[E->value()];
|
||||||
if (Object *obj = var) {
|
if (Object *obj = var) {
|
||||||
if (Object::cast_to<GDNativeClass>(obj))
|
if (Object::cast_to<GDScriptNativeClass>(obj))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user