From 3f11de583ac51192f62df16e5125b28519ab3242 Mon Sep 17 00:00:00 2001 From: Lee Morgan Date: Wed, 30 Apr 2014 15:07:38 +0100 Subject: [PATCH] Scripting: added setting shader property [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 --- dali-toolkit/internal/builder/builder-impl.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/dali-toolkit/internal/builder/builder-impl.cpp b/dali-toolkit/internal/builder/builder-impl.cpp index 226883e..d16c64f 100644 --- a/dali-toolkit/internal/builder/builder-impl.cpp +++ b/dali-toolkit/internal/builder/builder-impl.cpp @@ -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 -- 2.7.4