summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-12-20 10:31:59 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-12-20 10:31:59 +0100
commit281f548dc24f39b21b5c430934e3c4cafddccd1b (patch)
tree20830ecc67ece511f3a7e5cf5b193f79bf4b08c9
parent6eb12fcfa522665cb789d0e148a8c5a05bc62a9b (diff)
parentaa133b60a124643ffd6c2a6fc7da974180d8bc4c (diff)
Merge pull request #70170 from TokageItLab/fix-anim-keying-crash
Make keys deselected when keying property for animation to avoid crash
-rw-r--r--editor/plugins/animation_player_editor_plugin.cpp6
-rw-r--r--editor/plugins/skeleton_3d_editor_plugin.cpp3
2 files changed, 6 insertions, 3 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp
index 5183a738ae..de16400ec9 100644
--- a/editor/plugins/animation_player_editor_plugin.cpp
+++ b/editor/plugins/animation_player_editor_plugin.cpp
@@ -1922,10 +1922,12 @@ void AnimationPlayerEditorPlugin::_notification(int p_what) {
}
void AnimationPlayerEditorPlugin::_property_keyed(const String &p_keyed, const Variant &p_value, bool p_advance) {
- if (!anim_editor->get_track_editor()->has_keying()) {
+ AnimationTrackEditor *te = anim_editor->get_track_editor();
+ if (!te || !te->has_keying()) {
return;
}
- anim_editor->get_track_editor()->insert_value_key(p_keyed, p_value, p_advance);
+ te->_clear_selection();
+ te->insert_value_key(p_keyed, p_value, p_advance);
}
void AnimationPlayerEditorPlugin::_transform_key_request(Object *sp, const String &p_sub, const Transform3D &p_key) {
diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp
index f79a001efb..d2dadd884b 100644
--- a/editor/plugins/skeleton_3d_editor_plugin.cpp
+++ b/editor/plugins/skeleton_3d_editor_plugin.cpp
@@ -153,9 +153,10 @@ void BoneTransformEditor::set_target(const String &p_prop) {
void BoneTransformEditor::_property_keyed(const String &p_path, bool p_advance) {
AnimationTrackEditor *te = AnimationPlayerEditor::get_singleton()->get_track_editor();
- if (!te->has_keying()) {
+ if (!te || !te->has_keying()) {
return;
}
+ te->_clear_selection();
PackedStringArray split = p_path.split("/");
if (split.size() == 3 && split[0] == "bones") {
int bone_idx = split[1].to_int();