diff options
| -rw-r--r-- | doc/classes/AudioEffectSpectrumAnalyzer.xml | 1 | ||||
| -rw-r--r-- | doc/classes/AudioEffectSpectrumAnalyzerInstance.xml | 10 | ||||
| -rw-r--r-- | editor/animation_bezier_editor.cpp | 53 | ||||
| -rw-r--r-- | editor/animation_bezier_editor.h | 2 | ||||
| -rw-r--r-- | editor/animation_track_editor.cpp | 6 | ||||
| -rw-r--r-- | editor/code_editor.cpp | 4 | ||||
| -rw-r--r-- | editor/import/3d/resource_importer_scene.cpp | 2 | ||||
| -rw-r--r-- | editor/import/3d/resource_importer_scene.h | 24 | ||||
| -rw-r--r-- | editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 4 | ||||
| -rw-r--r-- | scene/3d/bone_attachment_3d.cpp | 11 |
10 files changed, 88 insertions, 29 deletions
diff --git a/doc/classes/AudioEffectSpectrumAnalyzer.xml b/doc/classes/AudioEffectSpectrumAnalyzer.xml index fbc0c2275f..b90f87ef5b 100644 --- a/doc/classes/AudioEffectSpectrumAnalyzer.xml +++ b/doc/classes/AudioEffectSpectrumAnalyzer.xml @@ -5,6 +5,7 @@ </brief_description> <description> This audio effect does not affect sound output, but can be used for real-time audio visualizations. + This resource configures an [AudioEffectSpectrumAnalyzerInstance], which performs the actual analysis at runtime. An instance can be acquired with [method AudioServer.get_bus_effect_instance]. See also [AudioStreamGenerator] for procedurally generating sounds. </description> <tutorials> diff --git a/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml b/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml index e8c6394073..184f80db2e 100644 --- a/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml +++ b/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml @@ -1,10 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectSpectrumAnalyzerInstance" inherits="AudioEffectInstance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Queryable instance of an [AudioEffectSpectrumAnalyzer]. </brief_description> <description> + The runtime part of an [AudioEffectSpectrumAnalyzer], which can be used to query the magnitude of a frequency range on its host bus. + An instance of this class can be acquired with [method AudioServer.get_bus_effect_instance]. </description> <tutorials> + <link title="Audio Spectrum Visualizer Demo">https://godotengine.org/asset-library/asset/2762</link> </tutorials> <methods> <method name="get_magnitude_for_frequency_range" qualifiers="const"> @@ -13,15 +17,17 @@ <param index="1" name="to_hz" type="float" /> <param index="2" name="mode" type="int" enum="AudioEffectSpectrumAnalyzerInstance.MagnitudeMode" default="1" /> <description> + Returns the magnitude of the frequencies from [param from_hz] to [param to_hz] in linear energy as a Vector2. The [code]x[/code] component of the return value represents the left stereo channel, and [code]y[/code] represents the right channel. + [param mode] determines how the frequency range will be processed. See [enum MagnitudeMode]. </description> </method> </methods> <constants> <constant name="MAGNITUDE_AVERAGE" value="0" enum="MagnitudeMode"> - Use the average value as magnitude. + Use the average value across the frequency range as magnitude. </constant> <constant name="MAGNITUDE_MAX" value="1" enum="MagnitudeMode"> - Use the maximum value as magnitude. + Use the maximum value of the frequency range as magnitude. </constant> </constants> </class> diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index ffd609d925..d192ce0356 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -682,6 +682,7 @@ void AnimationBezierTrackEdit::set_editor(AnimationTrackEditor *p_editor) { editor = p_editor; connect("clear_selection", callable_mp(editor, &AnimationTrackEditor::_clear_selection).bind(false)); connect("select_key", callable_mp(editor, &AnimationTrackEditor::_key_selected), CONNECT_DEFERRED); + connect("deselect_key", callable_mp(editor, &AnimationTrackEditor::_key_deselected), CONNECT_DEFERRED); } void AnimationBezierTrackEdit::_play_position_draw() { @@ -877,7 +878,7 @@ void AnimationBezierTrackEdit::_clear_selection_for_anim(const Ref<Animation> &p _clear_selection(); } -void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos) { +void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos, bool p_single) { if (!(animation == p_anim)) { return; } @@ -886,7 +887,7 @@ void AnimationBezierTrackEdit::_select_at_anim(const Ref<Animation> &p_anim, int ERR_FAIL_COND(idx < 0); selection.insert(IntPair(p_track, idx)); - emit_signal(SNAME("select_key"), idx, true, p_track); + emit_signal(SNAME("select_key"), idx, p_single, p_track); queue_redraw(); } @@ -1002,7 +1003,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { return; } else if (ED_IS_SHORTCUT("animation_bezier_editor/select_all_keys", p_event)) { for (int i = 0; i < edit_points.size(); ++i) { - selection.insert(IntPair(edit_points[i].track, edit_points[i].key)); + _select_at_anim(animation, edit_points[i].track, animation->track_get_key_time(edit_points[i].track, edit_points[i].key), i == 0); } queue_redraw(); @@ -1010,6 +1011,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { return; } else if (ED_IS_SHORTCUT("animation_bezier_editor/deselect_all_keys", p_event)) { selection.clear(); + emit_signal(SNAME("clear_selection")); queue_redraw(); accept_event(); @@ -1235,7 +1237,7 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { int index = animation->track_find_key(selected_track, time, Animation::FIND_MODE_APPROX); ERR_FAIL_COND(index == -1); _clear_selection(); - selection.insert(IntPair(selected_track, index)); + _select_at_anim(animation, selected_track, animation->track_get_key_time(selected_track, index), true); moving_selection_attempt = true; moving_selection = false; @@ -1277,13 +1279,15 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { Rect2 selection_rect(bs_from, bs_to - bs_from); bool track_set = false; + int j = 0; for (int i = 0; i < edit_points.size(); i++) { if (edit_points[i].point_rect.intersects(selection_rect)) { - selection.insert(IntPair(edit_points[i].track, edit_points[i].key)); + _select_at_anim(animation, edit_points[i].track, animation->track_get_key_time(edit_points[i].track, edit_points[i].key), j == 0 && !box_selecting_add); if (!track_set) { track_set = true; set_animation_and_track(animation, edit_points[i].track, read_only); } + j++; } } } else { @@ -1418,21 +1422,22 @@ void AnimationBezierTrackEdit::gui_input(const Ref<InputEvent> &p_event) { undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation); // 7-reselect - + int i = 0; for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { real_t oldpos = animation->track_get_key_time(E->get().first, E->get().second); real_t newpos = oldpos + moving_selection_offset.x; - undo_redo->add_do_method(this, "_select_at_anim", animation, E->get().first, newpos); - undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, oldpos); + undo_redo->add_do_method(this, "_select_at_anim", animation, E->get().first, newpos, i == 0); + undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, oldpos, i == 0); + i++; } undo_redo->commit_action(); } else if (select_single_attempt != IntPair(-1, -1)) { selection.clear(); - selection.insert(select_single_attempt); set_animation_and_track(animation, select_single_attempt.first, read_only); + _select_at_anim(animation, select_single_attempt.first, animation->track_get_key_time(select_single_attempt.first, select_single_attempt.second), true); } moving_selection = false; @@ -1567,9 +1572,10 @@ bool AnimationBezierTrackEdit::_try_select_at_ui_pos(const Point2 &p_pos, bool p if (selection.has(pair)) { if (p_deselectable) { selection.erase(pair); + emit_signal(SNAME("deselect_key"), edit_points[i].key, edit_points[i].track); } } else { - selection.insert(pair); + _select_at_anim(animation, edit_points[i].track, animation->track_get_key_time(edit_points[i].track, edit_points[i].key), false); } queue_redraw(); select_single_attempt = IntPair(-1, -1); @@ -1595,7 +1601,7 @@ bool AnimationBezierTrackEdit::_try_select_at_ui_pos(const Point2 &p_pos, bool p set_animation_and_track(animation, pair.first, read_only); if (!selection.has(pair)) { selection.clear(); - selection.insert(pair); + _select_at_anim(animation, edit_points[i].track, animation->track_get_key_time(edit_points[i].track, edit_points[i].key), true); } } return true; @@ -1763,12 +1769,16 @@ void AnimationBezierTrackEdit::duplicate_selected_keys(real_t p_ofs, bool p_ofs_ undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation); // Reselect duplicated. + int i = 0; for (const Pair<int, real_t> &E : new_selection_values) { - undo_redo->add_do_method(this, "_select_at_anim", animation, E.first, E.second); + undo_redo->add_do_method(this, "_select_at_anim", animation, E.first, E.second, i == 0); + i++; } + i = 0; for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { real_t time = animation->track_get_key_time(E->get().first, E->get().second); - undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, time); + undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, time, i == 0); + i++; } undo_redo->add_do_method(this, "queue_redraw"); @@ -1805,16 +1815,20 @@ void AnimationBezierTrackEdit::copy_selected_keys(bool p_cut) { undo_redo->create_action(TTR("Animation Cut Keys"), UndoRedo::MERGE_DISABLE, animation.ptr()); undo_redo->add_do_method(this, "_clear_selection_for_anim", animation); undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation); + int i = 0; for (RBMap<AnimationTrackEditor::SelectedKey, AnimationTrackEditor::KeyInfo>::Element *E = keys.back(); E; E = E->prev()) { int track_idx = E->key().track; int key_idx = E->key().key; float time = E->value().pos; undo_redo->add_do_method(animation.ptr(), "track_remove_key_at_time", track_idx, time); undo_redo->add_undo_method(animation.ptr(), "track_insert_key", track_idx, time, animation->track_get_key_value(track_idx, key_idx), animation->track_get_key_transition(track_idx, key_idx)); - undo_redo->add_undo_method(this, "_select_at_anim", animation, track_idx, time); + undo_redo->add_undo_method(this, "_select_at_anim", animation, track_idx, time, i == 0); + i++; } + i = 0; for (RBMap<AnimationTrackEditor::SelectedKey, AnimationTrackEditor::KeyInfo>::Element *E = keys.back(); E; E = E->prev()) { - undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, E->value().pos); + undo_redo->add_undo_method(this, "_select_at_anim", animation, E->key().track, E->value().pos, i == 0); + i++; } undo_redo->commit_action(); } @@ -1883,11 +1897,15 @@ void AnimationBezierTrackEdit::paste_keys(real_t p_ofs, bool p_ofs_valid) { undo_redo->add_undo_method(this, "_clear_selection_for_anim", animation); // Reselect pasted. + int i = 0; for (const Pair<int, float> &E : new_selection_values) { - undo_redo->add_do_method(this, "_select_at_anim", animation, E.first, E.second); + undo_redo->add_do_method(this, "_select_at_anim", animation, E.first, E.second, i == 0); + i++; } + i = 0; for (SelectionSet::Element *E = selection.back(); E; E = E->prev()) { - undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, animation->track_get_key_time(E->get().first, E->get().second)); + undo_redo->add_undo_method(this, "_select_at_anim", animation, E->get().first, animation->track_get_key_time(E->get().first, E->get().second), i == 0); + i++; } undo_redo->commit_action(); @@ -1928,6 +1946,7 @@ void AnimationBezierTrackEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("_bezier_track_insert_key"), &AnimationBezierTrackEdit::_bezier_track_insert_key); ADD_SIGNAL(MethodInfo("select_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::BOOL, "single"), PropertyInfo(Variant::INT, "track"))); + ADD_SIGNAL(MethodInfo("deselect_key", PropertyInfo(Variant::INT, "index"), PropertyInfo(Variant::INT, "track"))); ADD_SIGNAL(MethodInfo("clear_selection")); } diff --git a/editor/animation_bezier_editor.h b/editor/animation_bezier_editor.h index ab667421f3..888dad5341 100644 --- a/editor/animation_bezier_editor.h +++ b/editor/animation_bezier_editor.h @@ -144,7 +144,7 @@ class AnimationBezierTrackEdit : public Control { void _clear_selection(); void _clear_selection_for_anim(const Ref<Animation> &p_anim); - void _select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos); + void _select_at_anim(const Ref<Animation> &p_anim, int p_track, real_t p_pos, bool p_single); bool _try_select_at_ui_pos(const Point2 &p_pos, bool p_aggregate, bool p_deselectable); void _change_selected_keys_handle_mode(Animation::HandleMode p_mode, bool p_auto = false); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index b80a8d77f4..8628fd9e11 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -874,15 +874,15 @@ bool AnimationMultiTrackKeyEdit::_set(const StringName &p_name, const Variant &p undo_redo->create_action(TTR("Animation Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS); } Vector2 prev = animation->bezier_track_get_key_out_handle(track, key); - undo_redo->add_do_method(this, "_bezier_track_set_key_out_handle", track, key, value); - undo_redo->add_undo_method(this, "_bezier_track_set_key_out_handle", track, key, prev); + undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, value); + undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev); update_obj = true; } else if (name == "handle_mode") { const Variant &value = p_value; if (!setting) { setting = true; - undo_redo->create_action(TTR("Animation Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS); + undo_redo->create_action(TTR("Animation Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS, animation.ptr()); } int prev_mode = animation->bezier_track_get_key_handle_mode(track, key); Vector2 prev_in_handle = animation->bezier_track_get_key_in_handle(track, key); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 7e07e626b1..be0a09e09b 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -653,6 +653,7 @@ void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) { } if (base_text_editor) { + text_editor->set_search_text(String()); base_text_editor->remove_find_replace_bar(); base_text_editor = nullptr; text_editor->disconnect(SceneStringName(text_changed), callable_mp(this, &FindReplaceBar::_editor_text_changed)); @@ -670,8 +671,7 @@ void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) { text_editor = base_text_editor->get_text_editor(); text_editor->connect(SceneStringName(text_changed), callable_mp(this, &FindReplaceBar::_editor_text_changed)); - _update_results_count(); - _update_matches_display(); + _editor_text_changed(); } void FindReplaceBar::_bind_methods() { diff --git a/editor/import/3d/resource_importer_scene.cpp b/editor/import/3d/resource_importer_scene.cpp index 55a7208169..2db3fb1f07 100644 --- a/editor/import/3d/resource_importer_scene.cpp +++ b/editor/import/3d/resource_importer_scene.cpp @@ -1959,7 +1959,7 @@ void ResourceImporterScene::get_internal_import_options(InternalImportCategory p r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "generate/physics", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "generate/navmesh", PROPERTY_HINT_ENUM, "Disabled,Mesh + NavMesh,NavMesh Only"), 0)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "physics/body_type", PROPERTY_HINT_ENUM, "Static,Dynamic,Area"), 0)); - r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "physics/shape_type", PROPERTY_HINT_ENUM, "Decompose Convex,Simple Convex,Trimesh,Box,Sphere,Cylinder,Capsule", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 2)); + r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "physics/shape_type", PROPERTY_HINT_ENUM, "Decompose Convex,Simple Convex,Trimesh,Box,Sphere,Cylinder,Capsule,Automatic", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 7)); r_options->push_back(ImportOption(PropertyInfo(Variant::OBJECT, "physics/physics_material_override", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsMaterial"), Variant())); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "physics/layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), 1)); r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "physics/mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), 1)); diff --git a/editor/import/3d/resource_importer_scene.h b/editor/import/3d/resource_importer_scene.h index cd6a725231..f9124ad289 100644 --- a/editor/import/3d/resource_importer_scene.h +++ b/editor/import/3d/resource_importer_scene.h @@ -212,6 +212,7 @@ class ResourceImporterScene : public ResourceImporter { SHAPE_TYPE_SPHERE, SHAPE_TYPE_CYLINDER, SHAPE_TYPE_CAPSULE, + SHAPE_TYPE_AUTOMATIC, }; static Error _check_resource_save_paths(const Dictionary &p_data); @@ -324,11 +325,21 @@ public: template <typename M> Vector<Ref<Shape3D>> ResourceImporterScene::get_collision_shapes(const Ref<ImporterMesh> &p_mesh, const M &p_options, float p_applied_root_scale) { ERR_FAIL_COND_V(p_mesh.is_null(), Vector<Ref<Shape3D>>()); - ShapeType generate_shape_type = SHAPE_TYPE_TRIMESH; + + ShapeType generate_shape_type = SHAPE_TYPE_AUTOMATIC; if (p_options.has(SNAME("physics/shape_type"))) { generate_shape_type = (ShapeType)p_options[SNAME("physics/shape_type")].operator int(); } + if (generate_shape_type == SHAPE_TYPE_AUTOMATIC) { + BodyType body_type = BODY_TYPE_STATIC; + if (p_options.has(SNAME("physics/body_type"))) { + body_type = (BodyType)p_options[SNAME("physics/body_type")].operator int(); + } + + generate_shape_type = body_type == BODY_TYPE_DYNAMIC ? SHAPE_TYPE_DECOMPOSE_CONVEX : SHAPE_TYPE_TRIMESH; + } + if (generate_shape_type == SHAPE_TYPE_DECOMPOSE_CONVEX) { Ref<MeshConvexDecompositionSettings> decomposition_settings = Ref<MeshConvexDecompositionSettings>(); decomposition_settings.instantiate(); @@ -482,11 +493,20 @@ template <typename M> Transform3D ResourceImporterScene::get_collision_shapes_transform(const M &p_options) { Transform3D transform; - ShapeType generate_shape_type = SHAPE_TYPE_TRIMESH; + ShapeType generate_shape_type = SHAPE_TYPE_AUTOMATIC; if (p_options.has(SNAME("physics/shape_type"))) { generate_shape_type = (ShapeType)p_options[SNAME("physics/shape_type")].operator int(); } + if (generate_shape_type == SHAPE_TYPE_AUTOMATIC) { + BodyType body_type = BODY_TYPE_STATIC; + if (p_options.has(SNAME("physics/body_type"))) { + body_type = (BodyType)p_options[SNAME("physics/body_type")].operator int(); + } + + generate_shape_type = body_type == BODY_TYPE_DYNAMIC ? SHAPE_TYPE_DECOMPOSE_CONVEX : SHAPE_TYPE_TRIMESH; + } + if (generate_shape_type == SHAPE_TYPE_BOX || generate_shape_type == SHAPE_TYPE_SPHERE || generate_shape_type == SHAPE_TYPE_CYLINDER || diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 94e68ccc7c..0d26212cdb 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -651,7 +651,7 @@ void TileSetAtlasSourceEditor::_update_tile_data_editors() { tile_data_editors_tree->add_theme_constant_override("v_separation", 1); tile_data_editors_tree->add_theme_constant_override("h_separation", 3); - Color group_color = get_theme_color(SNAME("prop_category"), EditorStringName(Editor)); + Color group_color = get_theme_color(SNAME("separator_color"), EditorStringName(Editor)); // List of editors. // --- Rendering --- @@ -2451,6 +2451,8 @@ void TileSetAtlasSourceEditor::_notification(int p_what) { resize_handle = get_editor_theme_icon(SNAME("EditorHandle")); resize_handle_disabled = get_editor_theme_icon(SNAME("EditorHandleDisabled")); + + tile_data_editors_tree->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SceneStringName(panel), "PopupPanel")); } break; case NOTIFICATION_INTERNAL_PROCESS: { diff --git a/scene/3d/bone_attachment_3d.cpp b/scene/3d/bone_attachment_3d.cpp index 6aade24e4e..4889512037 100644 --- a/scene/3d/bone_attachment_3d.cpp +++ b/scene/3d/bone_attachment_3d.cpp @@ -239,9 +239,20 @@ int BoneAttachment3D::get_bone_idx() const { } void BoneAttachment3D::set_override_pose(bool p_override) { + if (override_pose == p_override) { + return; + } + override_pose = p_override; set_notify_transform(override_pose); set_process_internal(override_pose); + if (!override_pose && bone_idx >= 0) { + Skeleton3D *sk = _get_skeleton3d(); + if (sk) { + sk->reset_bone_pose(bone_idx); + } + } + notify_property_list_changed(); } |
