|
@@ -49,13 +49,13 @@ Error AnimationLibrary::add_animation(const StringName &p_name, const Ref<Animat
|
|
|
ERR_FAIL_COND_V(p_animation.is_null(), ERR_INVALID_PARAMETER);
|
|
ERR_FAIL_COND_V(p_animation.is_null(), ERR_INVALID_PARAMETER);
|
|
|
|
|
|
|
|
if (animations.has(p_name)) {
|
|
if (animations.has(p_name)) {
|
|
|
- animations.get(p_name)->disconnect_changed(callable_mp(this, &AnimationLibrary::_animation_changed));
|
|
|
|
|
|
|
+ animations[p_name]->disconnect_changed(callable_mp(this, &AnimationLibrary::_animation_changed));
|
|
|
animations.erase(p_name);
|
|
animations.erase(p_name);
|
|
|
emit_signal(SNAME("animation_removed"), p_name);
|
|
emit_signal(SNAME("animation_removed"), p_name);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
animations.insert(p_name, p_animation);
|
|
animations.insert(p_name, p_animation);
|
|
|
- animations.get(p_name)->connect_changed(callable_mp(this, &AnimationLibrary::_animation_changed).bind(p_name));
|
|
|
|
|
|
|
+ animations[p_name]->connect_changed(callable_mp(this, &AnimationLibrary::_animation_changed).bind(p_name));
|
|
|
emit_signal(SNAME("animation_added"), p_name);
|
|
emit_signal(SNAME("animation_added"), p_name);
|
|
|
notify_property_list_changed();
|
|
notify_property_list_changed();
|
|
|
return OK;
|
|
return OK;
|
|
@@ -64,7 +64,7 @@ Error AnimationLibrary::add_animation(const StringName &p_name, const Ref<Animat
|
|
|
void AnimationLibrary::remove_animation(const StringName &p_name) {
|
|
void AnimationLibrary::remove_animation(const StringName &p_name) {
|
|
|
ERR_FAIL_COND_MSG(!animations.has(p_name), vformat("Animation not found: %s.", p_name));
|
|
ERR_FAIL_COND_MSG(!animations.has(p_name), vformat("Animation not found: %s.", p_name));
|
|
|
|
|
|
|
|
- animations.get(p_name)->disconnect_changed(callable_mp(this, &AnimationLibrary::_animation_changed));
|
|
|
|
|
|
|
+ animations[p_name]->disconnect_changed(callable_mp(this, &AnimationLibrary::_animation_changed));
|
|
|
animations.erase(p_name);
|
|
animations.erase(p_name);
|
|
|
emit_signal(SNAME("animation_removed"), p_name);
|
|
emit_signal(SNAME("animation_removed"), p_name);
|
|
|
notify_property_list_changed();
|
|
notify_property_list_changed();
|
|
@@ -75,8 +75,8 @@ void AnimationLibrary::rename_animation(const StringName &p_name, const StringNa
|
|
|
ERR_FAIL_COND_MSG(!is_valid_animation_name(p_new_name), "Invalid animation name: '" + String(p_new_name) + "'.");
|
|
ERR_FAIL_COND_MSG(!is_valid_animation_name(p_new_name), "Invalid animation name: '" + String(p_new_name) + "'.");
|
|
|
ERR_FAIL_COND_MSG(animations.has(p_new_name), vformat("Animation name \"%s\" already exists in library.", p_new_name));
|
|
ERR_FAIL_COND_MSG(animations.has(p_new_name), vformat("Animation name \"%s\" already exists in library.", p_new_name));
|
|
|
|
|
|
|
|
- animations.get(p_name)->disconnect_changed(callable_mp(this, &AnimationLibrary::_animation_changed));
|
|
|
|
|
- animations.get(p_name)->connect_changed(callable_mp(this, &AnimationLibrary::_animation_changed).bind(p_new_name));
|
|
|
|
|
|
|
+ animations[p_name]->disconnect_changed(callable_mp(this, &AnimationLibrary::_animation_changed));
|
|
|
|
|
+ animations[p_name]->connect_changed(callable_mp(this, &AnimationLibrary::_animation_changed).bind(p_new_name));
|
|
|
animations.insert(p_new_name, animations[p_name]);
|
|
animations.insert(p_new_name, animations[p_name]);
|
|
|
animations.erase(p_name);
|
|
animations.erase(p_name);
|
|
|
emit_signal(SNAME("animation_renamed"), p_name, p_new_name);
|
|
emit_signal(SNAME("animation_renamed"), p_name, p_new_name);
|