2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/event/actors/actor-impl.h>
27 #include <dali/public-api/common/constants.h>
28 #include <dali/public-api/common/dali-common.h>
29 #include <dali/public-api/math/radian.h>
30 #include <dali/public-api/math/vector2.h>
31 #include <dali/public-api/math/vector3.h>
32 #include <dali/public-api/object/type-registry.h>
34 #include <dali/devel-api/actors/actor-devel.h>
35 #include <dali/devel-api/common/capabilities.h>
37 #include <dali/integration-api/debug.h>
39 #include <dali/internal/event/actors/actor-coords.h>
40 #include <dali/internal/event/actors/actor-parent.h>
41 #include <dali/internal/event/actors/actor-property-handler.h>
42 #include <dali/internal/event/actors/actor-relayouter.h>
43 #include <dali/internal/event/actors/camera-actor-impl.h>
44 #include <dali/internal/event/common/event-thread-services.h>
45 #include <dali/internal/event/common/property-helper.h>
46 #include <dali/internal/event/common/scene-impl.h>
47 #include <dali/internal/event/common/stage-impl.h>
48 #include <dali/internal/event/common/thread-local-storage.h>
49 #include <dali/internal/event/common/type-info-impl.h>
50 #include <dali/internal/event/events/actor-gesture-data.h>
51 #include <dali/internal/event/render-tasks/render-task-impl.h>
52 #include <dali/internal/event/render-tasks/render-task-list-impl.h>
53 #include <dali/internal/event/rendering/renderer-impl.h>
54 #include <dali/internal/event/size-negotiation/relayout-controller-impl.h>
55 #include <dali/internal/update/manager/update-manager.h>
56 #include <dali/internal/update/nodes/node-messages.h>
58 using Dali::Internal::SceneGraph::AnimatableProperty;
59 using Dali::Internal::SceneGraph::Node;
60 using Dali::Internal::SceneGraph::PropertyBase;
62 #if defined(DEBUG_ENABLED)
63 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER");
70 namespace // unnamed namespace
75 * We want to discourage the use of property strings (minimize string comparisons),
76 * particularly for the default properties.
77 * Name Type writable animatable constraint-input enum for index-checking
79 DALI_PROPERTY_TABLE_BEGIN
80 DALI_PROPERTY("parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN)
81 DALI_PROPERTY("parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X)
82 DALI_PROPERTY("parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y)
83 DALI_PROPERTY("parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z)
84 DALI_PROPERTY("anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT)
85 DALI_PROPERTY("anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X)
86 DALI_PROPERTY("anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y)
87 DALI_PROPERTY("anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z)
88 DALI_PROPERTY("size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE)
89 DALI_PROPERTY("sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH)
90 DALI_PROPERTY("sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT)
91 DALI_PROPERTY("sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH)
92 DALI_PROPERTY("position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION)
93 DALI_PROPERTY("positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X)
94 DALI_PROPERTY("positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y)
95 DALI_PROPERTY("positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z)
96 DALI_PROPERTY("worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION)
97 DALI_PROPERTY("worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X)
98 DALI_PROPERTY("worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y)
99 DALI_PROPERTY("worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z)
100 DALI_PROPERTY("orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION)
101 DALI_PROPERTY("worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION)
102 DALI_PROPERTY("scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE)
103 DALI_PROPERTY("scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X)
104 DALI_PROPERTY("scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y)
105 DALI_PROPERTY("scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z)
106 DALI_PROPERTY("worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE)
107 DALI_PROPERTY("visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE)
108 DALI_PROPERTY("color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR)
109 DALI_PROPERTY("colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED)
110 DALI_PROPERTY("colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN)
111 DALI_PROPERTY("colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE)
112 DALI_PROPERTY("colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA)
113 DALI_PROPERTY("worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR)
114 DALI_PROPERTY("worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX)
115 DALI_PROPERTY("name", STRING, true, false, false, Dali::Actor::Property::NAME)
116 DALI_PROPERTY("sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE)
117 DALI_PROPERTY("leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED)
118 DALI_PROPERTY("inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION)
119 DALI_PROPERTY("inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE)
120 DALI_PROPERTY("colorMode", INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE)
121 DALI_PROPERTY("drawMode", INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE)
122 DALI_PROPERTY("sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR)
123 DALI_PROPERTY("widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY)
124 DALI_PROPERTY("heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY)
125 DALI_PROPERTY("sizeScalePolicy", INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY)
126 DALI_PROPERTY("widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT)
127 DALI_PROPERTY("heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH)
128 DALI_PROPERTY("padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING)
129 DALI_PROPERTY("minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE)
130 DALI_PROPERTY("maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE)
131 DALI_PROPERTY("inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION)
132 DALI_PROPERTY("clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE)
133 DALI_PROPERTY("layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION)
134 DALI_PROPERTY("inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION)
135 DALI_PROPERTY("opacity", FLOAT, true, true, true, Dali::Actor::Property::OPACITY)
136 DALI_PROPERTY("screenPosition", VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION)
137 DALI_PROPERTY("positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT)
138 DALI_PROPERTY("culled", BOOLEAN, false, false, true, Dali::Actor::Property::CULLED)
139 DALI_PROPERTY("id", INTEGER, false, false, false, Dali::Actor::Property::ID)
140 DALI_PROPERTY("hierarchyDepth", INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH)
141 DALI_PROPERTY("isRoot", BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT)
142 DALI_PROPERTY("isLayer", BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER)
143 DALI_PROPERTY("connectedToScene", BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE)
144 DALI_PROPERTY("keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE)
145 DALI_PROPERTY("siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER)
146 DALI_PROPERTY("updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT)
147 DALI_PROPERTY("captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START)
148 DALI_PROPERTY("touchAreaOffset", RECTANGLE, true, false, false, Dali::DevelActor::Property::TOUCH_AREA_OFFSET)
149 DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION)
150 DALI_PROPERTY("touchFocusable", BOOLEAN, true, false, false, Dali::DevelActor::Property::TOUCH_FOCUSABLE)
151 DALI_PROPERTY("keyboardFocusableChildren", BOOLEAN, true, false, false, Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN)
152 DALI_PROPERTY_TABLE_END(DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties)
156 static constexpr std::string_view SIGNAL_HOVERED = "hovered";
157 static constexpr std::string_view SIGNAL_WHEEL_EVENT = "wheelEvent";
158 static constexpr std::string_view SIGNAL_ON_SCENE = "onScene";
159 static constexpr std::string_view SIGNAL_OFF_SCENE = "offScene";
160 static constexpr std::string_view SIGNAL_ON_RELAYOUT = "onRelayout";
161 static constexpr std::string_view SIGNAL_TOUCHED = "touched";
162 static constexpr std::string_view SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
163 static constexpr std::string_view SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
164 static constexpr std::string_view SIGNAL_CHILD_ADDED = "childAdded";
165 static constexpr std::string_view SIGNAL_CHILD_REMOVED = "childRemoved";
169 static constexpr std::string_view ACTION_SHOW = "show";
170 static constexpr std::string_view ACTION_HIDE = "hide";
172 BaseHandle CreateActor()
174 return Dali::Actor::New();
177 TypeRegistration mType(typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties);
179 SignalConnectorType signalConnector2(mType, std::string(SIGNAL_HOVERED), &Actor::DoConnectSignal);
180 SignalConnectorType signalConnector3(mType, std::string(SIGNAL_WHEEL_EVENT), &Actor::DoConnectSignal);
181 SignalConnectorType signalConnector4(mType, std::string(SIGNAL_ON_SCENE), &Actor::DoConnectSignal);
182 SignalConnectorType signalConnector5(mType, std::string(SIGNAL_OFF_SCENE), &Actor::DoConnectSignal);
183 SignalConnectorType signalConnector6(mType, std::string(SIGNAL_ON_RELAYOUT), &Actor::DoConnectSignal);
184 SignalConnectorType signalConnector7(mType, std::string(SIGNAL_TOUCHED), &Actor::DoConnectSignal);
185 SignalConnectorType signalConnector8(mType, std::string(SIGNAL_VISIBILITY_CHANGED), &Actor::DoConnectSignal);
186 SignalConnectorType signalConnector9(mType, std::string(SIGNAL_LAYOUT_DIRECTION_CHANGED), &Actor::DoConnectSignal);
187 SignalConnectorType signalConnector10(mType, std::string(SIGNAL_CHILD_ADDED), &Actor::DoConnectSignal);
188 SignalConnectorType signalConnector11(mType, std::string(SIGNAL_CHILD_REMOVED), &Actor::DoConnectSignal);
190 TypeAction a1(mType, std::string(ACTION_SHOW), &Actor::DoAction);
191 TypeAction a2(mType, std::string(ACTION_HIDE), &Actor::DoAction);
194 * @brief Extract a given dimension from a Vector2
196 * @param[in] values The values to extract from
197 * @param[in] dimension The dimension to extract
198 * @return Return the value for the dimension
200 constexpr float GetDimensionValue(const Vector2& values, Dimension::Type dimension)
204 case Dimension::WIDTH:
208 case Dimension::HEIGHT:
210 return values.height;
221 * @brief Extract a given dimension from a Vector3
223 * @param[in] values The values to extract from
224 * @param[in] dimension The dimension to extract
225 * @return Return the value for the dimension
227 float GetDimensionValue(const Vector3& values, Dimension::Type dimension)
229 return GetDimensionValue(values.GetVectorXY(), dimension);
232 /// Helper for emitting a signal
233 template<typename Signal, typename Event>
234 bool EmitConsumingSignal(Actor& actor, Signal& signal, const Event& event)
236 bool consumed = false;
240 Dali::Actor handle(&actor);
241 consumed = signal.Emit(handle, event);
247 /// Helper for emitting signals with multiple parameters
248 template<typename Signal, typename... Param>
249 void EmitSignal(Actor& actor, Signal& signal, Param... params)
253 Dali::Actor handle(&actor);
254 signal.Emit(handle, params...);
258 } // unnamed namespace
260 ActorPtr Actor::New()
262 // pass a reference to actor, actor does not own its node
263 ActorPtr actor(new Actor(BASIC, *CreateNode()));
265 // Second-phase construction
271 const SceneGraph::Node* Actor::CreateNode()
273 // create node. Nodes are owned by the update manager
274 SceneGraph::Node* node = SceneGraph::Node::New();
275 OwnerPointer<SceneGraph::Node> transferOwnership(node);
276 Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal();
278 DALI_ASSERT_ALWAYS(tls && "ThreadLocalStorage is null");
280 AddNodeMessage(tls->GetUpdateManager(), transferOwnership);
285 void Actor::SetName(std::string_view name)
287 mName = ConstString(name);
289 // ATTENTION: string for debug purposes is not thread safe.
290 DALI_LOG_SET_OBJECT_STRING(const_cast<SceneGraph::Node*>(&GetNode()), mName.GetCString());
293 uint32_t Actor::GetId() const
295 return GetNode().GetId();
298 Dali::Layer Actor::GetLayer()
302 // Short-circuit for Layer derived actors
305 layer = Dali::Layer(static_cast<Dali::Internal::Layer*>(this)); // static cast as we trust the flag
308 // Find the immediate Layer parent
309 for(Actor* parent = GetParent(); !layer && parent != nullptr; parent = parent->GetParent())
311 if(parent->IsLayer())
313 layer = Dali::Layer(static_cast<Dali::Internal::Layer*>(parent)); // static cast as we trust the flag
320 void Actor::Unparent()
324 // Remove this actor from the parent. The remove will put a relayout request in for
325 // the parent if required
326 mParent->Remove(*this);
327 // mParent is now NULL!
331 void Actor::SetParentOrigin(const Vector3& origin)
333 // node is being used in a separate thread; queue a message to set the value & base value
334 SetParentOriginMessage(GetEventThreadServices(), GetNode(), origin);
336 // Cache for event-thread access
339 // not allocated, check if different from default
340 if(ParentOrigin::DEFAULT != origin)
342 mParentOrigin = new Vector3(origin);
347 // check if different from current costs more than just set
348 *mParentOrigin = origin;
352 const Vector3& Actor::GetCurrentParentOrigin() const
354 // Cached for event-thread access
355 return (mParentOrigin) ? *mParentOrigin : ParentOrigin::DEFAULT;
358 void Actor::SetAnchorPoint(const Vector3& anchor)
360 // node is being used in a separate thread; queue a message to set the value & base value
361 SetAnchorPointMessage(GetEventThreadServices(), GetNode(), anchor);
363 // Cache for event-thread access
366 // not allocated, check if different from default
367 if(AnchorPoint::DEFAULT != anchor)
369 mAnchorPoint = new Vector3(anchor);
374 // check if different from current costs more than just set
375 *mAnchorPoint = anchor;
379 const Vector3& Actor::GetCurrentAnchorPoint() const
381 // Cached for event-thread access
382 return (mAnchorPoint) ? *mAnchorPoint : AnchorPoint::DEFAULT;
385 void Actor::SetPosition(float x, float y)
387 SetPosition(Vector3(x, y, 0.0f));
390 void Actor::SetPosition(float x, float y, float z)
392 SetPosition(Vector3(x, y, z));
395 void Actor::SetPosition(const Vector3& position)
397 mTargetPosition = position;
399 // node is being used in a separate thread; queue a message to set the value & base value
400 SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, position);
403 void Actor::SetX(float x)
405 mTargetPosition.x = x;
407 // node is being used in a separate thread; queue a message to set the value & base value
408 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x);
411 void Actor::SetY(float y)
413 mTargetPosition.y = y;
415 // node is being used in a separate thread; queue a message to set the value & base value
416 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y);
419 void Actor::SetZ(float z)
421 mTargetPosition.z = z;
423 // node is being used in a separate thread; queue a message to set the value & base value
424 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z);
427 void Actor::TranslateBy(const Vector3& distance)
429 mTargetPosition += distance;
431 // node is being used in a separate thread; queue a message to set the value & base value
432 SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelative, distance);
435 const Vector3& Actor::GetCurrentPosition() const
437 // node is being used in a separate thread; copy the value from the previous update
438 return GetNode().GetPosition(GetEventThreadServices().GetEventBufferIndex());
441 const Vector3& Actor::GetCurrentWorldPosition() const
443 // node is being used in a separate thread; copy the value from the previous update
444 return GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex());
447 const Vector2 Actor::GetCurrentScreenPosition() const
449 if(mScene && OnScene())
451 Vector3 worldPosition = GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex());
452 Vector3 cameraPosition = mScene->GetDefaultCameraActor().GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex());
453 worldPosition -= cameraPosition;
455 Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale();
456 Vector2 halfSceneSize(mScene->GetSize() * 0.5f); // World position origin is center of scene
457 Vector3 halfActorSize(actorSize * 0.5f);
458 Vector3 anchorPointOffSet = halfActorSize - actorSize * (mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT);
460 return Vector2(halfSceneSize.width + worldPosition.x - anchorPointOffSet.x,
461 halfSceneSize.height + worldPosition.y - anchorPointOffSet.y);
464 return Vector2::ZERO;
467 void Actor::SetInheritPosition(bool inherit)
469 if(mInheritPosition != inherit)
471 // non animatable so keep local copy
472 mInheritPosition = inherit;
473 SetInheritPositionMessage(GetEventThreadServices(), GetNode(), inherit);
477 void Actor::SetOrientation(const Radian& angle, const Vector3& axis)
479 Vector3 normalizedAxis(axis.x, axis.y, axis.z);
480 normalizedAxis.Normalize();
482 Quaternion orientation(angle, normalizedAxis);
484 SetOrientation(orientation);
487 void Actor::SetOrientation(const Quaternion& orientation)
489 mTargetOrientation = orientation;
491 // node is being used in a separate thread; queue a message to set the value & base value
492 SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::Bake, orientation);
495 void Actor::RotateBy(const Radian& angle, const Vector3& axis)
497 RotateBy(Quaternion(angle, axis));
500 void Actor::RotateBy(const Quaternion& relativeRotation)
502 mTargetOrientation *= Quaternion(relativeRotation);
504 // node is being used in a separate thread; queue a message to set the value & base value
505 SceneGraph::NodeTransformPropertyMessage<Quaternion>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler<Quaternion>::BakeRelative, relativeRotation);
508 const Quaternion& Actor::GetCurrentOrientation() const
510 // node is being used in a separate thread; copy the value from the previous update
511 return GetNode().GetOrientation(GetEventThreadServices().GetEventBufferIndex());
514 const Quaternion& Actor::GetCurrentWorldOrientation() const
516 // node is being used in a separate thread; copy the value from the previous update
517 return GetNode().GetWorldOrientation(GetEventThreadServices().GetEventBufferIndex());
520 void Actor::SetScale(float scale)
522 SetScale(Vector3(scale, scale, scale));
525 void Actor::SetScale(float x, float y, float z)
527 SetScale(Vector3(x, y, z));
530 void Actor::SetScale(const Vector3& scale)
532 mTargetScale = scale;
534 // node is being used in a separate thread; queue a message to set the value & base value
535 SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, scale);
538 void Actor::SetScaleX(float x)
542 // node is being used in a separate thread; queue a message to set the value & base value
543 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, x);
546 void Actor::SetScaleY(float y)
550 // node is being used in a separate thread; queue a message to set the value & base value
551 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, y);
554 void Actor::SetScaleZ(float z)
558 // node is being used in a separate thread; queue a message to set the value & base value
559 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, z);
562 void Actor::ScaleBy(const Vector3& relativeScale)
564 mTargetScale *= relativeScale;
566 // node is being used in a separate thread; queue a message to set the value & base value
567 SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeRelativeMultiply, relativeScale);
570 const Vector3& Actor::GetCurrentScale() const
572 // node is being used in a separate thread; copy the value from the previous update
573 return GetNode().GetScale(GetEventThreadServices().GetEventBufferIndex());
576 const Vector3& Actor::GetCurrentWorldScale() const
578 // node is being used in a separate thread; copy the value from the previous update
579 return GetNode().GetWorldScale(GetEventThreadServices().GetEventBufferIndex());
582 void Actor::SetInheritScale(bool inherit)
584 if(mInheritScale != inherit)
586 // non animatable so keep local copy
587 mInheritScale = inherit;
588 // node is being used in a separate thread; queue a message to set the value
589 SetInheritScaleMessage(GetEventThreadServices(), GetNode(), inherit);
593 Matrix Actor::GetCurrentWorldMatrix() const
595 return GetNode().GetWorldMatrix(0);
598 void Actor::SetVisible(bool visible)
600 SetVisibleInternal(visible, SendMessage::TRUE);
603 bool Actor::IsVisible() const
605 // node is being used in a separate thread; copy the value from the previous update
606 return GetNode().IsVisible(GetEventThreadServices().GetEventBufferIndex());
609 void Actor::SetOpacity(float opacity)
611 mTargetColor.a = opacity;
613 // node is being used in a separate thread; queue a message to set the value & base value
614 SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeW, opacity);
616 RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
619 float Actor::GetCurrentOpacity() const
621 // node is being used in a separate thread; copy the value from the previous update
622 return GetNode().GetOpacity(GetEventThreadServices().GetEventBufferIndex());
625 const Vector4& Actor::GetCurrentWorldColor() const
627 return GetNode().GetWorldColor(GetEventThreadServices().GetEventBufferIndex());
630 void Actor::SetColor(const Vector4& color)
632 mTargetColor = color;
634 // node is being used in a separate thread; queue a message to set the value & base value
635 SceneGraph::NodePropertyMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::Bake, color);
637 RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
640 void Actor::SetColorRed(float red)
642 mTargetColor.r = red;
644 // node is being used in a separate thread; queue a message to set the value & base value
645 SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeX, red);
647 RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
650 void Actor::SetColorGreen(float green)
652 mTargetColor.g = green;
654 // node is being used in a separate thread; queue a message to set the value & base value
655 SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeY, green);
657 RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
660 void Actor::SetColorBlue(float blue)
662 mTargetColor.b = blue;
664 // node is being used in a separate thread; queue a message to set the value & base value
665 SceneGraph::NodePropertyComponentMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty<Vector4>::BakeZ, blue);
667 RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
670 const Vector4& Actor::GetCurrentColor() const
672 // node is being used in a separate thread; copy the value from the previous update
673 return GetNode().GetColor(GetEventThreadServices().GetEventBufferIndex());
676 void Actor::SetInheritOrientation(bool inherit)
678 if(mInheritOrientation != inherit)
680 // non animatable so keep local copy
681 mInheritOrientation = inherit;
682 // node is being used in a separate thread; queue a message to set the value
683 SetInheritOrientationMessage(GetEventThreadServices(), GetNode(), inherit);
687 void Actor::SetSizeModeFactor(const Vector3& factor)
691 mRelayoutData->sizeModeFactor = factor;
694 const Vector3& Actor::GetSizeModeFactor() const
698 return mRelayoutData->sizeModeFactor;
701 return Relayouter::DEFAULT_SIZE_MODE_FACTOR;
704 void Actor::SetColorMode(ColorMode colorMode)
706 // non animatable so keep local copy
707 mColorMode = colorMode;
708 // node is being used in a separate thread; queue a message to set the value
709 SetColorModeMessage(GetEventThreadServices(), GetNode(), colorMode);
712 void Actor::SetSize(float width, float height)
714 SetSize(Vector2(width, height));
717 void Actor::SetSize(float width, float height, float depth)
719 SetSize(Vector3(width, height, depth));
722 void Actor::SetSize(const Vector2& size)
724 SetSize(Vector3(size.width, size.height, 0.f));
727 void Actor::SetSizeInternal(const Vector2& size)
729 SetSizeInternal(Vector3(size.width, size.height, 0.f));
732 void Actor::SetSize(const Vector3& size)
734 if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout)
736 // TODO we cannot just ignore the given Z but that means rewrite the size negotiation!!
737 SetPreferredSize(size.GetVectorXY());
741 SetSizeInternal(size);
745 void Actor::SetSizeInternal(const Vector3& size)
747 // dont allow recursive loop
748 DALI_ASSERT_ALWAYS(!mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet");
749 // check that we have a node AND the new size width, height or depth is at least a little bit different from the old one
750 Vector3 currentSize = GetCurrentSize();
752 if((fabsf(mTargetSize.width - size.width) > Math::MACHINE_EPSILON_1) ||
753 (fabsf(mTargetSize.height - size.height) > Math::MACHINE_EPSILON_1) ||
754 (fabsf(mTargetSize.depth - size.depth) > Math::MACHINE_EPSILON_1) ||
755 (fabsf(mTargetSize.width - currentSize.width) > Math::MACHINE_EPSILON_1) ||
756 (fabsf(mTargetSize.height - currentSize.height) > Math::MACHINE_EPSILON_1) ||
757 (fabsf(mTargetSize.depth - currentSize.depth) > Math::MACHINE_EPSILON_1))
761 // Update the preferred size after relayoutting
762 // It should be used in the next relayoutting
763 if(mUseAnimatedSize & AnimatedSizeFlag::WIDTH && mRelayoutData)
765 mRelayoutData->preferredSize.width = mAnimatedSize.width;
768 if(mUseAnimatedSize & AnimatedSizeFlag::HEIGHT && mRelayoutData)
770 mRelayoutData->preferredSize.height = mAnimatedSize.height;
773 // node is being used in a separate thread; queue a message to set the value & base value
774 SceneGraph::NodeTransformPropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, mTargetSize);
776 // Notification for derived classes
777 mInsideOnSizeSet = true;
778 OnSizeSet(mTargetSize);
779 mInsideOnSizeSet = false;
781 // Raise a relayout request if the flag is not locked
782 if(mRelayoutData && !mRelayoutData->insideRelayout)
789 void Actor::SetWidth(float width)
791 if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout)
793 SetResizePolicy(ResizePolicy::FIXED, Dimension::WIDTH);
794 mRelayoutData->preferredSize.width = width;
798 mTargetSize.width = width;
800 // node is being used in a separate thread; queue a message to set the value & base value
801 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeX, width);
804 mUseAnimatedSize &= ~AnimatedSizeFlag::WIDTH;
809 void Actor::SetHeight(float height)
811 if(IsRelayoutEnabled() && !mRelayoutData->insideRelayout)
813 SetResizePolicy(ResizePolicy::FIXED, Dimension::HEIGHT);
814 mRelayoutData->preferredSize.height = height;
818 mTargetSize.height = height;
820 // node is being used in a separate thread; queue a message to set the value & base value
821 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeY, height);
824 mUseAnimatedSize &= ~AnimatedSizeFlag::HEIGHT;
829 void Actor::SetDepth(float depth)
831 mTargetSize.depth = depth;
833 mUseAnimatedSize &= ~AnimatedSizeFlag::DEPTH;
835 // node is being used in a separate thread; queue a message to set the value & base value
836 SceneGraph::NodeTransformComponentMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler<Vector3>::BakeZ, depth);
839 Vector3 Actor::GetTargetSize() const
841 Vector3 size = mTargetSize;
843 if(mUseAnimatedSize & AnimatedSizeFlag::WIDTH)
845 // Should return animated size if size is animated
846 size.width = mAnimatedSize.width;
850 // Should return preferred size if size is fixed as set by SetSize
851 if(GetResizePolicy(Dimension::WIDTH) == ResizePolicy::FIXED)
853 size.width = GetPreferredSize().width;
857 if(mUseAnimatedSize & AnimatedSizeFlag::HEIGHT)
859 size.height = mAnimatedSize.height;
863 if(GetResizePolicy(Dimension::HEIGHT) == ResizePolicy::FIXED)
865 size.height = GetPreferredSize().height;
869 if(mUseAnimatedSize & AnimatedSizeFlag::DEPTH)
871 size.depth = mAnimatedSize.depth;
877 const Vector3& Actor::GetCurrentSize() const
879 // node is being used in a separate thread; copy the value from the previous update
880 return GetNode().GetSize(GetEventThreadServices().GetEventBufferIndex());
883 Vector3 Actor::GetNaturalSize() const
885 // It is up to deriving classes to return the appropriate natural size
886 return Vector3(0.0f, 0.0f, 0.0f);
889 void Actor::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension)
891 EnsureRelayouter().SetResizePolicy(policy, dimension, mTargetSize);
893 OnSetResizePolicy(policy, dimension);
895 // Trigger relayout on this control
899 ResizePolicy::Type Actor::GetResizePolicy(Dimension::Type dimension) const
903 return mRelayoutData->GetResizePolicy(dimension);
906 return ResizePolicy::DEFAULT;
909 void Actor::SetSizeScalePolicy(SizeScalePolicy::Type policy)
913 mRelayoutData->sizeSetPolicy = policy;
915 // Trigger relayout on this control
919 SizeScalePolicy::Type Actor::GetSizeScalePolicy() const
923 return mRelayoutData->sizeSetPolicy;
926 return Relayouter::DEFAULT_SIZE_SCALE_POLICY;
929 void Actor::SetDimensionDependency(Dimension::Type dimension, Dimension::Type dependency)
931 EnsureRelayouter().SetDimensionDependency(dimension, dependency);
934 Dimension::Type Actor::GetDimensionDependency(Dimension::Type dimension) const
938 return mRelayoutData->GetDimensionDependency(dimension);
941 return Dimension::ALL_DIMENSIONS; // Default
944 void Actor::SetRelayoutEnabled(bool relayoutEnabled)
946 // If relayout data has not been allocated yet and the client is requesting
947 // to disable it, do nothing
948 if(mRelayoutData || relayoutEnabled)
952 DALI_ASSERT_DEBUG(mRelayoutData && "mRelayoutData not created");
954 mRelayoutData->relayoutEnabled = relayoutEnabled;
958 bool Actor::IsRelayoutEnabled() const
960 // Assume that if relayout data has not been allocated yet then
961 // relayout is disabled
962 return mRelayoutData && mRelayoutData->relayoutEnabled;
965 void Actor::SetLayoutDirty(bool dirty, Dimension::Type dimension)
967 EnsureRelayouter().SetLayoutDirty(dirty, dimension);
970 bool Actor::IsLayoutDirty(Dimension::Type dimension) const
972 return mRelayoutData && mRelayoutData->IsLayoutDirty(dimension);
975 bool Actor::RelayoutPossible(Dimension::Type dimension) const
977 return mRelayoutData && mRelayoutData->relayoutEnabled && !IsLayoutDirty(dimension);
980 bool Actor::RelayoutRequired(Dimension::Type dimension) const
982 return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty(dimension);
985 uint32_t Actor::AddRenderer(Renderer& renderer)
989 mRenderers = new RendererContainer(GetEventThreadServices());
991 return mRenderers->Add(GetNode(), renderer, mIsBlendEquationSet, mBlendEquation);
994 uint32_t Actor::GetRendererCount() const
996 return mRenderers ? mRenderers->GetCount() : 0u;
999 RendererPtr Actor::GetRendererAt(uint32_t index)
1001 return mRenderers ? mRenderers->GetRendererAt(index) : nullptr;
1004 void Actor::RemoveRenderer(Renderer& renderer)
1008 mRenderers->Remove(GetNode(), renderer);
1012 void Actor::RemoveRenderer(uint32_t index)
1016 mRenderers->Remove(GetNode(), index);
1020 void Actor::SetBlendEquation(DevelBlendEquation::Type blendEquation)
1022 if(Dali::Capabilities::IsBlendEquationSupported(blendEquation))
1024 if(mBlendEquation != blendEquation)
1026 mBlendEquation = blendEquation;
1029 mRenderers->SetBlending(blendEquation);
1032 mIsBlendEquationSet = true;
1036 DALI_LOG_ERROR("Invalid blend equation is entered.\n");
1040 DevelBlendEquation::Type Actor::GetBlendEquation() const
1042 return mBlendEquation;
1045 void Actor::SetTransparent(bool transparent)
1047 SetTransparentMessage(GetEventThreadServices(), GetNode(), transparent);
1050 bool Actor::IsTransparent() const
1052 return GetNode().IsTransparent();
1055 void Actor::SetDrawMode(DrawMode::Type drawMode)
1057 // this flag is not animatable so keep the value
1058 mDrawMode = drawMode;
1060 // node is being used in a separate thread; queue a message to set the value
1061 SetDrawModeMessage(GetEventThreadServices(), GetNode(), drawMode);
1064 bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const
1066 return mScene && OnScene() && ConvertScreenToLocalRenderTaskList(mScene->GetRenderTaskList(), GetNode().GetWorldMatrix(0), GetCurrentSize(), localX, localY, screenX, screenY);
1069 bool Actor::ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const
1071 return OnScene() && ConvertScreenToLocalRenderTask(renderTask, GetNode().GetWorldMatrix(0), GetCurrentSize(), localX, localY, screenX, screenY);
1074 bool Actor::ScreenToLocal(const Matrix& viewMatrix, const Matrix& projectionMatrix, const Viewport& viewport, float& localX, float& localY, float screenX, float screenY) const
1076 return OnScene() && ConvertScreenToLocal(viewMatrix, projectionMatrix, GetNode().GetWorldMatrix(0), GetCurrentSize(), viewport, localX, localY, screenX, screenY);
1079 ActorGestureData& Actor::GetGestureData()
1081 // Likely scenario is that once gesture-data is created for this actor, the actor will require
1082 // that gesture for its entire life-time so no need to destroy it until the actor is destroyed
1083 if(nullptr == mGestureData)
1085 mGestureData = new ActorGestureData;
1087 return *mGestureData;
1090 bool Actor::IsGestureRequired(GestureType::Value type) const
1092 return mGestureData && mGestureData->IsGestureRequired(type);
1095 bool Actor::EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch)
1097 return EmitConsumingSignal(*this, mInterceptTouchedSignal, touch);
1100 bool Actor::EmitTouchEventSignal(const Dali::TouchEvent& touch)
1102 return EmitConsumingSignal(*this, mTouchedSignal, touch);
1105 bool Actor::EmitHoverEventSignal(const Dali::HoverEvent& event)
1107 return EmitConsumingSignal(*this, mHoveredSignal, event);
1110 bool Actor::EmitWheelEventSignal(const Dali::WheelEvent& event)
1112 return EmitConsumingSignal(*this, mWheelEventSignal, event);
1115 void Actor::EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type)
1117 EmitSignal(*this, mVisibilityChangedSignal, visible, type);
1120 void Actor::EmitLayoutDirectionChangedSignal(LayoutDirection::Type type)
1122 EmitSignal(*this, mLayoutDirectionChangedSignal, type);
1125 DevelActor::ChildChangedSignalType& Actor::ChildAddedSignal()
1127 return mParentImpl.ChildAddedSignal();
1130 DevelActor::ChildChangedSignalType& Actor::ChildRemovedSignal()
1132 return mParentImpl.ChildRemovedSignal();
1135 DevelActor::ChildOrderChangedSignalType& Actor::ChildOrderChangedSignal()
1137 return mParentImpl.ChildOrderChangedSignal();
1140 bool Actor::DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor)
1142 bool connected(true);
1143 Actor* actor = static_cast<Actor*>(object); // TypeRegistry guarantees that this is the correct type.
1145 std::string_view name(signalName);
1147 if(name == SIGNAL_HOVERED)
1149 actor->HoveredSignal().Connect(tracker, functor);
1151 else if(signalName == SIGNAL_WHEEL_EVENT)
1153 actor->WheelEventSignal().Connect(tracker, functor);
1155 else if(name == SIGNAL_ON_SCENE)
1157 actor->OnSceneSignal().Connect(tracker, functor);
1159 else if(name == SIGNAL_OFF_SCENE)
1161 actor->OffSceneSignal().Connect(tracker, functor);
1163 else if(name == SIGNAL_ON_RELAYOUT)
1165 actor->OnRelayoutSignal().Connect(tracker, functor);
1167 else if(name == SIGNAL_TOUCHED)
1169 actor->TouchedSignal().Connect(tracker, functor);
1171 else if(name == SIGNAL_VISIBILITY_CHANGED)
1173 actor->VisibilityChangedSignal().Connect(tracker, functor);
1175 else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED)
1177 actor->LayoutDirectionChangedSignal().Connect(tracker, functor);
1179 else if(name == SIGNAL_CHILD_ADDED)
1181 actor->ChildAddedSignal().Connect(tracker, functor);
1183 else if(name == SIGNAL_CHILD_REMOVED)
1185 actor->ChildRemovedSignal().Connect(tracker, functor);
1189 // signalName does not match any signal
1196 Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node)
1201 mRenderers(nullptr),
1202 mParentOrigin(nullptr),
1203 mAnchorPoint(nullptr),
1204 mRelayoutData(nullptr),
1205 mGestureData(nullptr),
1206 mInterceptTouchedSignal(),
1209 mWheelEventSignal(),
1212 mOnRelayoutSignal(),
1213 mVisibilityChangedSignal(),
1214 mLayoutDirectionChangedSignal(),
1215 mTargetOrientation(Quaternion::IDENTITY),
1216 mTargetColor(Color::WHITE),
1217 mTargetSize(Vector3::ZERO),
1218 mTargetPosition(Vector3::ZERO),
1219 mTargetScale(Vector3::ONE),
1220 mAnimatedSize(Vector3::ZERO),
1221 mTouchAreaOffset(0, 0, 0, 0),
1225 mUseAnimatedSize(AnimatedSizeFlag::CLEAR),
1226 mIsRoot(ROOT_LAYER == derivedType),
1227 mIsLayer(LAYER == derivedType || ROOT_LAYER == derivedType),
1230 mLeaveRequired(false),
1231 mKeyboardFocusable(false),
1232 mKeyboardFocusableChildren(true),
1233 mTouchFocusable(false),
1234 mOnSceneSignalled(false),
1235 mInsideOnSizeSet(false),
1236 mInheritPosition(true),
1237 mInheritOrientation(true),
1238 mInheritScale(true),
1239 mPositionUsesAnchorPoint(true),
1241 mInheritLayoutDirection(true),
1242 mCaptureAllTouchAfterStart(false),
1243 mIsBlendEquationSet(false),
1244 mNeedGesturePropagation(false),
1245 mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
1246 mDrawMode(DrawMode::NORMAL),
1247 mColorMode(Node::DEFAULT_COLOR_MODE),
1248 mClippingMode(ClippingMode::DISABLED),
1249 mBlendEquation(DevelBlendEquation::ADD)
1253 void Actor::Initialize()
1257 GetEventThreadServices().RegisterObject(this);
1262 // Remove mParent pointers from children even if we're destroying core,
1263 // to guard against GetParent() & Unparent() calls from CustomActor destructors.
1267 // Guard to allow handle destruction after Core has been destroyed
1268 if(EventThreadServices::IsCoreRunning())
1270 // Root layer will destroy its node in its own destructor
1273 DestroyNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode());
1275 GetEventThreadServices().UnregisterObject(this);
1279 // Cleanup optional gesture data
1280 delete mGestureData;
1282 // Cleanup optional parent origin and anchor
1283 delete mParentOrigin;
1284 delete mAnchorPoint;
1286 // Delete optional relayout data
1287 delete mRelayoutData;
1290 void Actor::Add(Actor& child, bool notify)
1292 mParentImpl.Add(child, notify);
1295 void Actor::Remove(Actor& child, bool notify)
1297 mParentImpl.Remove(child, notify);
1300 void Actor::SwitchParent(Actor& newParent)
1302 if(this == &newParent)
1304 DALI_LOG_ERROR("Cannot add actor to itself");
1308 if(!this->OnScene() || !newParent.OnScene())
1310 DALI_LOG_ERROR("Both of current parent and new parent must be on Scene");
1314 newParent.Add(*this, false);
1317 uint32_t Actor::GetChildCount() const
1319 return mParentImpl.GetChildCount();
1322 ActorPtr Actor::GetChildAt(uint32_t index) const
1324 return mParentImpl.GetChildAt(index);
1327 ActorContainer& Actor::GetChildrenInternal()
1329 return mParentImpl.GetChildrenInternal();
1332 ActorPtr Actor::FindChildByName(ConstString actorName)
1334 return mParentImpl.FindChildByName(actorName);
1337 ActorPtr Actor::FindChildById(const uint32_t id)
1339 return mParentImpl.FindChildById(id);
1342 void Actor::UnparentChildren()
1344 mParentImpl.UnparentChildren();
1347 void Actor::ConnectToScene(uint32_t parentDepth, bool notify)
1349 // This container is used instead of walking the Actor hierarchy.
1350 // It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks.
1351 ActorContainer connectionList;
1355 mScene->RequestRebuildDepthTree();
1358 // This stage is not interrupted by user callbacks.
1359 mParentImpl.RecursiveConnectToScene(connectionList, parentDepth + 1);
1361 // Notify applications about the newly connected actors.
1362 for(const auto& actor : connectionList)
1364 actor->NotifyStageConnection(notify);
1371 * This method is called when the Actor is connected to the Stage.
1372 * The parent must have added its Node to the scene-graph.
1373 * The child must connect its Node to the parent's Node.
1374 * This is recursive; the child calls ConnectToScene() for its children.
1376 void Actor::ConnectToSceneGraph()
1378 DALI_ASSERT_DEBUG(mParent != NULL);
1380 // Reparent Node in next Update
1381 ConnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetParent()->GetNode(), GetNode());
1383 // Request relayout on all actors that are added to the scenegraph
1386 // Notification for Object::Observers
1390 void Actor::NotifyStageConnection(bool notify)
1392 // Actors can be removed (in a callback), before the on-stage stage is reported.
1393 // The actor may also have been reparented, in which case mOnSceneSignalled will be true.
1394 if(OnScene() && !mOnSceneSignalled)
1398 // Notification for external (CustomActor) derived classes
1399 OnSceneConnectionExternal(mDepth);
1401 if(!mOnSceneSignal.Empty())
1403 Dali::Actor handle(this);
1404 mOnSceneSignal.Emit(handle);
1408 // Guard against Remove during callbacks
1411 mOnSceneSignalled = true; // signal required next time Actor is removed
1416 void Actor::DisconnectFromStage(bool notify)
1418 // This container is used instead of walking the Actor hierachy.
1419 // It protects us when the Actor hierachy is modified during OnSceneDisconnectionExternal callbacks.
1420 ActorContainer disconnectionList;
1424 mScene->RequestRebuildDepthTree();
1427 // This stage is not interrupted by user callbacks
1428 mParentImpl.RecursiveDisconnectFromScene(disconnectionList);
1430 // Notify applications about the newly disconnected actors.
1431 for(const auto& actor : disconnectionList)
1433 actor->NotifyStageDisconnection(notify);
1438 * This method is called by an actor or its parent, before a node removal message is sent.
1439 * This is recursive; the child calls DisconnectFromStage() for its children.
1441 void Actor::DisconnectFromSceneGraph()
1443 // Notification for Object::Observers
1444 OnSceneObjectRemove();
1447 void Actor::NotifyStageDisconnection(bool notify)
1449 // Actors can be added (in a callback), before the off-stage state is reported.
1450 // Also if the actor was added & removed before mOnSceneSignalled was set, then we don't notify here.
1451 // only do this step if there is a stage, i.e. Core is not being shut down
1452 if(EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled)
1456 // Notification for external (CustomeActor) derived classes
1457 OnSceneDisconnectionExternal();
1459 if(!mOffSceneSignal.Empty())
1461 Dali::Actor handle(this);
1462 mOffSceneSignal.Emit(handle);
1466 // Guard against Add during callbacks
1469 mOnSceneSignalled = false; // signal required next time Actor is added
1474 bool Actor::IsNodeConnected() const
1476 return OnScene() && (IsRoot() || GetNode().GetParent());
1479 // This method initiates traversal of the actor tree using depth-first
1480 // traversal to set a depth index based on traversal order. It sends a
1481 // single message to update manager to update all the actor's nodes in
1482 // this tree with the depth index. The sceneGraphNodeDepths vector's
1483 // elements are ordered by depth, and could be used to reduce sorting
1484 // in the update thread.
1485 void Actor::RebuildDepthTree()
1487 DALI_LOG_TIMER_START(depthTimer);
1489 // Vector of scene-graph nodes and their depths to send to UpdateManager
1490 // in a single message
1491 OwnerPointer<SceneGraph::NodeDepths> sceneGraphNodeDepths(new SceneGraph::NodeDepths());
1493 int32_t depthIndex = 1;
1494 mParentImpl.DepthTraverseActorTree(sceneGraphNodeDepths, depthIndex);
1496 SetDepthIndicesMessage(GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths);
1497 DALI_LOG_TIMER_END(depthTimer, gLogFilter, Debug::Concise, "Depth tree traversal time: ");
1500 void Actor::SetDefaultProperty(Property::Index index, const Property::Value& property)
1502 PropertyHandler::SetDefaultProperty(*this, index, property);
1505 // TODO: This method needs to be removed
1506 void Actor::SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value)
1508 PropertyHandler::SetSceneGraphProperty(index, entry, value, GetEventThreadServices(), GetNode());
1511 Property::Value Actor::GetDefaultProperty(Property::Index index) const
1513 Property::Value value;
1515 if(!GetCachedPropertyValue(index, value))
1517 // If property value is not stored in the event-side, then it must be a scene-graph only property
1518 GetCurrentPropertyValue(index, value);
1524 Property::Value Actor::GetDefaultPropertyCurrentValue(Property::Index index) const
1526 Property::Value value;
1528 if(!GetCurrentPropertyValue(index, value))
1530 // If unable to retrieve scene-graph property value, then it must be an event-side only property
1531 GetCachedPropertyValue(index, value);
1537 void Actor::OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType)
1539 PropertyHandler::OnNotifyDefaultPropertyAnimation(*this, animation, index, value, animationType);
1542 const PropertyBase* Actor::GetSceneObjectAnimatableProperty(Property::Index index) const
1544 const PropertyBase* property = PropertyHandler::GetSceneObjectAnimatableProperty(index, GetNode());
1547 // not our property, ask base
1548 property = Object::GetSceneObjectAnimatableProperty(index);
1554 const PropertyInputImpl* Actor::GetSceneObjectInputProperty(Property::Index index) const
1556 const PropertyInputImpl* property = PropertyHandler::GetSceneObjectInputProperty(index, GetNode());
1559 // reuse animatable property getter as animatable properties are inputs as well
1560 // animatable property chains back to Object::GetSceneObjectInputProperty() so all properties get covered
1561 property = GetSceneObjectAnimatableProperty(index);
1567 int32_t Actor::GetPropertyComponentIndex(Property::Index index) const
1569 int32_t componentIndex = PropertyHandler::GetPropertyComponentIndex(index);
1570 if(Property::INVALID_COMPONENT_INDEX == componentIndex)
1573 componentIndex = Object::GetPropertyComponentIndex(index);
1576 return componentIndex;
1579 const SceneGraph::Node& Actor::GetNode() const
1581 return *static_cast<const SceneGraph::Node*>(mUpdateObject);
1588 mParent->RaiseChild(*this);
1592 DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
1600 mParent->LowerChild(*this);
1604 DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
1608 void Actor::RaiseToTop()
1612 mParent->RaiseChildToTop(*this);
1616 DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
1620 void Actor::LowerToBottom()
1624 mParent->LowerChildToBottom(*this);
1628 DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
1632 void Actor::RaiseAbove(Internal::Actor& target)
1636 mParent->RaiseChildAbove(*this, target);
1640 DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
1644 void Actor::LowerBelow(Internal::Actor& target)
1648 mParent->LowerChildBelow(*this, target);
1652 DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n");
1656 void Actor::SetParent(ActorParent* parent, bool notify)
1660 DALI_ASSERT_ALWAYS(!mParent && "Actor cannot have 2 parents");
1663 Actor* parentActor = static_cast<Actor*>(parent);
1664 mScene = parentActor->mScene;
1666 if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
1667 parentActor->OnScene())
1669 // Instruct each actor to create a corresponding node in the scene graph
1670 ConnectToScene(parentActor->GetHierarchyDepth(), notify);
1673 // Resolve the name and index for the child properties if any
1674 ResolveChildProperties();
1676 else // parent being set to NULL
1678 DALI_ASSERT_ALWAYS(mParent != nullptr && "Actor should have a parent");
1682 if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
1685 // Disconnect the Node & its children from the scene-graph.
1686 DisconnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode());
1688 // Instruct each actor to discard pointers to the scene-graph
1689 DisconnectFromStage(notify);
1696 bool Actor::DoAction(BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */)
1699 Actor* actor = dynamic_cast<Actor*>(object);
1703 std::string_view name(actionName);
1704 if(name == ACTION_SHOW)
1706 actor->SetVisible(true);
1709 else if(name == ACTION_HIDE)
1711 actor->SetVisible(false);
1719 Rect<> Actor::CalculateScreenExtents() const
1721 auto screenPosition = GetCurrentScreenPosition();
1722 Vector3 size = GetCurrentSize() * GetCurrentWorldScale();
1723 Vector3 anchorPointOffSet = size * (mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT);
1724 Vector2 position = Vector2(screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y);
1725 return {position.x, position.y, size.x, size.y};
1728 void Actor::SetNeedGesturePropagation(bool propagation)
1730 mNeedGesturePropagation = propagation;
1733 bool Actor::NeedGesturePropagation()
1735 return mNeedGesturePropagation;
1738 bool Actor::GetCachedPropertyValue(Property::Index index, Property::Value& value) const
1740 return PropertyHandler::GetCachedPropertyValue(*this, index, value);
1743 bool Actor::GetCurrentPropertyValue(Property::Index index, Property::Value& value) const
1745 return PropertyHandler::GetCurrentPropertyValue(*this, index, value);
1748 Actor::Relayouter& Actor::EnsureRelayouter()
1750 // Assign relayouter
1753 mRelayoutData = new Relayouter();
1756 return *mRelayoutData;
1759 bool Actor::RelayoutDependentOnParent(Dimension::Type dimension)
1761 // Check if actor is dependent on parent
1762 for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
1764 if((dimension & (1 << i)))
1766 const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
1767 if(resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT)
1777 bool Actor::RelayoutDependentOnChildren(Dimension::Type dimension)
1779 // Check if actor is dependent on children
1780 for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
1782 if((dimension & (1 << i)))
1784 const ResizePolicy::Type resizePolicy = GetResizePolicy(static_cast<Dimension::Type>(1 << i));
1785 switch(resizePolicy)
1787 case ResizePolicy::FIT_TO_CHILDREN:
1788 case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children
1804 bool Actor::RelayoutDependentOnChildrenBase(Dimension::Type dimension)
1806 return Actor::RelayoutDependentOnChildren(dimension);
1809 bool Actor::RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension)
1811 // Check each possible dimension and see if it is dependent on the input one
1812 for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
1814 if(dimension & (1 << i))
1816 return mRelayoutData->resizePolicies[i] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[i] == dependentDimension;
1823 void Actor::SetNegotiatedDimension(float negotiatedDimension, Dimension::Type dimension)
1825 for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
1827 if(dimension & (1 << i))
1829 mRelayoutData->negotiatedDimensions[i] = negotiatedDimension;
1834 float Actor::GetNegotiatedDimension(Dimension::Type dimension) const
1836 // If more than one dimension is requested, just return the first one found
1837 for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
1839 if((dimension & (1 << i)))
1841 return mRelayoutData->negotiatedDimensions[i];
1845 return 0.0f; // Default
1848 void Actor::SetPadding(const Vector2& padding, Dimension::Type dimension)
1850 EnsureRelayouter().SetPadding(padding, dimension);
1853 Vector2 Actor::GetPadding(Dimension::Type dimension) const
1857 // If more than one dimension is requested, just return the first one found
1858 for(uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i)
1860 if((dimension & (1 << i)))
1862 return mRelayoutData->dimensionPadding[i];
1867 return Relayouter::DEFAULT_DIMENSION_PADDING;
1870 void Actor::SetLayoutNegotiated(bool negotiated, Dimension::Type dimension)
1872 EnsureRelayouter().SetLayoutNegotiated(negotiated, dimension);
1875 bool Actor::IsLayoutNegotiated(Dimension::Type dimension) const
1877 return mRelayoutData && mRelayoutData->IsLayoutNegotiated(dimension);
1880 float Actor::GetHeightForWidthBase(float width)
1882 const Vector3 naturalSize = GetNaturalSize();
1883 return naturalSize.width > 0.0f ? naturalSize.height * width / naturalSize.width : width;
1886 float Actor::GetWidthForHeightBase(float height)
1888 const Vector3 naturalSize = GetNaturalSize();
1889 return naturalSize.height > 0.0f ? naturalSize.width * height / naturalSize.height : height;
1892 float Actor::CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension)
1894 // Fill to parent, taking size mode factor into account
1895 switch(child.GetResizePolicy(dimension))
1897 case ResizePolicy::FILL_TO_PARENT:
1899 return GetLatestSize(dimension);
1902 case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
1904 return GetLatestSize(dimension) * GetDimensionValue(child.GetProperty<Vector3>(Dali::Actor::Property::SIZE_MODE_FACTOR), dimension);
1907 case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
1909 return GetLatestSize(dimension) + GetDimensionValue(child.GetProperty<Vector3>(Dali::Actor::Property::SIZE_MODE_FACTOR), dimension);
1914 return GetLatestSize(dimension);
1919 float Actor::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension)
1921 // Can be overridden in derived class
1922 return CalculateChildSizeBase(child, dimension);
1925 float Actor::GetHeightForWidth(float width)
1927 // Can be overridden in derived class
1928 return GetHeightForWidthBase(width);
1931 float Actor::GetWidthForHeight(float height)
1933 // Can be overridden in derived class
1934 return GetWidthForHeightBase(height);
1937 float Actor::GetLatestSize(Dimension::Type dimension) const
1939 return IsLayoutNegotiated(dimension) ? GetNegotiatedDimension(dimension) : GetSize(dimension);
1942 float Actor::GetRelayoutSize(Dimension::Type dimension) const
1944 Vector2 padding = GetPadding(dimension);
1946 return GetLatestSize(dimension) + padding.x + padding.y;
1949 float Actor::NegotiateFromParent(Dimension::Type dimension)
1951 Actor* parent = GetParent();
1954 Vector2 padding(GetPadding(dimension));
1955 Vector2 parentPadding(parent->GetPadding(dimension));
1956 return parent->CalculateChildSize(Dali::Actor(this), dimension) - parentPadding.x - parentPadding.y - padding.x - padding.y;
1962 float Actor::NegotiateFromChildren(Dimension::Type dimension)
1964 float maxDimensionPoint = 0.0f;
1966 for(uint32_t i = 0, count = GetChildCount(); i < count; ++i)
1968 ActorPtr child = GetChildAt(i);
1970 if(!child->RelayoutDependentOnParent(dimension))
1972 // Calculate the min and max points that the children range across
1973 float childPosition = GetDimensionValue(child->GetTargetPosition(), dimension);
1974 float dimensionSize = child->GetRelayoutSize(dimension);
1975 maxDimensionPoint = std::max(maxDimensionPoint, childPosition + dimensionSize);
1979 return maxDimensionPoint;
1982 float Actor::GetSize(Dimension::Type dimension) const
1984 return GetDimensionValue(mTargetSize, dimension);
1987 float Actor::GetNaturalSize(Dimension::Type dimension) const
1989 return GetDimensionValue(GetNaturalSize(), dimension);
1992 float Actor::CalculateSize(Dimension::Type dimension, const Vector2& maximumSize)
1994 switch(GetResizePolicy(dimension))
1996 case ResizePolicy::USE_NATURAL_SIZE:
1998 return GetNaturalSize(dimension);
2001 case ResizePolicy::FIXED:
2003 return GetDimensionValue(GetPreferredSize(), dimension);
2006 case ResizePolicy::USE_ASSIGNED_SIZE:
2008 return GetDimensionValue(maximumSize, dimension);
2011 case ResizePolicy::FILL_TO_PARENT:
2012 case ResizePolicy::SIZE_RELATIVE_TO_PARENT:
2013 case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT:
2015 return NegotiateFromParent(dimension);
2018 case ResizePolicy::FIT_TO_CHILDREN:
2020 return NegotiateFromChildren(dimension);
2023 case ResizePolicy::DIMENSION_DEPENDENCY:
2025 const Dimension::Type dimensionDependency = GetDimensionDependency(dimension);
2028 if(dimension == Dimension::WIDTH && dimensionDependency == Dimension::HEIGHT)
2030 return GetWidthForHeight(GetNegotiatedDimension(Dimension::HEIGHT));
2033 if(dimension == Dimension::HEIGHT && dimensionDependency == Dimension::WIDTH)
2035 return GetHeightForWidth(GetNegotiatedDimension(Dimension::WIDTH));
2047 return 0.0f; // Default
2050 Vector2 Actor::ApplySizeSetPolicy(const Vector2& size)
2052 return mRelayoutData->ApplySizeSetPolicy(*this, size);
2055 void Actor::SetNegotiatedSize(RelayoutContainer& container)
2057 // Do the set actor size
2058 Vector2 negotiatedSize(GetLatestSize(Dimension::WIDTH), GetLatestSize(Dimension::HEIGHT));
2060 // Adjust for size set policy
2061 negotiatedSize = ApplySizeSetPolicy(negotiatedSize);
2063 // Lock the flag to stop recursive relayouts on set size
2064 mRelayoutData->insideRelayout = true;
2065 SetSize(negotiatedSize);
2066 mRelayoutData->insideRelayout = false;
2068 // Clear flags for all dimensions
2069 SetLayoutDirty(false);
2071 // Give deriving classes a chance to respond
2072 OnRelayout(negotiatedSize, container);
2074 if(!mOnRelayoutSignal.Empty())
2076 Dali::Actor handle(this);
2077 mOnRelayoutSignal.Emit(handle);
2080 mRelayoutData->relayoutRequested = false;
2083 void Actor::NegotiateSize(const Vector2& allocatedSize, RelayoutContainer& container)
2085 Relayouter::NegotiateSize(*this, allocatedSize, container);
2088 void Actor::SetUseAssignedSize(bool use, Dimension::Type dimension)
2092 mRelayoutData->SetUseAssignedSize(use, dimension);
2096 bool Actor::GetUseAssignedSize(Dimension::Type dimension) const
2098 return mRelayoutData && mRelayoutData->GetUseAssignedSize(dimension);
2101 void Actor::RelayoutRequest(Dimension::Type dimension)
2103 Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get();
2104 if(relayoutController)
2106 Dali::Actor self(this);
2107 relayoutController->RequestRelayout(self, dimension);
2111 mRelayoutData->relayoutRequested = true;
2116 void Actor::SetPreferredSize(const Vector2& size)
2118 EnsureRelayouter().SetPreferredSize(*this, size);
2121 Vector2 Actor::GetPreferredSize() const
2123 return mRelayoutData ? Vector2(mRelayoutData->preferredSize) : Relayouter::DEFAULT_PREFERRED_SIZE;
2126 void Actor::SetMinimumSize(float size, Dimension::Type dimension)
2128 EnsureRelayouter().SetMinimumSize(size, dimension);
2132 float Actor::GetMinimumSize(Dimension::Type dimension) const
2134 return mRelayoutData ? mRelayoutData->GetMinimumSize(dimension) : 0.0f;
2137 void Actor::SetMaximumSize(float size, Dimension::Type dimension)
2139 EnsureRelayouter().SetMaximumSize(size, dimension);
2143 float Actor::GetMaximumSize(Dimension::Type dimension) const
2145 return mRelayoutData ? mRelayoutData->GetMaximumSize(dimension) : FLT_MAX;
2148 void Actor::SetVisibleInternal(bool visible, SendMessage::Type sendMessage)
2150 if(mVisible != visible)
2152 if(sendMessage == SendMessage::TRUE)
2154 // node is being used in a separate thread; queue a message to set the value & base value
2155 SceneGraph::NodePropertyMessage<bool>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty<bool>::Bake, visible);
2157 RequestRenderingMessage(GetEventThreadServices().GetUpdateManager());
2162 // Emit the signal on this actor and all its children
2163 mParentImpl.EmitVisibilityChangedSignalRecursively(visible, DevelActor::VisibilityChange::SELF);
2167 void Actor::SetSiblingOrderOfChild(Actor& child, uint32_t order)
2169 mParentImpl.SetSiblingOrderOfChild(child, order);
2172 uint32_t Actor::GetSiblingOrderOfChild(const Actor& child) const
2174 return mParentImpl.GetSiblingOrderOfChild(child);
2177 void Actor::RaiseChild(Actor& child)
2179 mParentImpl.RaiseChild(child);
2182 void Actor::LowerChild(Actor& child)
2184 mParentImpl.LowerChild(child);
2187 void Actor::RaiseChildToTop(Actor& child)
2189 mParentImpl.RaiseChildToTop(child);
2192 void Actor::LowerChildToBottom(Actor& child)
2194 mParentImpl.LowerChildToBottom(child);
2197 void Actor::RaiseChildAbove(Actor& child, Actor& target)
2199 mParentImpl.RaiseChildAbove(child, target);
2202 void Actor::LowerChildBelow(Actor& child, Actor& target)
2204 mParentImpl.LowerChildBelow(child, target);
2207 void Actor::SetInheritLayoutDirection(bool inherit)
2209 if(mInheritLayoutDirection != inherit)
2211 mInheritLayoutDirection = inherit;
2213 if(inherit && mParent)
2215 mParentImpl.InheritLayoutDirectionRecursively(GetParent()->mLayoutDirection);
2220 void Actor::SetUpdateSizeHint(const Vector2& updateSizeHint)
2222 // node is being used in a separate thread; queue a message to set the value & base value
2223 SceneGraph::NodePropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty<Vector3>::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f));
2226 } // namespace Internal