mirror of
				https://github.com/godotengine/godot.git
				synced 2025-11-04 07:31:16 +00:00 
			
		
		
		
	Improved script attachment/removal a bit
This commit is contained in:
		
							parent
							
								
									09d090921c
								
							
						
					
					
						commit
						be2bc4dab8
					
				
					 1 changed files with 12 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1615,7 +1615,10 @@ void SceneTreeDock::_delete_confirm() {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void SceneTreeDock::_update_script_button() {
 | 
			
		||||
	if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 1) {
 | 
			
		||||
	if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 0) {
 | 
			
		||||
		button_create_script->hide();
 | 
			
		||||
		button_clear_script->hide();
 | 
			
		||||
	} else if (EditorNode::get_singleton()->get_editor_selection()->get_selection().size() == 1) {
 | 
			
		||||
		Node *n = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list()[0];
 | 
			
		||||
		if (n->get_script().is_null()) {
 | 
			
		||||
			button_create_script->show();
 | 
			
		||||
| 
						 | 
				
			
			@ -1626,6 +1629,14 @@ void SceneTreeDock::_update_script_button() {
 | 
			
		|||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		button_create_script->show();
 | 
			
		||||
		List<Node *> selection = EditorNode::get_singleton()->get_editor_selection()->get_selected_node_list();
 | 
			
		||||
		for (List<Node *>::Element *E = selection.front(); E; E = E->next()) {
 | 
			
		||||
			Node *n = E->get();
 | 
			
		||||
			if (!n->get_script().is_null()) {
 | 
			
		||||
				button_clear_script->show();
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		button_clear_script->hide();
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue