X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=base%2Fdali-toolkit%2Finternal%2Fbuilder%2Fbuilder-animations.cpp;h=72911b89628c693b214b0f534e38804e81975e9b;hp=9f8bc476801d1b04e8b3b3e500e40bcf57be412d;hb=84a2ec0cd7f851b6d8e5c1faf267907dbf05b1bb;hpb=d5e3ed5f5b1c8fdba3ae97ead8729620f54b3836 diff --git a/base/dali-toolkit/internal/builder/builder-animations.cpp b/base/dali-toolkit/internal/builder/builder-animations.cpp index 9f8bc47..72911b8 100644 --- a/base/dali-toolkit/internal/builder/builder-animations.cpp +++ b/base/dali-toolkit/internal/builder/builder-animations.cpp @@ -109,20 +109,34 @@ AlphaFunction GetAlphaFunction( const std::string& alphaFunction ) if( 0 == alphaFunctionLut.size() ) { // coding convention is uppercase enums - alphaFunctionLut["DEFAULT"] = Dali::AlphaFunctions::Default; - alphaFunctionLut["LINEAR"] = Dali::AlphaFunctions::Linear; - alphaFunctionLut["REVERSE"] = Dali::AlphaFunctions::Reverse; - alphaFunctionLut["EASE_IN"] = Dali::AlphaFunctions::EaseIn; - alphaFunctionLut["EASE_OUT"] = Dali::AlphaFunctions::EaseOut; - alphaFunctionLut["EASE_IN_OUT"] = Dali::AlphaFunctions::EaseInOut; - alphaFunctionLut["EASE_IN_SINE"] = Dali::AlphaFunctions::EaseInSine; - alphaFunctionLut["EASE_OUT_SINE"] = Dali::AlphaFunctions::EaseOutSine; - alphaFunctionLut["EASE_IN_OUT_SINE"]= Dali::AlphaFunctions::EaseInOutSine; - alphaFunctionLut["BOUNCE"] = Dali::AlphaFunctions::Bounce; - alphaFunctionLut["BOUNCE_BACK"] = Dali::AlphaFunctions::BounceBack; - alphaFunctionLut["EASE_OUT_BACK"] = Dali::AlphaFunctions::EaseOutBack; - alphaFunctionLut["SIN"] = Dali::AlphaFunctions::Sin; - alphaFunctionLut["SIN2X"] = Dali::AlphaFunctions::Sin; + alphaFunctionLut["DEFAULT"] = AlphaFunctions::Default; + alphaFunctionLut["LINEAR"] = AlphaFunctions::Linear; + alphaFunctionLut["SQUARE"] = AlphaFunctions::Square; + alphaFunctionLut["REVERSE"] = AlphaFunctions::Reverse; + alphaFunctionLut["EASE_IN"] = AlphaFunctions::EaseIn; + alphaFunctionLut["EASE_OUT"] = AlphaFunctions::EaseOut; + alphaFunctionLut["EASE_IN_OUT"] = AlphaFunctions::EaseInOut; + alphaFunctionLut["EASE_IN_SINE"] = AlphaFunctions::EaseInSine; + alphaFunctionLut["EASE_OUT_SINE"] = AlphaFunctions::EaseOutSine; + alphaFunctionLut["EASE_IN_OUT_SINE"] = AlphaFunctions::EaseInOutSine; + alphaFunctionLut["EASE_IN_SINE_33"] = AlphaFunctions::EaseInSine33; + alphaFunctionLut["EASE_OUT_SINE_33"] = AlphaFunctions::EaseOutSine33; + alphaFunctionLut["EASE_IN_OUT_SINE_33"] = AlphaFunctions::EaseInOutSine33; + alphaFunctionLut["EASE_IN_OUT_SINE_50"] = AlphaFunctions::EaseInOutSine50; + alphaFunctionLut["EASE_IN_OUT_SINE_60"] = AlphaFunctions::EaseInOutSine60; + alphaFunctionLut["EASE_IN_OUT_SINE_70"] = AlphaFunctions::EaseInOutSine70; + alphaFunctionLut["EASE_IN_OUT_SINE_80"] = AlphaFunctions::EaseInOutSine80; + alphaFunctionLut["EASE_IN_OUT_SINE_90"] = AlphaFunctions::EaseInOutSine90; + alphaFunctionLut["DOUBLE_EASE_IN_OUT_SINE_60"] = AlphaFunctions::DoubleEaseInOutSine60; + alphaFunctionLut["EASE_OUT_QUINT_50"] = AlphaFunctions::EaseOutQuint50; + alphaFunctionLut["EASE_OUT_QUINT_80"] = AlphaFunctions::EaseOutQuint80; + alphaFunctionLut["BOUNCE"] = AlphaFunctions::Bounce; + alphaFunctionLut["BOUNCE_BACK"] = AlphaFunctions::BounceBack; + alphaFunctionLut["EASE_IN_BACK"] = AlphaFunctions::EaseInBack; + alphaFunctionLut["EASE_OUT_BACK"] = AlphaFunctions::EaseOutBack; + alphaFunctionLut["EASE_IN_OUT_BACK"] = AlphaFunctions::EaseInOutBack; + alphaFunctionLut["SIN"] = AlphaFunctions::Sin; + alphaFunctionLut["SIN2X"] = AlphaFunctions::Sin2x; } const AlphaFunctionLut::const_iterator iter( alphaFunctionLut.find( alphaFunction ) ); @@ -216,27 +230,33 @@ Animation CreateAnimation( const TreeNode& child, const Replacement& constant, D DALI_ASSERT_ALWAYS( actorName && "Animation must specify actor name" ); DALI_ASSERT_ALWAYS( property && "Animation must specify a property name" ); - Actor targetActor = searchActor.FindChildByName( *actorName ); - DALI_ASSERT_ALWAYS( targetActor && "Actor must exist for property" ); + Handle targetHandle = searchActor.FindChildByName( *actorName ); + DALI_ASSERT_ALWAYS( targetHandle && "Actor must exist for property" ); - Property::Index idx( targetActor.GetPropertyIndex( *property ) ); + Property::Index idx( targetHandle.GetPropertyIndex( *property ) ); - // A limitation here is that its possible that between binding to the signal and - // the signal call that the ShaderEffect of the targetActor has been changed. - // However this is a unlikely use case especially when using scripts. + // if the property is not found from the (actor) handle, try to downcast it to renderable actor + // to allow animating shader uniforms if( idx == Property::INVALID_INDEX ) { - if( ShaderEffect effect = targetActor.GetShaderEffect() ) + RenderableActor renderable = RenderableActor::DownCast( targetHandle ); + if( renderable ) { - idx = effect.GetPropertyIndex( *property ); - if(idx != Property::INVALID_INDEX) + // A limitation here is that its possible that between creation of animation + // and running it the ShaderEffect of the actor has been changed. + // However this is a unlikely use case especially when using scripts. + if( ShaderEffect effect = renderable.GetShaderEffect() ) { - targetActor = effect; - } - else - { - DALI_SCRIPT_WARNING( "Cannot find property on object or ShaderEffect\n" ); - continue; + idx = effect.GetPropertyIndex( *property ); + if(idx != Property::INVALID_INDEX) + { + targetHandle = effect; + } + else + { + DALI_SCRIPT_WARNING( "Cannot find property on object or ShaderEffect\n" ); + continue; + } } } else @@ -252,7 +272,7 @@ Animation CreateAnimation( const TreeNode& child, const Replacement& constant, D continue; } - Property prop( Property( targetActor, idx ) ); + Property prop( Property( targetHandle, idx ) ); Property::Value propValue; // these are the defaults