Internal::Actor Refactoring
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-property-handler.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/event/actors/actor-property-handler.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/math/vector2.h>
23 #include <dali/public-api/math/vector3.h>
24 #include <dali/devel-api/actors/actor-devel.h>
25 #include <dali/internal/event/actors/actor-impl.h>
26 #include <dali/internal/event/common/property-helper.h>
27 #include <dali/internal/update/nodes/node-messages.h>
28 #include <dali/internal/update/nodes/node-declarations.h>
29
30 using Dali::Internal::SceneGraph::Node;
31 using Dali::Internal::SceneGraph::AnimatableProperty;
32 using Dali::Internal::SceneGraph::PropertyBase;
33
34 namespace Dali
35 {
36
37 namespace Internal
38 {
39
40 namespace // unnamed namespace
41 {
42
43 struct AnchorValue
44 {
45   const char* name;
46   const Vector3& value;
47 };
48
49 DALI_ENUM_TO_STRING_TABLE_BEGIN_WITH_TYPE( AnchorValue, ANCHOR_CONSTANT )
50 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_LEFT )
51 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_CENTER )
52 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, TOP_RIGHT )
53 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER_LEFT )
54 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER )
55 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, CENTER_RIGHT )
56 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_LEFT )
57 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_CENTER )
58 DALI_ENUM_TO_STRING_WITH_SCOPE( AnchorPoint, BOTTOM_RIGHT )
59 DALI_ENUM_TO_STRING_TABLE_END( ANCHOR_CONSTANT )
60
61 DALI_ENUM_TO_STRING_TABLE_BEGIN( COLOR_MODE )
62 DALI_ENUM_TO_STRING( USE_OWN_COLOR )
63 DALI_ENUM_TO_STRING( USE_PARENT_COLOR )
64 DALI_ENUM_TO_STRING( USE_OWN_MULTIPLY_PARENT_COLOR )
65 DALI_ENUM_TO_STRING( USE_OWN_MULTIPLY_PARENT_ALPHA )
66 DALI_ENUM_TO_STRING_TABLE_END( COLOR_MODE )
67
68 DALI_ENUM_TO_STRING_TABLE_BEGIN( DRAW_MODE )
69 DALI_ENUM_TO_STRING_WITH_SCOPE( DrawMode, NORMAL )
70 DALI_ENUM_TO_STRING_WITH_SCOPE( DrawMode, OVERLAY_2D )
71 DALI_ENUM_TO_STRING_TABLE_END( DRAW_MODE )
72
73 DALI_ENUM_TO_STRING_TABLE_BEGIN( RESIZE_POLICY )
74 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FIXED )
75 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, USE_NATURAL_SIZE )
76 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FILL_TO_PARENT )
77 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, SIZE_RELATIVE_TO_PARENT )
78 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, SIZE_FIXED_OFFSET_FROM_PARENT )
79 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, FIT_TO_CHILDREN )
80 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, DIMENSION_DEPENDENCY )
81 DALI_ENUM_TO_STRING_WITH_SCOPE( ResizePolicy, USE_ASSIGNED_SIZE )
82 DALI_ENUM_TO_STRING_TABLE_END( RESIZE_POLICY )
83
84 DALI_ENUM_TO_STRING_TABLE_BEGIN( SIZE_SCALE_POLICY )
85 DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, USE_SIZE_SET )
86 DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, FIT_WITH_ASPECT_RATIO )
87 DALI_ENUM_TO_STRING_WITH_SCOPE( SizeScalePolicy, FILL_WITH_ASPECT_RATIO )
88 DALI_ENUM_TO_STRING_TABLE_END( SIZE_SCALE_POLICY )
89
90 DALI_ENUM_TO_STRING_TABLE_BEGIN( CLIPPING_MODE )
91 DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, DISABLED )
92 DALI_ENUM_TO_STRING_WITH_SCOPE( ClippingMode, CLIP_CHILDREN )
93 DALI_ENUM_TO_STRING_TABLE_END( CLIPPING_MODE )
94
95 DALI_ENUM_TO_STRING_TABLE_BEGIN( LAYOUT_DIRECTION )
96 DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, LEFT_TO_RIGHT )
97 DALI_ENUM_TO_STRING_WITH_SCOPE( LayoutDirection, RIGHT_TO_LEFT )
98 DALI_ENUM_TO_STRING_TABLE_END( LAYOUT_DIRECTION )
99
100 bool GetAnchorPointConstant( const std::string& value, Vector3& anchor )
101 {
102   for( uint32_t i = 0; i < ANCHOR_CONSTANT_TABLE_COUNT; ++i )
103   {
104     uint32_t sizeIgnored = 0;
105     if( CompareTokens( value.c_str(), ANCHOR_CONSTANT_TABLE[ i ].name, sizeIgnored ) )
106     {
107       anchor = ANCHOR_CONSTANT_TABLE[ i ].value;
108       return true;
109     }
110   }
111   return false;
112 }
113
114 inline bool GetParentOriginConstant( const std::string& value, Vector3& parentOrigin )
115 {
116   // Values are the same so just use the same table as anchor-point
117   return GetAnchorPointConstant( value, parentOrigin );
118 }
119
120 } // unnamed namespace
121
122 void Actor::PropertyHandler::SetDefaultProperty( Internal::Actor& actor, Property::Index index, const Property::Value& property )
123 {
124   switch( index )
125   {
126     case Dali::Actor::Property::PARENT_ORIGIN:
127     {
128       Property::Type type = property.GetType();
129       if( type == Property::VECTOR3 )
130       {
131         actor.SetParentOrigin( property.Get< Vector3 >() );
132       }
133       else if ( type == Property::STRING )
134       {
135         std::string parentOriginString;
136         property.Get( parentOriginString );
137         Vector3 parentOrigin;
138         if( GetParentOriginConstant( parentOriginString, parentOrigin ) )
139         {
140           actor.SetParentOrigin( parentOrigin );
141         }
142       }
143       break;
144     }
145
146     case Dali::Actor::Property::PARENT_ORIGIN_X:
147     {
148       const Vector3& current = actor.GetCurrentParentOrigin();
149       actor.SetParentOrigin( Vector3( property.Get< float >(), current.y, current.z ) );
150       break;
151     }
152
153     case Dali::Actor::Property::PARENT_ORIGIN_Y:
154     {
155       const Vector3& current = actor.GetCurrentParentOrigin();
156       actor.SetParentOrigin( Vector3( current.x, property.Get< float >(), current.z ) );
157       break;
158     }
159
160     case Dali::Actor::Property::PARENT_ORIGIN_Z:
161     {
162       const Vector3& current = actor.GetCurrentParentOrigin();
163       actor.SetParentOrigin( Vector3( current.x, current.y, property.Get< float >() ) );
164       break;
165     }
166
167     case Dali::Actor::Property::ANCHOR_POINT:
168     {
169       Property::Type type = property.GetType();
170       if( type == Property::VECTOR3 )
171       {
172         actor.SetAnchorPoint( property.Get< Vector3 >() );
173       }
174       else if ( type == Property::STRING )
175       {
176         std::string anchorPointString;
177         property.Get( anchorPointString );
178         Vector3 anchor;
179         if( GetAnchorPointConstant( anchorPointString, anchor ) )
180         {
181           actor.SetAnchorPoint( anchor );
182         }
183       }
184       break;
185     }
186
187     case Dali::Actor::Property::ANCHOR_POINT_X:
188     {
189       const Vector3& current = actor.GetCurrentAnchorPoint();
190       actor.SetAnchorPoint( Vector3( property.Get< float >(), current.y, current.z ) );
191       break;
192     }
193
194     case Dali::Actor::Property::ANCHOR_POINT_Y:
195     {
196       const Vector3& current = actor.GetCurrentAnchorPoint();
197       actor.SetAnchorPoint( Vector3( current.x, property.Get< float >(), current.z ) );
198       break;
199     }
200
201     case Dali::Actor::Property::ANCHOR_POINT_Z:
202     {
203       const Vector3& current = actor.GetCurrentAnchorPoint();
204       actor.SetAnchorPoint( Vector3( current.x, current.y, property.Get< float >() ) );
205       break;
206     }
207
208     case Dali::Actor::Property::SIZE:
209     {
210       Property::Type type = property.GetType();
211       if( type == Property::VECTOR2 )
212       {
213         actor.SetSize( property.Get< Vector2 >() );
214       }
215       else if ( type == Property::VECTOR3 )
216       {
217         actor.SetSize( property.Get< Vector3 >() );
218       }
219       break;
220     }
221
222     case Dali::Actor::Property::SIZE_WIDTH:
223     {
224       actor.SetWidth( property.Get< float >() );
225       break;
226     }
227
228     case Dali::Actor::Property::SIZE_HEIGHT:
229     {
230       actor.SetHeight( property.Get< float >() );
231       break;
232     }
233
234     case Dali::Actor::Property::SIZE_DEPTH:
235     {
236       actor.SetDepth( property.Get< float >() );
237       break;
238     }
239
240     case Dali::Actor::Property::POSITION:
241     {
242       Property::Type type = property.GetType();
243       if( type == Property::VECTOR2 )
244       {
245         Vector2 position = property.Get< Vector2 >();
246         actor.SetPosition( Vector3( position.x, position.y, 0.0f ) );
247       }
248       else if ( type == Property::VECTOR3 )
249       {
250         actor.SetPosition( property.Get< Vector3 >() );
251       }
252       break;
253     }
254
255     case Dali::Actor::Property::POSITION_X:
256     {
257       actor.SetX( property.Get< float >() );
258       break;
259     }
260
261     case Dali::Actor::Property::POSITION_Y:
262     {
263       actor.SetY( property.Get< float >() );
264       break;
265     }
266
267     case Dali::Actor::Property::POSITION_Z:
268     {
269       actor.SetZ( property.Get< float >() );
270       break;
271     }
272
273     case Dali::Actor::Property::ORIENTATION:
274     {
275       actor.SetOrientation( property.Get< Quaternion >() );
276       break;
277     }
278
279     case Dali::Actor::Property::SCALE:
280     {
281       Property::Type type = property.GetType();
282       if( type == Property::FLOAT )
283       {
284         float scale = property.Get< float >();
285         actor.SetScale( scale, scale, scale );
286       }
287       else if ( type == Property::VECTOR3 )
288       {
289         actor.SetScale( property.Get< Vector3 >() );
290       }
291       break;
292     }
293
294     case Dali::Actor::Property::SCALE_X:
295     {
296       actor.SetScaleX( property.Get< float >() );
297       break;
298     }
299
300     case Dali::Actor::Property::SCALE_Y:
301     {
302       actor.SetScaleY( property.Get< float >() );
303       break;
304     }
305
306     case Dali::Actor::Property::SCALE_Z:
307     {
308       actor.SetScaleZ( property.Get< float >() );
309       break;
310     }
311
312     case Dali::Actor::Property::VISIBLE:
313     {
314       actor.SetVisible( property.Get< bool >() );
315       break;
316     }
317
318     case Dali::Actor::Property::COLOR:
319     {
320       Property::Type type = property.GetType();
321       if( type == Property::VECTOR3 )
322       {
323         Vector3 color = property.Get< Vector3 >();
324         actor.SetColor( Vector4( color.r, color.g, color.b, 1.0f ) );
325       }
326       else if( type == Property::VECTOR4 )
327       {
328         actor.SetColor( property.Get< Vector4 >() );
329       }
330       break;
331     }
332
333     case Dali::Actor::Property::COLOR_RED:
334     {
335       actor.SetColorRed( property.Get< float >() );
336       break;
337     }
338
339     case Dali::Actor::Property::COLOR_GREEN:
340     {
341       actor.SetColorGreen( property.Get< float >() );
342       break;
343     }
344
345     case Dali::Actor::Property::COLOR_BLUE:
346     {
347       actor.SetColorBlue( property.Get< float >() );
348       break;
349     }
350
351     case Dali::Actor::Property::COLOR_ALPHA:
352     case Dali::Actor::Property::OPACITY:
353     {
354       float value;
355       if( property.Get( value ) )
356       {
357         actor.SetOpacity( value );
358       }
359       break;
360     }
361
362     case Dali::Actor::Property::NAME:
363     {
364       actor.SetName( property.Get< std::string >() );
365       break;
366     }
367
368     case Dali::Actor::Property::SENSITIVE:
369     {
370       actor.SetSensitive( property.Get< bool >() );
371       break;
372     }
373
374     case Dali::Actor::Property::LEAVE_REQUIRED:
375     {
376       actor.SetLeaveRequired( property.Get< bool >() );
377       break;
378     }
379
380     case Dali::Actor::Property::INHERIT_POSITION:
381     {
382       actor.SetInheritPosition( property.Get< bool >() );
383       break;
384     }
385
386     case Dali::Actor::Property::INHERIT_ORIENTATION:
387     {
388       actor.SetInheritOrientation( property.Get< bool >() );
389       break;
390     }
391
392     case Dali::Actor::Property::INHERIT_SCALE:
393     {
394       actor.SetInheritScale( property.Get< bool >() );
395       break;
396     }
397
398     case Dali::Actor::Property::COLOR_MODE:
399     {
400       ColorMode mode = actor.mColorMode;
401       if ( Scripting::GetEnumerationProperty< ColorMode >( property, COLOR_MODE_TABLE, COLOR_MODE_TABLE_COUNT, mode ) )
402       {
403         actor.SetColorMode( mode );
404       }
405       break;
406     }
407
408     case Dali::Actor::Property::DRAW_MODE:
409     {
410       DrawMode::Type mode = actor.mDrawMode;
411       if( Scripting::GetEnumerationProperty< DrawMode::Type >( property, DRAW_MODE_TABLE, DRAW_MODE_TABLE_COUNT, mode ) )
412       {
413         actor.SetDrawMode( mode );
414       }
415       break;
416     }
417
418     case Dali::Actor::Property::SIZE_MODE_FACTOR:
419     {
420       actor.SetSizeModeFactor( property.Get< Vector3 >() );
421       break;
422     }
423
424     case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
425     {
426       ResizePolicy::Type type = actor.GetResizePolicy( Dimension::WIDTH );
427       if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
428       {
429         actor.SetResizePolicy( type, Dimension::WIDTH );
430       }
431       break;
432     }
433
434     case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
435     {
436       ResizePolicy::Type type = actor.GetResizePolicy( Dimension::HEIGHT );
437       if( Scripting::GetEnumerationProperty< ResizePolicy::Type >( property, RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT, type ) )
438       {
439         actor.SetResizePolicy( type, Dimension::HEIGHT );
440       }
441       break;
442     }
443
444     case Dali::Actor::Property::SIZE_SCALE_POLICY:
445     {
446       SizeScalePolicy::Type type = actor.GetSizeScalePolicy();
447       if( Scripting::GetEnumerationProperty< SizeScalePolicy::Type >( property, SIZE_SCALE_POLICY_TABLE, SIZE_SCALE_POLICY_TABLE_COUNT, type ) )
448       {
449         actor.SetSizeScalePolicy( type );
450       }
451       break;
452     }
453
454     case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
455     {
456       if( property.Get< bool >() )
457       {
458         actor.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::WIDTH );
459       }
460       break;
461     }
462
463     case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
464     {
465       if( property.Get< bool >() )
466       {
467         actor.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
468       }
469       break;
470     }
471
472     case Dali::Actor::Property::PADDING:
473     {
474       Vector4 padding = property.Get< Vector4 >();
475       actor.SetPadding( Vector2( padding.x, padding.y ), Dimension::WIDTH );
476       actor.SetPadding( Vector2( padding.z, padding.w ), Dimension::HEIGHT );
477       break;
478     }
479
480     case Dali::Actor::Property::MINIMUM_SIZE:
481     {
482       Vector2 size = property.Get< Vector2 >();
483       actor.SetMinimumSize( size.x, Dimension::WIDTH );
484       actor.SetMinimumSize( size.y, Dimension::HEIGHT );
485       break;
486     }
487
488     case Dali::Actor::Property::MAXIMUM_SIZE:
489     {
490       Vector2 size = property.Get< Vector2 >();
491       actor.SetMaximumSize( size.x, Dimension::WIDTH );
492       actor.SetMaximumSize( size.y, Dimension::HEIGHT );
493       break;
494     }
495
496     case Dali::DevelActor::Property::SIBLING_ORDER:
497     {
498       int value;
499
500       if( property.Get( value ) )
501       {
502         actor.SetSiblingOrder( value );
503       }
504       break;
505     }
506
507     case Dali::Actor::Property::CLIPPING_MODE:
508     {
509       ClippingMode::Type convertedValue = actor.mClippingMode;
510       if( Scripting::GetEnumerationProperty< ClippingMode::Type >( property, CLIPPING_MODE_TABLE, CLIPPING_MODE_TABLE_COUNT, convertedValue ) )
511       {
512         actor.mClippingMode = convertedValue;
513         SetClippingModeMessage( actor.GetEventThreadServices(), actor.GetNode(), actor.mClippingMode );
514       }
515       break;
516     }
517
518     case Dali::Actor::Property::POSITION_USES_ANCHOR_POINT:
519     {
520       bool value = false;
521       if( property.Get( value ) && value != actor.mPositionUsesAnchorPoint )
522       {
523         actor.mPositionUsesAnchorPoint = value;
524         SetPositionUsesAnchorPointMessage( actor.GetEventThreadServices(), actor.GetNode(), actor.mPositionUsesAnchorPoint );
525       }
526       break;
527     }
528
529     case Dali::Actor::Property::LAYOUT_DIRECTION:
530     {
531       Dali::LayoutDirection::Type direction = actor.mLayoutDirection;
532       actor.mInheritLayoutDirection = false;
533
534       if( Scripting::GetEnumerationProperty< LayoutDirection::Type >( property, LAYOUT_DIRECTION_TABLE, LAYOUT_DIRECTION_TABLE_COUNT, direction ) )
535       {
536         actor.InheritLayoutDirectionRecursively( &actor, direction, true );
537       }
538       break;
539     }
540
541     case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION:
542     {
543       bool value = false;
544       if( property.Get( value ) )
545       {
546         actor.SetInheritLayoutDirection( value );
547       }
548       break;
549     }
550
551     case Dali::Actor::Property::KEYBOARD_FOCUSABLE:
552     {
553       bool value = false;
554       if( property.Get( value ) )
555       {
556         actor.SetKeyboardFocusable( value );
557       }
558       break;
559     }
560
561     case Dali::DevelActor::Property::UPDATE_SIZE_HINT:
562     {
563       actor.SetUpdateSizeHint( property.Get< Vector2 >() );
564       break;
565     }
566
567     case Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START:
568     {
569       bool boolValue = false;
570       if ( property.Get( boolValue ) )
571       {
572         actor.mCaptureAllTouchAfterStart = boolValue;
573       }
574       break;
575     }
576
577     default:
578     {
579       // this can happen in the case of a non-animatable default property so just do nothing
580       break;
581     }
582   }
583 }
584
585 void Actor::PropertyHandler::SetSceneGraphProperty(
586     Property::Index index,
587     const PropertyMetadata& entry,
588     const Property::Value& value,
589     EventThreadServices& eventThreadServices,
590     const SceneGraph::Node& node)
591 {
592   switch( entry.GetType() )
593   {
594     case Property::BOOLEAN:
595     {
596       const AnimatableProperty< bool >* property = dynamic_cast< const AnimatableProperty< bool >* >( entry.GetSceneGraphProperty() );
597       DALI_ASSERT_DEBUG( NULL != property );
598
599       // property is being used in a separate thread; queue a message to set the property
600       SceneGraph::NodePropertyMessage<bool>::Send( eventThreadServices, &node, property, &AnimatableProperty<bool>::Bake, value.Get<bool>() );
601
602       break;
603     }
604
605     case Property::INTEGER:
606     {
607       const AnimatableProperty< int >* property = dynamic_cast< const AnimatableProperty< int >* >( entry.GetSceneGraphProperty() );
608       DALI_ASSERT_DEBUG( NULL != property );
609
610       // property is being used in a separate thread; queue a message to set the property
611       SceneGraph::NodePropertyMessage<int>::Send( eventThreadServices, &node, property, &AnimatableProperty<int>::Bake, value.Get<int>() );
612
613       break;
614     }
615
616     case Property::FLOAT:
617     {
618       const AnimatableProperty< float >* property = dynamic_cast< const AnimatableProperty< float >* >( entry.GetSceneGraphProperty() );
619       DALI_ASSERT_DEBUG( NULL != property );
620
621       // property is being used in a separate thread; queue a message to set the property
622       SceneGraph::NodePropertyMessage<float>::Send( eventThreadServices, &node, property, &AnimatableProperty<float>::Bake, value.Get<float>() );
623
624       break;
625     }
626
627     case Property::VECTOR2:
628     {
629       const AnimatableProperty< Vector2 >* property = dynamic_cast< const AnimatableProperty< Vector2 >* >( entry.GetSceneGraphProperty() );
630       DALI_ASSERT_DEBUG( NULL != property );
631
632       // property is being used in a separate thread; queue a message to set the property
633       if(entry.componentIndex == 0)
634       {
635         SceneGraph::NodePropertyComponentMessage<Vector2>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector2>::BakeX, value.Get<float>() );
636       }
637       else if(entry.componentIndex == 1)
638       {
639         SceneGraph::NodePropertyComponentMessage<Vector2>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector2>::BakeY, value.Get<float>() );
640       }
641       else
642       {
643         SceneGraph::NodePropertyMessage<Vector2>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector2>::Bake, value.Get<Vector2>() );
644       }
645
646       break;
647     }
648
649     case Property::VECTOR3:
650     {
651       const AnimatableProperty< Vector3 >* property = dynamic_cast< const AnimatableProperty< Vector3 >* >( entry.GetSceneGraphProperty() );
652       DALI_ASSERT_DEBUG( NULL != property );
653
654       // property is being used in a separate thread; queue a message to set the property
655       if(entry.componentIndex == 0)
656       {
657         SceneGraph::NodePropertyComponentMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeX, value.Get<float>() );
658       }
659       else if(entry.componentIndex == 1)
660       {
661         SceneGraph::NodePropertyComponentMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeY, value.Get<float>() );
662       }
663       else if(entry.componentIndex == 2)
664       {
665         SceneGraph::NodePropertyComponentMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::BakeZ, value.Get<float>() );
666       }
667       else
668       {
669         SceneGraph::NodePropertyMessage<Vector3>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector3>::Bake, value.Get<Vector3>() );
670       }
671
672       break;
673     }
674
675     case Property::VECTOR4:
676     {
677       const AnimatableProperty< Vector4 >* property = dynamic_cast< const AnimatableProperty< Vector4 >* >( entry.GetSceneGraphProperty() );
678       DALI_ASSERT_DEBUG( NULL != property );
679
680       // property is being used in a separate thread; queue a message to set the property
681       if(entry.componentIndex == 0)
682       {
683         SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeX, value.Get<float>() );
684       }
685       else if(entry.componentIndex == 1)
686       {
687         SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeY, value.Get<float>() );
688       }
689       else if(entry.componentIndex == 2)
690       {
691         SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeZ, value.Get<float>() );
692       }
693       else if(entry.componentIndex == 3)
694       {
695         SceneGraph::NodePropertyComponentMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::BakeW, value.Get<float>() );
696       }
697       else
698       {
699         SceneGraph::NodePropertyMessage<Vector4>::Send( eventThreadServices, &node, property, &AnimatableProperty<Vector4>::Bake, value.Get<Vector4>() );
700       }
701
702       break;
703     }
704
705     case Property::ROTATION:
706     {
707       const AnimatableProperty< Quaternion >* property = dynamic_cast< const AnimatableProperty< Quaternion >* >( entry.GetSceneGraphProperty() );
708       DALI_ASSERT_DEBUG( NULL != property );
709
710       // property is being used in a separate thread; queue a message to set the property
711       SceneGraph::NodePropertyMessage<Quaternion>::Send( eventThreadServices, &node, property,&AnimatableProperty<Quaternion>::Bake,  value.Get<Quaternion>() );
712
713       break;
714     }
715
716     case Property::MATRIX:
717     {
718       const AnimatableProperty< Matrix >* property = dynamic_cast< const AnimatableProperty< Matrix >* >( entry.GetSceneGraphProperty() );
719       DALI_ASSERT_DEBUG( NULL != property );
720
721       // property is being used in a separate thread; queue a message to set the property
722       SceneGraph::NodePropertyMessage<Matrix>::Send( eventThreadServices, &node, property,&AnimatableProperty<Matrix>::Bake,  value.Get<Matrix>() );
723
724       break;
725     }
726
727     case Property::MATRIX3:
728     {
729       const AnimatableProperty< Matrix3 >* property = dynamic_cast< const AnimatableProperty< Matrix3 >* >( entry.GetSceneGraphProperty() );
730       DALI_ASSERT_DEBUG( NULL != property );
731
732       // property is being used in a separate thread; queue a message to set the property
733       SceneGraph::NodePropertyMessage<Matrix3>::Send( eventThreadServices, &node, property,&AnimatableProperty<Matrix3>::Bake,  value.Get<Matrix3>() );
734
735       break;
736     }
737
738     default:
739     {
740       // nothing to do for other types
741     }
742   } // entry.GetType
743 }
744
745 void Actor::PropertyHandler::OnNotifyDefaultPropertyAnimation(Internal::Actor& actor, Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType)
746 {
747   switch( animationType )
748   {
749     case Animation::TO:
750     case Animation::BETWEEN:
751     {
752       switch( index )
753       {
754         case Dali::Actor::Property::SIZE:
755         {
756           if( value.Get( actor.mTargetSize ) )
757           {
758             actor.mAnimatedSize = actor.mTargetSize;
759             actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH;
760
761             // Notify deriving classes
762             actor.OnSizeAnimation( animation, actor.mTargetSize );
763           }
764           break;
765         }
766
767         case Dali::Actor::Property::SIZE_WIDTH:
768         {
769           if( value.Get( actor.mTargetSize.width ) )
770           {
771             actor.mAnimatedSize.width = actor.mTargetSize.width;
772             actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH;
773
774             // Notify deriving classes
775             actor.OnSizeAnimation( animation, actor.mTargetSize );
776           }
777           break;
778         }
779
780         case Dali::Actor::Property::SIZE_HEIGHT:
781         {
782           if( value.Get( actor.mTargetSize.height ) )
783           {
784             actor.mAnimatedSize.height = actor.mTargetSize.height;
785             actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT;
786
787             // Notify deriving classes
788             actor.OnSizeAnimation( animation, actor.mTargetSize );
789           }
790           break;
791         }
792
793         case Dali::Actor::Property::SIZE_DEPTH:
794         {
795           if( value.Get( actor.mTargetSize.depth ) )
796           {
797             actor.mAnimatedSize.depth = actor.mTargetSize.depth;
798             actor.mUseAnimatedSize |= AnimatedSizeFlag::DEPTH;
799
800             // Notify deriving classes
801             actor.OnSizeAnimation( animation, actor.mTargetSize );
802           }
803           break;
804         }
805
806         case Dali::Actor::Property::POSITION:
807         {
808           value.Get( actor.mTargetPosition );
809           break;
810         }
811
812         case Dali::Actor::Property::POSITION_X:
813         {
814           value.Get( actor.mTargetPosition.x );
815           break;
816         }
817
818         case Dali::Actor::Property::POSITION_Y:
819         {
820           value.Get( actor.mTargetPosition.y );
821           break;
822         }
823
824         case Dali::Actor::Property::POSITION_Z:
825         {
826           value.Get( actor.mTargetPosition.z );
827           break;
828         }
829
830         case Dali::Actor::Property::ORIENTATION:
831         {
832           value.Get( actor.mTargetOrientation );
833           break;
834         }
835
836         case Dali::Actor::Property::SCALE:
837         {
838           value.Get( actor.mTargetScale );
839           break;
840         }
841
842         case Dali::Actor::Property::SCALE_X:
843         {
844           value.Get( actor.mTargetScale.x );
845           break;
846         }
847
848         case Dali::Actor::Property::SCALE_Y:
849         {
850           value.Get( actor.mTargetScale.y );
851           break;
852         }
853
854         case Dali::Actor::Property::SCALE_Z:
855         {
856           value.Get( actor.mTargetScale.z );
857           break;
858         }
859
860         case Dali::Actor::Property::VISIBLE:
861         {
862           actor.SetVisibleInternal( value.Get< bool >(), SendMessage::FALSE );
863           break;
864         }
865
866         case Dali::Actor::Property::COLOR:
867         {
868           value.Get( actor.mTargetColor );
869           break;
870         }
871
872         case Dali::Actor::Property::COLOR_RED:
873         {
874           value.Get( actor.mTargetColor.r );
875           break;
876         }
877
878         case Dali::Actor::Property::COLOR_GREEN:
879         {
880           value.Get( actor.mTargetColor.g );
881           break;
882         }
883
884         case Dali::Actor::Property::COLOR_BLUE:
885         {
886           value.Get( actor.mTargetColor.b );
887           break;
888         }
889
890         case Dali::Actor::Property::COLOR_ALPHA:
891         case Dali::Actor::Property::OPACITY:
892         {
893           value.Get( actor.mTargetColor.a );
894           break;
895         }
896
897         default:
898         {
899           // Not an animatable property. Do nothing.
900           break;
901         }
902       }
903       break;
904     }
905
906     case Animation::BY:
907     {
908       switch( index )
909       {
910         case Dali::Actor::Property::SIZE:
911         {
912           if( AdjustValue< Vector3 >( actor.mTargetSize, value ) )
913           {
914             actor.mAnimatedSize = actor.mTargetSize;
915             actor.mUseAnimatedSize = AnimatedSizeFlag::WIDTH | AnimatedSizeFlag::HEIGHT | AnimatedSizeFlag::DEPTH;
916
917             // Notify deriving classes
918             actor.OnSizeAnimation( animation, actor.mTargetSize );
919           }
920           break;
921         }
922
923         case Dali::Actor::Property::SIZE_WIDTH:
924         {
925           if( AdjustValue< float >( actor.mTargetSize.width, value ) )
926           {
927             actor.mAnimatedSize.width = actor.mTargetSize.width;
928             actor.mUseAnimatedSize |= AnimatedSizeFlag::WIDTH;
929
930             // Notify deriving classes
931             actor.OnSizeAnimation( animation, actor.mTargetSize );
932           }
933           break;
934         }
935
936         case Dali::Actor::Property::SIZE_HEIGHT:
937         {
938           if( AdjustValue< float >( actor.mTargetSize.height, value ) )
939           {
940             actor.mAnimatedSize.height = actor.mTargetSize.height;
941             actor.mUseAnimatedSize |= AnimatedSizeFlag::HEIGHT;
942
943             // Notify deriving classes
944             actor.OnSizeAnimation( animation, actor.mTargetSize );
945           }
946           break;
947         }
948
949         case Dali::Actor::Property::SIZE_DEPTH:
950         {
951           if( AdjustValue< float >( actor.mTargetSize.depth, value ) )
952           {
953             actor.mAnimatedSize.depth = actor.mTargetSize.depth;
954             actor.mUseAnimatedSize |= AnimatedSizeFlag::DEPTH;
955
956             // Notify deriving classes
957             actor.OnSizeAnimation( animation, actor.mTargetSize );
958           }
959           break;
960         }
961
962         case Dali::Actor::Property::POSITION:
963         {
964           AdjustValue< Vector3 >( actor.mTargetPosition, value );
965           break;
966         }
967
968         case Dali::Actor::Property::POSITION_X:
969         {
970           AdjustValue< float >( actor.mTargetPosition.x, value );
971           break;
972         }
973
974         case Dali::Actor::Property::POSITION_Y:
975         {
976           AdjustValue< float >( actor.mTargetPosition.y, value );
977           break;
978         }
979
980         case Dali::Actor::Property::POSITION_Z:
981         {
982           AdjustValue< float >( actor.mTargetPosition.z, value );
983           break;
984         }
985
986         case Dali::Actor::Property::ORIENTATION:
987         {
988           Quaternion relativeValue;
989           if( value.Get( relativeValue ) )
990           {
991             actor.mTargetOrientation *= relativeValue;
992           }
993           break;
994         }
995
996         case Dali::Actor::Property::SCALE:
997         {
998           AdjustValue< Vector3 >( actor.mTargetScale, value );
999           break;
1000         }
1001
1002         case Dali::Actor::Property::SCALE_X:
1003         {
1004           AdjustValue< float >( actor.mTargetScale.x, value );
1005           break;
1006         }
1007
1008         case Dali::Actor::Property::SCALE_Y:
1009         {
1010           AdjustValue< float >( actor.mTargetScale.y, value );
1011           break;
1012         }
1013
1014         case Dali::Actor::Property::SCALE_Z:
1015         {
1016           AdjustValue< float >( actor.mTargetScale.z, value );
1017           break;
1018         }
1019
1020         case Dali::Actor::Property::VISIBLE:
1021         {
1022           bool relativeValue = false;
1023           if( value.Get( relativeValue ) )
1024           {
1025             bool visible = actor.mVisible || relativeValue;
1026             actor.SetVisibleInternal( visible, SendMessage::FALSE );
1027           }
1028           break;
1029         }
1030
1031         case Dali::Actor::Property::COLOR:
1032         {
1033           AdjustValue< Vector4 >( actor.mTargetColor, value );
1034           break;
1035         }
1036
1037         case Dali::Actor::Property::COLOR_RED:
1038         {
1039           AdjustValue< float >( actor.mTargetColor.r, value );
1040           break;
1041         }
1042
1043         case Dali::Actor::Property::COLOR_GREEN:
1044         {
1045           AdjustValue< float >( actor.mTargetColor.g, value );
1046           break;
1047         }
1048
1049         case Dali::Actor::Property::COLOR_BLUE:
1050         {
1051           AdjustValue< float >( actor.mTargetColor.b, value );
1052           break;
1053         }
1054
1055         case Dali::Actor::Property::COLOR_ALPHA:
1056         case Dali::Actor::Property::OPACITY:
1057         {
1058           AdjustValue< float >( actor.mTargetColor.a, value );
1059           break;
1060         }
1061
1062         default:
1063         {
1064           // Not an animatable property. Do nothing.
1065           break;
1066         }
1067       }
1068       break;
1069     }
1070   }
1071 }
1072
1073 const PropertyBase* Actor::PropertyHandler::GetSceneObjectAnimatableProperty(Property::Index index, const SceneGraph::Node& node)
1074 {
1075   const PropertyBase* property( nullptr );
1076
1077   switch( index )
1078   {
1079     case Dali::Actor::Property::SIZE:        // FALLTHROUGH
1080     case Dali::Actor::Property::SIZE_WIDTH:  // FALLTHROUGH
1081     case Dali::Actor::Property::SIZE_HEIGHT: // FALLTHROUGH
1082     case Dali::Actor::Property::SIZE_DEPTH:
1083     {
1084       property = &node.mSize;
1085       break;
1086     }
1087     case Dali::Actor::Property::POSITION:   // FALLTHROUGH
1088     case Dali::Actor::Property::POSITION_X: // FALLTHROUGH
1089     case Dali::Actor::Property::POSITION_Y: // FALLTHROUGH
1090     case Dali::Actor::Property::POSITION_Z:
1091     {
1092       property = &node.mPosition;
1093       break;
1094     }
1095     case Dali::Actor::Property::ORIENTATION:
1096     {
1097       property = &node.mOrientation;
1098       break;
1099     }
1100     case Dali::Actor::Property::SCALE:   // FALLTHROUGH
1101     case Dali::Actor::Property::SCALE_X: // FALLTHROUGH
1102     case Dali::Actor::Property::SCALE_Y: // FALLTHROUGH
1103     case Dali::Actor::Property::SCALE_Z:
1104     {
1105       property = &node.mScale;
1106       break;
1107     }
1108     case Dali::Actor::Property::VISIBLE:
1109     {
1110       property = &node.mVisible;
1111       break;
1112     }
1113     case Dali::Actor::Property::COLOR:       // FALLTHROUGH
1114     case Dali::Actor::Property::COLOR_RED:   // FALLTHROUGH
1115     case Dali::Actor::Property::COLOR_GREEN: // FALLTHROUGH
1116     case Dali::Actor::Property::COLOR_BLUE:  // FALLTHROUGH
1117     case Dali::Actor::Property::COLOR_ALPHA: // FALLTHROUGH
1118     case Dali::Actor::Property::OPACITY:
1119     {
1120       property = &node.mColor;
1121       break;
1122     }
1123     default:
1124     {
1125       break;
1126     }
1127   }
1128
1129   return property;
1130 }
1131
1132 const PropertyInputImpl* Actor::PropertyHandler::GetSceneObjectInputProperty(Property::Index index, const SceneGraph::Node& node)
1133 {
1134   const PropertyInputImpl* property( nullptr );
1135
1136   switch( index )
1137   {
1138     case Dali::Actor::Property::PARENT_ORIGIN:   // FALLTHROUGH
1139     case Dali::Actor::Property::PARENT_ORIGIN_X: // FALLTHROUGH
1140     case Dali::Actor::Property::PARENT_ORIGIN_Y: // FALLTHROUGH
1141     case Dali::Actor::Property::PARENT_ORIGIN_Z:
1142     {
1143       property = &node.mParentOrigin;
1144       break;
1145     }
1146     case Dali::Actor::Property::ANCHOR_POINT:   // FALLTHROUGH
1147     case Dali::Actor::Property::ANCHOR_POINT_X: // FALLTHROUGH
1148     case Dali::Actor::Property::ANCHOR_POINT_Y: // FALLTHROUGH
1149     case Dali::Actor::Property::ANCHOR_POINT_Z:
1150     {
1151       property = &node.mAnchorPoint;
1152       break;
1153     }
1154     case Dali::Actor::Property::WORLD_POSITION:   // FALLTHROUGH
1155     case Dali::Actor::Property::WORLD_POSITION_X: // FALLTHROUGH
1156     case Dali::Actor::Property::WORLD_POSITION_Y: // FALLTHROUGH
1157     case Dali::Actor::Property::WORLD_POSITION_Z:
1158     {
1159       property = &node.mWorldPosition;
1160       break;
1161     }
1162     case Dali::Actor::Property::WORLD_ORIENTATION:
1163     {
1164       property = &node.mWorldOrientation;
1165       break;
1166     }
1167     case Dali::Actor::Property::WORLD_SCALE:
1168     {
1169       property = &node.mWorldScale;
1170       break;
1171     }
1172     case Dali::Actor::Property::WORLD_COLOR:
1173     {
1174       property = &node.mWorldColor;
1175       break;
1176     }
1177     case Dali::Actor::Property::WORLD_MATRIX:
1178     {
1179       property = &node.mWorldMatrix;
1180       break;
1181     }
1182     case Dali::Actor::Property::CULLED:
1183     {
1184       property = &node.mCulled;
1185       break;
1186     }
1187     default:
1188     {
1189       break;
1190     }
1191   }
1192
1193   return property;
1194 }
1195
1196 int32_t Actor::PropertyHandler::GetPropertyComponentIndex(Property::Index index)
1197 {
1198   int32_t componentIndex = Property::INVALID_COMPONENT_INDEX;
1199
1200   switch( index )
1201   {
1202     case Dali::Actor::Property::PARENT_ORIGIN_X:
1203     case Dali::Actor::Property::ANCHOR_POINT_X:
1204     case Dali::Actor::Property::SIZE_WIDTH:
1205     case Dali::Actor::Property::POSITION_X:
1206     case Dali::Actor::Property::WORLD_POSITION_X:
1207     case Dali::Actor::Property::SCALE_X:
1208     case Dali::Actor::Property::COLOR_RED:
1209     {
1210       componentIndex = 0;
1211       break;
1212     }
1213
1214     case Dali::Actor::Property::PARENT_ORIGIN_Y:
1215     case Dali::Actor::Property::ANCHOR_POINT_Y:
1216     case Dali::Actor::Property::SIZE_HEIGHT:
1217     case Dali::Actor::Property::POSITION_Y:
1218     case Dali::Actor::Property::WORLD_POSITION_Y:
1219     case Dali::Actor::Property::SCALE_Y:
1220     case Dali::Actor::Property::COLOR_GREEN:
1221     {
1222       componentIndex = 1;
1223       break;
1224     }
1225
1226     case Dali::Actor::Property::PARENT_ORIGIN_Z:
1227     case Dali::Actor::Property::ANCHOR_POINT_Z:
1228     case Dali::Actor::Property::SIZE_DEPTH:
1229     case Dali::Actor::Property::POSITION_Z:
1230     case Dali::Actor::Property::WORLD_POSITION_Z:
1231     case Dali::Actor::Property::SCALE_Z:
1232     case Dali::Actor::Property::COLOR_BLUE:
1233     {
1234       componentIndex = 2;
1235       break;
1236     }
1237
1238     case Dali::Actor::Property::COLOR_ALPHA:
1239     case Dali::Actor::Property::OPACITY:
1240     {
1241       componentIndex = 3;
1242       break;
1243     }
1244
1245     default:
1246     {
1247       // Do nothing
1248       break;
1249     }
1250   }
1251
1252   return componentIndex;
1253 }
1254
1255 bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor, Property::Index index, Property::Value& value)
1256 {
1257   bool valueSet = true;
1258
1259   switch( index )
1260   {
1261     case Dali::Actor::Property::PARENT_ORIGIN:
1262     {
1263       value = actor.GetCurrentParentOrigin();
1264       break;
1265     }
1266
1267     case Dali::Actor::Property::PARENT_ORIGIN_X:
1268     {
1269       value = actor.GetCurrentParentOrigin().x;
1270       break;
1271     }
1272
1273     case Dali::Actor::Property::PARENT_ORIGIN_Y:
1274     {
1275       value = actor.GetCurrentParentOrigin().y;
1276       break;
1277     }
1278
1279     case Dali::Actor::Property::PARENT_ORIGIN_Z:
1280     {
1281       value = actor.GetCurrentParentOrigin().z;
1282       break;
1283     }
1284
1285     case Dali::Actor::Property::ANCHOR_POINT:
1286     {
1287       value = actor.GetCurrentAnchorPoint();
1288       break;
1289     }
1290
1291     case Dali::Actor::Property::ANCHOR_POINT_X:
1292     {
1293       value = actor.GetCurrentAnchorPoint().x;
1294       break;
1295     }
1296
1297     case Dali::Actor::Property::ANCHOR_POINT_Y:
1298     {
1299       value = actor.GetCurrentAnchorPoint().y;
1300       break;
1301     }
1302
1303     case Dali::Actor::Property::ANCHOR_POINT_Z:
1304     {
1305       value = actor.GetCurrentAnchorPoint().z;
1306       break;
1307     }
1308
1309     case Dali::Actor::Property::SIZE:
1310     {
1311       value = actor.GetTargetSize();
1312       break;
1313     }
1314
1315     case Dali::Actor::Property::SIZE_WIDTH:
1316     {
1317       value = actor.GetTargetSize().width;
1318       break;
1319     }
1320
1321     case Dali::Actor::Property::SIZE_HEIGHT:
1322     {
1323       value = actor.GetTargetSize().height;
1324       break;
1325     }
1326
1327     case Dali::Actor::Property::SIZE_DEPTH:
1328     {
1329       value = actor.GetTargetSize().depth;
1330       break;
1331     }
1332
1333     case Dali::Actor::Property::POSITION:
1334     {
1335       value = actor.GetTargetPosition();
1336       break;
1337     }
1338
1339     case Dali::Actor::Property::POSITION_X:
1340     {
1341       value = actor.GetTargetPosition().x;
1342       break;
1343     }
1344
1345     case Dali::Actor::Property::POSITION_Y:
1346     {
1347       value = actor.GetTargetPosition().y;
1348       break;
1349     }
1350
1351     case Dali::Actor::Property::POSITION_Z:
1352     {
1353       value = actor.GetTargetPosition().z;
1354       break;
1355     }
1356
1357     case Dali::Actor::Property::ORIENTATION:
1358     {
1359       value = actor.mTargetOrientation;
1360       break;
1361     }
1362
1363     case Dali::Actor::Property::SCALE:
1364     {
1365       value = actor.mTargetScale;
1366       break;
1367     }
1368
1369     case Dali::Actor::Property::SCALE_X:
1370     {
1371       value = actor.mTargetScale.x;
1372       break;
1373     }
1374
1375     case Dali::Actor::Property::SCALE_Y:
1376     {
1377       value = actor.mTargetScale.y;
1378       break;
1379     }
1380
1381     case Dali::Actor::Property::SCALE_Z:
1382     {
1383       value = actor.mTargetScale.z;
1384       break;
1385     }
1386
1387     case Dali::Actor::Property::VISIBLE:
1388     {
1389       value = actor.mVisible;
1390       break;
1391     }
1392
1393     case Dali::Actor::Property::COLOR:
1394     {
1395       value = actor.mTargetColor;
1396       break;
1397     }
1398
1399     case Dali::Actor::Property::COLOR_RED:
1400     {
1401       value = actor.mTargetColor.r;
1402       break;
1403     }
1404
1405     case Dali::Actor::Property::COLOR_GREEN:
1406     {
1407       value = actor.mTargetColor.g;
1408       break;
1409     }
1410
1411     case Dali::Actor::Property::COLOR_BLUE:
1412     {
1413       value = actor.mTargetColor.b;
1414       break;
1415     }
1416
1417     case Dali::Actor::Property::COLOR_ALPHA:
1418     case Dali::Actor::Property::OPACITY:
1419     {
1420       value = actor.mTargetColor.a;
1421       break;
1422     }
1423
1424     case Dali::Actor::Property::NAME:
1425     {
1426       value = actor.GetName();
1427       break;
1428     }
1429
1430     case Dali::Actor::Property::SENSITIVE:
1431     {
1432       value = actor.IsSensitive();
1433       break;
1434     }
1435
1436     case Dali::Actor::Property::LEAVE_REQUIRED:
1437     {
1438       value = actor.GetLeaveRequired();
1439       break;
1440     }
1441
1442     case Dali::Actor::Property::INHERIT_POSITION:
1443     {
1444       value = actor.IsPositionInherited();
1445       break;
1446     }
1447
1448     case Dali::Actor::Property::INHERIT_ORIENTATION:
1449     {
1450       value = actor.IsOrientationInherited();
1451       break;
1452     }
1453
1454     case Dali::Actor::Property::INHERIT_SCALE:
1455     {
1456       value = actor.IsScaleInherited();
1457       break;
1458     }
1459
1460     case Dali::Actor::Property::COLOR_MODE:
1461     {
1462       value = actor.GetColorMode();
1463       break;
1464     }
1465
1466     case Dali::Actor::Property::DRAW_MODE:
1467     {
1468       value = actor.GetDrawMode();
1469       break;
1470     }
1471
1472     case Dali::Actor::Property::SIZE_MODE_FACTOR:
1473     {
1474       value = actor.GetSizeModeFactor();
1475       break;
1476     }
1477
1478     case Dali::Actor::Property::WIDTH_RESIZE_POLICY:
1479     {
1480       value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( actor.GetResizePolicy( Dimension::WIDTH ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
1481       break;
1482     }
1483
1484     case Dali::Actor::Property::HEIGHT_RESIZE_POLICY:
1485     {
1486       value = Scripting::GetLinearEnumerationName< ResizePolicy::Type >( actor.GetResizePolicy( Dimension::HEIGHT ), RESIZE_POLICY_TABLE, RESIZE_POLICY_TABLE_COUNT );
1487       break;
1488     }
1489
1490     case Dali::Actor::Property::SIZE_SCALE_POLICY:
1491     {
1492       value = actor.GetSizeScalePolicy();
1493       break;
1494     }
1495
1496     case Dali::Actor::Property::WIDTH_FOR_HEIGHT:
1497     {
1498       value = ( actor.GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( actor.GetDimensionDependency( Dimension::WIDTH ) == Dimension::HEIGHT );
1499       break;
1500     }
1501
1502     case Dali::Actor::Property::HEIGHT_FOR_WIDTH:
1503     {
1504       value = ( actor.GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DIMENSION_DEPENDENCY ) && ( actor.GetDimensionDependency( Dimension::HEIGHT ) == Dimension::WIDTH );
1505       break;
1506     }
1507
1508     case Dali::Actor::Property::PADDING:
1509     {
1510       Vector2 widthPadding = actor.GetPadding( Dimension::WIDTH );
1511       Vector2 heightPadding = actor.GetPadding( Dimension::HEIGHT );
1512       value = Vector4( widthPadding.x, widthPadding.y, heightPadding.x, heightPadding.y );
1513       break;
1514     }
1515
1516     case Dali::Actor::Property::MINIMUM_SIZE:
1517     {
1518       value = Vector2( actor.GetMinimumSize( Dimension::WIDTH ), actor.GetMinimumSize( Dimension::HEIGHT ) );
1519       break;
1520     }
1521
1522     case Dali::Actor::Property::MAXIMUM_SIZE:
1523     {
1524       value = Vector2( actor.GetMaximumSize( Dimension::WIDTH ), actor.GetMaximumSize( Dimension::HEIGHT ) );
1525       break;
1526     }
1527
1528     case Dali::Actor::Property::CLIPPING_MODE:
1529     {
1530       value = actor.mClippingMode;
1531       break;
1532     }
1533
1534     case Dali::DevelActor::Property::SIBLING_ORDER:
1535     {
1536       value = static_cast<int>( actor.GetSiblingOrder() );
1537       break;
1538     }
1539
1540     case Dali::Actor::Property::SCREEN_POSITION:
1541     {
1542       value = actor.GetCurrentScreenPosition();
1543       break;
1544     }
1545
1546     case Dali::Actor::Property::POSITION_USES_ANCHOR_POINT:
1547     {
1548       value = actor.mPositionUsesAnchorPoint;
1549       break;
1550     }
1551
1552     case Dali::Actor::Property::LAYOUT_DIRECTION:
1553     {
1554       value = actor.mLayoutDirection;
1555       break;
1556     }
1557
1558     case Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION:
1559     {
1560       value = actor.IsLayoutDirectionInherited();
1561       break;
1562     }
1563
1564     case Dali::Actor::Property::ID:
1565     {
1566       value = static_cast<int>( actor.GetId() );
1567       break;
1568     }
1569
1570     case Dali::Actor::Property::HIERARCHY_DEPTH:
1571     {
1572       value = actor.GetHierarchyDepth();
1573       break;
1574     }
1575
1576     case Dali::Actor::Property::IS_ROOT:
1577     {
1578       value = actor.IsRoot();
1579       break;
1580     }
1581
1582     case Dali::Actor::Property::IS_LAYER:
1583     {
1584       value = actor.IsLayer();
1585       break;
1586     }
1587
1588     case Dali::Actor::Property::CONNECTED_TO_SCENE:
1589     {
1590       value = actor.OnScene();
1591       break;
1592     }
1593
1594     case Dali::Actor::Property::KEYBOARD_FOCUSABLE:
1595     {
1596       value = actor.IsKeyboardFocusable();
1597       break;
1598     }
1599
1600     case Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START:
1601     {
1602       value = actor.mCaptureAllTouchAfterStart;
1603       break;
1604     }
1605
1606     default:
1607     {
1608       // Must be a scene-graph only property
1609       valueSet = false;
1610       break;
1611     }
1612   }
1613
1614   return valueSet;
1615 }
1616
1617 bool Actor::PropertyHandler::GetCurrentPropertyValue(const Internal::Actor& actor, Property::Index index, Property::Value& value)
1618 {
1619   bool valueSet = true;
1620
1621   switch( index )
1622   {
1623     case Dali::Actor::Property::SIZE:
1624     {
1625       value = actor.GetCurrentSize();
1626       break;
1627     }
1628
1629     case Dali::Actor::Property::SIZE_WIDTH:
1630     {
1631       value = actor.GetCurrentSize().width;
1632       break;
1633     }
1634
1635     case Dali::Actor::Property::SIZE_HEIGHT:
1636     {
1637       value = actor.GetCurrentSize().height;
1638       break;
1639     }
1640
1641     case Dali::Actor::Property::SIZE_DEPTH:
1642     {
1643       value = actor.GetCurrentSize().depth;
1644       break;
1645     }
1646
1647     case Dali::Actor::Property::POSITION:
1648     {
1649       value = actor.GetCurrentPosition();
1650       break;
1651     }
1652
1653     case Dali::Actor::Property::POSITION_X:
1654     {
1655       value = actor.GetCurrentPosition().x;
1656       break;
1657     }
1658
1659     case Dali::Actor::Property::POSITION_Y:
1660     {
1661       value = actor.GetCurrentPosition().y;
1662       break;
1663     }
1664
1665     case Dali::Actor::Property::POSITION_Z:
1666     {
1667       value = actor.GetCurrentPosition().z;
1668       break;
1669     }
1670
1671     case Dali::Actor::Property::WORLD_POSITION:
1672     {
1673       value = actor.GetCurrentWorldPosition();
1674       break;
1675     }
1676
1677     case Dali::Actor::Property::WORLD_POSITION_X:
1678     {
1679       value = actor.GetCurrentWorldPosition().x;
1680       break;
1681     }
1682
1683     case Dali::Actor::Property::WORLD_POSITION_Y:
1684     {
1685       value = actor.GetCurrentWorldPosition().y;
1686       break;
1687     }
1688
1689     case Dali::Actor::Property::WORLD_POSITION_Z:
1690     {
1691       value = actor.GetCurrentWorldPosition().z;
1692       break;
1693     }
1694
1695     case Dali::Actor::Property::ORIENTATION:
1696     {
1697       value = actor.GetCurrentOrientation();
1698       break;
1699     }
1700
1701     case Dali::Actor::Property::WORLD_ORIENTATION:
1702     {
1703       value = actor.GetCurrentWorldOrientation();
1704       break;
1705     }
1706
1707     case Dali::Actor::Property::SCALE:
1708     {
1709       value = actor.GetCurrentScale();
1710       break;
1711     }
1712
1713     case Dali::Actor::Property::SCALE_X:
1714     {
1715       value = actor.GetCurrentScale().x;
1716       break;
1717     }
1718
1719     case Dali::Actor::Property::SCALE_Y:
1720     {
1721       value = actor.GetCurrentScale().y;
1722       break;
1723     }
1724
1725     case Dali::Actor::Property::SCALE_Z:
1726     {
1727       value = actor.GetCurrentScale().z;
1728       break;
1729     }
1730
1731     case Dali::Actor::Property::WORLD_SCALE:
1732     {
1733       value = actor.GetCurrentWorldScale();
1734       break;
1735     }
1736
1737     case Dali::Actor::Property::COLOR:
1738     {
1739       value = actor.GetCurrentColor();
1740       break;
1741     }
1742
1743     case Dali::Actor::Property::COLOR_RED:
1744     {
1745       value = actor.GetCurrentColor().r;
1746       break;
1747     }
1748
1749     case Dali::Actor::Property::COLOR_GREEN:
1750     {
1751       value = actor.GetCurrentColor().g;
1752       break;
1753     }
1754
1755     case Dali::Actor::Property::COLOR_BLUE:
1756     {
1757       value = actor.GetCurrentColor().b;
1758       break;
1759     }
1760
1761     case Dali::Actor::Property::COLOR_ALPHA:
1762     case Dali::Actor::Property::OPACITY:
1763     {
1764       value = actor.GetCurrentColor().a;
1765       break;
1766     }
1767
1768     case Dali::Actor::Property::WORLD_COLOR:
1769     {
1770       value = actor.GetCurrentWorldColor();
1771       break;
1772     }
1773
1774     case Dali::Actor::Property::WORLD_MATRIX:
1775     {
1776       value = actor.GetCurrentWorldMatrix();
1777       break;
1778     }
1779
1780     case Dali::Actor::Property::VISIBLE:
1781     {
1782       value = actor.IsVisible();
1783       break;
1784     }
1785
1786     case Dali::Actor::Property::CULLED:
1787     {
1788       value = actor.GetNode().IsCulled( actor.GetEventThreadServices().GetEventBufferIndex() );
1789       break;
1790     }
1791
1792     case Dali::DevelActor::Property::UPDATE_SIZE_HINT:
1793     {
1794       // node is being used in a separate thread, the value from the previous update is the same, set by user
1795       value = Vector2( actor.GetNode().GetUpdateSizeHint() );
1796       break;
1797     }
1798
1799     default:
1800     {
1801       // Must be an event-side only property
1802       valueSet = false;
1803       break;
1804     }
1805   }
1806
1807   return valueSet;
1808 }
1809
1810 } // namespace Internal
1811
1812 } // namespace Dali