mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-03 23:21:15 +00:00 
			
		
		
		
	Fixed Tab Switching of Main Scene State. Closes #11045
This commit is contained in:
		
							parent
							
								
									d1cb73b47a
								
							
						
					
					
						commit
						9e204658ff
					
				
					 1 changed files with 21 additions and 26 deletions
				
			
		| 
						 | 
					@ -2741,14 +2741,6 @@ Dictionary EditorNode::_get_main_scene_state() {
 | 
				
			||||||
	state["property_edit_offset"] = get_property_editor()->get_scene_tree()->get_vscroll_bar()->get_value();
 | 
						state["property_edit_offset"] = get_property_editor()->get_scene_tree()->get_vscroll_bar()->get_value();
 | 
				
			||||||
	state["saved_version"] = saved_version;
 | 
						state["saved_version"] = saved_version;
 | 
				
			||||||
	state["node_filter"] = scene_tree_dock->get_filter();
 | 
						state["node_filter"] = scene_tree_dock->get_filter();
 | 
				
			||||||
	int current = -1;
 | 
					 | 
				
			||||||
	for (int i = 0; i < editor_table.size(); i++) {
 | 
					 | 
				
			||||||
		if (editor_plugin_screen == editor_table[i]) {
 | 
					 | 
				
			||||||
			current = i;
 | 
					 | 
				
			||||||
			break;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	state["editor_index"] = current;
 | 
					 | 
				
			||||||
	return state;
 | 
						return state;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2759,9 +2751,6 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	changing_scene = false;
 | 
						changing_scene = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (p_state.has("editor_index")) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		int index = p_state["editor_index"];
 | 
					 | 
				
			||||||
	int current = -1;
 | 
						int current = -1;
 | 
				
			||||||
	for (int i = 0; i < editor_table.size(); i++) {
 | 
						for (int i = 0; i < editor_table.size(); i++) {
 | 
				
			||||||
		if (editor_plugin_screen == editor_table[i]) {
 | 
							if (editor_plugin_screen == editor_table[i]) {
 | 
				
			||||||
| 
						 | 
					@ -2770,10 +2759,17 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (p_state.has("editor_index")) {
 | 
				
			||||||
 | 
							int index = p_state["editor_index"];
 | 
				
			||||||
		if (current < 2) { //if currently in spatial/2d, only switch to spatial/2d. if curently in script, stay there
 | 
							if (current < 2) { //if currently in spatial/2d, only switch to spatial/2d. if curently in script, stay there
 | 
				
			||||||
			if (index < 2 || !get_edited_scene()) {
 | 
								if (index < 2 || !get_edited_scene()) {
 | 
				
			||||||
				_editor_select(index);
 | 
									_editor_select(index);
 | 
				
			||||||
			} else {
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (get_edited_scene()) {
 | 
				
			||||||
 | 
							if (current < 2) {
 | 
				
			||||||
			//use heuristic instead
 | 
								//use heuristic instead
 | 
				
			||||||
			int n2d = 0, n3d = 0;
 | 
								int n2d = 0, n3d = 0;
 | 
				
			||||||
			_find_node_types(get_edited_scene(), n2d, n3d);
 | 
								_find_node_types(get_edited_scene(), n2d, n3d);
 | 
				
			||||||
| 
						 | 
					@ -2784,7 +2780,6 @@ void EditorNode::_set_main_scene_state(Dictionary p_state, Node *p_for_scene) {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (p_state.has("scene_tree_offset"))
 | 
						if (p_state.has("scene_tree_offset"))
 | 
				
			||||||
		scene_tree_dock->get_tree_editor()->get_scene_tree()->get_vscroll_bar()->set_value(p_state["scene_tree_offset"]);
 | 
							scene_tree_dock->get_tree_editor()->get_scene_tree()->get_vscroll_bar()->set_value(p_state["scene_tree_offset"]);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue