aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tools/editor/editor_node.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 03b65992f..f8540e3c6 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -3304,7 +3304,10 @@ void EditorNode::fix_dependencies(const String& p_for_file) {
dependency_fixer->edit(p_for_file);
}
-Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bool p_set_inherited,bool p_clear_errors) {
+
+
+
+Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps, bool p_set_inherited, bool p_clear_errors, bool p_force_open_imported) {
if (!is_inside_tree()) {
defer_load_scene = p_scene;
@@ -3313,6 +3316,8 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
if(!p_set_inherited) {
+
+
for(int i=0;i<editor_data.get_edited_scene_count();i++) {
if (editor_data.get_scene_path(i)==p_scene) {
@@ -3320,9 +3325,19 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo
return OK;
}
}
+
+ if (!p_force_open_imported && FileAccess::exists(p_scene+".import")) {
+ open_imported->set_text(vformat(TTR("Scene '%s' was automatically imported, so it can't be modified.\nTo make changes to it, a new inherited scene can be created."),p_scene.get_file()));
+ open_imported->popup_centered_minsize();
+ new_inherited_button->grab_focus();
+ open_import_request=p_scene;
+ return OK;
+ }
+
}
+
if (p_clear_errors)
load_errors->clear();
@@ -4958,6 +4973,19 @@ void EditorNode::_call_build() {
}
}
+
+void EditorNode::_inherit_imported(const String& p_action) {
+
+ open_imported->hide();
+ load_scene(open_import_request,true,true);
+
+}
+
+void EditorNode::_open_imported() {
+
+ load_scene(open_import_request,true,false,true,true);
+}
+
void EditorNode::_bind_methods() {
@@ -5035,6 +5063,8 @@ void EditorNode::_bind_methods() {
ClassDB::bind_method(_MD("get_gui_base"), &EditorNode::get_gui_base);
ClassDB::bind_method(_MD("_bottom_panel_switch"), &EditorNode::_bottom_panel_switch);
+ ClassDB::bind_method(_MD("_open_imported"), &EditorNode::_open_imported);
+ ClassDB::bind_method(_MD("_inherit_imported"), &EditorNode::_inherit_imported);
ADD_SIGNAL( MethodInfo("play_pressed") );
ADD_SIGNAL( MethodInfo("pause_pressed") );
@@ -6357,6 +6387,14 @@ EditorNode::EditorNode() {
}
}
+ open_imported = memnew( ConfirmationDialog );
+ open_imported->get_ok()->set_text(TTR("Open Anyway"));
+ new_inherited_button=open_imported->add_button("New Inherited",!OS::get_singleton()->get_swap_ok_cancel(),"inherit");
+ open_imported->connect("confirmed",this,"_open_imported");
+ open_imported->connect("custom_action",this,"_inherit_imported");
+ gui_base->add_child(open_imported);
+
+
//edited_scene=NULL;
saved_version=1;