From 0e8987abaf898db74b8b0278effd305673935d5e Mon Sep 17 00:00:00 2001 From: Nathan Warden Date: Tue, 20 Jan 2015 09:05:22 -0500 Subject: [PATCH] Fixed a bug where if a scene hadn't been saved it would find a cyclical dependency. --- tools/editor/scene_tree_dock.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index d8d713ee40..6f33d4b3d1 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -83,12 +83,16 @@ Node* SceneTreeDock::instance(const String& p_file) { return NULL; } - if (_cyclical_dependency_exists(edited_scene->get_filename(), instanced_scene)) { + // If the scene hasn't been saved yet a cyclical dependency cannot exist. + if (edited_scene->get_filename()!="") { - accept->get_ok()->set_text("Ok"); - accept->set_text(String("Cannot instance the scene '")+p_file+String("' because the current scene exists within one of its' nodes.")); - accept->popup_centered(Size2(300,90)); - return NULL; + if (_cyclical_dependency_exists(edited_scene->get_filename(), instanced_scene)) { + + accept->get_ok()->set_text("Ok"); + accept->set_text(String("Cannot instance the scene '")+p_file+String("' because the current scene exists within one of its' nodes.")); + accept->popup_centered(Size2(300,90)); + return NULL; + } } instanced_scene->generate_instance_state();