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