Scripting: added setting shader property 15/20315/1
authorLee Morgan <Lee.morgan@partner.samsung.com>
Wed, 30 Apr 2014 14:07:38 +0000 (15:07 +0100)
committerDavid Steele <david.steele@partner.samsung.com>
Thu, 1 May 2014 15:01:35 +0000 (16:01 +0100)
[Issue#] (N/A)

[Problem] Animation checks effect if property set fails on an object.

[Cause] N/A

[Solution] Make Builder ApplyStyle() do the same.

Change-Id: I152f57fb09cb3e2c8a6e60a9ca014f9bc09cd025
Signed-off-by: Lee Morgan <Lee.morgan@partner.samsung.com>
dali-toolkit/internal/builder/builder-impl.cpp

index 226883e..d16c64f 100644 (file)
@@ -267,11 +267,29 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
         continue;
       }
 
-      Property::Index index = handle.GetPropertyIndex(key);
+      Handle propertyObject( handle );
+
+      Property::Index index = propertyObject.GetPropertyIndex( key );
+
+      if( Property::INVALID_INDEX == index )
+      {
+        Actor actor = Actor::DownCast(propertyObject);
+        if( actor )
+        {
+          if( ShaderEffect effect = actor.GetShaderEffect() )
+          {
+            index = effect.GetPropertyIndex( key );
+            if(index != Property::INVALID_INDEX)
+            {
+              propertyObject = effect;
+            }
+          }
+        }
+      }
 
       if( Property::INVALID_INDEX != index )
       {
-        Property::Type type = handle.GetPropertyType(index);
+        Property::Type type = propertyObject.GetPropertyType(index);
 
         Property::Value value;
         if( !SetPropertyFromNode( keyChild.second, type, value, constant ) )
@@ -284,7 +302,7 @@ void Builder::SetProperties( const TreeNode& node, Handle& handle, const Replace
         {
           DALI_SCRIPT_VERBOSE("SetProperty '%s' Index=:%d Value Type=%d Value '%s'\n", key.c_str(), index, value.GetType(), PropertyValueToString(value).c_str() );
 
-          handle.SetProperty( index, value );
+          propertyObject.SetProperty( index, value );
         }
       }
       else