diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/debugger/editor_debugger_node.cpp | 72 | ||||
-rw-r--r-- | editor/debugger/editor_debugger_node.h | 1 | ||||
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 2 | ||||
-rw-r--r-- | editor/editor_properties.cpp | 5 | ||||
-rw-r--r-- | editor/editor_properties.h | 2 | ||||
-rw-r--r-- | editor/editor_properties_array_dict.cpp | 78 | ||||
-rw-r--r-- | editor/editor_properties_array_dict.h | 8 | ||||
-rw-r--r-- | editor/editor_property_name_processor.cpp | 1 | ||||
-rw-r--r-- | editor/editor_themes.cpp | 13 | ||||
-rw-r--r-- | editor/import/dynamic_font_import_settings.cpp | 9 | ||||
-rw-r--r-- | editor/import/resource_importer_dynamic_font.cpp | 7 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 38 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 21 |
13 files changed, 172 insertions, 85 deletions
diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index bc28b11a71..e13af59d69 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -103,6 +103,7 @@ ScriptEditorDebugger *EditorDebuggerNode::_add_debugger() { node->connect("remote_object_updated", callable_mp(this, &EditorDebuggerNode::_remote_object_updated), varray(id)); node->connect("remote_object_property_updated", callable_mp(this, &EditorDebuggerNode::_remote_object_property_updated), varray(id)); node->connect("remote_object_requested", callable_mp(this, &EditorDebuggerNode::_remote_object_requested), varray(id)); + node->connect("errors_cleared", callable_mp(this, &EditorDebuggerNode::_update_errors)); if (tabs->get_tab_count() > 0) { get_debugger(0)->clear_style(); @@ -267,40 +268,7 @@ void EditorDebuggerNode::_notification(int p_what) { } server->poll(); - // Errors and warnings - int error_count = 0; - int warning_count = 0; - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - error_count += dbg->get_error_count(); - warning_count += dbg->get_warning_count(); - }); - - if (error_count != last_error_count || warning_count != last_warning_count) { - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - dbg->update_tabs(); - }); - - if (error_count == 0 && warning_count == 0) { - debugger_button->set_text(TTR("Debugger")); - debugger_button->remove_theme_color_override("font_color"); - debugger_button->set_icon(Ref<Texture2D>()); - } else { - debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); - if (error_count >= 1 && warning_count >= 1) { - debugger_button->set_icon(get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons"))); - // Use error color to represent the highest level of severity reported. - debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); - } else if (error_count >= 1) { - debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); - debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); - } else { - debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))); - debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); - } - } - last_error_count = error_count; - last_warning_count = warning_count; - } + _update_errors(); // Remote scene tree update remote_scene_tree_timeout -= get_process_delta_time(); @@ -361,6 +329,42 @@ void EditorDebuggerNode::_notification(int p_what) { } } +void EditorDebuggerNode::_update_errors() { + int error_count = 0; + int warning_count = 0; + _for_all(tabs, [&](ScriptEditorDebugger *dbg) { + error_count += dbg->get_error_count(); + warning_count += dbg->get_warning_count(); + }); + + if (error_count != last_error_count || warning_count != last_warning_count) { + _for_all(tabs, [&](ScriptEditorDebugger *dbg) { + dbg->update_tabs(); + }); + + if (error_count == 0 && warning_count == 0) { + debugger_button->set_text(TTR("Debugger")); + debugger_button->remove_theme_color_override("font_color"); + debugger_button->set_icon(Ref<Texture2D>()); + } else { + debugger_button->set_text(TTR("Debugger") + " (" + itos(error_count + warning_count) + ")"); + if (error_count >= 1 && warning_count >= 1) { + debugger_button->set_icon(get_theme_icon(SNAME("ErrorWarning"), SNAME("EditorIcons"))); + // Use error color to represent the highest level of severity reported. + debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); + } else if (error_count >= 1) { + debugger_button->set_icon(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); + debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); + } else { + debugger_button->set_icon(get_theme_icon(SNAME("Warning"), SNAME("EditorIcons"))); + debugger_button->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); + } + } + last_error_count = error_count; + last_warning_count = warning_count; + } +} + void EditorDebuggerNode::_debugger_stopped(int p_id) { ScriptEditorDebugger *dbg = get_debugger(p_id); ERR_FAIL_COND(!dbg); diff --git a/editor/debugger/editor_debugger_node.h b/editor/debugger/editor_debugger_node.h index 87457fc09a..8dc53690eb 100644 --- a/editor/debugger/editor_debugger_node.h +++ b/editor/debugger/editor_debugger_node.h @@ -116,6 +116,7 @@ private: ScriptEditorDebugger *_add_debugger(); EditorDebuggerRemoteObject *get_inspected_remote_object(); + void _update_errors(); friend class DebuggerEditorPlugin; friend class DebugAdapterParser; diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 9184846408..05409dbeeb 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1465,6 +1465,7 @@ void ScriptEditorDebugger::_clear_errors_list() { error_tree->clear(); error_count = 0; warning_count = 0; + emit_signal(SNAME("errors_cleared")); update_tabs(); expand_all_button->set_disabled(true); @@ -1626,6 +1627,7 @@ void ScriptEditorDebugger::_bind_methods() { ADD_SIGNAL(MethodInfo("debug_data", PropertyInfo(Variant::STRING, "msg"), PropertyInfo(Variant::ARRAY, "data"))); ADD_SIGNAL(MethodInfo("set_breakpoint", PropertyInfo("script"), PropertyInfo(Variant::INT, "line"), PropertyInfo(Variant::BOOL, "enabled"))); ADD_SIGNAL(MethodInfo("clear_breakpoints")); + ADD_SIGNAL(MethodInfo("errors_cleared")); } void ScriptEditorDebugger::add_debugger_plugin(const Ref<Script> &p_script) { diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 521f237fb1..ddf1974070 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -1259,12 +1259,13 @@ void EditorPropertyInteger::update_property() { void EditorPropertyInteger::_bind_methods() { } -void EditorPropertyInteger::setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser) { +void EditorPropertyInteger::setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser, const String &p_suffix) { spin->set_min(p_min); spin->set_max(p_max); spin->set_step(p_step); spin->set_allow_greater(p_allow_greater); spin->set_allow_lesser(p_allow_lesser); + spin->set_suffix(p_suffix); } EditorPropertyInteger::EditorPropertyInteger() { @@ -3492,7 +3493,7 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_ EditorPropertyInteger *editor = memnew(EditorPropertyInteger); EditorPropertyRangeHint hint = _parse_range_hint(p_hint, p_hint_text, 1); - editor->setup(hint.min, hint.max, hint.step, hint.greater, hint.lesser); + editor->setup(hint.min, hint.max, hint.step, hint.greater, hint.lesser, hint.suffix); return editor; } diff --git a/editor/editor_properties.h b/editor/editor_properties.h index a3990db678..6513eb0390 100644 --- a/editor/editor_properties.h +++ b/editor/editor_properties.h @@ -368,7 +368,7 @@ protected: public: virtual void update_property() override; - void setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser); + void setup(int64_t p_min, int64_t p_max, int64_t p_step, bool p_allow_greater, bool p_allow_lesser, const String &p_suffix = String()); EditorPropertyInteger(); }; diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index b3a1f35218..f47c6e298b 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -217,11 +217,11 @@ void EditorPropertyArray::update_property() { if (array.get_type() == Variant::NIL) { edit->set_text(vformat(TTR("(Nil) %s"), array_type_name)); edit->set_pressed(false); - if (vbox) { + if (container) { set_bottom_editor(nullptr); - memdelete(vbox); + memdelete(container); button_add_item = nullptr; - vbox = nullptr; + container = nullptr; } return; } @@ -241,10 +241,14 @@ void EditorPropertyArray::update_property() { if (unfolded) { updating = true; - if (!vbox) { - vbox = memnew(VBoxContainer); - add_child(vbox); - set_bottom_editor(vbox); + if (!container) { + container = memnew(MarginContainer); + container->set_theme_type_variation("MarginContainer4px"); + add_child(container); + set_bottom_editor(container); + + VBoxContainer *vbox = memnew(VBoxContainer); + container->add_child(vbox); HBoxContainer *hbox = memnew(HBoxContainer); vbox->add_child(hbox); @@ -372,11 +376,11 @@ void EditorPropertyArray::update_property() { updating = false; } else { - if (vbox) { + if (container) { set_bottom_editor(nullptr); - memdelete(vbox); + memdelete(container); button_add_item = nullptr; - vbox = nullptr; + container = nullptr; } } } @@ -687,7 +691,7 @@ EditorPropertyArray::EditorPropertyArray() { add_child(edit); add_focusable(edit); - vbox = nullptr; + container = nullptr; property_vbox = nullptr; size_slider = nullptr; button_add_item = nullptr; @@ -791,11 +795,11 @@ void EditorPropertyDictionary::update_property() { if (updated_val.get_type() == Variant::NIL) { edit->set_text(TTR("Dictionary (Nil)")); // This provides symmetry with the array property. edit->set_pressed(false); - if (vbox) { + if (container) { set_bottom_editor(nullptr); - memdelete(vbox); + memdelete(container); button_add_item = nullptr; - vbox = nullptr; + container = nullptr; } return; } @@ -812,10 +816,14 @@ void EditorPropertyDictionary::update_property() { if (unfolded) { updating = true; - if (!vbox) { - vbox = memnew(VBoxContainer); - add_child(vbox); - set_bottom_editor(vbox); + if (!container) { + container = memnew(MarginContainer); + container->set_theme_type_variation("MarginContainer4px"); + add_child(container); + set_bottom_editor(container); + + VBoxContainer *vbox = memnew(VBoxContainer); + container->add_child(vbox); property_vbox = memnew(VBoxContainer); property_vbox->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1116,11 +1124,11 @@ void EditorPropertyDictionary::update_property() { updating = false; } else { - if (vbox) { + if (container) { set_bottom_editor(nullptr); - memdelete(vbox); + memdelete(container); button_add_item = nullptr; - vbox = nullptr; + container = nullptr; } } } @@ -1188,7 +1196,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() { add_child(edit); add_focusable(edit); - vbox = nullptr; + container = nullptr; button_add_item = nullptr; paginator = nullptr; change_type = memnew(PopupMenu); @@ -1250,11 +1258,11 @@ void EditorPropertyLocalizableString::update_property() { if (updated_val.get_type() == Variant::NIL) { edit->set_text(TTR("Localizable String (Nil)")); // This provides symmetry with the array property. edit->set_pressed(false); - if (vbox) { + if (container) { set_bottom_editor(nullptr); - memdelete(vbox); + memdelete(container); button_add_item = nullptr; - vbox = nullptr; + container = nullptr; } return; } @@ -1271,10 +1279,14 @@ void EditorPropertyLocalizableString::update_property() { if (unfolded) { updating = true; - if (!vbox) { - vbox = memnew(VBoxContainer); - add_child(vbox); - set_bottom_editor(vbox); + if (!container) { + container = memnew(MarginContainer); + container->set_theme_type_variation("MarginContainer4px"); + add_child(container); + set_bottom_editor(container); + + VBoxContainer *vbox = memnew(VBoxContainer); + container->add_child(vbox); property_vbox = memnew(VBoxContainer); property_vbox->set_h_size_flags(SIZE_EXPAND_FILL); @@ -1351,11 +1363,11 @@ void EditorPropertyLocalizableString::update_property() { updating = false; } else { - if (vbox) { + if (container) { set_bottom_editor(nullptr); - memdelete(vbox); + memdelete(container); button_add_item = nullptr; - vbox = nullptr; + container = nullptr; } } } @@ -1410,7 +1422,7 @@ EditorPropertyLocalizableString::EditorPropertyLocalizableString() { add_child(edit); add_focusable(edit); - vbox = nullptr; + container = nullptr; button_add_item = nullptr; paginator = nullptr; updating = false; diff --git a/editor/editor_properties_array_dict.h b/editor/editor_properties_array_dict.h index 070353c538..44623149d0 100644 --- a/editor/editor_properties_array_dict.h +++ b/editor/editor_properties_array_dict.h @@ -89,7 +89,7 @@ class EditorPropertyArray : public EditorProperty { int page_index = 0; int changing_type_index; Button *edit = nullptr; - VBoxContainer *vbox = nullptr; + MarginContainer *container = nullptr; VBoxContainer *property_vbox = nullptr; EditorSpinSlider *size_slider = nullptr; Button *button_add_item = nullptr; @@ -146,9 +146,9 @@ class EditorPropertyDictionary : public EditorProperty { int page_index = 0; int changing_type_index; Button *edit = nullptr; - VBoxContainer *vbox = nullptr; + MarginContainer *container = nullptr; VBoxContainer *property_vbox = nullptr; - EditorSpinSlider *size_slider = nullptr; + EditorSpinSlider *size_sliderv; Button *button_add_item = nullptr; EditorPaginator *paginator = nullptr; @@ -181,7 +181,7 @@ class EditorPropertyLocalizableString : public EditorProperty { int page_length = 20; int page_index = 0; Button *edit = nullptr; - VBoxContainer *vbox = nullptr; + MarginContainer *container = nullptr; VBoxContainer *property_vbox = nullptr; EditorSpinSlider *size_slider = nullptr; Button *button_add_item = nullptr; diff --git a/editor/editor_property_name_processor.cpp b/editor/editor_property_name_processor.cpp index 1e7638bf72..397afc0653 100644 --- a/editor/editor_property_name_processor.cpp +++ b/editor/editor_property_name_processor.cpp @@ -213,6 +213,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() { capitalize_string_remaps["stdout"] = "stdout"; capitalize_string_remaps["sv"] = "SV"; capitalize_string_remaps["svg"] = "SVG"; + capitalize_string_remaps["taa"] = "TAA"; capitalize_string_remaps["tcp"] = "TCP"; capitalize_string_remaps["ui"] = "UI"; capitalize_string_remaps["url"] = "URL"; diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 5ce6ca4823..7a80cf36a8 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1283,6 +1283,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_constant("h_separation", "VFlowContainer", default_margin_size * EDSCALE); theme->set_constant("v_separation", "VFlowContainer", default_margin_size * EDSCALE); + // Custom theme type for MarginContainer with 4px margins. + theme->set_type_variation("MarginContainer4px", "MarginContainer"); + theme->set_constant("margin_left", "MarginContainer4px", 4 * EDSCALE); + theme->set_constant("margin_top", "MarginContainer4px", 4 * EDSCALE); + theme->set_constant("margin_right", "MarginContainer4px", 4 * EDSCALE); + theme->set_constant("margin_bottom", "MarginContainer4px", 4 * EDSCALE); + // Window // Prevent corner artifacts between window title and body. @@ -1626,7 +1633,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("preview_picker_label", "ThemeEditor", theme_preview_picker_label_sb); // Dictionary editor add item. - theme->set_stylebox("DictionaryAddItem", "EditorStyles", make_flat_stylebox(prop_subsection_color, 4, 4, 4, 4, corner_radius)); + // Expand to the left and right by 4px to compensate for the dictionary editor margins. + Ref<StyleBoxFlat> style_dictionary_add_item = make_flat_stylebox(prop_subsection_color, 0, 4, 0, 4, corner_radius); + style_dictionary_add_item->set_expand_margin_size(SIDE_LEFT, 4 * EDSCALE); + style_dictionary_add_item->set_expand_margin_size(SIDE_RIGHT, 4 * EDSCALE); + theme->set_stylebox("DictionaryAddItem", "EditorStyles", style_dictionary_add_item); // adaptive script theme constants // for comments and elements with lower relevance diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index b361dcd036..5e203a3e39 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -454,7 +454,11 @@ void DynamicFontImportSettings::_add_glyph_range_item(int32_t p_start, int32_t p void DynamicFontImportSettings::_main_prop_changed(const String &p_edited_property) { // Update font preview. - if (p_edited_property == "antialiased") { + if (p_edited_property == "face_index") { + if (font_preview->get_data_count() > 0) { + font_preview->get_data(0)->set_face_index(import_settings_data->get("face_index")); + } + } else if (p_edited_property == "antialiased") { if (font_preview->get_data_count() > 0) { font_preview->get_data(0)->set_antialiased(import_settings_data->get("antialiased")); } @@ -945,6 +949,7 @@ void DynamicFontImportSettings::_notification(int p_what) { void DynamicFontImportSettings::_re_import() { HashMap<StringName, Variant> main_settings; + main_settings["face_index"] = import_settings_data->get("face_index"); main_settings["antialiased"] = import_settings_data->get("antialiased"); main_settings["generate_mipmaps"] = import_settings_data->get("generate_mipmaps"); main_settings["multichannel_signed_distance_field"] = import_settings_data->get("multichannel_signed_distance_field"); @@ -1299,6 +1304,7 @@ void DynamicFontImportSettings::open_settings(const String &p_path) { import_settings_data->notify_property_list_changed(); if (font_preview->get_data_count() > 0) { + font_preview->get_data(0)->set_face_index(import_settings_data->get("face_index")); font_preview->get_data(0)->set_antialiased(import_settings_data->get("antialiased")); font_preview->get_data(0)->set_multichannel_signed_distance_field(import_settings_data->get("multichannel_signed_distance_field")); font_preview->get_data(0)->set_msdf_pixel_range(import_settings_data->get("msdf_pixel_range")); @@ -1360,6 +1366,7 @@ DynamicFontImportSettings *DynamicFontImportSettings::get_singleton() { DynamicFontImportSettings::DynamicFontImportSettings() { singleton = this; + options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::INT, "face_index"), 0)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "antialiased"), true)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false)); options_general.push_back(ResourceImporter::ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), true)); diff --git a/editor/import/resource_importer_dynamic_font.cpp b/editor/import/resource_importer_dynamic_font.cpp index 04f6a0b7af..a92b0fe280 100644 --- a/editor/import/resource_importer_dynamic_font.cpp +++ b/editor/import/resource_importer_dynamic_font.cpp @@ -50,7 +50,9 @@ void ResourceImporterDynamicFont::get_recognized_extensions(List<String> *p_exte if (p_extensions) { #ifdef MODULE_FREETYPE_ENABLED p_extensions->push_back("ttf"); + p_extensions->push_back("ttc"); p_extensions->push_back("otf"); + p_extensions->push_back("otc"); p_extensions->push_back("woff"); p_extensions->push_back("woff2"); p_extensions->push_back("pfb"); @@ -101,6 +103,8 @@ String ResourceImporterDynamicFont::get_preset_name(int p_idx) const { void ResourceImporterDynamicFont::get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const { bool msdf = p_preset == PRESET_MSDF; + r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "face_index"), 0)); + r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "antialiased"), true)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate_mipmaps"), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "multichannel_signed_distance_field", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), (msdf) ? true : false)); @@ -179,6 +183,8 @@ void ResourceImporterDynamicFont::show_advanced_options(const String &p_path) { Error ResourceImporterDynamicFont::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) { print_verbose("Importing dynamic font from: " + p_source_file); + int face_index = p_options["face_index"]; + bool antialiased = p_options["antialiased"]; bool generate_mipmaps = p_options["generate_mipmaps"]; bool msdf = p_options["multichannel_signed_distance_field"]; @@ -200,6 +206,7 @@ Error ResourceImporterDynamicFont::import(const String &p_source_file, const Str Ref<FontData> font; font.instantiate(); font->set_data(data); + font->set_face_index(face_index); font->set_antialiased(antialiased); font->set_generate_mipmaps(generate_mipmaps); font->set_multichannel_signed_distance_field(msdf); diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 80230bc316..f2975b1d7a 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -658,6 +658,44 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, HashMap<R } } } + } else if (_teststr(name, "vehicle")) { + if (isroot) { + return p_node; + } + + Node *owner = p_node->get_owner(); + Node3D *s = Object::cast_to<Node3D>(p_node); + VehicleBody3D *bv = memnew(VehicleBody3D); + String n = _fixstr(p_node->get_name(), "vehicle"); + bv->set_name(n); + p_node->replace_by(bv); + p_node->set_name(n); + bv->add_child(p_node); + bv->set_owner(owner); + p_node->set_owner(owner); + bv->set_transform(s->get_transform()); + s->set_transform(Transform3D()); + + p_node = bv; + } else if (_teststr(name, "wheel")) { + if (isroot) { + return p_node; + } + + Node *owner = p_node->get_owner(); + Node3D *s = Object::cast_to<Node3D>(p_node); + VehicleWheel3D *bv = memnew(VehicleWheel3D); + String n = _fixstr(p_node->get_name(), "wheel"); + bv->set_name(n); + p_node->replace_by(bv); + p_node->set_name(n); + bv->add_child(p_node); + bv->set_owner(owner); + p_node->set_owner(owner); + bv->set_transform(s->get_transform()); + s->set_transform(Transform3D()); + + p_node = bv; } else if (Object::cast_to<ImporterMeshInstance3D>(p_node)) { //last attempt, maybe collision inside the mesh data diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index bfe9e202d6..83b0d74dd2 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4089,6 +4089,8 @@ void CanvasItemEditor::_button_tool_select(int p_index) { void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, bool p_scale, bool p_on_existing) { const HashMap<Node *, Object *> &selection = editor_selection->get_selection(); + AnimationTrackEditor *te = AnimationPlayerEditor::get_singleton()->get_track_editor(); + te->make_insert_queue(); for (const KeyValue<Node *, Object *> &E : selection) { CanvasItem *canvas_item = Object::cast_to<CanvasItem>(E.key); if (!canvas_item || !canvas_item->is_visible_in_tree()) { @@ -4103,13 +4105,13 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, Node2D *n2d = Object::cast_to<Node2D>(canvas_item); if (key_pos && p_location) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(n2d, "position", n2d->get_position(), p_on_existing); + te->insert_node_value_key(n2d, "position", n2d->get_position(), p_on_existing); } if (key_rot && p_rotation) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(n2d, "rotation", n2d->get_rotation(), p_on_existing); + te->insert_node_value_key(n2d, "rotation", n2d->get_rotation(), p_on_existing); } if (key_scale && p_scale) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(n2d, "scale", n2d->get_scale(), p_on_existing); + te->insert_node_value_key(n2d, "scale", n2d->get_scale(), p_on_existing); } if (n2d->has_meta("_edit_bone_") && n2d->get_parent_item()) { @@ -4135,13 +4137,13 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, if (has_chain && ik_chain.size()) { for (Node2D *&F : ik_chain) { if (key_pos) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(F, "position", F->get_position(), p_on_existing); + te->insert_node_value_key(F, "position", F->get_position(), p_on_existing); } if (key_rot) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(F, "rotation", F->get_rotation(), p_on_existing); + te->insert_node_value_key(F, "rotation", F->get_rotation(), p_on_existing); } if (key_scale) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(F, "scale", F->get_scale(), p_on_existing); + te->insert_node_value_key(F, "scale", F->get_scale(), p_on_existing); } } } @@ -4151,16 +4153,17 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, Control *ctrl = Object::cast_to<Control>(canvas_item); if (key_pos) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(ctrl, "rect_position", ctrl->get_position(), p_on_existing); + te->insert_node_value_key(ctrl, "rect_position", ctrl->get_position(), p_on_existing); } if (key_rot) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(ctrl, "rect_rotation", ctrl->get_rotation(), p_on_existing); + te->insert_node_value_key(ctrl, "rect_rotation", ctrl->get_rotation(), p_on_existing); } if (key_scale) { - AnimationPlayerEditor::get_singleton()->get_track_editor()->insert_node_value_key(ctrl, "rect_size", ctrl->get_size(), p_on_existing); + te->insert_node_value_key(ctrl, "rect_size", ctrl->get_size(), p_on_existing); } } } + te->commit_insert_queue(); } void CanvasItemEditor::_update_override_camera_button(bool p_game_running) { |