@@ -69,10 +69,7 @@ bool AnimationMixer::_set(const StringName &p_name, const Variant &p_value) {
6969 al = get_animation_library (StringName ());
7070 }
7171 al->add_animation (which, anim);
72- } else if (name.begins_with (" libraries" )) {
73- #else
74- if (name.begins_with (" libraries" )) {
75- #endif // DISABLE_DEPRECATED
72+ } else if (name == " libraries" ) {
7673 Dictionary d = p_value;
7774 while (animation_libraries.size ()) {
7875 remove_animation_library (animation_libraries[0 ].name );
@@ -82,23 +79,42 @@ bool AnimationMixer::_set(const StringName &p_name, const Variant &p_value) {
8279 add_animation_library (kv.key , lib);
8380 }
8481 emit_signal (SNAME (" animation_libraries_updated" ));
85-
82+ } else if (name.begins_with (" libraries/" )) {
83+ String which = name.get_slicec (' /' , 1 );
84+ if (has_animation_library (which)) {
85+ remove_animation_library (which);
86+ }
87+ add_animation_library (which, p_value);
88+ emit_signal (SNAME (" animation_libraries_updated" ));
89+ } else {
90+ return false ;
91+ }
92+ #else
93+ if (name.begins_with (" libraries/" )) {
94+ String which = name.get_slicec (' /' , 1 );
95+ if (has_animation_library (which)) {
96+ remove_animation_library (which);
97+ }
98+ add_animation_library (which, p_value);
99+ emit_signal (SNAME (" animation_libraries_updated" ));
86100 } else {
87101 return false ;
88102 }
103+ #endif // DISABLE_DEPRECATED
89104
90105 return true ;
91106}
92107
93108bool AnimationMixer::_get (const StringName &p_name, Variant &r_ret) const {
94109 String name = p_name;
95110
96- if (name.begins_with (" libraries" )) {
97- Dictionary d;
98- for (const AnimationLibraryData &lib : animation_libraries) {
99- d[lib.name ] = lib.library ;
111+ if (name.begins_with (" libraries/" )) {
112+ String which = name.get_slicec (' /' , 1 );
113+ if (has_animation_library (which)) {
114+ r_ret = get_animation_library (which);
115+ } else {
116+ return false ;
100117 }
101- r_ret = d;
102118 } else {
103119 return false ;
104120 }
@@ -111,7 +127,10 @@ uint32_t AnimationMixer::_get_libraries_property_usage() const {
111127}
112128
113129void AnimationMixer::_get_property_list (List<PropertyInfo> *p_list) const {
114- p_list->push_back (PropertyInfo (Variant::DICTIONARY, PNAME (" libraries" ), PROPERTY_HINT_DICTIONARY_TYPE, " StringName;AnimationLibrary" , _get_libraries_property_usage ()));
130+ for (uint32_t i = 0 ; i < animation_libraries.size (); i++) {
131+ const String path = vformat (" libraries/%s" , animation_libraries[i].name );
132+ p_list->push_back (PropertyInfo (Variant::OBJECT, path, PROPERTY_HINT_RESOURCE_TYPE, " AnimationLibrary" , _get_libraries_property_usage ()));
133+ }
115134}
116135
117136void AnimationMixer::_validate_property (PropertyInfo &p_property) const {
0 commit comments