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