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