1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-01 16:38:31 +00:00

-Fixes to undo redo to avoid crash, closes #24251

-Changed Animation to have a special signal when tracks are changed, to avoid unnecesary track cache rebuilds in AnimationPlayer
-Added missing emit_changed whe modifying keys to Animation
-Changed AnimationPlayer to use the new refcounted connections instead of the previous hacky way to keep references
-Changed AnimationEditor to update the current track when keys are edited
-Fixed bug where undo/redo did not work with AnimationKeyEdit (was not being updated)
-Made sure UndoRedo does not mind deleted objects in undo/redo history, this would corrupt the history or clear it without need.
This commit is contained in:
Juan Linietsky
2019-02-14 10:19:03 -03:00
parent 6b184e4d3b
commit 4a24ba6e77
12 changed files with 68 additions and 30 deletions

View File

@@ -991,25 +991,12 @@ void AnimationPlayer::remove_animation(const StringName &p_name) {
void AnimationPlayer::_ref_anim(const Ref<Animation> &p_anim) {
if (used_anims.has(p_anim))
used_anims[p_anim]++;
else {
used_anims[p_anim] = 1;
Ref<Animation>(p_anim)->connect("changed", this, "_animation_changed");
}
Ref<Animation>(p_anim)->connect(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed", varray(), CONNECT_REFERENCE_COUNTED);
}
void AnimationPlayer::_unref_anim(const Ref<Animation> &p_anim) {
ERR_FAIL_COND(!used_anims.has(p_anim));
int &n = used_anims[p_anim];
n--;
if (n == 0) {
Ref<Animation>(p_anim)->disconnect("changed", this, "_animation_changed");
used_anims.erase(p_anim);
}
Ref<Animation>(p_anim)->disconnect(SceneStringNames::get_singleton()->tracks_changed, this, "_animation_changed");
}
void AnimationPlayer::rename_animation(const StringName &p_name, const StringName &p_new_name) {