MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _edit_current

Method _edit_current

editor/editor_node.cpp:2762–2956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2760}
2761
2762void EditorNode::_edit_current(bool p_skip_foreign, bool p_skip_inspector_update) {
2763 ObjectID current_id = editor_history.get_current();
2764 Object *current_obj = current_id.is_valid() ? ObjectDB::get_instance(current_id) : nullptr;
2765
2766 Ref<Resource> res = Object::cast_to<Resource>(current_obj);
2767 if (p_skip_foreign && res.is_valid()) {
2768 const int current_tab = scene_tabs->get_current_tab();
2769 if (res->get_path().contains("::") && res->get_path().get_slice("::", 0) != editor_data.get_scene_path(current_tab)) {
2770 // Trying to edit resource that belongs to another scene; abort.
2771 current_obj = nullptr;
2772 }
2773 }
2774
2775 bool inspector_only = editor_history.is_current_inspector_only();
2776 current = current_obj;
2777
2778 if (!current_obj) {
2779 SceneTreeDock::get_singleton()->set_selected(nullptr);
2780 InspectorDock::get_inspector_singleton()->edit(nullptr);
2781 NodeDock::get_singleton()->set_node(nullptr);
2782 InspectorDock::get_singleton()->update(nullptr);
2783 EditorDebuggerNode::get_singleton()->clear_remote_tree_selection();
2784 hide_unused_editors();
2785 return;
2786 }
2787
2788 // Update the use folding setting and state.
2789 bool disable_folding = bool(EDITOR_GET("interface/inspector/disable_folding")) || current_obj->is_class("EditorDebuggerRemoteObjects");
2790 if (InspectorDock::get_inspector_singleton()->is_using_folding() == disable_folding) {
2791 InspectorDock::get_inspector_singleton()->set_use_folding(!disable_folding, false);
2792 }
2793
2794 bool is_resource = current_obj->is_class("Resource");
2795 bool is_node = current_obj->is_class("Node");
2796 bool stay_in_script_editor_on_node_selected = bool(EDITOR_GET("text_editor/behavior/navigation/stay_in_script_editor_on_node_selected"));
2797 bool skip_main_plugin = false;
2798
2799 String editable_info; // None by default.
2800 bool info_is_warning = false;
2801
2802 if (current_obj->has_method("_is_read_only")) {
2803 if (current_obj->call("_is_read_only")) {
2804 editable_info = TTR("This object is marked as read-only, so it's not editable.");
2805 }
2806 }
2807
2808 if (is_resource) {
2809 Resource *current_res = Object::cast_to<Resource>(current_obj);
2810 ERR_FAIL_NULL(current_res);
2811
2812 if (!p_skip_inspector_update) {
2813 InspectorDock::get_inspector_singleton()->edit(current_res);
2814 SceneTreeDock::get_singleton()->set_selected(nullptr);
2815 NodeDock::get_singleton()->set_node(nullptr);
2816 InspectorDock::get_singleton()->update(nullptr);
2817 EditorDebuggerNode::get_singleton()->clear_remote_tree_selection();
2818 ImportDock::get_singleton()->set_edit_path(current_res->get_path());
2819 }

Callers

nothing calls this directly

Calls 15

TTRFunction · 0.85
get_sliceMethod · 0.80
is_using_foldingMethod · 0.80
set_use_foldingMethod · 0.80
set_edit_pathMethod · 0.80
substrMethod · 0.80
is_resource_fileMethod · 0.80
get_scene_file_pathMethod · 0.80
is_inside_treeMethod · 0.80

Tested by

no test coverage detected