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