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=b3a4bb462dac9245fb39bf3c5339978af8e1d042;hp=454a686eadb01171dadcde82e1c201f98c0c99a6;hb=865bc7d9efba2ba1ddc5e365ce99fa94ae3e9187;hpb=022b76df6f53c2860f2684ef1ffee81af1805e2e diff --git a/base/dali-toolkit/internal/builder/builder-animations.cpp b/base/dali-toolkit/internal/builder/builder-animations.cpp index 454a686..b3a4bb4 100644 --- a/base/dali-toolkit/internal/builder/builder-animations.cpp +++ b/base/dali-toolkit/internal/builder/builder-animations.cpp @@ -1,18 +1,19 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // EXTERNAL INCLUDES #include @@ -215,27 +216,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 @@ -251,7 +258,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