diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/create_dialog.cpp | 10 | ||||
-rw-r--r-- | editor/create_dialog.h | 2 | ||||
-rw-r--r-- | editor/editor_data.cpp | 23 | ||||
-rw-r--r-- | editor/editor_data.h | 4 | ||||
-rw-r--r-- | editor/editor_log.cpp | 3 | ||||
-rw-r--r-- | editor/editor_native_shader_source_visualizer.cpp | 72 | ||||
-rw-r--r-- | editor/editor_native_shader_source_visualizer.h | 50 | ||||
-rw-r--r-- | editor/editor_node.cpp | 20 | ||||
-rw-r--r-- | editor/editor_node.h | 4 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 36 | ||||
-rw-r--r-- | editor/editor_properties.h | 1 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 9 | ||||
-rw-r--r-- | editor/inspector_dock.cpp | 5 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 17 | ||||
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/tile_map_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | editor/property_editor.cpp | 19 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 5 |
18 files changed, 206 insertions, 81 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index dd5a87ff30..3a63100012 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -408,15 +408,15 @@ String CreateDialog::get_selected_type() { return selected->get_text(0); } -Object *CreateDialog::instance_selected() { +Variant CreateDialog::instance_selected() { TreeItem *selected = search_options->get_selected(); if (!selected) { - return nullptr; + return Variant(); } Variant md = selected->get_metadata(0); - Object *obj = nullptr; + Variant obj; if (md.get_type() != Variant::NIL) { String custom = md; if (ScriptServer::is_global_class(custom)) { @@ -434,13 +434,13 @@ Object *CreateDialog::instance_selected() { // Check if any Object-type property should be instantiated. List<PropertyInfo> pinfo; - obj->get_property_list(&pinfo); + ((Object *)obj)->get_property_list(&pinfo); for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) { PropertyInfo pi = E->get(); if (pi.type == Variant::OBJECT && pi.usage & PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT) { Object *prop = ClassDB::instance(pi.class_name); - obj->set(pi.name, prop); + ((Object *)obj)->set(pi.name, prop); } } diff --git a/editor/create_dialog.h b/editor/create_dialog.h index b76155365f..b08cb72f14 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -102,7 +102,7 @@ protected: void _save_and_update_favorite_list(); public: - Object *instance_selected(); + Variant instance_selected(); String get_selected_type(); void set_base_type(const String &p_base) { base_type = p_base; } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 4c4dacbeb5..1d3bd55ed3 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -468,24 +468,25 @@ void EditorData::add_custom_type(const String &p_type, const String &p_inherits, custom_types[p_inherits].push_back(ct); } -Object *EditorData::instance_custom_type(const String &p_type, const String &p_inherits) { +Variant EditorData::instance_custom_type(const String &p_type, const String &p_inherits) { if (get_custom_types().has(p_inherits)) { for (int i = 0; i < get_custom_types()[p_inherits].size(); i++) { if (get_custom_types()[p_inherits][i].name == p_type) { Ref<Script> script = get_custom_types()[p_inherits][i].script; - Object *ob = ClassDB::instance(p_inherits); - ERR_FAIL_COND_V(!ob, nullptr); - if (ob->is_class("Node")) { - ob->call("set_name", p_type); + Variant ob = ClassDB::instance(p_inherits); + ERR_FAIL_COND_V(!ob, Variant()); + Node *n = Object::cast_to<Node>(ob); + if (n) { + n->set_name(p_type); } - ob->set_script(script); + ((Object *)ob)->set_script(script); return ob; } } } - return nullptr; + return Variant(); } void EditorData::remove_custom_type(const String &p_type) { @@ -867,18 +868,18 @@ StringName EditorData::script_class_get_base(const String &p_class) const { return script->get_language()->get_global_class_name(base_script->get_path()); } -Object *EditorData::script_class_instance(const String &p_class) { +Variant EditorData::script_class_instance(const String &p_class) { if (ScriptServer::is_global_class(p_class)) { - Object *obj = ClassDB::instance(ScriptServer::get_global_class_native_base(p_class)); + Variant obj = ClassDB::instance(ScriptServer::get_global_class_native_base(p_class)); if (obj) { Ref<Script> script = script_class_load_script(p_class); if (script.is_valid()) { - obj->set_script(script); + ((Object *)obj)->set_script(script); } return obj; } } - return nullptr; + return Variant(); } Ref<Script> EditorData::script_class_load_script(const String &p_class) const { diff --git a/editor/editor_data.h b/editor/editor_data.h index 42afc9e079..d5c8c2a713 100644 --- a/editor/editor_data.h +++ b/editor/editor_data.h @@ -171,7 +171,7 @@ public: void restore_editor_global_states(); void add_custom_type(const String &p_type, const String &p_inherits, const Ref<Script> &p_script, const Ref<Texture2D> &p_icon); - Object *instance_custom_type(const String &p_type, const String &p_inherits); + Variant instance_custom_type(const String &p_type, const String &p_inherits); void remove_custom_type(const String &p_type); const Map<String, Vector<CustomType>> &get_custom_types() const { return custom_types; } @@ -208,7 +208,7 @@ public: bool script_class_is_parent(const String &p_class, const String &p_inherits); StringName script_class_get_base(const String &p_class) const; - Object *script_class_instance(const String &p_class); + Variant script_class_instance(const String &p_class); Ref<Script> script_class_load_script(const String &p_class) const; diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 859292c573..7b94016fb6 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -101,8 +101,6 @@ void EditorLog::copy() { } void EditorLog::add_message(const String &p_msg, MessageType p_type) { - log->add_newline(); - bool restore = p_type != MSG_TYPE_STD; switch (p_type) { case MSG_TYPE_STD: { @@ -128,6 +126,7 @@ void EditorLog::add_message(const String &p_msg, MessageType p_type) { } log->add_text(p_msg); + log->add_newline(); if (restore) { log->pop(); diff --git a/editor/editor_native_shader_source_visualizer.cpp b/editor/editor_native_shader_source_visualizer.cpp new file mode 100644 index 0000000000..ed2692190c --- /dev/null +++ b/editor/editor_native_shader_source_visualizer.cpp @@ -0,0 +1,72 @@ +/*************************************************************************/ +/* editor_native_shader_source_visualizer.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "editor_native_shader_source_visualizer.h" + +#include "scene/gui/text_edit.h" + +void EditorNativeShaderSourceVisualizer::_inspect_shader(RID p_shader) { + if (versions) { + memdelete(versions); + versions = nullptr; + } + + RS::ShaderNativeSourceCode nsc = RS::get_singleton()->shader_get_native_source_code(p_shader); + + versions = memnew(TabContainer); + versions->set_v_size_flags(Control::SIZE_EXPAND_FILL); + versions->set_h_size_flags(Control::SIZE_EXPAND_FILL); + for (int i = 0; i < nsc.versions.size(); i++) { + TabContainer *vtab = memnew(TabContainer); + vtab->set_name("Version " + itos(i)); + vtab->set_v_size_flags(Control::SIZE_EXPAND_FILL); + vtab->set_h_size_flags(Control::SIZE_EXPAND_FILL); + versions->add_child(vtab); + for (int j = 0; j < nsc.versions[i].stages.size(); j++) { + TextEdit *vtext = memnew(TextEdit); + vtext->set_readonly(true); + vtext->set_name(nsc.versions[i].stages[j].name); + vtext->set_text(nsc.versions[i].stages[j].code); + vtext->set_v_size_flags(Control::SIZE_EXPAND_FILL); + vtext->set_h_size_flags(Control::SIZE_EXPAND_FILL); + vtab->add_child(vtext); + } + } + add_child(versions); + popup_centered_ratio(); +} + +void EditorNativeShaderSourceVisualizer::_bind_methods() { + ClassDB::bind_method("_inspect_shader", &EditorNativeShaderSourceVisualizer::_inspect_shader); +} +EditorNativeShaderSourceVisualizer::EditorNativeShaderSourceVisualizer() { + add_to_group("_native_shader_source_visualizer"); + set_title(TTR("Native Shader Source Inspector")); +} diff --git a/editor/editor_native_shader_source_visualizer.h b/editor/editor_native_shader_source_visualizer.h new file mode 100644 index 0000000000..72a2f8baae --- /dev/null +++ b/editor/editor_native_shader_source_visualizer.h @@ -0,0 +1,50 @@ +/*************************************************************************/ +/* editor_native_shader_source_visualizer.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef EDITOR_NATIVE_SHADER_SOURCE_VISUALIZER_H +#define EDITOR_NATIVE_SHADER_SOURCE_VISUALIZER_H + +#include "scene/gui/dialogs.h" +#include "scene/gui/tab_container.h" + +class EditorNativeShaderSourceVisualizer : public AcceptDialog { + GDCLASS(EditorNativeShaderSourceVisualizer, AcceptDialog) + TabContainer *versions = nullptr; + + void _inspect_shader(RID p_shader); + +protected: + static void _bind_methods(); + +public: + EditorNativeShaderSourceVisualizer(); +}; + +#endif // EDITOR_NATIVE_SHADER_SOURCE_VISUALIZER_H diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 72d9aacef3..6f03518029 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2123,7 +2123,10 @@ void EditorNode::_run(bool p_current, const String &p_custom) { if (scene->get_filename() == "") { current_option = -1; - _menu_option_confirm(FILE_SAVE_BEFORE_RUN, false); + _menu_option(FILE_SAVE_AS_SCENE); + // Set the option to save and run so when the dialog is accepted, the scene runs. + current_option = FILE_SAVE_AND_RUN; + file->set_title(TTR("Save scene before running...")); return; } @@ -2382,18 +2385,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case FILE_SAVE_ALL_SCENES: { _save_all_scenes(); } break; - case FILE_SAVE_BEFORE_RUN: { - if (!p_confirmed) { - confirmation->get_cancel_button()->set_text(TTR("No")); - confirmation->get_ok_button()->set_text(TTR("Yes")); - confirmation->set_text(TTR("This scene has never been saved. Save before running?")); - confirmation->popup_centered(); - break; - } - - _menu_option(FILE_SAVE_AS_SCENE); - _menu_option_confirm(FILE_SAVE_AND_RUN, false); - } break; case FILE_EXPORT_PROJECT: { project_export->popup_export(); @@ -6528,6 +6519,9 @@ EditorNode::EditorNode() { center_split->connect("resized", callable_mp(this, &EditorNode::_vp_resized)); + native_shader_source_visualizer = memnew(EditorNativeShaderSourceVisualizer); + gui_base->add_child(native_shader_source_visualizer); + orphan_resources = memnew(OrphanResourcesDialog); gui_base->add_child(orphan_resources); diff --git a/editor/editor_node.h b/editor/editor_node.h index 0ef2e8cbfc..1da162dc9c 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -34,6 +34,7 @@ #include "editor/editor_data.h" #include "editor/editor_export.h" #include "editor/editor_folding.h" +#include "editor/editor_native_shader_source_visualizer.h" #include "editor/editor_run.h" #include "editor/inspector_dock.h" #include "editor/property_editor.h" @@ -125,7 +126,6 @@ private: FILE_SAVE_SCENE, FILE_SAVE_AS_SCENE, FILE_SAVE_ALL_SCENES, - FILE_SAVE_BEFORE_RUN, FILE_SAVE_AND_RUN, FILE_SHOW_IN_FILESYSTEM, FILE_IMPORT_SUBSCENE, @@ -323,6 +323,8 @@ private: String current_path; MenuButton *update_spinner; + EditorNativeShaderSourceVisualizer *native_shader_source_visualizer; + String defer_load_scene; Node *_last_instanced_scene; diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 690808ddac..3fa183e10c 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -68,16 +68,18 @@ void EditorPropertyText::_text_changed(const String &p_string) { } if (string_name) { - emit_changed(get_edited_property(), StringName(p_string), "", false); + emit_changed(get_edited_property(), StringName(p_string), "", true); } else { - emit_changed(get_edited_property(), p_string, "", false); + emit_changed(get_edited_property(), p_string, "", true); } } void EditorPropertyText::update_property() { String s = get_edited_object()->get(get_edited_property()); updating = true; - text->set_text(s); + if (text->get_text() != s) { + text->set_text(s); + } text->set_editable(!is_read_only()); updating = false; } @@ -133,9 +135,11 @@ void EditorPropertyMultilineText::_open_big_text() { void EditorPropertyMultilineText::update_property() { String t = get_edited_object()->get(get_edited_property()); - text->set_text(t); - if (big_text && big_text->is_visible_in_tree()) { - big_text->set_text(t); + if (text->get_text() != t) { + text->set_text(t); + if (big_text && big_text->is_visible_in_tree()) { + big_text->set_text(t); + } } } @@ -2144,10 +2148,6 @@ void EditorPropertyColor::_color_changed(const Color &p_color) { emit_changed(get_edited_property(), p_color, "", true); } -void EditorPropertyColor::_popup_closed() { - emit_changed(get_edited_property(), picker->get_pick_color(), "", false); -} - void EditorPropertyColor::_picker_created() { // get default color picker mode from editor settings int default_color_mode = EDITOR_GET("interface/inspector/default_color_picker_mode"); @@ -2191,7 +2191,6 @@ EditorPropertyColor::EditorPropertyColor() { add_child(picker); picker->set_flat(true); picker->connect("color_changed", callable_mp(this, &EditorPropertyColor::_color_changed)); - picker->connect("popup_closed", callable_mp(this, &EditorPropertyColor::_popup_closed)); picker->connect("picker_created", callable_mp(this, &EditorPropertyColor::_picker_created)); } @@ -2545,35 +2544,32 @@ void EditorPropertyResource::_menu_option(int p_which) { return; } - Object *obj = nullptr; - RES res_temp; + Variant obj; if (ScriptServer::is_global_class(intype)) { obj = ClassDB::instance(ScriptServer::get_global_class_native_base(intype)); if (obj) { - res_temp = obj; Ref<Script> script = ResourceLoader::load(ScriptServer::get_global_class_path(intype)); if (script.is_valid()) { - obj->set_script(Variant(script)); + ((Object *)obj)->set_script(script); } } } else { obj = ClassDB::instance(intype); - res_temp = obj; } if (!obj) { obj = EditorNode::get_editor_data().instance_custom_type(intype, "Resource"); - res_temp = obj; } - ERR_BREAK(!res_temp.is_valid()); + Resource *resp = Object::cast_to<Resource>(obj); + ERR_BREAK(!resp); if (get_edited_object() && base_type != String() && base_type == "Script") { //make visual script the right type - res_temp->call("set_instance_base_type", get_edited_object()->get_class()); + resp->call("set_instance_base_type", get_edited_object()->get_class()); } - res = res_temp; + res = RES(resp); emit_changed(get_edited_property(), res); update_property(); diff --git a/editor/editor_properties.h b/editor/editor_properties.h index ab908244ba..856a406e62 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -547,7 +547,6 @@ class EditorPropertyColor : public EditorProperty { GDCLASS(EditorPropertyColor, EditorProperty); ColorPickerButton *picker; void _color_changed(const Color &p_color); - void _popup_closed(); void _picker_created(); protected: diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index fcf3e49a91..e8cf081320 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1898,7 +1898,7 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> &p_selected } void FileSystemDock::_resource_created() { - Object *c = new_resource_dialog->instance_selected(); + Variant c = new_resource_dialog->instance_selected(); ERR_FAIL_COND(!c); Resource *r = Object::cast_to<Resource>(c); @@ -1912,17 +1912,14 @@ void FileSystemDock::_resource_created() { memdelete(node); } - REF res(r); - editor->push_item(c); - - RES current_res = RES(r); + editor->push_item(r); String fpath = path; if (!fpath.ends_with("/")) { fpath = fpath.get_base_dir(); } - editor->save_resource_as(current_res, fpath); + editor->save_resource_as(RES(r), fpath); } void FileSystemDock::_search_changed(const String &p_text, const Control *p_from) { diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 311fa5206e..fbcd76a95f 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -270,14 +270,13 @@ void InspectorDock::_select_history(int p_idx) { } void InspectorDock::_resource_created() { - Object *c = new_resource_dialog->instance_selected(); + Variant c = new_resource_dialog->instance_selected(); ERR_FAIL_COND(!c); Resource *r = Object::cast_to<Resource>(c); ERR_FAIL_COND(!r); - REF res(r); - editor->push_item(c); + editor->push_item(r); } void InspectorDock::_resource_selected(const RES &p_res, const String &p_property) { diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 67b7a2af79..498f9d5c19 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -963,9 +963,24 @@ void CanvasItemEditor::_restore_canvas_item_state(List<CanvasItem *> p_canvas_it } void CanvasItemEditor::_commit_canvas_item_state(List<CanvasItem *> p_canvas_items, String action_name, bool commit_bones) { - undo_redo->create_action(action_name); + List<CanvasItem *> modified_canvas_items; for (List<CanvasItem *>::Element *E = p_canvas_items.front(); E; E = E->next()) { CanvasItem *canvas_item = E->get(); + Dictionary old_state = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item)->undo_state; + Dictionary new_state = canvas_item->_edit_get_state(); + + if (old_state.hash() != new_state.hash()) { + modified_canvas_items.push_back(canvas_item); + } + } + + if (modified_canvas_items.is_empty()) { + return; + } + + undo_redo->create_action(action_name); + for (List<CanvasItem *>::Element *E = modified_canvas_items.front(); E; E = E->next()) { + CanvasItem *canvas_item = E->get(); CanvasItemEditorSelectedItem *se = editor_selection->get_node_editor_data<CanvasItemEditorSelectedItem>(canvas_item); undo_redo->add_do_method(canvas_item, "_edit_set_state", canvas_item->_edit_get_state()); undo_redo->add_undo_method(canvas_item, "_edit_set_state", se->undo_state); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index c05f55a115..d6a816f606 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -339,7 +339,7 @@ void ShaderEditor::_menu_option(int p_option) { shader_editor->remove_all_bookmarks(); } break; case HELP_DOCS: { - OS::get_singleton()->shell_open("https://docs.godotengine.org/en/stable/tutorials/shading/shading_reference/index.html"); + OS::get_singleton()->shell_open("https://docs.godotengine.org/en/latest/tutorials/shaders/shader_reference/index.html"); } break; } if (p_option != SEARCH_FIND && p_option != SEARCH_REPLACE && p_option != SEARCH_GOTO_LINE) { diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp index dffa796e8d..6a16aa28a9 100644 --- a/editor/plugins/tile_map_editor_plugin.cpp +++ b/editor/plugins/tile_map_editor_plugin.cpp @@ -39,7 +39,10 @@ #include "scene/gui/split_container.h" void TileMapEditor::_node_removed(Node *p_node) { - if (p_node == node) { + if (p_node == node && node) { + // Fixes #44824, which describes a situation where you can reselect a TileMap node without first de-selecting it when switching scenes. + node->disconnect("settings_changed", callable_mp(this, &TileMapEditor::_tileset_settings_changed)); + node = nullptr; } } diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 93689dd4cd..07312e42b4 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -262,7 +262,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { return; } - Object *obj = ClassDB::instance(intype); + Variant obj = ClassDB::instance(intype); if (!obj) { if (ScriptServer::is_global_class(intype)) { @@ -280,7 +280,7 @@ void CustomPropertyEditor::_menu_option(int p_which) { res->call("set_instance_base_type", owner->get_class()); } - v = res; + v = obj; emit_signal("variant_changed"); } break; @@ -1064,7 +1064,7 @@ void CustomPropertyEditor::_type_create_selected(int p_idx) { String intype = inheritors_array[p_idx]; - Object *obj = ClassDB::instance(intype); + Variant obj = ClassDB::instance(intype); if (!obj) { if (ScriptServer::is_global_class(intype)) { @@ -1075,11 +1075,9 @@ void CustomPropertyEditor::_type_create_selected(int p_idx) { } ERR_FAIL_COND(!obj); + ERR_FAIL_COND(!Object::cast_to<Resource>(obj)); - Resource *res = Object::cast_to<Resource>(obj); - ERR_FAIL_COND(!res); - - v = res; + v = obj; emit_signal("variant_changed"); hide(); } @@ -1251,7 +1249,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) { String intype = inheritors_array[0]; if (hint == PROPERTY_HINT_RESOURCE_TYPE) { - Object *obj = ClassDB::instance(intype); + Variant obj = ClassDB::instance(intype); if (!obj) { if (ScriptServer::is_global_class(intype)) { @@ -1262,10 +1260,9 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } ERR_BREAK(!obj); - Resource *res = Object::cast_to<Resource>(obj); - ERR_BREAK(!res); + ERR_BREAK(!Object::cast_to<Resource>(obj)); - v = res; + v = obj; emit_signal("variant_changed"); hide(); } diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index f317ac581f..bbedb4f033 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -228,6 +228,7 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String> &p_files, Node } editor_data->get_undo_redo().commit_action(); + editor->push_item(instances[instances.size() - 1]); } void SceneTreeDock::_replace_with_branch_scene(const String &p_file, Node *base) { @@ -1935,7 +1936,7 @@ void SceneTreeDock::_selection_changed() { } void SceneTreeDock::_do_create(Node *p_parent) { - Object *c = create_dialog->instance_selected(); + Variant c = create_dialog->instance_selected(); ERR_FAIL_COND(!c); Node *child = Object::cast_to<Node>(c); @@ -2015,7 +2016,7 @@ void SceneTreeDock::_create() { Node *n = E->get(); ERR_FAIL_COND(!n); - Object *c = create_dialog->instance_selected(); + Variant c = create_dialog->instance_selected(); ERR_FAIL_COND(!c); Node *newnode = Object::cast_to<Node>(c); |