From 0d09f80e43f9bc27a4e7f02efb4921091389f884 Mon Sep 17 00:00:00 2001 From: DualMatrix Date: Thu, 13 Sep 2018 00:49:12 +0200 Subject: [PATCH] Added warning when disabling editable_instance Added warning when disabling editable_instance to prevent data loss. --- editor/scene_tree_dock.cpp | 48 ++++++++++++++++++++++++++++---------- editor/scene_tree_dock.h | 3 +++ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 9461f39aeb0..35f3a401907 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -709,21 +709,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *node = e->get(); if (node) { bool editable = EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(node); - int editable_item_idx = menu->get_item_idx_from_text(TTR("Editable Children")); - int placeholder_item_idx = menu->get_item_idx_from_text(TTR("Load As Placeholder")); - editable = !editable; - EditorNode::get_singleton()->get_edited_scene()->set_editable_instance(node, editable); - - menu->set_item_checked(editable_item_idx, editable); if (editable) { - node->set_scene_instance_load_placeholder(false); - menu->set_item_checked(placeholder_item_idx, false); + editable_instance_remove_dialog->set_text(TTR("Disabling \"editable_instance\" will cause all properties of the node to be reverted to their default.")); + editable_instance_remove_dialog->popup_centered_minsize(); + break; } - - SpatialEditor::get_singleton()->update_all_gizmos(node); - - scene_tree->update_tree(); + _toggle_editable_children(); } } } break; @@ -1521,6 +1513,33 @@ void SceneTreeDock::_script_created(Ref