diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/animation_track_editor.cpp | 2 | ||||
-rw-r--r-- | editor/animation_track_editor_plugins.cpp | 4 | ||||
-rw-r--r-- | editor/connections_dialog.cpp | 24 | ||||
-rw-r--r-- | editor/connections_dialog.h | 2 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 6 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.h | 1 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 80 | ||||
-rw-r--r-- | editor/editor_file_system.h | 3 | ||||
-rw-r--r-- | editor/editor_node.cpp | 50 | ||||
-rw-r--r-- | editor/editor_node.h | 3 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 2 | ||||
-rw-r--r-- | editor/editor_properties_array_dict.cpp | 2 | ||||
-rw-r--r-- | editor/editor_spin_slider.cpp | 1 | ||||
-rw-r--r-- | editor/import/editor_import_plugin.cpp | 16 | ||||
-rw-r--r-- | editor/import/editor_import_plugin.h | 3 | ||||
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 31 | ||||
-rw-r--r-- | editor/project_converter_3_to_4.cpp | 7 | ||||
-rw-r--r-- | editor/project_converter_3_to_4.h | 3 |
18 files changed, 155 insertions, 85 deletions
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index ee4163bc14..8426dfd1ac 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1108,7 +1108,7 @@ void AnimationMultiTrackKeyEdit::_get_property_list(List<PropertyInfo> *p_list) p_list->push_back(PropertyInfo(Variant::VECTOR3, "position")); } break; case Animation::TYPE_ROTATION_3D: { - p_list->push_back(PropertyInfo(Variant::QUATERNION, "scale")); + p_list->push_back(PropertyInfo(Variant::QUATERNION, "rotation")); } break; case Animation::TYPE_SCALE_3D: { p_list->push_back(PropertyInfo(Variant::VECTOR3, "scale")); diff --git a/editor/animation_track_editor_plugins.cpp b/editor/animation_track_editor_plugins.cpp index ba73a63245..2895aa9710 100644 --- a/editor/animation_track_editor_plugins.cpp +++ b/editor/animation_track_editor_plugins.cpp @@ -389,7 +389,7 @@ Rect2 AnimationTrackEditSpriteFrame::get_key_rect(int p_index, float p_pixels_se size = texture->get_size(); - if (bool(object->call("is_region"))) { + if (bool(object->call("is_region_enabled"))) { size = Rect2(object->call("get_region_rect")).size; } @@ -479,7 +479,7 @@ void AnimationTrackEditSpriteFrame::draw_key(int p_index, float p_pixels_sec, in region.size = texture->get_size(); - if (bool(object->call("is_region"))) { + if (bool(object->call("is_region_enabled"))) { region = Rect2(object->call("get_region_rect")); } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index f4d293e9f4..20a9e633a8 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -170,6 +170,10 @@ void ConnectDialog::_tree_node_selected() { _update_ok_enabled(); } +void ConnectDialog::_focus_currently_connected() { + tree->set_selected(source); +} + void ConnectDialog::_unbind_count_changed(double p_count) { for (Control *control : bind_controls) { BaseButton *b = Object::cast_to<BaseButton>(control); @@ -577,6 +581,8 @@ void ConnectDialog::init(const ConnectionData &p_cd, const PackedStringArray &p_ void ConnectDialog::popup_dialog(const String p_for_signal) { from_signal->set_text(p_for_signal); error_label->add_theme_color_override("font_color", error_label->get_theme_color(SNAME("error_color"), SNAME("Editor"))); + filter_nodes->clear(); + if (!advanced->is_pressed()) { error_label->set_visible(!_find_first_script(get_tree()->get_edited_scene_root(), get_tree()->get_edited_scene_root())); } @@ -628,12 +634,28 @@ ConnectDialog::ConnectDialog() { tree = memnew(SceneTreeEditor(false)); tree->set_connecting_signal(true); tree->set_show_enabled_subscene(true); + tree->set_v_size_flags(Control::SIZE_FILL | Control::SIZE_EXPAND); tree->get_scene_tree()->connect("item_activated", callable_mp(this, &ConnectDialog::_item_activated)); tree->connect("node_selected", callable_mp(this, &ConnectDialog::_tree_node_selected)); tree->set_connect_to_script_mode(true); - Node *mc = vbc_left->add_margin_child(TTR("Connect to Script:"), tree, true); + HBoxContainer *hbc_filter = memnew(HBoxContainer); + + filter_nodes = memnew(LineEdit); + hbc_filter->add_child(filter_nodes); + filter_nodes->set_h_size_flags(Control::SIZE_FILL | Control::SIZE_EXPAND); + filter_nodes->set_placeholder(TTR("Filter Nodes")); + filter_nodes->set_clear_button_enabled(true); + filter_nodes->connect("text_changed", callable_mp(tree, &SceneTreeEditor::set_filter)); + + Button *focus_current = memnew(Button); + hbc_filter->add_child(focus_current); + focus_current->set_text(TTR("Go to Source")); + focus_current->connect("pressed", callable_mp(this, &ConnectDialog::_focus_currently_connected)); + + Node *mc = vbc_left->add_margin_child(TTR("Connect to Script:"), hbc_filter, false); connect_to_label = Object::cast_to<Label>(vbc_left->get_child(mc->get_index() - 1)); + vbc_left->add_child(tree); error_label = memnew(Label); error_label->set_text(TTR("Scene does not contain any script.")); diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h index 277ea03cf7..e5375a3fc8 100644 --- a/editor/connections_dialog.h +++ b/editor/connections_dialog.h @@ -106,6 +106,7 @@ public: private: Label *connect_to_label = nullptr; LineEdit *from_signal = nullptr; + LineEdit *filter_nodes = nullptr; Node *source = nullptr; ConnectionData source_connection_data; StringName signal; @@ -142,6 +143,7 @@ private: void _item_activated(); void _text_submitted(const String &p_text); void _tree_node_selected(); + void _focus_currently_connected(); void _method_selected(); void _create_method_tree_items(const List<MethodInfo> &p_methods, TreeItem *p_parent_item); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 32952a367d..304beec681 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -308,6 +308,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da String error = p_data[1]; bool has_stackdump = p_data[2]; breaked = true; + can_request_idle_draw = true; can_debug = can_continue; _update_buttons_state(); _set_reason_text(error, MESSAGE_ERROR); @@ -378,6 +379,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da vmem_total->set_tooltip_text(TTR("Bytes:") + " " + itos(total)); vmem_total->set_text(String::humanize_size(total)); + } else if (p_msg == "servers:drawn") { + can_request_idle_draw = true; } else if (p_msg == "stack_dump") { DebuggerMarshalls::ScriptStackDump stack; stack.deserialize(p_data); @@ -843,8 +846,9 @@ void ScriptEditorDebugger::_notification(int p_what) { msg.push_back(cam->get_far()); _put_msg("scene:override_camera_3D:transform", msg); } - if (breaked) { + if (breaked && can_request_idle_draw) { _put_msg("servers:draw", Array()); + can_request_idle_draw = false; } } diff --git a/editor/debugger/script_editor_debugger.h b/editor/debugger/script_editor_debugger.h index a0c420522a..1659bbee8d 100644 --- a/editor/debugger/script_editor_debugger.h +++ b/editor/debugger/script_editor_debugger.h @@ -155,6 +155,7 @@ private: bool breaked = false; bool can_debug = false; bool move_to_foreground = true; + bool can_request_idle_draw = false; bool live_debug; diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 644c32e8a4..ec1ef8a6bc 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -1900,49 +1900,56 @@ Error EditorFileSystem::_reimport_group(const String &p_group_file, const Vector return err; } -void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<StringName, Variant> *p_custom_options, const String &p_custom_importer) { +Error EditorFileSystem::_reimport_file(const String &p_file, const HashMap<StringName, Variant> &p_custom_options, const String &p_custom_importer, Variant *p_generator_parameters) { EditorFileSystemDirectory *fs = nullptr; int cpos = -1; bool found = _find_file(p_file, &fs, cpos); - ERR_FAIL_COND_MSG(!found, "Can't find file '" + p_file + "'."); + ERR_FAIL_COND_V_MSG(!found, ERR_FILE_NOT_FOUND, "Can't find file '" + p_file + "'."); //try to obtain existing params - HashMap<StringName, Variant> params; + HashMap<StringName, Variant> params = p_custom_options; String importer_name; //empty by default though if (!p_custom_importer.is_empty()) { importer_name = p_custom_importer; } - if (p_custom_options != nullptr) { - params = *p_custom_options; - } ResourceUID::ID uid = ResourceUID::INVALID_ID; + Variant generator_parameters; + if (p_generator_parameters) { + generator_parameters = *p_generator_parameters; + } if (FileAccess::exists(p_file + ".import")) { //use existing - if (p_custom_options == nullptr) { - Ref<ConfigFile> cf; - cf.instantiate(); - Error err = cf->load(p_file + ".import"); - if (err == OK) { - if (cf->has_section("params")) { - List<String> sk; - cf->get_section_keys("params", &sk); - for (const String &E : sk) { + Ref<ConfigFile> cf; + cf.instantiate(); + Error err = cf->load(p_file + ".import"); + if (err == OK) { + if (cf->has_section("params")) { + List<String> sk; + cf->get_section_keys("params", &sk); + for (const String &E : sk) { + if (!params.has(E)) { params[E] = cf->get_value("params", E); } } + } + + if (cf->has_section("remap")) { + if (p_custom_importer.is_empty()) { + importer_name = cf->get_value("remap", "importer"); + } - if (cf->has_section("remap")) { - if (p_custom_importer.is_empty()) { - importer_name = cf->get_value("remap", "importer"); - } + if (cf->has_section_key("remap", "uid")) { + String uidt = cf->get_value("remap", "uid"); + uid = ResourceUID::get_singleton()->text_to_id(uidt); + } - if (cf->has_section_key("remap", "uid")) { - String uidt = cf->get_value("remap", "uid"); - uid = ResourceUID::get_singleton()->text_to_id(uidt); + if (!p_generator_parameters) { + if (cf->has_section_key("remap", "generator_parameters")) { + generator_parameters = cf->get_value("remap", "generator_parameters"); } } } @@ -1957,7 +1964,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<String fs->files[cpos]->type = ""; fs->files[cpos]->import_valid = false; EditorResourcePreview::get_singleton()->check_for_invalidation(p_file); - return; + return OK; } Ref<ResourceImporter> importer; bool load_default = false; @@ -1971,8 +1978,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<String importer = ResourceFormatImporter::get_singleton()->get_importer_by_extension(p_file.get_extension()); load_default = true; if (importer.is_null()) { - ERR_PRINT("BUG: File queued for import, but can't be imported, importer for type '" + importer_name + "' not found."); - ERR_FAIL(); + ERR_FAIL_V_MSG(ERR_FILE_CANT_OPEN, "BUG: File queued for import, but can't be imported, importer for type '" + importer_name + "' not found."); } } @@ -2005,16 +2011,14 @@ void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<String Variant meta; Error err = importer->import(p_file, base_path, params, &import_variants, &gen_files, &meta); - if (err != OK) { - ERR_PRINT("Error importing '" + p_file + "'."); - } + ERR_FAIL_COND_V_MSG(err != OK, ERR_FILE_UNRECOGNIZED, "Error importing '" + p_file + "'."); //as import is complete, save the .import file Vector<String> dest_paths; { Ref<FileAccess> f = FileAccess::open(p_file + ".import", FileAccess::WRITE); - ERR_FAIL_COND_MSG(f.is_null(), "Cannot open file from path '" + p_file + ".import'."); + ERR_FAIL_COND_V_MSG(f.is_null(), ERR_FILE_CANT_OPEN, "Cannot open file from path '" + p_file + ".import'."); //write manually, as order matters ([remap] has to go first for performance). f->store_line("[remap]"); @@ -2059,6 +2063,10 @@ void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<String f->store_line("metadata=" + meta.get_construct_string()); } + if (generator_parameters != Variant()) { + f->store_line("generator_parameters=" + generator_parameters.get_construct_string()); + } + f->store_line(""); f->store_line("[deps]\n"); @@ -2102,7 +2110,7 @@ void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<String // Store the md5's of the various files. These are stored separately so that the .import files can be version controlled. { Ref<FileAccess> md5s = FileAccess::open(base_path + ".md5", FileAccess::WRITE); - ERR_FAIL_COND_MSG(md5s.is_null(), "Cannot open MD5 file '" + base_path + ".md5'."); + ERR_FAIL_COND_V_MSG(md5s.is_null(), ERR_FILE_CANT_OPEN, "Cannot open MD5 file '" + base_path + ".md5'."); md5s->store_line("source_md5=\"" + FileAccess::get_md5(p_file) + "\""); if (dest_paths.size()) { @@ -2136,6 +2144,8 @@ void EditorFileSystem::_reimport_file(const String &p_file, const HashMap<String } EditorResourcePreview::get_singleton()->check_for_invalidation(p_file); + + return OK; } void EditorFileSystem::_find_group_files(EditorFileSystemDirectory *efd, HashMap<String, Vector<String>> &group_files, HashSet<String> &groups_to_reimport) { @@ -2156,7 +2166,7 @@ void EditorFileSystem::_find_group_files(EditorFileSystemDirectory *efd, HashMap } void EditorFileSystem::reimport_file_with_custom_parameters(const String &p_file, const String &p_importer, const HashMap<StringName, Variant> &p_custom_params) { - _reimport_file(p_file, &p_custom_params, p_importer); + _reimport_file(p_file, p_custom_params, p_importer); } void EditorFileSystem::_reimport_thread(uint32_t p_index, ImportThreadData *p_import_data) { @@ -2166,10 +2176,11 @@ void EditorFileSystem::_reimport_thread(uint32_t p_index, ImportThreadData *p_im void EditorFileSystem::reimport_files(const Vector<String> &p_files) { importing = true; - EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size()); Vector<String> reloads; + EditorProgress pr("reimport", TTR("(Re)Importing Assets"), p_files.size()); + Vector<ImportFile> reimport_files; HashSet<String> groups_to_reimport; @@ -2292,6 +2303,11 @@ void EditorFileSystem::reimport_files(const Vector<String> &p_files) { emit_signal(SNAME("resources_reimported"), reloads); } +Error EditorFileSystem::reimport_append(const String &p_file, const HashMap<StringName, Variant> &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters) { + ERR_FAIL_COND_V_MSG(!importing, ERR_INVALID_PARAMETER, "Can only append files to import during a current reimport process."); + return _reimport_file(p_file, p_custom_options, p_custom_importer, &p_generator_parameters); +} + Error EditorFileSystem::_resource_import(const String &p_path) { Vector<String> files; files.push_back(p_path); diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index 2490bd31b3..0d558c84c5 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -242,7 +242,7 @@ class EditorFileSystem : public Node { void _update_extensions(); - void _reimport_file(const String &p_file, const HashMap<StringName, Variant> *p_custom_options = nullptr, const String &p_custom_importer = String()); + Error _reimport_file(const String &p_file, const HashMap<StringName, Variant> &p_custom_options = HashMap<StringName, Variant>(), const String &p_custom_importer = String(), Variant *generator_parameters = nullptr); Error _reimport_group(const String &p_group_file, const Vector<String> &p_files); bool _test_for_reimport(const String &p_path, bool p_only_imported_files); @@ -315,6 +315,7 @@ public: EditorFileSystemDirectory *find_file(const String &p_file, int *r_index) const; void reimport_files(const Vector<String> &p_files); + Error reimport_append(const String &p_file, const HashMap<StringName, Variant> &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters); void reimport_file_with_custom_parameters(const String &p_file, const String &p_importer, const HashMap<StringName, Variant> &p_custom_params); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index f317c23b83..3adebb2f8e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -852,6 +852,18 @@ void EditorNode::_remove_plugin_from_enabled(const String &p_name) { ps->set("editor_plugins/enabled", enabled_plugins); } +void EditorNode::_plugin_over_edit(EditorPlugin *p_plugin, Object *p_object) { + if (p_object) { + editor_plugins_over->add_plugin(p_plugin); + p_plugin->make_visible(true); + p_plugin->edit(p_object); + } else { + editor_plugins_over->remove_plugin(p_plugin); + p_plugin->make_visible(false); + p_plugin->edit(nullptr); + } +} + void EditorNode::_resources_changed(const Vector<String> &p_resources) { List<Ref<Resource>> changed; @@ -2102,8 +2114,7 @@ void EditorNode::edit_item(Object *p_object, Object *p_editing_owner) { if (!item_plugins.has(plugin)) { // Remove plugins no longer used by this editing owner. to_remove.push_back(plugin); - plugin->make_visible(false); - plugin->edit(nullptr); + _plugin_over_edit(plugin, nullptr); } } @@ -2113,6 +2124,7 @@ void EditorNode::edit_item(Object *p_object, Object *p_editing_owner) { for (EditorPlugin *plugin : item_plugins) { if (active_plugins[owner_id].has(plugin)) { + plugin->edit(p_object); continue; } @@ -2127,9 +2139,7 @@ void EditorNode::edit_item(Object *p_object, Object *p_editing_owner) { } } active_plugins[owner_id].insert(plugin); - editor_plugins_over->add_plugin(plugin); - plugin->edit(p_object); - plugin->make_visible(true); + _plugin_over_edit(plugin, p_object); } } else { hide_unused_editors(p_editing_owner); @@ -2181,9 +2191,7 @@ void EditorNode::hide_unused_editors(const Object *p_editing_owner) { if (p_editing_owner) { const ObjectID id = p_editing_owner->get_instance_id(); for (EditorPlugin *plugin : active_plugins[id]) { - plugin->make_visible(false); - plugin->edit(nullptr); - editor_plugins_over->remove_plugin(plugin); + _plugin_over_edit(plugin, nullptr); } active_plugins.erase(id); } else { @@ -2194,9 +2202,7 @@ void EditorNode::hide_unused_editors(const Object *p_editing_owner) { if (!ObjectDB::get_instance(kv.key)) { to_remove.push_back(kv.key); for (EditorPlugin *plugin : kv.value) { - plugin->make_visible(false); - plugin->edit(nullptr); - editor_plugins_over->remove_plugin(plugin); + _plugin_over_edit(plugin, nullptr); } } } @@ -2947,7 +2953,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } else if (export_template_manager->can_install_android_template()) { install_android_build_template->popup_centered(); } else { - custom_build_manage_templates->popup_centered(); + gradle_build_manage_templates->popup_centered(); } } } break; @@ -3037,7 +3043,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { #endif } break; case SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE: { - custom_build_manage_templates->hide(); + gradle_build_manage_templates->hide(); file_android_build_source->popup_centered_ratio(); } break; case SETTINGS_MANAGE_FEATURE_PROFILES: { @@ -5618,8 +5624,9 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) { return; } - bottom_panel_updating = true; if (p_enable) { + bottom_panel_updating = true; + for (int i = 0; i < bottom_panel_items.size(); i++) { bottom_panel_items[i].button->set_pressed(i == p_idx); bottom_panel_items[i].control->set_visible(i == p_idx); @@ -5636,7 +5643,6 @@ void EditorNode::_bottom_panel_switch(bool p_enable, int p_idx) { top_split->hide(); } bottom_panel_raise->show(); - } else { bottom_panel->add_theme_style_override("panel", gui_base->get_theme_stylebox(SNAME("BottomPanel"), SNAME("EditorStyles"))); bottom_panel_items[p_idx].button->set_pressed(false); @@ -7700,12 +7706,12 @@ EditorNode::EditorNode() { save_confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current)); save_confirmation->connect("custom_action", callable_mp(this, &EditorNode::_discard_changes)); - custom_build_manage_templates = memnew(ConfirmationDialog); - custom_build_manage_templates->set_text(TTR("Android build template is missing, please install relevant templates.")); - custom_build_manage_templates->set_ok_button_text(TTR("Manage Templates")); - custom_build_manage_templates->add_button(TTR("Install from file"))->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE)); - custom_build_manage_templates->connect("confirmed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_MANAGE_EXPORT_TEMPLATES)); - gui_base->add_child(custom_build_manage_templates); + gradle_build_manage_templates = memnew(ConfirmationDialog); + gradle_build_manage_templates->set_text(TTR("Android build template is missing, please install relevant templates.")); + gradle_build_manage_templates->set_ok_button_text(TTR("Manage Templates")); + gradle_build_manage_templates->add_button(TTR("Install from file"))->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE)); + gradle_build_manage_templates->connect("confirmed", callable_mp(this, &EditorNode::_menu_option).bind(SETTINGS_MANAGE_EXPORT_TEMPLATES)); + gui_base->add_child(gradle_build_manage_templates); file_android_build_source = memnew(EditorFileDialog); file_android_build_source->set_title(TTR("Select Android sources file")); @@ -7716,7 +7722,7 @@ EditorNode::EditorNode() { gui_base->add_child(file_android_build_source); install_android_build_template = memnew(ConfirmationDialog); - install_android_build_template->set_text(TTR("This will set up your project for custom Android builds by installing the source template to \"res://android/build\".\nYou can then apply modifications and build your own custom APK on export (adding modules, changing the AndroidManifest.xml, etc.).\nNote that in order to make custom builds instead of using pre-built APKs, the \"Use Custom Build\" option should be enabled in the Android export preset.")); + install_android_build_template->set_text(TTR("This will set up your project for gradle Android builds by installing the source template to \"res://android/build\".\nYou can then apply modifications and build your own custom APK on export (adding modules, changing the AndroidManifest.xml, etc.).\nNote that in order to make gradle builds instead of using pre-built APKs, the \"Use Gradle Build\" option should be enabled in the Android export preset.")); install_android_build_template->set_ok_button_text(TTR("Install")); install_android_build_template->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current)); gui_base->add_child(install_android_build_template); diff --git a/editor/editor_node.h b/editor/editor_node.h index 914dab0254..eefe45ca1f 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -398,7 +398,7 @@ private: PopupMenu *editor_layouts = nullptr; EditorLayoutsDialog *layout_dialog = nullptr; - ConfirmationDialog *custom_build_manage_templates = nullptr; + ConfirmationDialog *gradle_build_manage_templates = nullptr; ConfirmationDialog *install_android_build_template = nullptr; ConfirmationDialog *remove_android_build_template = nullptr; @@ -565,6 +565,7 @@ private: void _update_file_menu_closed(); void _remove_plugin_from_enabled(const String &p_name); + void _plugin_over_edit(EditorPlugin *p_plugin, Object *p_object); void _fs_changed(); void _resources_reimported(const Vector<String> &p_resources); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c9eae77b53..33bba90c70 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -4593,7 +4593,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ } break; case Variant::PACKED_STRING_ARRAY: { EditorPropertyArray *editor = memnew(EditorPropertyArray); - editor->setup(Variant::PACKED_STRING_ARRAY); + editor->setup(Variant::PACKED_STRING_ARRAY, p_hint_text); return editor; } break; case Variant::PACKED_VECTOR2_ARRAY: { diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index b96ac9dbcb..24cfa7ad7b 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -574,7 +574,7 @@ void EditorPropertyArray::setup(Variant::Type p_array_type, const String &p_hint // The format of p_hint_string is: // subType/subTypeHint:nextSubtype ... etc. - if (array_type == Variant::ARRAY && !p_hint_string.is_empty()) { + if (!p_hint_string.is_empty()) { int hint_subtype_separator = p_hint_string.find(":"); if (hint_subtype_separator >= 0) { String subtype_string = p_hint_string.substr(0, hint_subtype_separator); diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 54e14074d9..2d3ec437c6 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -367,7 +367,6 @@ void EditorSpinSlider::_draw_spin_slider() { if (!hide_slider) { if (get_step() == 1) { - number_width -= updown->get_width(); Ref<Texture2D> updown2 = get_theme_icon(is_read_only() ? SNAME("updown_disabled") : SNAME("updown"), SNAME("SpinBox")); int updown_vofs = (size.height - updown2->get_height()) / 2; if (rtl) { diff --git a/editor/import/editor_import_plugin.cpp b/editor/import/editor_import_plugin.cpp index ef3d3d1276..7afce116b8 100644 --- a/editor/import/editor_import_plugin.cpp +++ b/editor/import/editor_import_plugin.cpp @@ -31,6 +31,7 @@ #include "editor_import_plugin.h" #include "core/object/script_language.h" +#include "editor/editor_file_system.h" EditorImportPlugin::EditorImportPlugin() { } @@ -185,6 +186,20 @@ Error EditorImportPlugin::import(const String &p_source_file, const String &p_sa ERR_FAIL_V_MSG(ERR_METHOD_NOT_FOUND, "Unimplemented _import in add-on."); } +Error EditorImportPlugin::_append_import_external_resource(const String &p_file, const Dictionary &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters) { + HashMap<StringName, Variant> options; + List<Variant> keys; + p_custom_options.get_key_list(&keys); + for (const Variant &K : keys) { + options.insert(K, p_custom_options[K]); + } + return append_import_external_resource(p_file, options, p_custom_importer, p_generator_parameters); +} + +Error EditorImportPlugin::append_import_external_resource(const String &p_file, const HashMap<StringName, Variant> &p_custom_options, const String &p_custom_importer, Variant p_generator_parameters) { + return EditorFileSystem::get_singleton()->reimport_append(p_file, p_custom_options, p_custom_importer, p_generator_parameters); +} + void EditorImportPlugin::_bind_methods() { GDVIRTUAL_BIND(_get_importer_name) GDVIRTUAL_BIND(_get_visible_name) @@ -198,4 +213,5 @@ void EditorImportPlugin::_bind_methods() { GDVIRTUAL_BIND(_get_import_order) GDVIRTUAL_BIND(_get_option_visibility, "path", "option_name", "options") GDVIRTUAL_BIND(_import, "source_file", "save_path", "options", "platform_variants", "gen_files"); + ClassDB::bind_method(D_METHOD("append_import_external_resource", "path", "custom_options", "custom_importer", "generator_parameters"), &EditorImportPlugin::_append_import_external_resource, DEFVAL(Dictionary()), DEFVAL(String()), DEFVAL(Variant())); } diff --git a/editor/import/editor_import_plugin.h b/editor/import/editor_import_plugin.h index bf912058a2..fb164c7f15 100644 --- a/editor/import/editor_import_plugin.h +++ b/editor/import/editor_import_plugin.h @@ -53,6 +53,8 @@ protected: GDVIRTUAL3RC(bool, _get_option_visibility, String, StringName, Dictionary) GDVIRTUAL5RC(Error, _import, String, String, Dictionary, TypedArray<String>, TypedArray<String>) + Error _append_import_external_resource(const String &p_file, const Dictionary &p_custom_options = Dictionary(), const String &p_custom_importer = String(), Variant p_generator_parameters = Variant()); + public: EditorImportPlugin(); virtual String get_importer_name() const override; @@ -67,6 +69,7 @@ public: virtual void get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const override; virtual bool get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const override; virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata = nullptr) override; + Error append_import_external_resource(const String &p_file, const HashMap<StringName, Variant> &p_custom_options = HashMap<StringName, Variant>(), const String &p_custom_importer = String(), Variant p_generator_parameters = Variant()); }; #endif // EDITOR_IMPORT_PLUGIN_H diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 14b5f7cefb..c41bf4b8cc 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -1171,32 +1171,29 @@ void SpriteFramesEditor::edit(Ref<SpriteFrames> p_frames) { if (!p_frames.is_valid()) { frames.unref(); + hide(); return; } frames = p_frames; read_only = EditorNode::get_singleton()->is_resource_read_only(p_frames); - if (p_frames.is_valid()) { - if (!p_frames->has_animation(edited_anim)) { - List<StringName> anim_names; - frames->get_animation_list(&anim_names); - anim_names.sort_custom<StringName::AlphCompare>(); - if (anim_names.size()) { - edited_anim = anim_names.front()->get(); - } else { - edited_anim = StringName(); - } + if (!p_frames->has_animation(edited_anim)) { + List<StringName> anim_names; + frames->get_animation_list(&anim_names); + anim_names.sort_custom<StringName::AlphCompare>(); + if (anim_names.size()) { + edited_anim = anim_names.front()->get(); + } else { + edited_anim = StringName(); } - - _update_library(); - // Clear zoom and split sheet texture - split_sheet_preview->set_texture(Ref<Texture2D>()); - _zoom_reset(); - } else { - hide(); } + _update_library(); + // Clear zoom and split sheet texture + split_sheet_preview->set_texture(Ref<Texture2D>()); + _zoom_reset(); + add_anim->set_disabled(read_only); delete_anim->set_disabled(read_only); anim_speed->set_editable(!read_only); diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 26f872421e..706466a974 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -30,13 +30,14 @@ #include "project_converter_3_to_4.h" -#include "modules/modules_enabled.gen.h" - #ifndef DISABLE_DEPRECATED -#ifdef MODULE_REGEX_ENABLED const int ERROR_CODE = 77; +#include "modules/modules_enabled.gen.h" // For regex. + +#ifdef MODULE_REGEX_ENABLED + #include "modules/regex/regex.h" #include "core/io/dir_access.h" diff --git a/editor/project_converter_3_to_4.h b/editor/project_converter_3_to_4.h index 6ec2dd188d..641bc467ac 100644 --- a/editor/project_converter_3_to_4.h +++ b/editor/project_converter_3_to_4.h @@ -29,9 +29,10 @@ /**************************************************************************/ #ifndef PROJECT_CONVERTER_3_TO_4_H -#ifndef DISABLE_DEPRECATED #define PROJECT_CONVERTER_3_TO_4_H +#ifndef DISABLE_DEPRECATED + #include "core/io/file_access.h" #include "core/object/ref_counted.h" #include "core/string/ustring.h" |