Browse Source

New node will be added to root node if nothing is selected

mostafahassan 10 years ago
parent
commit
3d4cc27bad
1 changed files with 5 additions and 4 deletions
  1. 5 4
      tools/editor/scene_tree_dock.cpp

+ 5 - 4
tools/editor/scene_tree_dock.cpp

@@ -1059,14 +1059,15 @@ void SceneTreeDock::_create() {
 
 
 		if (edited_scene) {
-
+			// If root exists in edited scene
 			parent = scene_tree->get_selected();
-			ERR_FAIL_COND(!parent);
-		} else {
+			if( !parent )
+				parent = edited_scene;
 
+		} else {
+			// If no root exist in edited scene
 			parent = scene_root;
 			ERR_FAIL_COND(!parent);
-
 		}
 
 		Object *c = create_dialog->instance_selected();