Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions editor/debugger/script_editor_debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "editor/editor_log.h"
#include "editor/editor_node.h"
#include "editor/editor_string_names.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/file_system/editor_file_system.h"
#include "editor/gui/editor_file_dialog.h"
#include "editor/gui/editor_toaster.h"
Expand Down Expand Up @@ -449,6 +450,38 @@ void ScriptEditorDebugger::_msg_scene_inspect_object(uint64_t p_thread_id, const
}
#endif // DISABLE_DEPRECATED

void ScriptEditorDebugger::_msg_scene_select_path(uint64_t p_thread_id, const Array &p_data) {
ERR_FAIL_COND(p_data.is_empty());
String scene_path = p_data[0];
String node_path = p_data[1];
if (EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path() == scene_path) {
Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node_or_null(node_path);
if (n) {
EditorSelection *selection = EditorNode::get_singleton()->get_editor_selection();
selection->clear();
selection->add_node(n);
}
}
}

void ScriptEditorDebugger::_msg_scene_set_object_property(uint64_t p_thread_id, const Array &p_data) {
ERR_FAIL_COND(p_data.is_empty());
String scene_path = p_data[0];
String node_path = p_data[1];
String property_path = p_data[2];
Variant value = p_data[3];
if (EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path() == scene_path) {
Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node_or_null(node_path);
if (n) {
EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
undo_redo->create_action("Update property remotely");
undo_redo->add_do_property(n, property_path, value);
undo_redo->add_undo_property(n, property_path, n->get(property_path));
undo_redo->commit_action();
}
}
}

void ScriptEditorDebugger::_msg_scene_debug_mute_audio(uint64_t p_thread_id, const Array &p_data) {
ERR_FAIL_COND(p_data.is_empty());
// This is handled by SceneDebugger, we need to ignore here to not show a warning.
Expand Down Expand Up @@ -974,6 +1007,8 @@ void ScriptEditorDebugger::_init_parse_message_handlers() {
#ifndef DISABLE_DEPRECATED
parse_message_handlers["scene:inspect_object"] = &ScriptEditorDebugger::_msg_scene_inspect_object;
#endif // DISABLE_DEPRECATED
parse_message_handlers["scene:select_path"] = &ScriptEditorDebugger::_msg_scene_select_path;
parse_message_handlers["scene:set_object_property"] = &ScriptEditorDebugger::_msg_scene_set_object_property;
parse_message_handlers["scene:debug_mute_audio"] = &ScriptEditorDebugger::_msg_scene_debug_mute_audio;
parse_message_handlers["servers:memory_usage"] = &ScriptEditorDebugger::_msg_servers_memory_usage;
parse_message_handlers["servers:drawn"] = &ScriptEditorDebugger::_msg_servers_drawn;
Expand Down
2 changes: 2 additions & 0 deletions editor/debugger/script_editor_debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ class ScriptEditorDebugger : public MarginContainer {
#ifndef DISABLE_DEPRECATED
void _msg_scene_inspect_object(uint64_t p_thread_id, const Array &p_data);
#endif // DISABLE_DEPRECATED
void _msg_scene_select_path(uint64_t p_thread_id, const Array &p_data);
void _msg_scene_set_object_property(uint64_t p_thread_id, const Array &p_data);
void _msg_scene_debug_mute_audio(uint64_t p_thread_id, const Array &p_data);
void _msg_servers_memory_usage(uint64_t p_thread_id, const Array &p_data);
void _msg_servers_drawn(uint64_t p_thread_id, const Array &p_data);
Expand Down
Loading