|
44 | 44 | #include "editor/editor_log.h" |
45 | 45 | #include "editor/editor_node.h" |
46 | 46 | #include "editor/editor_string_names.h" |
| 47 | +#include "editor/editor_undo_redo_manager.h" |
47 | 48 | #include "editor/file_system/editor_file_system.h" |
48 | 49 | #include "editor/gui/editor_file_dialog.h" |
49 | 50 | #include "editor/gui/editor_toaster.h" |
@@ -449,6 +450,38 @@ void ScriptEditorDebugger::_msg_scene_inspect_object(uint64_t p_thread_id, const |
449 | 450 | } |
450 | 451 | #endif // DISABLE_DEPRECATED |
451 | 452 |
|
| 453 | +void ScriptEditorDebugger::_msg_scene_select_path(uint64_t p_thread_id, const Array &p_data) { |
| 454 | + ERR_FAIL_COND(p_data.is_empty()); |
| 455 | + String scene_path = p_data[0]; |
| 456 | + String node_path = p_data[1]; |
| 457 | + if (EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path() == scene_path) { |
| 458 | + Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node_or_null(node_path); |
| 459 | + if (n) { |
| 460 | + EditorSelection *selection = EditorNode::get_singleton()->get_editor_selection(); |
| 461 | + selection->clear(); |
| 462 | + selection->add_node(n); |
| 463 | + } |
| 464 | + } |
| 465 | +} |
| 466 | + |
| 467 | +void ScriptEditorDebugger::_msg_scene_set_object_property(uint64_t p_thread_id, const Array &p_data) { |
| 468 | + ERR_FAIL_COND(p_data.is_empty()); |
| 469 | + String scene_path = p_data[0]; |
| 470 | + String node_path = p_data[1]; |
| 471 | + String property_path = p_data[2]; |
| 472 | + Variant value = p_data[3]; |
| 473 | + if (EditorNode::get_singleton()->get_edited_scene()->get_scene_file_path() == scene_path) { |
| 474 | + Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node_or_null(node_path); |
| 475 | + if (n) { |
| 476 | + EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton(); |
| 477 | + undo_redo->create_action("Update property remotely"); |
| 478 | + undo_redo->add_do_property(n, property_path, value); |
| 479 | + undo_redo->add_undo_property(n, property_path, n->get(property_path)); |
| 480 | + undo_redo->commit_action(); |
| 481 | + } |
| 482 | + } |
| 483 | +} |
| 484 | + |
452 | 485 | void ScriptEditorDebugger::_msg_scene_debug_mute_audio(uint64_t p_thread_id, const Array &p_data) { |
453 | 486 | ERR_FAIL_COND(p_data.is_empty()); |
454 | 487 | // This is handled by SceneDebugger, we need to ignore here to not show a warning. |
@@ -974,6 +1007,8 @@ void ScriptEditorDebugger::_init_parse_message_handlers() { |
974 | 1007 | #ifndef DISABLE_DEPRECATED |
975 | 1008 | parse_message_handlers["scene:inspect_object"] = &ScriptEditorDebugger::_msg_scene_inspect_object; |
976 | 1009 | #endif // DISABLE_DEPRECATED |
| 1010 | + parse_message_handlers["scene:select_path"] = &ScriptEditorDebugger::_msg_scene_select_path; |
| 1011 | + parse_message_handlers["scene:set_object_property"] = &ScriptEditorDebugger::_msg_scene_set_object_property; |
977 | 1012 | parse_message_handlers["scene:debug_mute_audio"] = &ScriptEditorDebugger::_msg_scene_debug_mute_audio; |
978 | 1013 | parse_message_handlers["servers:memory_usage"] = &ScriptEditorDebugger::_msg_servers_memory_usage; |
979 | 1014 | parse_message_handlers["servers:drawn"] = &ScriptEditorDebugger::_msg_servers_drawn; |
|
0 commit comments