Fix setting bezier track handle mode from inspector.
(cherry picked from commit 09a4aa3ce8
)
This commit is contained in:
parent
1f677eb279
commit
49031b24e5
|
@ -306,10 +306,14 @@ bool AnimationTrackKeyEdit::_set(const StringName &p_name, const Variant &p_valu
|
|||
|
||||
setting = true;
|
||||
undo_redo->create_action(TTR("Animation Change Keyframe Value"), UndoRedo::MERGE_ENDS);
|
||||
int prev = animation->bezier_track_get_key_handle_mode(track, key);
|
||||
undo_redo->add_do_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
|
||||
undo_redo->add_undo_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev);
|
||||
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);
|
||||
Vector2 prev_out_handle = animation->bezier_track_get_key_out_handle(track, key);
|
||||
undo_redo->add_do_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
|
||||
undo_redo->add_do_method(this, "_update_obj", animation);
|
||||
undo_redo->add_undo_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev_mode);
|
||||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev_in_handle);
|
||||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev_out_handle);
|
||||
undo_redo->add_undo_method(this, "_update_obj", animation);
|
||||
undo_redo->commit_action();
|
||||
|
||||
|
@ -857,8 +861,8 @@ 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_in_handle(track, key);
|
||||
undo_redo->add_do_method(this, "_bezier_track_set_key_in_handle", track, key, value);
|
||||
undo_redo->add_undo_method(this, "_bezier_track_set_key_in_handle", track, key, prev);
|
||||
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, value);
|
||||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev);
|
||||
update_obj = true;
|
||||
} else if (name == "out_handle") {
|
||||
const Variant &value = p_value;
|
||||
|
@ -878,9 +882,13 @@ bool AnimationMultiTrackKeyEdit::_set(const StringName &p_name, const Variant &p
|
|||
setting = true;
|
||||
undo_redo->create_action(TTR("Animation Multi Change Keyframe Value"), UndoRedo::MERGE_ENDS);
|
||||
}
|
||||
int prev = animation->bezier_track_get_key_handle_mode(track, key);
|
||||
undo_redo->add_do_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
|
||||
undo_redo->add_undo_method(this, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev);
|
||||
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);
|
||||
Vector2 prev_out_handle = animation->bezier_track_get_key_out_handle(track, key);
|
||||
undo_redo->add_do_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, value);
|
||||
undo_redo->add_undo_method(editor, "_bezier_track_set_key_handle_mode", animation.ptr(), track, key, prev_mode);
|
||||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_in_handle", track, key, prev_in_handle);
|
||||
undo_redo->add_undo_method(animation.ptr(), "bezier_track_set_key_out_handle", track, key, prev_out_handle);
|
||||
update_obj = true;
|
||||
}
|
||||
} break;
|
||||
|
@ -5175,6 +5183,7 @@ void AnimationTrackEditor::_update_key_edit() {
|
|||
key_edit->animation_read_only = read_only;
|
||||
key_edit->track = selection.front()->key().track;
|
||||
key_edit->use_fps = timeline->is_using_fps();
|
||||
key_edit->editor = this;
|
||||
|
||||
int key_id = selection.front()->key().key;
|
||||
if (key_id >= animation->track_get_key_count(key_edit->track)) {
|
||||
|
@ -5194,6 +5203,7 @@ void AnimationTrackEditor::_update_key_edit() {
|
|||
multi_key_edit = memnew(AnimationMultiTrackKeyEdit);
|
||||
multi_key_edit->animation = animation;
|
||||
multi_key_edit->animation_read_only = read_only;
|
||||
multi_key_edit->editor = this;
|
||||
|
||||
RBMap<int, List<float>> key_ofs_map;
|
||||
RBMap<int, NodePath> base_map;
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
PropertyInfo hint;
|
||||
NodePath base;
|
||||
bool use_fps = false;
|
||||
AnimationTrackEditor *editor = nullptr;
|
||||
|
||||
bool _hide_script_from_inspector() { return true; }
|
||||
bool _hide_metadata_from_inspector() { return true; }
|
||||
|
@ -105,6 +106,7 @@ public:
|
|||
Node *root_path = nullptr;
|
||||
|
||||
bool use_fps = false;
|
||||
AnimationTrackEditor *editor = nullptr;
|
||||
|
||||
bool _hide_script_from_inspector() { return true; }
|
||||
bool _hide_metadata_from_inspector() { return true; }
|
||||
|
|
Loading…
Reference in New Issue