|
43 | 43 | #include "editor/inspector_dock.h" |
44 | 44 | #include "editor/plugins/animation_player_editor_plugin.h" |
45 | 45 | #include "editor/themes/editor_scale.h" |
| 46 | +#include "scene/3d/mesh_instance_3d.h" |
46 | 47 | #include "scene/animation/animation_player.h" |
47 | 48 | #include "scene/animation/tween.h" |
48 | 49 | #include "scene/gui/check_box.h" |
@@ -5120,16 +5121,7 @@ void AnimationTrackEditor::_new_track_property_selected(const String &p_name) { |
5120 | 5121 | Animation::InterpolationType interp_type = Animation::INTERPOLATION_LINEAR; |
5121 | 5122 | bool loop_wrap = true; |
5122 | 5123 | _fetch_value_track_options(full_path, &update_mode, &interp_type, &loop_wrap); |
5123 | | - if (adding_track_type == Animation::TYPE_VALUE) { |
5124 | | - undo_redo->create_action(TTR("Add Track")); |
5125 | | - undo_redo->add_do_method(animation.ptr(), "add_track", adding_track_type); |
5126 | | - undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), full_path); |
5127 | | - undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_type", animation->get_track_count(), interp_type); |
5128 | | - undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_loop_wrap", animation->get_track_count(), loop_wrap); |
5129 | | - undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", animation->get_track_count(), update_mode); |
5130 | | - undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count()); |
5131 | | - undo_redo->commit_action(); |
5132 | | - } else { |
| 5124 | + if (adding_track_type == Animation::TYPE_BEZIER) { |
5133 | 5125 | Vector<String> subindices; |
5134 | 5126 | { |
5135 | 5127 | // Hack. |
@@ -5157,6 +5149,24 @@ void AnimationTrackEditor::_new_track_property_selected(const String &p_name) { |
5157 | 5149 | undo_redo->add_undo_method(animation.ptr(), "remove_track", base_track); |
5158 | 5150 | } |
5159 | 5151 | undo_redo->commit_action(); |
| 5152 | + } else { |
| 5153 | + bool is_blend_shape = adding_track_type == Animation::TYPE_BLEND_SHAPE; |
| 5154 | + if (is_blend_shape) { |
| 5155 | + PackedStringArray split = p_name.split("/"); |
| 5156 | + if (!split.is_empty()) { |
| 5157 | + full_path = String(adding_track_path) + ":" + split[split.size() - 1]; |
| 5158 | + } |
| 5159 | + } |
| 5160 | + undo_redo->create_action(TTR("Add Track")); |
| 5161 | + undo_redo->add_do_method(animation.ptr(), "add_track", adding_track_type); |
| 5162 | + undo_redo->add_do_method(animation.ptr(), "track_set_path", animation->get_track_count(), full_path); |
| 5163 | + undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_type", animation->get_track_count(), interp_type); |
| 5164 | + undo_redo->add_do_method(animation.ptr(), "track_set_interpolation_loop_wrap", animation->get_track_count(), loop_wrap); |
| 5165 | + if (!is_blend_shape) { |
| 5166 | + undo_redo->add_do_method(animation.ptr(), "value_track_set_update_mode", animation->get_track_count(), update_mode); |
| 5167 | + } |
| 5168 | + undo_redo->add_undo_method(animation.ptr(), "remove_track", animation->get_track_count()); |
| 5169 | + undo_redo->commit_action(); |
5160 | 5170 | } |
5161 | 5171 | } |
5162 | 5172 |
|
@@ -5249,7 +5259,16 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) { |
5249 | 5259 |
|
5250 | 5260 | id.value = base->get_scale(); |
5251 | 5261 | } break; |
5252 | | - case Animation::TYPE_BLEND_SHAPE: |
| 5262 | + case Animation::TYPE_BLEND_SHAPE: { |
| 5263 | + MeshInstance3D *base = Object::cast_to<MeshInstance3D>(node); |
| 5264 | + |
| 5265 | + if (!base) { |
| 5266 | + EditorNode::get_singleton()->show_warning(TTR("Track is not of type MeshInstance3D, can't insert key")); |
| 5267 | + return; |
| 5268 | + } |
| 5269 | + |
| 5270 | + id.value = base->get_blend_shape_value(base->find_blend_shape_by_name(id.path.get_subname(0))); |
| 5271 | + } break; |
5253 | 5272 | case Animation::TYPE_VALUE: { |
5254 | 5273 | NodePath bp; |
5255 | 5274 | _find_hint_for_track(p_track, bp, &id.value); |
|
0 commit comments