Browse Source

Allow name-based child attribute animation also on UIElement.

Lasse Öörni 8 years ago
parent
commit
f1513fcaae
1 changed files with 12 additions and 2 deletions
  1. 12 2
      Source/Urho3D/UI/UIElement.cpp

+ 12 - 2
Source/Urho3D/UI/UIElement.cpp

@@ -1931,8 +1931,18 @@ Animatable* UIElement::FindAttributeAnimationTarget(const String& name, String&
                 return 0;
             }
 
-            unsigned index = (unsigned)ToInt(names[i].Substring(1, names[i].Length() - 1));
-            element = element->GetChild(index);
+            String name = names[i].Substring(1, names[i].Length() - 1);
+            char s = name.Front();
+            if (s >= '0' && s <= '9')
+            {
+                unsigned index = ToUInt(name);
+                element = element->GetChild(index);
+            }
+            else
+            {
+                element = element->GetChild(name, true);
+            }
+
             if (!element)
             {
                 URHO3D_LOGERROR("Could not find element by name " + name);