summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp17
-rw-r--r--editor/editor_node.h2
-rw-r--r--editor/editor_properties.cpp2
-rw-r--r--editor/editor_resource_preview.cpp15
-rw-r--r--editor/editor_resource_preview.h2
-rw-r--r--editor/icons/icon_oriented_path_follow.svg5
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
-rw-r--r--editor/plugins/item_list_editor_plugin.cpp2
-rw-r--r--editor/scene_tree_dock.cpp14
9 files changed, 44 insertions, 19 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 9169227e8a..719130621e 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -494,7 +494,7 @@ void EditorNode::_fs_changed() {
}
}
- get_tree()->quit();
+ _exit_editor();
}
}
@@ -1120,7 +1120,7 @@ void EditorNode::save_all_scenes_and_restart() {
to_reopen = get_tree()->get_edited_scene_root()->get_filename();
}
- get_tree()->quit();
+ _exit_editor();
String exec = OS::get_singleton()->get_executable_path();
List<String> args;
@@ -2356,6 +2356,12 @@ int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) {
return -1;
}
+void EditorNode::_exit_editor() {
+ exiting = true;
+ resource_preview->stop(); //stop early to avoid crashes
+ get_tree()->quit();
+}
+
void EditorNode::_discard_changes(const String &p_str) {
switch (current_option) {
@@ -2383,14 +2389,13 @@ void EditorNode::_discard_changes(const String &p_str) {
case FILE_QUIT: {
_menu_option_confirm(RUN_STOP, true);
- exiting = true;
- get_tree()->quit();
+ _exit_editor();
+
} break;
case RUN_PROJECT_MANAGER: {
_menu_option_confirm(RUN_STOP, true);
- exiting = true;
- get_tree()->quit();
+ _exit_editor();
String exec = OS::get_singleton()->get_executable_path();
List<String> args;
diff --git a/editor/editor_node.h b/editor/editor_node.h
index d7d969fb16..13bebea5f0 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -470,6 +470,8 @@ private:
void _dropped_files(const Vector<String> &p_files, int p_screen);
String _recent_scene;
+ void _exit_editor();
+
bool convert_old;
void _unhandled_input(const Ref<InputEvent> &p_event);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 72545f6b19..e33b26d9cb 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -2397,7 +2397,7 @@ void EditorPropertyResource::_update_menu() {
void EditorPropertyResource::_sub_inspector_property_keyed(const String &p_property, const Variant &p_value, bool) {
- emit_signal("property_keyed_with_value", String(get_edited_property()) + ":" + p_property, p_value);
+ emit_signal("property_keyed_with_value", String(get_edited_property()) + ":" + p_property, p_value, false);
}
void EditorPropertyResource::_sub_inspector_resource_selected(const RES &p_resource, const String &p_property) {
diff --git a/editor/editor_resource_preview.cpp b/editor/editor_resource_preview.cpp
index 25139b0163..368efbc48f 100644
--- a/editor/editor_resource_preview.cpp
+++ b/editor/editor_resource_preview.cpp
@@ -416,6 +416,16 @@ void EditorResourcePreview::check_for_invalidation(const String &p_path) {
}
}
+void EditorResourcePreview::stop() {
+ if (thread) {
+ exit = true;
+ preview_sem->post();
+ Thread::wait_to_finish(thread);
+ memdelete(thread);
+ thread = NULL;
+ }
+}
+
EditorResourcePreview::EditorResourcePreview() {
singleton = this;
preview_mutex = Mutex::create();
@@ -428,10 +438,7 @@ EditorResourcePreview::EditorResourcePreview() {
EditorResourcePreview::~EditorResourcePreview() {
- exit = true;
- preview_sem->post();
- Thread::wait_to_finish(thread);
- memdelete(thread);
+ stop();
memdelete(preview_mutex);
memdelete(preview_sem);
}
diff --git a/editor/editor_resource_preview.h b/editor/editor_resource_preview.h
index 055ecc6bbf..85ac78d58f 100644
--- a/editor/editor_resource_preview.h
+++ b/editor/editor_resource_preview.h
@@ -126,6 +126,8 @@ public:
void remove_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator);
void check_for_invalidation(const String &p_path);
+ void stop();
+
EditorResourcePreview();
~EditorResourcePreview();
};
diff --git a/editor/icons/icon_oriented_path_follow.svg b/editor/icons/icon_oriented_path_follow.svg
deleted file mode 100644
index bd3f585e54..0000000000
--- a/editor/icons/icon_oriented_path_follow.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
-<g transform="translate(0 -1036.4)">
-<path transform="translate(0 1036.4)" d="m13 0l-3 4h1.9473c-0.1385 1.3203-0.5583 1.9074-1.084 2.2754-0.64426 0.451-1.7129 0.60547-2.9629 0.73047s-2.6814 0.22053-3.9121 1.082c-0.89278 0.62493-1.5321 1.6522-1.8184 3.0957a2 2 0 0 0 -1.1699 1.8164 2 2 0 0 0 2 2 2 2 0 0 0 2 -2 2 2 0 0 0 -0.84961 -1.6328c0.19235-0.88496 0.55306-1.3373 0.98633-1.6406 0.64426-0.451 1.7129-0.60547 2.9629-0.73047s2.6814-0.22053 3.9121-1.082c1.0528-0.73697 1.7552-2.032 1.9375-3.9141h2.0508l-3-4z" fill="#fc9c9c" fill-opacity=".99608"/>
-</g>
-</svg>
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index b0e812a130..86d6799b19 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -573,10 +573,10 @@ bool CanvasItemEditor::_get_bone_shape(Vector<Vector2> *shape, Vector<Vector2> *
Node2D *from_node = Object::cast_to<Node2D>(ObjectDB::get_instance(bone->key().from));
Node2D *to_node = Object::cast_to<Node2D>(ObjectDB::get_instance(bone->key().to));
- if (!from_node->is_inside_tree())
- return false; //may have been removed
if (!from_node)
return false;
+ if (!from_node->is_inside_tree())
+ return false; //may have been removed
if (!to_node && bone->get().length == 0)
return false;
diff --git a/editor/plugins/item_list_editor_plugin.cpp b/editor/plugins/item_list_editor_plugin.cpp
index d9861c91e0..db0816064c 100644
--- a/editor/plugins/item_list_editor_plugin.cpp
+++ b/editor/plugins/item_list_editor_plugin.cpp
@@ -109,7 +109,7 @@ void ItemListPlugin::_get_property_list(List<PropertyInfo> *p_list) const {
int flags = get_flags();
if (flags & FLAG_CHECKABLE) {
- p_list->push_back(PropertyInfo(Variant::BOOL, base + "checkable", PROPERTY_HINT_ENUM, "No,As checkbox,As radio button"));
+ p_list->push_back(PropertyInfo(Variant::INT, base + "checkable", PROPERTY_HINT_ENUM, "No,As checkbox,As radio button"));
p_list->push_back(PropertyInfo(Variant::BOOL, base + "checked"));
}
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index daa7f92dcf..be1c4a36bd 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -563,6 +563,20 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
if (node == root)
return;
+ //check that from node to root, all owners are right
+
+ if (node->get_owner() != root) {
+ accept->set_text(TTR("Node must belong to the edited scene to become root."));
+ accept->popup_centered_minsize();
+ return;
+ }
+
+ if (node->get_filename() != String()) {
+ accept->set_text(TTR("Instantiated scenes can't become root"));
+ accept->popup_centered_minsize();
+ return;
+ }
+
editor_data->get_undo_redo().create_action("Make node as Root");
editor_data->get_undo_redo().add_do_method(node->get_parent(), "remove_child", node);
editor_data->get_undo_redo().add_do_method(root->get_parent(), "remove_child", root);