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

Method _set_main_scene_state

editor/editor_node.cpp:4199–4240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4197}
4198
4199void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
4200 if (get_edited_scene() != p_for_scene && p_for_scene != nullptr) {
4201 return; // Not for this scene.
4202 }
4203
4204 changing_scene = false;
4205
4206 if (get_edited_scene()) {
4207 if (editor_main_screen->can_auto_switch_screens()) {
4208 // Switch between 2D and 3D if currently in 2D or 3D.
4209 Node *selected_node = SceneTreeDock::get_singleton()->get_tree_editor()->get_selected();
4210 if (!selected_node) {
4211 selected_node = get_edited_scene();
4212 }
4213 const int plugin_index = editor_main_screen->get_plugin_index(editor_data.get_handling_main_editor(selected_node));
4214 if (plugin_index >= 0) {
4215 editor_main_screen->select(plugin_index);
4216 }
4217 }
4218 }
4219
4220 if (p_state.has("scene_tree_offset")) {
4221 SceneTreeDock::get_singleton()->get_tree_editor()->get_scene_tree()->get_vscroll_bar()->set_value(p_state["scene_tree_offset"]);
4222 }
4223 if (p_state.has("property_edit_offset")) {
4224 InspectorDock::get_inspector_singleton()->set_scroll_offset(p_state["property_edit_offset"]);
4225 }
4226
4227 if (p_state.has("node_filter")) {
4228 SceneTreeDock::get_singleton()->set_filter(p_state["node_filter"]);
4229 }
4230
4231 // This should only happen at the very end.
4232
4233 EditorDebuggerNode::get_singleton()->update_live_edit_root();
4234 ScriptEditor::get_singleton()->set_scene_root_script(editor_data.get_scene_root_script(editor_data.get_edited_scene()));
4235 editor_data.notify_edited_scene_changed();
4236 emit_signal(SNAME("scene_changed"));
4237
4238 // Reset SDFGI after everything else so that any last-second scene modifications will be processed.
4239 RenderingServer::get_singleton()->sdfgi_reset();
4240}
4241
4242bool EditorNode::is_changing_scene() const {
4243 return changing_scene;

Callers

nothing calls this directly

Calls 15

get_tree_editorMethod · 0.80
get_plugin_indexMethod · 0.80
get_vscroll_barMethod · 0.80
set_scene_root_scriptMethod · 0.80
get_scene_root_scriptMethod · 0.80
get_selectedMethod · 0.45
selectMethod · 0.45
hasMethod · 0.45
set_valueMethod · 0.45

Tested by

no test coverage detected