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