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