X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Factors%2Factor-impl.cpp;h=2df7181ca7e908769ad797da13c06ed9e19fe113;hb=032363632332b2657f0afe41d1b47ead0621b374;hp=96e5a676735c263eaa6ccff36fa7734f46cf92c9;hpb=d73f8e9d136fd843f96690e8d9a1c9c7170baff3;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp old mode 100755 new mode 100644 index 96e5a67..2df7181 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,55 +19,54 @@ #include // EXTERNAL INCLUDES -#include #include -#include +#include // INTERNAL INCLUDES -#include -#include #include +#include +#include #include #include -#include #include -#include + #include -#include +#include + +#include + +#include +#include #include -#include -#include #include #include -#include #include #include #include #include #include +#include #include #include -#include +#include +#include #include -#include +#include -using Dali::Internal::SceneGraph::Node; using Dali::Internal::SceneGraph::AnimatableProperty; +using Dali::Internal::SceneGraph::Node; using Dali::Internal::SceneGraph::PropertyBase; #if defined(DEBUG_ENABLED) -Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER" ); +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_DEPTH_TIMER"); #endif namespace Dali { - namespace Internal { - namespace // unnamed namespace { - // Properties /** @@ -76,77 +75,80 @@ namespace // unnamed namespace * Name Type writable animatable constraint-input enum for index-checking */ DALI_PROPERTY_TABLE_BEGIN -DALI_PROPERTY( "parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN ) -DALI_PROPERTY( "parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X ) -DALI_PROPERTY( "parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y ) -DALI_PROPERTY( "parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z ) -DALI_PROPERTY( "anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT ) -DALI_PROPERTY( "anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X ) -DALI_PROPERTY( "anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y ) -DALI_PROPERTY( "anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z ) -DALI_PROPERTY( "size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE ) -DALI_PROPERTY( "sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH ) -DALI_PROPERTY( "sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT ) -DALI_PROPERTY( "sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH ) -DALI_PROPERTY( "position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION ) -DALI_PROPERTY( "positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X ) -DALI_PROPERTY( "positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y ) -DALI_PROPERTY( "positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z ) -DALI_PROPERTY( "worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION ) -DALI_PROPERTY( "worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X ) -DALI_PROPERTY( "worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y ) -DALI_PROPERTY( "worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z ) -DALI_PROPERTY( "orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION ) -DALI_PROPERTY( "worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION ) -DALI_PROPERTY( "scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE ) -DALI_PROPERTY( "scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X ) -DALI_PROPERTY( "scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y ) -DALI_PROPERTY( "scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z ) -DALI_PROPERTY( "worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE ) -DALI_PROPERTY( "visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE ) -DALI_PROPERTY( "color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR ) -DALI_PROPERTY( "colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED ) -DALI_PROPERTY( "colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN ) -DALI_PROPERTY( "colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE ) -DALI_PROPERTY( "colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA ) -DALI_PROPERTY( "worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR ) -DALI_PROPERTY( "worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX ) -DALI_PROPERTY( "name", STRING, true, false, false, Dali::Actor::Property::NAME ) -DALI_PROPERTY( "sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE ) -DALI_PROPERTY( "leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED ) -DALI_PROPERTY( "inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION ) -DALI_PROPERTY( "inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE ) -DALI_PROPERTY( "colorMode", INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE ) -DALI_PROPERTY( "drawMode", INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE ) -DALI_PROPERTY( "sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR ) -DALI_PROPERTY( "widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY ) -DALI_PROPERTY( "heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY ) -DALI_PROPERTY( "sizeScalePolicy", INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY ) -DALI_PROPERTY( "widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT ) -DALI_PROPERTY( "heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH ) -DALI_PROPERTY( "padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING ) -DALI_PROPERTY( "minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE ) -DALI_PROPERTY( "maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE ) -DALI_PROPERTY( "inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION ) -DALI_PROPERTY( "clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE ) -DALI_PROPERTY( "layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION ) -DALI_PROPERTY( "inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION ) -DALI_PROPERTY( "opacity", FLOAT, true, true, true, Dali::Actor::Property::OPACITY ) -DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION ) -DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT ) -DALI_PROPERTY( "culled", BOOLEAN, false, false, true, Dali::Actor::Property::CULLED ) -DALI_PROPERTY( "id", INTEGER, false, false, false, Dali::Actor::Property::ID ) -DALI_PROPERTY( "hierarchyDepth", INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH ) -DALI_PROPERTY( "isRoot", BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT ) -DALI_PROPERTY( "isLayer", BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER ) -DALI_PROPERTY( "connectedToScene", BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE ) -DALI_PROPERTY( "keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE ) -DALI_PROPERTY( "siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER ) -DALI_PROPERTY( "updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT ) -DALI_PROPERTY( "captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START ) -DALI_PROPERTY( "touchArea", VECTOR2, true, false, false, Dali::DevelActor::Property::TOUCH_AREA ) -DALI_PROPERTY( "blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION ) -DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties ) +DALI_PROPERTY("parentOrigin", VECTOR3, true, false, true, Dali::Actor::Property::PARENT_ORIGIN) +DALI_PROPERTY("parentOriginX", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_X) +DALI_PROPERTY("parentOriginY", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Y) +DALI_PROPERTY("parentOriginZ", FLOAT, true, false, true, Dali::Actor::Property::PARENT_ORIGIN_Z) +DALI_PROPERTY("anchorPoint", VECTOR3, true, false, true, Dali::Actor::Property::ANCHOR_POINT) +DALI_PROPERTY("anchorPointX", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_X) +DALI_PROPERTY("anchorPointY", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Y) +DALI_PROPERTY("anchorPointZ", FLOAT, true, false, true, Dali::Actor::Property::ANCHOR_POINT_Z) +DALI_PROPERTY("size", VECTOR3, true, true, true, Dali::Actor::Property::SIZE) +DALI_PROPERTY("sizeWidth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_WIDTH) +DALI_PROPERTY("sizeHeight", FLOAT, true, true, true, Dali::Actor::Property::SIZE_HEIGHT) +DALI_PROPERTY("sizeDepth", FLOAT, true, true, true, Dali::Actor::Property::SIZE_DEPTH) +DALI_PROPERTY("position", VECTOR3, true, true, true, Dali::Actor::Property::POSITION) +DALI_PROPERTY("positionX", FLOAT, true, true, true, Dali::Actor::Property::POSITION_X) +DALI_PROPERTY("positionY", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Y) +DALI_PROPERTY("positionZ", FLOAT, true, true, true, Dali::Actor::Property::POSITION_Z) +DALI_PROPERTY("worldPosition", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_POSITION) +DALI_PROPERTY("worldPositionX", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_X) +DALI_PROPERTY("worldPositionY", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Y) +DALI_PROPERTY("worldPositionZ", FLOAT, false, false, true, Dali::Actor::Property::WORLD_POSITION_Z) +DALI_PROPERTY("orientation", ROTATION, true, true, true, Dali::Actor::Property::ORIENTATION) +DALI_PROPERTY("worldOrientation", ROTATION, false, false, true, Dali::Actor::Property::WORLD_ORIENTATION) +DALI_PROPERTY("scale", VECTOR3, true, true, true, Dali::Actor::Property::SCALE) +DALI_PROPERTY("scaleX", FLOAT, true, true, true, Dali::Actor::Property::SCALE_X) +DALI_PROPERTY("scaleY", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Y) +DALI_PROPERTY("scaleZ", FLOAT, true, true, true, Dali::Actor::Property::SCALE_Z) +DALI_PROPERTY("worldScale", VECTOR3, false, false, true, Dali::Actor::Property::WORLD_SCALE) +DALI_PROPERTY("visible", BOOLEAN, true, true, true, Dali::Actor::Property::VISIBLE) +DALI_PROPERTY("color", VECTOR4, true, true, true, Dali::Actor::Property::COLOR) +DALI_PROPERTY("colorRed", FLOAT, true, true, true, Dali::Actor::Property::COLOR_RED) +DALI_PROPERTY("colorGreen", FLOAT, true, true, true, Dali::Actor::Property::COLOR_GREEN) +DALI_PROPERTY("colorBlue", FLOAT, true, true, true, Dali::Actor::Property::COLOR_BLUE) +DALI_PROPERTY("colorAlpha", FLOAT, true, true, true, Dali::Actor::Property::COLOR_ALPHA) +DALI_PROPERTY("worldColor", VECTOR4, false, false, true, Dali::Actor::Property::WORLD_COLOR) +DALI_PROPERTY("worldMatrix", MATRIX, false, false, true, Dali::Actor::Property::WORLD_MATRIX) +DALI_PROPERTY("name", STRING, true, false, false, Dali::Actor::Property::NAME) +DALI_PROPERTY("sensitive", BOOLEAN, true, false, false, Dali::Actor::Property::SENSITIVE) +DALI_PROPERTY("leaveRequired", BOOLEAN, true, false, false, Dali::Actor::Property::LEAVE_REQUIRED) +DALI_PROPERTY("inheritOrientation", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_ORIENTATION) +DALI_PROPERTY("inheritScale", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_SCALE) +DALI_PROPERTY("colorMode", INTEGER, true, false, false, Dali::Actor::Property::COLOR_MODE) +DALI_PROPERTY("drawMode", INTEGER, true, false, false, Dali::Actor::Property::DRAW_MODE) +DALI_PROPERTY("sizeModeFactor", VECTOR3, true, false, false, Dali::Actor::Property::SIZE_MODE_FACTOR) +DALI_PROPERTY("widthResizePolicy", STRING, true, false, false, Dali::Actor::Property::WIDTH_RESIZE_POLICY) +DALI_PROPERTY("heightResizePolicy", STRING, true, false, false, Dali::Actor::Property::HEIGHT_RESIZE_POLICY) +DALI_PROPERTY("sizeScalePolicy", INTEGER, true, false, false, Dali::Actor::Property::SIZE_SCALE_POLICY) +DALI_PROPERTY("widthForHeight", BOOLEAN, true, false, false, Dali::Actor::Property::WIDTH_FOR_HEIGHT) +DALI_PROPERTY("heightForWidth", BOOLEAN, true, false, false, Dali::Actor::Property::HEIGHT_FOR_WIDTH) +DALI_PROPERTY("padding", VECTOR4, true, false, false, Dali::Actor::Property::PADDING) +DALI_PROPERTY("minimumSize", VECTOR2, true, false, false, Dali::Actor::Property::MINIMUM_SIZE) +DALI_PROPERTY("maximumSize", VECTOR2, true, false, false, Dali::Actor::Property::MAXIMUM_SIZE) +DALI_PROPERTY("inheritPosition", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_POSITION) +DALI_PROPERTY("clippingMode", STRING, true, false, false, Dali::Actor::Property::CLIPPING_MODE) +DALI_PROPERTY("layoutDirection", STRING, true, false, false, Dali::Actor::Property::LAYOUT_DIRECTION) +DALI_PROPERTY("inheritLayoutDirection", BOOLEAN, true, false, false, Dali::Actor::Property::INHERIT_LAYOUT_DIRECTION) +DALI_PROPERTY("opacity", FLOAT, true, true, true, Dali::Actor::Property::OPACITY) +DALI_PROPERTY("screenPosition", VECTOR2, false, false, false, Dali::Actor::Property::SCREEN_POSITION) +DALI_PROPERTY("positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::Actor::Property::POSITION_USES_ANCHOR_POINT) +DALI_PROPERTY("culled", BOOLEAN, false, false, true, Dali::Actor::Property::CULLED) +DALI_PROPERTY("id", INTEGER, false, false, false, Dali::Actor::Property::ID) +DALI_PROPERTY("hierarchyDepth", INTEGER, false, false, false, Dali::Actor::Property::HIERARCHY_DEPTH) +DALI_PROPERTY("isRoot", BOOLEAN, false, false, false, Dali::Actor::Property::IS_ROOT) +DALI_PROPERTY("isLayer", BOOLEAN, false, false, false, Dali::Actor::Property::IS_LAYER) +DALI_PROPERTY("connectedToScene", BOOLEAN, false, false, false, Dali::Actor::Property::CONNECTED_TO_SCENE) +DALI_PROPERTY("keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Property::KEYBOARD_FOCUSABLE) +DALI_PROPERTY("siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER) +DALI_PROPERTY("updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT) +DALI_PROPERTY("captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START) +DALI_PROPERTY("touchAreaOffset", RECTANGLE, true, false, false, Dali::DevelActor::Property::TOUCH_AREA_OFFSET) +DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION) +DALI_PROPERTY("touchFocusable", BOOLEAN, true, false, false, Dali::DevelActor::Property::TOUCH_FOCUSABLE) +DALI_PROPERTY("keyboardFocusableChildren", BOOLEAN, true, false, false, Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) +DALI_PROPERTY("userInteractionEnabled", BOOLEAN, true, false, false, Dali::DevelActor::Property::USER_INTERACTION_ENABLED) +DALI_PROPERTY_TABLE_END(DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties) // Signals @@ -171,93 +173,132 @@ BaseHandle CreateActor() return Dali::Actor::New(); } -TypeRegistration mType( typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties ); - -SignalConnectorType signalConnector2(mType, std::string(SIGNAL_HOVERED), &Actor::DoConnectSignal); -SignalConnectorType signalConnector3(mType, std::string(SIGNAL_WHEEL_EVENT), &Actor::DoConnectSignal); -SignalConnectorType signalConnector4(mType, std::string(SIGNAL_ON_SCENE), &Actor::DoConnectSignal); -SignalConnectorType signalConnector5(mType, std::string(SIGNAL_OFF_SCENE), &Actor::DoConnectSignal); -SignalConnectorType signalConnector6(mType, std::string(SIGNAL_ON_RELAYOUT), &Actor::DoConnectSignal); -SignalConnectorType signalConnector7(mType, std::string(SIGNAL_TOUCHED), &Actor::DoConnectSignal); -SignalConnectorType signalConnector8(mType, std::string(SIGNAL_VISIBILITY_CHANGED), &Actor::DoConnectSignal); -SignalConnectorType signalConnector9(mType, std::string(SIGNAL_LAYOUT_DIRECTION_CHANGED), &Actor::DoConnectSignal); -SignalConnectorType signalConnector10(mType, std::string(SIGNAL_CHILD_ADDED), &Actor::DoConnectSignal); -SignalConnectorType signalConnector11(mType, std::string(SIGNAL_CHILD_REMOVED), &Actor::DoConnectSignal); - -TypeAction a1(mType, std::string(ACTION_SHOW), &Actor::DoAction); -TypeAction a2(mType, std::string(ACTION_HIDE), &Actor::DoAction); - /** - * @brief Extract a given dimension from a Vector2 - * - * @param[in] values The values to extract from - * @param[in] dimension The dimension to extract - * @return Return the value for the dimension + * Connects a callback function with the object's signals. + * @param[in] object The object providing the signal. + * @param[in] tracker Used to disconnect the signal. + * @param[in] signalName The signal to connect to. + * @param[in] functor A newly allocated FunctorDelegate. + * @return True if the signal was connected. + * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor. */ -constexpr float GetDimensionValue( const Vector2& values, Dimension::Type dimension ) +static bool DoConnectSignal(BaseObject* object, + ConnectionTrackerInterface* tracker, + const std::string& signalName, + FunctorDelegate* functor) { - switch( dimension ) + bool connected(true); + Actor* actor = static_cast(object); // TypeRegistry guarantees that this is the correct type. + + std::string_view name(signalName); + + if(name == SIGNAL_HOVERED) { - case Dimension::WIDTH: - { - return values.width; - } - case Dimension::HEIGHT: - { - return values.height; - } - default: - { - break; - } + actor->HoveredSignal().Connect(tracker, functor); + } + else if(signalName == SIGNAL_WHEEL_EVENT) + { + actor->WheelEventSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_ON_SCENE) + { + actor->OnSceneSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_OFF_SCENE) + { + actor->OffSceneSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_ON_RELAYOUT) + { + actor->OnRelayoutSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_TOUCHED) + { + actor->TouchedSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_VISIBILITY_CHANGED) + { + actor->VisibilityChangedSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED) + { + actor->LayoutDirectionChangedSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_CHILD_ADDED) + { + actor->ChildAddedSignal().Connect(tracker, functor); + } + else if(name == SIGNAL_CHILD_REMOVED) + { + actor->ChildRemovedSignal().Connect(tracker, functor); + } + else + { + // signalName does not match any signal + connected = false; } - return 0.0f; -} -/** - * @brief Extract a given dimension from a Vector3 - * - * @param[in] values The values to extract from - * @param[in] dimension The dimension to extract - * @return Return the value for the dimension - */ -float GetDimensionValue( const Vector3& values, Dimension::Type dimension ) -{ - return GetDimensionValue( values.GetVectorXY(), dimension ); + return connected; } /** - * @brief Recursively emits the visibility-changed-signal on the actor tree. - * @param[in] actor The actor to emit the signal on - * @param[in] visible The new visibility of the actor - * @param[in] type Whether the actor's visible property has changed or a parent's + * Performs actions as requested using the action name. + * @param[in] object The object on which to perform the action. + * @param[in] actionName The action to perform. + * @param[in] attributes The attributes with which to perfrom this action. + * @return true if the action was done. */ -void EmitVisibilityChangedSignalRecursively( ActorPtr actor, bool visible, DevelActor::VisibilityChange::Type type ) +bool DoAction(BaseObject* object, + const std::string& actionName, + const Property::Map& attributes) { - if( actor ) - { - actor->EmitVisibilityChangedSignal( visible, type ); + bool done = false; + Actor* actor = dynamic_cast(object); - if( actor->GetChildCount() > 0 ) + if(actor) + { + std::string_view name(actionName); + if(name == ACTION_SHOW) { - for( auto& child : actor->GetChildrenInternal() ) - { - EmitVisibilityChangedSignalRecursively( child, visible, DevelActor::VisibilityChange::PARENT ); - } + actor->SetVisible(true); + done = true; + } + else if(name == ACTION_HIDE) + { + actor->SetVisible(false); + done = true; } } + + return done; } +TypeRegistration mType(typeid(Dali::Actor), typeid(Dali::Handle), CreateActor, ActorDefaultProperties); + +SignalConnectorType signalConnector2(mType, std::string(SIGNAL_HOVERED), &DoConnectSignal); +SignalConnectorType signalConnector3(mType, std::string(SIGNAL_WHEEL_EVENT), &DoConnectSignal); +SignalConnectorType signalConnector4(mType, std::string(SIGNAL_ON_SCENE), &DoConnectSignal); +SignalConnectorType signalConnector5(mType, std::string(SIGNAL_OFF_SCENE), &DoConnectSignal); +SignalConnectorType signalConnector6(mType, std::string(SIGNAL_ON_RELAYOUT), &DoConnectSignal); +SignalConnectorType signalConnector7(mType, std::string(SIGNAL_TOUCHED), &DoConnectSignal); +SignalConnectorType signalConnector8(mType, std::string(SIGNAL_VISIBILITY_CHANGED), &DoConnectSignal); +SignalConnectorType signalConnector9(mType, std::string(SIGNAL_LAYOUT_DIRECTION_CHANGED), &DoConnectSignal); +SignalConnectorType signalConnector10(mType, std::string(SIGNAL_CHILD_ADDED), &DoConnectSignal); +SignalConnectorType signalConnector11(mType, std::string(SIGNAL_CHILD_REMOVED), &DoConnectSignal); + +TypeAction a1(mType, std::string(ACTION_SHOW), &DoAction); +TypeAction a2(mType, std::string(ACTION_HIDE), &DoAction); + /// Helper for emitting a signal template -bool EmitConsumingSignal( Actor& actor, Signal& signal, const Event& event ) +bool EmitConsumingSignal(Actor& actor, Signal& signal, const Event& event) { bool consumed = false; - if( !signal.Empty() ) + if(!signal.Empty()) { - Dali::Actor handle( &actor ); - consumed = signal.Emit( handle, event ); + Dali::Actor handle(&actor); + consumed = signal.Emit(handle, event); } return consumed; @@ -265,67 +306,42 @@ bool EmitConsumingSignal( Actor& actor, Signal& signal, const Event& event ) /// Helper for emitting signals with multiple parameters template -void EmitSignal( Actor& actor, Signal& signal, Param... params) +void EmitSignal(Actor& actor, Signal& signal, Param... params) { - if( !signal.Empty() ) + if(!signal.Empty()) { - Dali::Actor handle( &actor ); - signal.Emit( handle, params... ); + Dali::Actor handle(&actor); + signal.Emit(handle, params...); } } -bool ScreenToLocalInternal( - const Matrix& viewMatrix, - const Matrix& projectionMatrix, - const Matrix& worldMatrix, - const Viewport& viewport, - const Vector3& currentSize, - float& localX, - float& localY, - float screenX, - float screenY ) -{ - // Get the ModelView matrix - Matrix modelView; - Matrix::Multiply( modelView, worldMatrix, viewMatrix ); - - // Calculate the inverted ModelViewProjection matrix; this will be used for 2 unprojects - Matrix invertedMvp( false/*don't init*/); - Matrix::Multiply( invertedMvp, modelView, projectionMatrix ); - bool success = invertedMvp.Invert(); +using ActorParentSiblingOrderMethod = void (ActorParent::*)(Actor&); +using ActorParentSiblingOrderMethodWithTarget = void (ActorParent::*)(Actor&, Actor&); - // Convert to GL coordinates - Vector4 screenPos( screenX - static_cast( viewport.x ), static_cast( viewport.height ) - screenY - static_cast( viewport.y ), 0.f, 1.f ); - - Vector4 nearPos; - if( success ) +/// Helper to check and call actor sibling methods in ActorParent +void CheckParentAndCall(ActorParent* parent, Actor& actor, ActorParentSiblingOrderMethod memberFunction) +{ + if(parent) { - success = Unproject( screenPos, invertedMvp, static_cast( viewport.width ), static_cast( viewport.height ), nearPos ); + (parent->*memberFunction)(actor); } - - Vector4 farPos; - if( success ) + else { - screenPos.z = 1.0f; - success = Unproject( screenPos, invertedMvp, static_cast( viewport.width ), static_cast( viewport.height ), farPos ); + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } +} - if( success ) +/// Helper to check and call actor sibling methods with a target parameter in ActorParent +void CheckParentAndCall(ActorParent* parent, Actor& actor, Actor& target, ActorParentSiblingOrderMethodWithTarget memberFunction) +{ + if(parent) { - Vector4 local; - if( XyPlaneIntersect( nearPos, farPos, local ) ) - { - Vector3 size = currentSize; - localX = local.x + size.x * 0.5f; - localY = local.y + size.y * 0.5f; - } - else - { - success = false; - } + (parent->*memberFunction)(actor, target); + } + else + { + DALI_LOG_WARNING("Actor must have a parent, Sibling order not changed.\n"); } - - return success; } } // unnamed namespace @@ -333,7 +349,7 @@ bool ScreenToLocalInternal( ActorPtr Actor::New() { // pass a reference to actor, actor does not own its node - ActorPtr actor( new Actor( BASIC, *CreateNode() ) ); + ActorPtr actor(new Actor(BASIC, *CreateNode())); // Second-phase construction actor->Initialize(); @@ -344,23 +360,23 @@ ActorPtr Actor::New() const SceneGraph::Node* Actor::CreateNode() { // create node. Nodes are owned by the update manager - SceneGraph::Node* node = SceneGraph::Node::New(); - OwnerPointer< SceneGraph::Node > transferOwnership( node ); - Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal(); + SceneGraph::Node* node = SceneGraph::Node::New(); + OwnerPointer transferOwnership(node); + Internal::ThreadLocalStorage* tls = Internal::ThreadLocalStorage::GetInternal(); - DALI_ASSERT_ALWAYS( tls && "ThreadLocalStorage is null" ); + DALI_ASSERT_ALWAYS(tls && "ThreadLocalStorage is null"); - AddNodeMessage( tls->GetUpdateManager(), transferOwnership ); + AddNodeMessage(tls->GetUpdateManager(), transferOwnership); return node; } -void Actor::SetName( const std::string& name ) +void Actor::SetName(std::string_view name) { - mName = name; + mName = ConstString(name); // ATTENTION: string for debug purposes is not thread safe. - DALI_LOG_SET_OBJECT_STRING( const_cast< SceneGraph::Node* >( &GetNode() ), name ); + DALI_LOG_SET_OBJECT_STRING(const_cast(&GetNode()), mName.GetCString()); } uint32_t Actor::GetId() const @@ -373,198 +389,46 @@ Dali::Layer Actor::GetLayer() Dali::Layer layer; // Short-circuit for Layer derived actors - if( mIsLayer ) + if(mIsLayer) { - layer = Dali::Layer( static_cast< Dali::Internal::Layer* >( this ) ); // static cast as we trust the flag + layer = Dali::Layer(static_cast(this)); // static cast as we trust the flag } // Find the immediate Layer parent - for( Actor* parent = mParent; !layer && parent != nullptr; parent = parent->GetParent() ) + for(Actor* parent = GetParent(); !layer && parent != nullptr; parent = parent->GetParent()) { - if( parent->IsLayer() ) + if(parent->IsLayer()) { - layer = Dali::Layer( static_cast< Dali::Internal::Layer* >( parent ) ); // static cast as we trust the flag + layer = Dali::Layer(static_cast(parent)); // static cast as we trust the flag } } return layer; } -void Actor::Add( Actor& child ) -{ - DALI_ASSERT_ALWAYS( this != &child && "Cannot add actor to itself" ); - DALI_ASSERT_ALWAYS( !child.IsRoot() && "Cannot add root actor" ); - - if( !mChildren ) - { - mChildren = new ActorContainer; - } - - Actor* const oldParent( child.mParent ); - - // child might already be ours - if( this != oldParent ) - { - // if we already have parent, unparent us first - if( oldParent ) - { - oldParent->Remove( child ); // This causes OnChildRemove callback & ChildRemoved signal - - // Old parent may need to readjust to missing child - if( oldParent->RelayoutDependentOnChildren() ) - { - oldParent->RelayoutRequest(); - } - } - - // Guard against Add() during previous OnChildRemove callback - if( !child.mParent ) - { - // Do this first, since user callbacks from within SetParent() may need to remove child - mChildren->push_back( ActorPtr( &child ) ); - - // SetParent asserts that child can be added - child.SetParent( this ); - - // Notification for derived classes - OnChildAdd( child ); - EmitChildAddedSignal( child ); - - InheritLayoutDirectionRecursively( ActorPtr( &child ), mLayoutDirection ); - - // Only put in a relayout request if there is a suitable dependency - if( RelayoutDependentOnChildren() ) - { - RelayoutRequest(); - } - } - } -} - -void Actor::Remove( Actor& child ) -{ - if( (this == &child) || (!mChildren) ) - { - // no children or removing itself - return; - } - - ActorPtr removed; - - // Find the child in mChildren, and unparent it - ActorIter end = mChildren->end(); - for( ActorIter iter = mChildren->begin(); iter != end; ++iter ) - { - ActorPtr actor = (*iter); - - if( actor.Get() == &child ) - { - // Keep handle for OnChildRemove notification - removed = actor; - - // Do this first, since user callbacks from within SetParent() may need to add the child - mChildren->erase( iter ); - - DALI_ASSERT_DEBUG( actor->GetParent() == this ); - actor->SetParent( nullptr ); - - break; - } - } - - if( removed ) - { - // Only put in a relayout request if there is a suitable dependency - if( RelayoutDependentOnChildren() ) - { - RelayoutRequest(); - } - } - - // Notification for derived classes - OnChildRemove( child ); - EmitChildRemovedSignal( child ); -} - void Actor::Unparent() { - if( mParent ) + if(mParent) { // Remove this actor from the parent. The remove will put a relayout request in for // the parent if required - mParent->Remove( *this ); + mParent->Remove(*this); // mParent is now NULL! } } -uint32_t Actor::GetChildCount() const -{ - return ( nullptr != mChildren ) ? static_cast( mChildren->size() ) : 0; // only 4,294,967,295 children per actor -} - -ActorPtr Actor::GetChildAt( uint32_t index ) const -{ - DALI_ASSERT_ALWAYS( index < GetChildCount() ); - - return ( ( mChildren ) ? ( *mChildren )[ index ] : ActorPtr() ); -} - -ActorPtr Actor::FindChildByName( const std::string& actorName ) -{ - ActorPtr child = nullptr; - if( actorName == mName ) - { - child = this; - } - else if( mChildren ) - { - for( const auto& actor : *mChildren ) - { - child = actor->FindChildByName( actorName ); - - if( child ) - { - break; - } - } - } - return child; -} - -ActorPtr Actor::FindChildById( const uint32_t id ) -{ - ActorPtr child = nullptr; - if( id == GetId() ) - { - child = this; - } - else if( mChildren ) - { - for( const auto& actor : *mChildren ) - { - child = actor->FindChildById( id ); - - if( child ) - { - break; - } - } - } - return child; -} - -void Actor::SetParentOrigin( const Vector3& origin ) +void Actor::SetParentOrigin(const Vector3& origin) { // node is being used in a separate thread; queue a message to set the value & base value - SetParentOriginMessage( GetEventThreadServices(), GetNode(), origin ); + SetParentOriginMessage(GetEventThreadServices(), GetNode(), origin); // Cache for event-thread access - if( !mParentOrigin ) + if(!mParentOrigin) { // not allocated, check if different from default - if( ParentOrigin::DEFAULT != origin ) + if(ParentOrigin::DEFAULT != origin) { - mParentOrigin = new Vector3( origin ); + mParentOrigin = new Vector3(origin); } } else @@ -577,21 +441,21 @@ void Actor::SetParentOrigin( const Vector3& origin ) const Vector3& Actor::GetCurrentParentOrigin() const { // Cached for event-thread access - return ( mParentOrigin ) ? *mParentOrigin : ParentOrigin::DEFAULT; + return (mParentOrigin) ? *mParentOrigin : ParentOrigin::DEFAULT; } -void Actor::SetAnchorPoint( const Vector3& anchor ) +void Actor::SetAnchorPoint(const Vector3& anchor) { // node is being used in a separate thread; queue a message to set the value & base value - SetAnchorPointMessage( GetEventThreadServices(), GetNode(), anchor ); + SetAnchorPointMessage(GetEventThreadServices(), GetNode(), anchor); // Cache for event-thread access - if( !mAnchorPoint ) + if(!mAnchorPoint) { // not allocated, check if different from default - if( AnchorPoint::DEFAULT != anchor ) + if(AnchorPoint::DEFAULT != anchor) { - mAnchorPoint = new Vector3( anchor ); + mAnchorPoint = new Vector3(anchor); } } else @@ -604,57 +468,57 @@ void Actor::SetAnchorPoint( const Vector3& anchor ) const Vector3& Actor::GetCurrentAnchorPoint() const { // Cached for event-thread access - return ( mAnchorPoint ) ? *mAnchorPoint : AnchorPoint::DEFAULT; + return (mAnchorPoint) ? *mAnchorPoint : AnchorPoint::DEFAULT; } -void Actor::SetPosition( float x, float y ) +void Actor::SetPosition(float x, float y) { - SetPosition( Vector3( x, y, 0.0f ) ); + SetPosition(Vector3(x, y, 0.0f)); } -void Actor::SetPosition( float x, float y, float z ) +void Actor::SetPosition(float x, float y, float z) { - SetPosition( Vector3( x, y, z ) ); + SetPosition(Vector3(x, y, z)); } -void Actor::SetPosition( const Vector3& position ) +void Actor::SetPosition(const Vector3& position) { mTargetPosition = position; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::Bake, position ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::Bake, position); } -void Actor::SetX( float x ) +void Actor::SetX(float x) { mTargetPosition.x = x; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeX, x ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeX, x); } -void Actor::SetY( float y ) +void Actor::SetY(float y) { mTargetPosition.y = y; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeY, y ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeY, y); } -void Actor::SetZ( float z ) +void Actor::SetZ(float z) { mTargetPosition.z = z; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z); } -void Actor::TranslateBy( const Vector3& distance ) +void Actor::TranslateBy(const Vector3& distance) { mTargetPosition += distance; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, distance ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mPosition, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, distance); } const Vector3& Actor::GetCurrentPosition() const @@ -666,68 +530,58 @@ const Vector3& Actor::GetCurrentPosition() const const Vector3& Actor::GetCurrentWorldPosition() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldPosition(GetEventThreadServices().GetEventBufferIndex()); } const Vector2 Actor::GetCurrentScreenPosition() const { - if( mScene && OnScene() ) + if(mScene) { - Vector3 worldPosition = GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); - Vector3 cameraPosition = mScene->GetDefaultCameraActor().GetNode().GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); - worldPosition -= cameraPosition; - - Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale(); - Vector2 halfSceneSize( mScene->GetSize() * 0.5f ); // World position origin is center of scene - Vector3 halfActorSize( actorSize * 0.5f ); - Vector3 anchorPointOffSet = halfActorSize - actorSize * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT ); - - return Vector2( halfSceneSize.width + worldPosition.x - anchorPointOffSet.x, - halfSceneSize.height + worldPosition.y - anchorPointOffSet.y ); + BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex(); + return CalculateActorScreenPosition(*this, bufferIndex); } - return Vector2::ZERO; } -void Actor::SetInheritPosition( bool inherit ) +void Actor::SetInheritPosition(bool inherit) { - if( mInheritPosition != inherit ) + if(mInheritPosition != inherit) { // non animatable so keep local copy mInheritPosition = inherit; - SetInheritPositionMessage( GetEventThreadServices(), GetNode(), inherit ); + SetInheritPositionMessage(GetEventThreadServices(), GetNode(), inherit); } } -void Actor::SetOrientation( const Radian& angle, const Vector3& axis ) +void Actor::SetOrientation(const Radian& angle, const Vector3& axis) { - Vector3 normalizedAxis( axis.x, axis.y, axis.z ); + Vector3 normalizedAxis(axis.x, axis.y, axis.z); normalizedAxis.Normalize(); - Quaternion orientation( angle, normalizedAxis ); + Quaternion orientation(angle, normalizedAxis); - SetOrientation( orientation ); + SetOrientation(orientation); } -void Actor::SetOrientation( const Quaternion& orientation ) +void Actor::SetOrientation(const Quaternion& orientation) { mTargetOrientation = orientation; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::Bake, orientation ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::Bake, orientation); } -void Actor::RotateBy( const Radian& angle, const Vector3& axis ) +void Actor::RotateBy(const Radian& angle, const Vector3& axis) { - RotateBy( Quaternion(angle, axis) ); + RotateBy(Quaternion(angle, axis)); } -void Actor::RotateBy( const Quaternion& relativeRotation ) +void Actor::RotateBy(const Quaternion& relativeRotation) { - mTargetOrientation *= Quaternion( relativeRotation ); + mTargetOrientation *= Quaternion(relativeRotation); // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, relativeRotation ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mOrientation, &SceneGraph::TransformManagerPropertyHandler::BakeRelative, relativeRotation); } const Quaternion& Actor::GetCurrentOrientation() const @@ -739,49 +593,49 @@ const Quaternion& Actor::GetCurrentOrientation() const const Quaternion& Actor::GetCurrentWorldOrientation() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetWorldOrientation( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldOrientation(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetScale( float scale ) +void Actor::SetScale(float scale) { - SetScale( Vector3( scale, scale, scale ) ); + SetScale(Vector3(scale, scale, scale)); } -void Actor::SetScale( float x, float y, float z ) +void Actor::SetScale(float x, float y, float z) { - SetScale( Vector3( x, y, z ) ); + SetScale(Vector3(x, y, z)); } -void Actor::SetScale( const Vector3& scale ) +void Actor::SetScale(const Vector3& scale) { mTargetScale = scale; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::Bake, scale ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::Bake, scale); } -void Actor::SetScaleX( float x ) +void Actor::SetScaleX(float x) { mTargetScale.x = x; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeX, x ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeX, x); } -void Actor::SetScaleY( float y ) +void Actor::SetScaleY(float y) { mTargetScale.y = y; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeY, y ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeY, y); } -void Actor::SetScaleZ( float z ) +void Actor::SetScaleZ(float z) { mTargetScale.z = z; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z ); + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeZ, z); } void Actor::ScaleBy(const Vector3& relativeScale) @@ -789,7 +643,7 @@ void Actor::ScaleBy(const Vector3& relativeScale) mTargetScale *= relativeScale; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeRelativeMultiply, relativeScale ); + SceneGraph::NodeTransformPropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mScale, &SceneGraph::TransformManagerPropertyHandler::BakeRelativeMultiply, relativeScale); } const Vector3& Actor::GetCurrentScale() const @@ -801,17 +655,17 @@ const Vector3& Actor::GetCurrentScale() const const Vector3& Actor::GetCurrentWorldScale() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetWorldScale( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldScale(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetInheritScale( bool inherit ) +void Actor::SetInheritScale(bool inherit) { - if( mInheritScale != inherit ) + if(mInheritScale != inherit) { // non animatable so keep local copy mInheritScale = inherit; // node is being used in a separate thread; queue a message to set the value - SetInheritScaleMessage( GetEventThreadServices(), GetNode(), inherit ); + SetInheritScaleMessage(GetEventThreadServices(), GetNode(), inherit); } } @@ -820,25 +674,25 @@ Matrix Actor::GetCurrentWorldMatrix() const return GetNode().GetWorldMatrix(0); } -void Actor::SetVisible( bool visible ) +void Actor::SetVisible(bool visible) { - SetVisibleInternal( visible, SendMessage::TRUE ); + SetVisibleInternal(visible, SendMessage::TRUE); } bool Actor::IsVisible() const { // node is being used in a separate thread; copy the value from the previous update - return GetNode().IsVisible( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().IsVisible(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetOpacity( float opacity ) +void Actor::SetOpacity(float opacity) { mTargetColor.a = opacity; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeW, opacity ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeW, opacity); - RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() ); + RequestRenderingMessage(GetEventThreadServices().GetUpdateManager()); } float Actor::GetCurrentOpacity() const @@ -849,47 +703,47 @@ float Actor::GetCurrentOpacity() const const Vector4& Actor::GetCurrentWorldColor() const { - return GetNode().GetWorldColor( GetEventThreadServices().GetEventBufferIndex() ); + return GetNode().GetWorldColor(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetColor( const Vector4& color ) +void Actor::SetColor(const Vector4& color) { mTargetColor = color; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::Bake, color ); + SceneGraph::NodePropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::Bake, color); - RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() ); + RequestRenderingMessage(GetEventThreadServices().GetUpdateManager()); } -void Actor::SetColorRed( float red ) +void Actor::SetColorRed(float red) { mTargetColor.r = red; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeX, red ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeX, red); - RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() ); + RequestRenderingMessage(GetEventThreadServices().GetUpdateManager()); } -void Actor::SetColorGreen( float green ) +void Actor::SetColorGreen(float green) { mTargetColor.g = green; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeY, green ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeY, green); - RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() ); + RequestRenderingMessage(GetEventThreadServices().GetUpdateManager()); } -void Actor::SetColorBlue( float blue ) +void Actor::SetColorBlue(float blue) { mTargetColor.b = blue; // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeZ, blue ); + SceneGraph::NodePropertyComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mColor, &AnimatableProperty::BakeZ, blue); - RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() ); + RequestRenderingMessage(GetEventThreadServices().GetUpdateManager()); } const Vector4& Actor::GetCurrentColor() const @@ -898,378 +752,174 @@ const Vector4& Actor::GetCurrentColor() const return GetNode().GetColor(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetInheritOrientation( bool inherit ) +void Actor::SetInheritOrientation(bool inherit) { - if( mInheritOrientation != inherit ) + if(mInheritOrientation != inherit) { // non animatable so keep local copy mInheritOrientation = inherit; // node is being used in a separate thread; queue a message to set the value - SetInheritOrientationMessage( GetEventThreadServices(), GetNode(), inherit ); + SetInheritOrientationMessage(GetEventThreadServices(), GetNode(), inherit); } } -void Actor::SetSizeModeFactor( const Vector3& factor ) +void Actor::SetSizeModeFactor(const Vector3& factor) { - EnsureRelayouter(); - - mRelayoutData->sizeModeFactor = factor; + mSizer.SetSizeModeFactor(factor); } const Vector3& Actor::GetSizeModeFactor() const { - if ( mRelayoutData ) - { - return mRelayoutData->sizeModeFactor; - } - - return Relayouter::DEFAULT_SIZE_MODE_FACTOR; + return mSizer.GetSizeModeFactor(); } -void Actor::SetColorMode( ColorMode colorMode ) +void Actor::SetColorMode(ColorMode colorMode) { // non animatable so keep local copy mColorMode = colorMode; // node is being used in a separate thread; queue a message to set the value - SetColorModeMessage( GetEventThreadServices(), GetNode(), colorMode ); + SetColorModeMessage(GetEventThreadServices(), GetNode(), colorMode); } -void Actor::SetSize( float width, float height ) +void Actor::SetSize(float width, float height) { - SetSize( Vector2( width, height ) ); + SetSize(Vector2(width, height)); } -void Actor::SetSize( float width, float height, float depth ) +void Actor::SetSize(float width, float height, float depth) { - SetSize( Vector3( width, height, depth ) ); + SetSize(Vector3(width, height, depth)); } -void Actor::SetSize( const Vector2& size ) +void Actor::SetSize(const Vector2& size) { - SetSize( Vector3( size.width, size.height, 0.f ) ); + SetSize(Vector3(size.width, size.height, 0.f)); } -void Actor::SetSizeInternal( const Vector2& size ) +void Actor::SetSize(const Vector3& size) { - SetSizeInternal( Vector3( size.width, size.height, 0.f ) ); + mSizer.SetSize(size); } -void Actor::SetSize( const Vector3& size ) +void Actor::SetWidth(float width) { - if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout ) - { - // TODO we cannot just ignore the given Z but that means rewrite the size negotiation!! - SetPreferredSize( size.GetVectorXY() ); - } - else - { - SetSizeInternal( size ); - } + mSizer.SetWidth(width); } -void Actor::SetSizeInternal( const Vector3& size ) +void Actor::SetHeight(float height) { - // dont allow recursive loop - DALI_ASSERT_ALWAYS( !mInsideOnSizeSet && "Cannot call SetSize from OnSizeSet" ); - // 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 - if( ( fabsf( mTargetSize.width - size.width ) > Math::MACHINE_EPSILON_1 )|| - ( fabsf( mTargetSize.height- size.height ) > Math::MACHINE_EPSILON_1 )|| - ( fabsf( mTargetSize.depth - size.depth ) > Math::MACHINE_EPSILON_1 ) ) - { - mTargetSize = size; + mSizer.SetHeight(height); +} - // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformPropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::Bake, mTargetSize ); +void Actor::SetDepth(float depth) +{ + mSizer.SetDepth(depth); + // node is being used in a separate thread; queue a message to set the value & base value + SceneGraph::NodeTransformComponentMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeZ, depth); +} - // Notification for derived classes - mInsideOnSizeSet = true; - OnSizeSet( mTargetSize ); - mInsideOnSizeSet = false; +Vector3 Actor::GetTargetSize() const +{ + return mSizer.GetTargetSize(); +} - // Raise a relayout request if the flag is not locked - if( mRelayoutData && !mRelayoutData->insideRelayout ) - { - RelayoutRequest(); - } - } +const Vector3& Actor::GetCurrentSize() const +{ + // node is being used in a separate thread; copy the value from the previous update + return GetNode().GetSize(GetEventThreadServices().GetEventBufferIndex()); } -void Actor::SetWidth( float width ) +Vector3 Actor::GetNaturalSize() const { - if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout ) - { - SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH ); - mRelayoutData->preferredSize.width = width; - } - else - { - mTargetSize.width = width; + // It is up to deriving classes to return the appropriate natural size + return Vector3(0.0f, 0.0f, 0.0f); +} - // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeX, width ); - } +void Actor::SetResizePolicy(ResizePolicy::Type policy, Dimension::Type dimension) +{ + mSizer.SetResizePolicy(policy, dimension); +} - mUseAnimatedSize &= ~AnimatedSizeFlag::WIDTH; +ResizePolicy::Type Actor::GetResizePolicy(Dimension::Type dimension) const +{ + return mSizer.GetResizePolicy(dimension); +} - RelayoutRequest(); +void Actor::SetRelayoutEnabled(bool relayoutEnabled) +{ + mSizer.SetRelayoutEnabled(relayoutEnabled); } -void Actor::SetHeight( float height ) +bool Actor::IsRelayoutEnabled() const { - if( IsRelayoutEnabled() && !mRelayoutData->insideRelayout ) - { - SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT ); - mRelayoutData->preferredSize.height = height; - } - else - { - mTargetSize.height = height; + return mSizer.IsRelayoutEnabled(); +} - // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeY, height ); - } +void Actor::SetLayoutDirty(bool dirty, Dimension::Type dimension) +{ + mSizer.SetLayoutDirty(dirty, dimension); +} - mUseAnimatedSize &= ~AnimatedSizeFlag::HEIGHT; +bool Actor::IsLayoutDirty(Dimension::Type dimension) const +{ + return mSizer.IsLayoutDirty(dimension); +} - RelayoutRequest(); +bool Actor::RelayoutPossible(Dimension::Type dimension) const +{ + return mSizer.RelayoutPossible(dimension); } -void Actor::SetDepth( float depth ) +bool Actor::RelayoutRequired(Dimension::Type dimension) const { - mTargetSize.depth = depth; + return mSizer.RelayoutRequired(dimension); +} - mUseAnimatedSize &= ~AnimatedSizeFlag::DEPTH; +uint32_t Actor::AddRenderer(Renderer& renderer) +{ + if(!mRenderers) + { + mRenderers = new RendererContainer(GetEventThreadServices()); + } + return mRenderers->Add(GetNode(), renderer, mIsBlendEquationSet, mBlendEquation); +} - // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodeTransformComponentMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mSize, &SceneGraph::TransformManagerPropertyHandler::BakeZ, depth ); +uint32_t Actor::GetRendererCount() const +{ + return mRenderers ? mRenderers->GetCount() : 0u; } -Vector3 Actor::GetTargetSize() const +RendererPtr Actor::GetRendererAt(uint32_t index) { - Vector3 size = mTargetSize; + return mRenderers ? mRenderers->GetRendererAt(index) : nullptr; +} - if( mUseAnimatedSize & AnimatedSizeFlag::WIDTH ) +void Actor::RemoveRenderer(Renderer& renderer) +{ + if(mRenderers) { - // Should return animated size if size is animated - size.width = mAnimatedSize.width; + mRenderers->Remove(GetNode(), renderer); } - else +} + +void Actor::RemoveRenderer(uint32_t index) +{ + if(mRenderers) { - // Should return preferred size if size is fixed as set by SetSize - if( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FIXED ) - { - size.width = GetPreferredSize().width; - } + mRenderers->Remove(GetNode(), index); } +} - if( mUseAnimatedSize & AnimatedSizeFlag::HEIGHT ) - { - size.height = mAnimatedSize.height; - } - else - { - if( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::FIXED ) - { - size.height = GetPreferredSize().height; - } - } - - if( mUseAnimatedSize & AnimatedSizeFlag::DEPTH ) - { - size.depth = mAnimatedSize.depth; - } - - return size; -} - -const Vector3& Actor::GetCurrentSize() const -{ - // node is being used in a separate thread; copy the value from the previous update - return GetNode().GetSize( GetEventThreadServices().GetEventBufferIndex() ); -} - -Vector3 Actor::GetNaturalSize() const -{ - // It is up to deriving classes to return the appropriate natural size - return Vector3( 0.0f, 0.0f, 0.0f ); -} - -void Actor::SetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension ) -{ - EnsureRelayouter().SetResizePolicy(policy, dimension, mTargetSize); - - OnSetResizePolicy( policy, dimension ); - - // Trigger relayout on this control - RelayoutRequest(); -} - -ResizePolicy::Type Actor::GetResizePolicy( Dimension::Type dimension ) const -{ - if ( mRelayoutData ) - { - return mRelayoutData->GetResizePolicy(dimension); - } - - return ResizePolicy::DEFAULT; -} - -void Actor::SetSizeScalePolicy( SizeScalePolicy::Type policy ) -{ - EnsureRelayouter(); - - mRelayoutData->sizeSetPolicy = policy; - - // Trigger relayout on this control - RelayoutRequest(); -} - -SizeScalePolicy::Type Actor::GetSizeScalePolicy() const -{ - if ( mRelayoutData ) - { - return mRelayoutData->sizeSetPolicy; - } - - return Relayouter::DEFAULT_SIZE_SCALE_POLICY; -} - -void Actor::SetDimensionDependency( Dimension::Type dimension, Dimension::Type dependency ) -{ - EnsureRelayouter().SetDimensionDependency(dimension, dependency); -} - -Dimension::Type Actor::GetDimensionDependency( Dimension::Type dimension ) const -{ - if ( mRelayoutData ) - { - return mRelayoutData->GetDimensionDependency(dimension); - } - - return Dimension::ALL_DIMENSIONS; // Default -} - -void Actor::SetRelayoutEnabled( bool relayoutEnabled ) -{ - // If relayout data has not been allocated yet and the client is requesting - // to disable it, do nothing - if( mRelayoutData || relayoutEnabled ) - { - EnsureRelayouter(); - - DALI_ASSERT_DEBUG( mRelayoutData && "mRelayoutData not created" ); - - mRelayoutData->relayoutEnabled = relayoutEnabled; - } -} - -bool Actor::IsRelayoutEnabled() const -{ - // Assume that if relayout data has not been allocated yet then - // relayout is disabled - return mRelayoutData && mRelayoutData->relayoutEnabled; -} - -void Actor::SetLayoutDirty( bool dirty, Dimension::Type dimension ) -{ - EnsureRelayouter().SetLayoutDirty(dirty, dimension); -} - -bool Actor::IsLayoutDirty( Dimension::Type dimension ) const -{ - return mRelayoutData && mRelayoutData->IsLayoutDirty(dimension); -} - -bool Actor::RelayoutPossible( Dimension::Type dimension ) const -{ - return mRelayoutData && mRelayoutData->relayoutEnabled && !IsLayoutDirty( dimension ); -} - -bool Actor::RelayoutRequired( Dimension::Type dimension ) const -{ - return mRelayoutData && mRelayoutData->relayoutEnabled && IsLayoutDirty( dimension ); -} - -uint32_t Actor::AddRenderer( Renderer& renderer ) -{ - if( !mRenderers ) - { - mRenderers = new RendererContainer; - } - - if(mIsBlendEquationSet) - { - renderer.SetBlendEquation(static_cast(mBlendEquation)); - } - - uint32_t index = static_cast( mRenderers->size() ); // 4,294,967,295 renderers per actor - RendererPtr rendererPtr = RendererPtr( &renderer ); - mRenderers->push_back( rendererPtr ); - AttachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() ); - return index; -} - -uint32_t Actor::GetRendererCount() const -{ - uint32_t rendererCount(0); - if( mRenderers ) - { - rendererCount = static_cast( mRenderers->size() ); // 4,294,967,295 renderers per actor - } - - return rendererCount; -} - -RendererPtr Actor::GetRendererAt( uint32_t index ) -{ - RendererPtr renderer; - if( index < GetRendererCount() ) - { - renderer = ( *mRenderers )[ index ]; - } - - return renderer; -} - -void Actor::RemoveRenderer( Renderer& renderer ) -{ - if( mRenderers ) - { - RendererIter end = mRenderers->end(); - for( RendererIter iter = mRenderers->begin(); iter != end; ++iter ) - { - if( (*iter).Get() == &renderer ) - { - mRenderers->erase( iter ); - DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.GetRendererSceneObject() ); - break; - } - } - } -} - -void Actor::RemoveRenderer( uint32_t index ) -{ - if( index < GetRendererCount() ) - { - RendererPtr renderer = ( *mRenderers )[ index ]; - DetachRendererMessage( GetEventThreadServices(), GetNode(), renderer.Get()->GetRendererSceneObject() ); - mRenderers->erase( mRenderers->begin()+index ); - } -} - -void Actor::SetBlendEquation(DevelBlendEquation::Type blendEquation) -{ - if(Dali::Capabilities::IsBlendEquationSupported(blendEquation)) +void Actor::SetBlendEquation(DevelBlendEquation::Type blendEquation) +{ + if(Dali::Capabilities::IsBlendEquationSupported(blendEquation)) { if(mBlendEquation != blendEquation) { - mBlendEquation = blendEquation; - uint32_t rendererCount = GetRendererCount(); - for(uint32_t i = 0; i < rendererCount; ++i) + mBlendEquation = blendEquation; + if(mRenderers) { - RendererPtr renderer = GetRendererAt(i); - renderer->SetBlendEquation(static_cast(blendEquation)); + mRenderers->SetBlending(blendEquation); } } mIsBlendEquationSet = true; @@ -1285,189 +935,111 @@ DevelBlendEquation::Type Actor::GetBlendEquation() const return mBlendEquation; } -void Actor::SetDrawMode( DrawMode::Type drawMode ) +void Actor::SetTransparent(bool transparent) +{ + SetTransparentMessage(GetEventThreadServices(), GetNode(), transparent); +} + +bool Actor::IsTransparent() const +{ + return GetNode().IsTransparent(); +} + +void Actor::SetDrawMode(DrawMode::Type drawMode) { // this flag is not animatable so keep the value mDrawMode = drawMode; // node is being used in a separate thread; queue a message to set the value - SetDrawModeMessage( GetEventThreadServices(), GetNode(), drawMode ); + SetDrawModeMessage(GetEventThreadServices(), GetNode(), drawMode); } -bool Actor::ScreenToLocal( float& localX, float& localY, float screenX, float screenY ) const +bool Actor::ScreenToLocal(float& localX, float& localY, float screenX, float screenY) const { - // only valid when on-stage - if( mScene && OnScene() ) - { - const RenderTaskList& taskList = mScene->GetRenderTaskList(); - - Vector2 converted( screenX, screenY ); - - // do a reverse traversal of all lists (as the default onscreen one is typically the last one) - uint32_t taskCount = taskList.GetTaskCount(); - for( uint32_t i = taskCount; i > 0; --i ) - { - RenderTaskPtr task = taskList.GetTask( i - 1 ); - if( ScreenToLocal( *task, localX, localY, screenX, screenY ) ) - { - // found a task where this conversion was ok so return - return true; - } - } - } - return false; + return mScene && OnScene() && ConvertScreenToLocalRenderTaskList(mScene->GetRenderTaskList(), GetNode().GetWorldMatrix(0), GetCurrentSize(), localX, localY, screenX, screenY); } -bool Actor::ScreenToLocal( const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY ) const +bool Actor::ScreenToLocal(const RenderTask& renderTask, float& localX, float& localY, float screenX, float screenY) const { - bool retval = false; - // only valid when on-stage - if( OnScene() ) - { - CameraActor* camera = renderTask.GetCameraActor(); - if( camera ) - { - Viewport viewport; - renderTask.GetViewport( viewport ); - - // need to translate coordinates to render tasks coordinate space - Vector2 converted( screenX, screenY ); - if( renderTask.TranslateCoordinates( converted ) ) - { - retval = ScreenToLocal( camera->GetViewMatrix(), camera->GetProjectionMatrix(), viewport, localX, localY, converted.x, converted.y ); - } - } - } - return retval; + return OnScene() && ConvertScreenToLocalRenderTask(renderTask, GetNode().GetWorldMatrix(0), GetCurrentSize(), localX, localY, screenX, screenY); } -bool Actor::ScreenToLocal( const Matrix& viewMatrix, const Matrix& projectionMatrix, const Viewport& viewport, float& localX, float& localY, float screenX, float screenY ) const +bool Actor::ScreenToLocal(const Matrix& viewMatrix, const Matrix& projectionMatrix, const Viewport& viewport, float& localX, float& localY, float screenX, float screenY) const { - return OnScene() && ScreenToLocalInternal(viewMatrix, projectionMatrix, GetNode().GetWorldMatrix(0), viewport, GetCurrentSize(), localX, localY, screenX, screenY); + return OnScene() && ConvertScreenToLocal(viewMatrix, projectionMatrix, GetNode().GetWorldMatrix(0), GetCurrentSize(), viewport, localX, localY, screenX, screenY); } ActorGestureData& Actor::GetGestureData() { // Likely scenario is that once gesture-data is created for this actor, the actor will require // that gesture for its entire life-time so no need to destroy it until the actor is destroyed - if( nullptr == mGestureData ) + if(nullptr == mGestureData) { mGestureData = new ActorGestureData; } return *mGestureData; } -bool Actor::IsGestureRequired( GestureType::Value type ) const +bool Actor::IsGestureRequired(GestureType::Value type) const { - return mGestureData && mGestureData->IsGestureRequired( type ); + return mGestureData && mGestureData->IsGestureRequired(type); } -bool Actor::EmitInterceptTouchEventSignal( const Dali::TouchEvent& touch ) +bool Actor::EmitInterceptTouchEventSignal(const Dali::TouchEvent& touch) { - return EmitConsumingSignal( *this, mInterceptTouchedSignal, touch ); + return EmitConsumingSignal(*this, mInterceptTouchedSignal, touch); } -bool Actor::EmitTouchEventSignal( const Dali::TouchEvent& touch ) +bool Actor::EmitTouchEventSignal(const Dali::TouchEvent& touch) { - return EmitConsumingSignal( *this, mTouchedSignal, touch ); + return EmitConsumingSignal(*this, mTouchedSignal, touch); } -bool Actor::EmitHoverEventSignal( const Dali::HoverEvent& event ) +bool Actor::EmitHoverEventSignal(const Dali::HoverEvent& event) { - return EmitConsumingSignal( *this, mHoveredSignal, event ); + return EmitConsumingSignal(*this, mHoveredSignal, event); } -bool Actor::EmitWheelEventSignal( const Dali::WheelEvent& event ) +bool Actor::EmitWheelEventSignal(const Dali::WheelEvent& event) { - return EmitConsumingSignal( *this, mWheelEventSignal, event ); + return EmitConsumingSignal(*this, mWheelEventSignal, event); } -void Actor::EmitVisibilityChangedSignal( bool visible, DevelActor::VisibilityChange::Type type ) +void Actor::EmitVisibilityChangedSignal(bool visible, DevelActor::VisibilityChange::Type type) { - EmitSignal( *this, mVisibilityChangedSignal, visible, type ); + EmitSignal(*this, mVisibilityChangedSignal, visible, type); } -void Actor::EmitLayoutDirectionChangedSignal( LayoutDirection::Type type ) +void Actor::EmitLayoutDirectionChangedSignal(LayoutDirection::Type type) { - EmitSignal( *this, mLayoutDirectionChangedSignal, type ); + EmitSignal(*this, mLayoutDirectionChangedSignal, type); } -void Actor::EmitChildAddedSignal( Actor& child ) +DevelActor::ChildChangedSignalType& Actor::ChildAddedSignal() { - EmitSignal( child, mChildAddedSignal ); + return mParentImpl.ChildAddedSignal(); } -void Actor::EmitChildRemovedSignal( Actor& child ) +DevelActor::ChildChangedSignalType& Actor::ChildRemovedSignal() { - EmitSignal( child, mChildRemovedSignal ); + return mParentImpl.ChildRemovedSignal(); } -bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) +DevelActor::ChildOrderChangedSignalType& Actor::ChildOrderChangedSignal() { - bool connected( true ); - Actor* actor = static_cast< Actor* >( object ); // TypeRegistry guarantees that this is the correct type. - - std::string_view name(signalName); - - if(name == SIGNAL_HOVERED) - { - actor->HoveredSignal().Connect( tracker, functor ); - } - else if(signalName == SIGNAL_WHEEL_EVENT) - { - actor->WheelEventSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_ON_SCENE) - { - actor->OnSceneSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_OFF_SCENE) - { - actor->OffSceneSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_ON_RELAYOUT) - { - actor->OnRelayoutSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_TOUCHED) - { - actor->TouchedSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_VISIBILITY_CHANGED) - { - actor->VisibilityChangedSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_LAYOUT_DIRECTION_CHANGED) - { - actor->LayoutDirectionChangedSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_CHILD_ADDED) - { - actor->ChildAddedSignal().Connect( tracker, functor ); - } - else if(name == SIGNAL_CHILD_REMOVED) - { - actor->ChildRemovedSignal().Connect( tracker, functor ); - } - else - { - // signalName does not match any signal - connected = false; - } - - return connected; + return mParentImpl.ChildOrderChangedSignal(); } -Actor::Actor( DerivedType derivedType, const SceneGraph::Node& node ) -: Object( &node ), - mScene( nullptr ), - mParent( nullptr ), - mChildren( nullptr ), - mRenderers( nullptr ), - mParentOrigin( nullptr ), - mAnchorPoint( nullptr ), - mRelayoutData( nullptr ), - mGestureData( nullptr ), +Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node) +: Object(&node), + mParentImpl(*this), + mSizer(*this), + mParent(nullptr), + mScene(nullptr), + mRenderers(nullptr), + mParentOrigin(nullptr), + mAnchorPoint(nullptr), + mGestureData(nullptr), mInterceptTouchedSignal(), mTouchedSignal(), mHoveredSignal(), @@ -1477,41 +1049,38 @@ Actor::Actor( DerivedType derivedType, const SceneGraph::Node& node ) mOnRelayoutSignal(), mVisibilityChangedSignal(), mLayoutDirectionChangedSignal(), - mChildAddedSignal(), - mChildRemovedSignal(), - mChildOrderChangedSignal(), - mTargetOrientation( Quaternion::IDENTITY ), - mTargetColor( Color::WHITE ), - mTargetSize( Vector3::ZERO ), - mTargetPosition( Vector3::ZERO ), - mTargetScale( Vector3::ONE ), - mAnimatedSize( Vector3::ZERO ), - mTouchArea( Vector2::ZERO ), + mTargetOrientation(Quaternion::IDENTITY), + mTargetColor(Color::WHITE), + mTargetPosition(Vector3::ZERO), + mTargetScale(Vector3::ONE), + mTouchAreaOffset(0, 0, 0, 0), mName(), - mSortedDepth( 0u ), - mDepth( 0u ), - mUseAnimatedSize( AnimatedSizeFlag::CLEAR ), - mIsRoot( ROOT_LAYER == derivedType ), - mIsLayer( LAYER == derivedType || ROOT_LAYER == derivedType ), - mIsOnScene( false ), - mSensitive( true ), - mLeaveRequired( false ), - mKeyboardFocusable( false ), - mOnSceneSignalled( false ), - mInsideOnSizeSet( false ), - mInheritPosition( true ), - mInheritOrientation( true ), - mInheritScale( true ), - mPositionUsesAnchorPoint( true ), - mVisible( true ), - mInheritLayoutDirection( true ), - mCaptureAllTouchAfterStart( false ), - mLayoutDirection( LayoutDirection::LEFT_TO_RIGHT ), - mDrawMode( DrawMode::NORMAL ), - mColorMode( Node::DEFAULT_COLOR_MODE ), - mClippingMode( ClippingMode::DISABLED ), - mBlendEquation( DevelBlendEquation::ADD ), - mIsBlendEquationSet( false ) + mSortedDepth(0u), + mDepth(0u), + mIsRoot(ROOT_LAYER == derivedType), + mIsLayer(LAYER == derivedType || ROOT_LAYER == derivedType), + mIsOnScene(false), + mSensitive(true), + mLeaveRequired(false), + mKeyboardFocusable(false), + mKeyboardFocusableChildren(true), + mTouchFocusable(false), + mOnSceneSignalled(false), + mInheritPosition(true), + mInheritOrientation(true), + mInheritScale(true), + mPositionUsesAnchorPoint(true), + mVisible(true), + mInheritLayoutDirection(true), + mCaptureAllTouchAfterStart(false), + mIsBlendEquationSet(false), + mNeedGesturePropagation(false), + mUserInteractionEnabled(true), + mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT), + mDrawMode(DrawMode::NORMAL), + mColorMode(Node::DEFAULT_COLOR_MODE), + mClippingMode(ClippingMode::DISABLED), + mBlendEquation(DevelBlendEquation::ADD) { } @@ -1519,32 +1088,25 @@ void Actor::Initialize() { OnInitialize(); - GetEventThreadServices().RegisterObject( this ); + GetEventThreadServices().RegisterObject(this); } Actor::~Actor() { // Remove mParent pointers from children even if we're destroying core, // to guard against GetParent() & Unparent() calls from CustomActor destructors. - if( mChildren ) - { - for( const auto& actor : *mChildren ) - { - actor->SetParent( nullptr ); - } - } - delete mChildren; + UnparentChildren(); delete mRenderers; // Guard to allow handle destruction after Core has been destroyed - if( EventThreadServices::IsCoreRunning() ) + if(EventThreadServices::IsCoreRunning()) { // Root layer will destroy its node in its own destructor - if ( !mIsRoot ) + if(!mIsRoot) { - DestroyNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() ); + DestroyNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode()); - GetEventThreadServices().UnregisterObject( this ); + GetEventThreadServices().UnregisterObject(this); } } @@ -1554,58 +1116,86 @@ Actor::~Actor() // Cleanup optional parent origin and anchor delete mParentOrigin; delete mAnchorPoint; +} - // Delete optional relayout data - delete mRelayoutData; +void Actor::Add(Actor& child, bool notify) +{ + mParentImpl.Add(child, notify); } -void Actor::ConnectToScene( uint32_t parentDepth ) +void Actor::Remove(Actor& child, bool notify) { - // This container is used instead of walking the Actor hierarchy. - // It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks. - ActorContainer connectionList; + mParentImpl.Remove(child, notify); +} - if( mScene ) +void Actor::SwitchParent(Actor& newParent) +{ + if(this == &newParent) { - mScene->RequestRebuildDepthTree(); + DALI_LOG_ERROR("Cannot add actor to itself"); + return; } - // This stage is atomic i.e. not interrupted by user callbacks. - RecursiveConnectToScene( connectionList, parentDepth + 1 ); - - // Notify applications about the newly connected actors. - for( const auto& actor : connectionList ) + if(!this->OnScene() || !newParent.OnScene()) { - actor->NotifyStageConnection(); + DALI_LOG_ERROR("Both of current parent and new parent must be on Scene"); + return; } - RelayoutRequest(); + newParent.Add(*this, false); +} + +uint32_t Actor::GetChildCount() const +{ + return mParentImpl.GetChildCount(); +} + +ActorPtr Actor::GetChildAt(uint32_t index) const +{ + return mParentImpl.GetChildAt(index); +} + +ActorContainer& Actor::GetChildrenInternal() +{ + return mParentImpl.GetChildrenInternal(); +} + +ActorPtr Actor::FindChildByName(ConstString actorName) +{ + return mParentImpl.FindChildByName(actorName); } -void Actor::RecursiveConnectToScene( ActorContainer& connectionList, uint32_t depth ) +ActorPtr Actor::FindChildById(const uint32_t id) { - DALI_ASSERT_ALWAYS( !OnScene() ); + return mParentImpl.FindChildById(id); +} - mIsOnScene = true; - mDepth = static_cast< uint16_t >( depth ); // overflow ignored, not expected in practice +void Actor::UnparentChildren() +{ + mParentImpl.UnparentChildren(); +} - ConnectToSceneGraph(); +void Actor::ConnectToScene(uint32_t parentDepth, bool notify) +{ + // This container is used instead of walking the Actor hierarchy. + // It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks. + ActorContainer connectionList; - // Notification for internal derived classes - OnSceneConnectionInternal(); + if(mScene) + { + mScene->RequestRebuildDepthTree(); + } - // This stage is atomic; avoid emitting callbacks until all Actors are connected - connectionList.push_back( ActorPtr( this ) ); + // This stage is not interrupted by user callbacks. + mParentImpl.RecursiveConnectToScene(connectionList, parentDepth + 1); - // Recursively connect children - if( mChildren ) + // Notify applications about the newly connected actors. + for(const auto& actor : connectionList) { - for( const auto& actor : *mChildren ) - { - actor->SetScene( *mScene ); - actor->RecursiveConnectToScene( connectionList, depth + 1 ); - } + actor->NotifyStageConnection(notify); } + + RelayoutRequest(); } /** @@ -1616,10 +1206,10 @@ void Actor::RecursiveConnectToScene( ActorContainer& connectionList, uint32_t de */ void Actor::ConnectToSceneGraph() { - DALI_ASSERT_DEBUG( mParent != NULL); + DALI_ASSERT_DEBUG(mParent != NULL); // Reparent Node in next Update - ConnectNodeMessage( GetEventThreadServices().GetUpdateManager(), mParent->GetNode(), GetNode() ); + ConnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetParent()->GetNode(), GetNode()); // Request relayout on all actors that are added to the scenegraph RelayoutRequest(); @@ -1628,71 +1218,51 @@ void Actor::ConnectToSceneGraph() OnSceneObjectAdd(); } -void Actor::NotifyStageConnection() +void Actor::NotifyStageConnection(bool notify) { // Actors can be removed (in a callback), before the on-stage stage is reported. // The actor may also have been reparented, in which case mOnSceneSignalled will be true. - if( OnScene() && !mOnSceneSignalled ) + if(OnScene() && !mOnSceneSignalled) { - // Notification for external (CustomActor) derived classes - OnSceneConnectionExternal( mDepth ); - - if( !mOnSceneSignal.Empty() ) + if(notify) { - Dali::Actor handle( this ); - mOnSceneSignal.Emit( handle ); + // Notification for external (CustomActor) derived classes + OnSceneConnectionExternal(mDepth); + + if(!mOnSceneSignal.Empty()) + { + Dali::Actor handle(this); + mOnSceneSignal.Emit(handle); + } } // Guard against Remove during callbacks - if( OnScene() ) + if(OnScene()) { mOnSceneSignalled = true; // signal required next time Actor is removed } } } -void Actor::DisconnectFromStage() +void Actor::DisconnectFromStage(bool notify) { // This container is used instead of walking the Actor hierachy. // It protects us when the Actor hierachy is modified during OnSceneDisconnectionExternal callbacks. ActorContainer disconnectionList; - if( mScene ) + if(mScene) { mScene->RequestRebuildDepthTree(); } - // This stage is atomic i.e. not interrupted by user callbacks - RecursiveDisconnectFromStage( disconnectionList ); + // This stage is not interrupted by user callbacks + mParentImpl.RecursiveDisconnectFromScene(disconnectionList); // Notify applications about the newly disconnected actors. - for( const auto& actor : disconnectionList ) - { - actor->NotifyStageDisconnection(); - } -} - -void Actor::RecursiveDisconnectFromStage( ActorContainer& disconnectionList ) -{ - // need to change state first so that internals relying on IsOnScene() inside OnSceneDisconnectionInternal() get the correct value - mIsOnScene = false; - - // Recursively disconnect children - if( mChildren ) + for(const auto& actor : disconnectionList) { - for( const auto& child : *mChildren ) - { - child->RecursiveDisconnectFromStage( disconnectionList ); - } + actor->NotifyStageDisconnection(notify); } - - // This stage is atomic; avoid emitting callbacks until all Actors are disconnected - disconnectionList.push_back( ActorPtr( this ) ); - - // Notification for internal derived classes - OnSceneDisconnectionInternal(); - - DisconnectFromSceneGraph(); } /** @@ -1705,24 +1275,27 @@ void Actor::DisconnectFromSceneGraph() OnSceneObjectRemove(); } -void Actor::NotifyStageDisconnection() +void Actor::NotifyStageDisconnection(bool notify) { // Actors can be added (in a callback), before the off-stage state is reported. // Also if the actor was added & removed before mOnSceneSignalled was set, then we don't notify here. // only do this step if there is a stage, i.e. Core is not being shut down - if ( EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled ) + if(EventThreadServices::IsCoreRunning() && !OnScene() && mOnSceneSignalled) { - // Notification for external (CustomeActor) derived classes - OnSceneDisconnectionExternal(); - - if( !mOffSceneSignal.Empty() ) + if(notify) { - Dali::Actor handle( this ); - mOffSceneSignal.Emit( handle ); + // Notification for external (CustomeActor) derived classes + OnSceneDisconnectionExternal(); + + if(!mOffSceneSignal.Empty()) + { + Dali::Actor handle(this); + mOffSceneSignal.Emit(handle); + } } // Guard against Add during callbacks - if( !OnScene() ) + if(!OnScene()) { mOnSceneSignalled = false; // signal required next time Actor is added } @@ -1731,17 +1304,7 @@ void Actor::NotifyStageDisconnection() bool Actor::IsNodeConnected() const { - bool connected( false ); - - if( OnScene() ) - { - if( IsRoot() || GetNode().GetParent() ) - { - connected = true; - } - } - - return connected; + return OnScene() && (IsRoot() || GetNode().GetParent()); } // This method initiates traversal of the actor tree using depth-first @@ -1756,780 +1319,378 @@ void Actor::RebuildDepthTree() // Vector of scene-graph nodes and their depths to send to UpdateManager // in a single message - OwnerPointer sceneGraphNodeDepths( new SceneGraph::NodeDepths() ); + OwnerPointer sceneGraphNodeDepths(new SceneGraph::NodeDepths()); int32_t depthIndex = 1; - DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex ); + mParentImpl.DepthTraverseActorTree(sceneGraphNodeDepths, depthIndex); - SetDepthIndicesMessage( GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths ); + SetDepthIndicesMessage(GetEventThreadServices().GetUpdateManager(), sceneGraphNodeDepths); DALI_LOG_TIMER_END(depthTimer, gLogFilter, Debug::Concise, "Depth tree traversal time: "); } -void Actor::DepthTraverseActorTree( OwnerPointer& sceneGraphNodeDepths, int32_t& depthIndex ) +void Actor::SetDefaultProperty(Property::Index index, const Property::Value& property) { - mSortedDepth = depthIndex * DevelLayer::SIBLING_ORDER_MULTIPLIER; - sceneGraphNodeDepths->Add( const_cast( &GetNode() ), mSortedDepth ); - - // Create/add to children of this node - if( mChildren ) - { - for( const auto& child : *mChildren ) - { - Actor* childActor = child.Get(); - ++depthIndex; - childActor->DepthTraverseActorTree( sceneGraphNodeDepths, depthIndex ); - } - } -} - -void Actor::SetDefaultProperty( Property::Index index, const Property::Value& property ) -{ - PropertyHandler::SetDefaultProperty(*this, index, property); + PropertyHandler::SetDefaultProperty(*this, index, property); } // TODO: This method needs to be removed -void Actor::SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value ) +void Actor::SetSceneGraphProperty(Property::Index index, const PropertyMetadata& entry, const Property::Value& value) { PropertyHandler::SetSceneGraphProperty(index, entry, value, GetEventThreadServices(), GetNode()); } -Property::Value Actor::GetDefaultProperty( Property::Index index ) const +Property::Value Actor::GetDefaultProperty(Property::Index index) const { Property::Value value; - if( ! GetCachedPropertyValue( index, value ) ) + if(!GetCachedPropertyValue(index, value)) { // If property value is not stored in the event-side, then it must be a scene-graph only property - GetCurrentPropertyValue( index, value ); + GetCurrentPropertyValue(index, value); } return value; } -Property::Value Actor::GetDefaultPropertyCurrentValue( Property::Index index ) const +Property::Value Actor::GetDefaultPropertyCurrentValue(Property::Index index) const { Property::Value value; - if( ! GetCurrentPropertyValue( index, value ) ) + if(!GetCurrentPropertyValue(index, value)) { // If unable to retrieve scene-graph property value, then it must be an event-side only property - GetCachedPropertyValue( index, value ); + GetCachedPropertyValue(index, value); } return value; } -void Actor::OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType ) +void Actor::OnNotifyDefaultPropertyAnimation(Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType) { PropertyHandler::OnNotifyDefaultPropertyAnimation(*this, animation, index, value, animationType); } -const PropertyBase* Actor::GetSceneObjectAnimatableProperty( Property::Index index ) const +const PropertyBase* Actor::GetSceneObjectAnimatableProperty(Property::Index index) const { const PropertyBase* property = PropertyHandler::GetSceneObjectAnimatableProperty(index, GetNode()); - if( !property ) + if(!property) { // not our property, ask base - property = Object::GetSceneObjectAnimatableProperty( index ); + property = Object::GetSceneObjectAnimatableProperty(index); } return property; } -const PropertyInputImpl* Actor::GetSceneObjectInputProperty( Property::Index index ) const +const PropertyInputImpl* Actor::GetSceneObjectInputProperty(Property::Index index) const { const PropertyInputImpl* property = PropertyHandler::GetSceneObjectInputProperty(index, GetNode()); - if( !property ) + if(!property) { // reuse animatable property getter as animatable properties are inputs as well // animatable property chains back to Object::GetSceneObjectInputProperty() so all properties get covered - property = GetSceneObjectAnimatableProperty( index ); + property = GetSceneObjectAnimatableProperty(index); } return property; } -int32_t Actor::GetPropertyComponentIndex( Property::Index index ) const +int32_t Actor::GetPropertyComponentIndex(Property::Index index) const { int32_t componentIndex = PropertyHandler::GetPropertyComponentIndex(index); - if( Property::INVALID_COMPONENT_INDEX == componentIndex ) + if(Property::INVALID_COMPONENT_INDEX == componentIndex) { // ask base - componentIndex = Object::GetPropertyComponentIndex( index ); + componentIndex = Object::GetPropertyComponentIndex(index); } return componentIndex; } -void Actor::SetParent( Actor* parent ) +const SceneGraph::Node& Actor::GetNode() const { - if( parent ) - { - DALI_ASSERT_ALWAYS( !mParent && "Actor cannot have 2 parents" ); - - mParent = parent; - - mScene = parent->mScene; - - if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction - parent->OnScene() ) - { - // Instruct each actor to create a corresponding node in the scene graph - ConnectToScene( parent->GetHierarchyDepth() ); - } - - // Resolve the name and index for the child properties if any - ResolveChildProperties(); - } - else // parent being set to NULL - { - DALI_ASSERT_ALWAYS( mParent != nullptr && "Actor should have a parent" ); - - mParent = nullptr; - - if ( EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction - OnScene() ) - { - // Disconnect the Node & its children from the scene-graph. - DisconnectNodeMessage( GetEventThreadServices().GetUpdateManager(), GetNode() ); - - // Instruct each actor to discard pointers to the scene-graph - DisconnectFromStage(); - } - - mScene = nullptr; - } + return *static_cast(mUpdateObject); } -bool Actor::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& /* attributes */ ) +void Actor::Raise() { - bool done = false; - Actor* actor = dynamic_cast< Actor* >( object ); - - if( actor ) - { - std::string_view name(actionName); - if(name == ACTION_SHOW) - { - actor->SetVisible( true ); - done = true; - } - else if(name == ACTION_HIDE) - { - actor->SetVisible( false ); - done = true; - } - } - - return done; + CheckParentAndCall(mParent, *this, &ActorParent::RaiseChild); } -Rect<> Actor::CalculateScreenExtents( ) const +void Actor::Lower() { - auto screenPosition = GetCurrentScreenPosition(); - Vector3 size = GetCurrentSize() * GetCurrentWorldScale(); - Vector3 anchorPointOffSet = size * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT ); - Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y ); - return { position.x, position.y, size.x, size.y }; + CheckParentAndCall(mParent, *this, &ActorParent::LowerChild); } -bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const +void Actor::RaiseToTop() { - return PropertyHandler::GetCachedPropertyValue(*this, index, value); + CheckParentAndCall(mParent, *this, &ActorParent::RaiseChildToTop); } -bool Actor::GetCurrentPropertyValue( Property::Index index, Property::Value& value ) const +void Actor::LowerToBottom() { - return PropertyHandler::GetCurrentPropertyValue(*this, index, value); + CheckParentAndCall(mParent, *this, &ActorParent::LowerChildToBottom); } -Actor::Relayouter& Actor::EnsureRelayouter() +void Actor::RaiseAbove(Internal::Actor& target) { - // Assign relayouter - if( !mRelayoutData ) - { - mRelayoutData = new Relayouter(); - } - - return *mRelayoutData; + CheckParentAndCall(mParent, *this, target, &ActorParent::RaiseChildAbove); } -bool Actor::RelayoutDependentOnParent( Dimension::Type dimension ) +void Actor::LowerBelow(Internal::Actor& target) { - // Check if actor is dependent on parent - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) - { - if( ( dimension & ( 1 << i ) ) ) - { - const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ); - if( resizePolicy == ResizePolicy::FILL_TO_PARENT || resizePolicy == ResizePolicy::SIZE_RELATIVE_TO_PARENT || resizePolicy == ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT ) - { - return true; - } - } - } - - return false; + CheckParentAndCall(mParent, *this, target, &ActorParent::LowerChildBelow); } -bool Actor::RelayoutDependentOnChildren( Dimension::Type dimension ) +void Actor::SetParent(ActorParent* parent, bool notify) { - // Check if actor is dependent on children - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + if(parent) { - if( ( dimension & ( 1 << i ) ) ) - { - const ResizePolicy::Type resizePolicy = GetResizePolicy( static_cast< Dimension::Type >( 1 << i ) ); - switch( resizePolicy ) - { - case ResizePolicy::FIT_TO_CHILDREN: - case ResizePolicy::USE_NATURAL_SIZE: // i.e. For things that calculate their size based on children - { - return true; - } - - default: - { - break; - } - } - } - } + DALI_ASSERT_ALWAYS(!mParent && "Actor cannot have 2 parents"); - return false; -} + mParent = parent; + Actor* parentActor = static_cast(parent); + mScene = parentActor->mScene; -bool Actor::RelayoutDependentOnChildrenBase( Dimension::Type dimension ) -{ - return Actor::RelayoutDependentOnChildren( dimension ); -} - -bool Actor::RelayoutDependentOnDimension( Dimension::Type dimension, Dimension::Type dependentDimension ) -{ - // Check each possible dimension and see if it is dependent on the input one - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) - { - if( dimension & ( 1 << i ) ) + if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction + parentActor->OnScene()) { - return mRelayoutData->resizePolicies[ i ] == ResizePolicy::DIMENSION_DEPENDENCY && mRelayoutData->dimensionDependencies[ i ] == dependentDimension; + // Instruct each actor to create a corresponding node in the scene graph + ConnectToScene(parentActor->GetHierarchyDepth(), notify); } - } - return false; -} - -void Actor::SetNegotiatedDimension( float negotiatedDimension, Dimension::Type dimension ) -{ - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) - { - if( dimension & ( 1 << i ) ) - { - mRelayoutData->negotiatedDimensions[ i ] = negotiatedDimension; - } + // Resolve the name and index for the child properties if any + ResolveChildProperties(); } -} - -float Actor::GetNegotiatedDimension( Dimension::Type dimension ) const -{ - // If more than one dimension is requested, just return the first one found - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + else // parent being set to NULL { - if( ( dimension & ( 1 << i ) ) ) - { - return mRelayoutData->negotiatedDimensions[ i ]; - } - } - - return 0.0f; // Default -} + DALI_ASSERT_ALWAYS(mParent != nullptr && "Actor should have a parent"); -void Actor::SetPadding( const Vector2& padding, Dimension::Type dimension ) -{ - EnsureRelayouter().SetPadding( padding, dimension ); -} + mParent = nullptr; -Vector2 Actor::GetPadding( Dimension::Type dimension ) const -{ - if ( mRelayoutData ) - { - // If more than one dimension is requested, just return the first one found - for( uint32_t i = 0; i < Dimension::DIMENSION_COUNT; ++i ) + if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction + OnScene()) { - if( ( dimension & ( 1 << i ) ) ) - { - return mRelayoutData->dimensionPadding[ i ]; - } - } - } - - return Relayouter::DEFAULT_DIMENSION_PADDING; -} + // Disconnect the Node & its children from the scene-graph. + DisconnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode()); -void Actor::SetLayoutNegotiated( bool negotiated, Dimension::Type dimension ) -{ - EnsureRelayouter().SetLayoutNegotiated(negotiated, dimension); -} + // Instruct each actor to discard pointers to the scene-graph + DisconnectFromStage(notify); + } -bool Actor::IsLayoutNegotiated( Dimension::Type dimension ) const -{ - return mRelayoutData && mRelayoutData->IsLayoutNegotiated(dimension); + mScene = nullptr; + } } -float Actor::GetHeightForWidthBase( float width ) +Rect<> Actor::CalculateScreenExtents() const { - float height = 0.0f; - - const Vector3 naturalSize = GetNaturalSize(); - if( naturalSize.width > 0.0f ) - { - height = naturalSize.height * width / naturalSize.width; - } - else // we treat 0 as 1:1 aspect ratio - { - height = width; - } - - return height; + auto screenPosition = GetCurrentScreenPosition(); + BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex(); + return CalculateActorScreenExtents(*this, screenPosition, bufferIndex); } -float Actor::GetWidthForHeightBase( float height ) +Vector3 Actor::GetAnchorPointForPosition() const { - float width = 0.0f; - - const Vector3 naturalSize = GetNaturalSize(); - if( naturalSize.height > 0.0f ) - { - width = naturalSize.width * height / naturalSize.height; - } - else // we treat 0 as 1:1 aspect ratio - { - width = height; - } - - return width; + return (mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT); } -float Actor::CalculateChildSizeBase( const Dali::Actor& child, Dimension::Type dimension ) +bool Actor::GetCachedPropertyValue(Property::Index index, Property::Value& value) const { - // Fill to parent, taking size mode factor into account - switch( child.GetResizePolicy( dimension ) ) - { - case ResizePolicy::FILL_TO_PARENT: - { - return GetLatestSize( dimension ); - } - - case ResizePolicy::SIZE_RELATIVE_TO_PARENT: - { - return GetLatestSize( dimension ) * GetDimensionValue( child.GetProperty< Vector3 >( Dali::Actor::Property::SIZE_MODE_FACTOR ), dimension ); - } - - case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT: - { - return GetLatestSize( dimension ) + GetDimensionValue( child.GetProperty< Vector3 >( Dali::Actor::Property::SIZE_MODE_FACTOR ), dimension ); - } - - default: - { - return GetLatestSize( dimension ); - } - } + return PropertyHandler::GetCachedPropertyValue(*this, index, value); } -float Actor::CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension ) +bool Actor::GetCurrentPropertyValue(Property::Index index, Property::Value& value) const { - // Can be overridden in derived class - return CalculateChildSizeBase( child, dimension ); + return PropertyHandler::GetCurrentPropertyValue(*this, index, value); } -float Actor::GetHeightForWidth( float width ) +bool Actor::RelayoutDependentOnParent(Dimension::Type dimension) { - // Can be overridden in derived class - return GetHeightForWidthBase( width ); + return mSizer.RelayoutDependentOnParent(dimension); } -float Actor::GetWidthForHeight( float height ) +bool Actor::RelayoutDependentOnChildren(Dimension::Type dimension) { - // Can be overridden in derived class - return GetWidthForHeightBase( height ); + return mSizer.RelayoutDependentOnChildrenBase(dimension); } -float Actor::GetLatestSize( Dimension::Type dimension ) const +bool Actor::RelayoutDependentOnDimension(Dimension::Type dimension, Dimension::Type dependentDimension) { - return IsLayoutNegotiated( dimension ) ? GetNegotiatedDimension( dimension ) : GetSize( dimension ); + return mSizer.RelayoutDependentOnDimension(dimension, dependentDimension); } -float Actor::GetRelayoutSize( Dimension::Type dimension ) const +void Actor::SetPadding(const Vector2& padding, Dimension::Type dimension) { - Vector2 padding = GetPadding( dimension ); - - return GetLatestSize( dimension ) + padding.x + padding.y; + mSizer.SetPadding(padding, dimension); } -float Actor::NegotiateFromParent( Dimension::Type dimension ) +Vector2 Actor::GetPadding(Dimension::Type dimension) const { - Actor* parent = GetParent(); - if( parent ) - { - Vector2 padding( GetPadding( dimension ) ); - Vector2 parentPadding( parent->GetPadding( dimension ) ); - return parent->CalculateChildSize( Dali::Actor( this ), dimension ) - parentPadding.x - parentPadding.y - padding.x - padding.y; - } - - return 0.0f; + return mSizer.GetPadding(dimension); } -float Actor::NegotiateFromChildren( Dimension::Type dimension ) +void Actor::SetLayoutNegotiated(bool negotiated, Dimension::Type dimension) { - float maxDimensionPoint = 0.0f; - - for( uint32_t i = 0, count = GetChildCount(); i < count; ++i ) - { - ActorPtr child = GetChildAt( i ); - - if( !child->RelayoutDependentOnParent( dimension ) ) - { - // Calculate the min and max points that the children range across - float childPosition = GetDimensionValue( child->GetTargetPosition(), dimension ); - float dimensionSize = child->GetRelayoutSize( dimension ); - maxDimensionPoint = std::max( maxDimensionPoint, childPosition + dimensionSize ); - } - } - - return maxDimensionPoint; + mSizer.SetLayoutNegotiated(negotiated, dimension); } -float Actor::GetSize( Dimension::Type dimension ) const +bool Actor::IsLayoutNegotiated(Dimension::Type dimension) const { - return GetDimensionValue( mTargetSize, dimension ); + return mSizer.IsLayoutNegotiated(dimension); } -float Actor::GetNaturalSize( Dimension::Type dimension ) const +float Actor::GetHeightForWidthBase(float width) { - return GetDimensionValue( GetNaturalSize(), dimension ); + // Can be overridden in derived class + return mSizer.GetHeightForWidthBase(width); } -float Actor::CalculateSize( Dimension::Type dimension, const Vector2& maximumSize ) +float Actor::GetWidthForHeightBase(float height) { - switch( GetResizePolicy( dimension ) ) - { - case ResizePolicy::USE_NATURAL_SIZE: - { - return GetNaturalSize( dimension ); - } - - case ResizePolicy::FIXED: - { - return GetDimensionValue( GetPreferredSize(), dimension ); - } - - case ResizePolicy::USE_ASSIGNED_SIZE: - { - return GetDimensionValue( maximumSize, dimension ); - } - - case ResizePolicy::FILL_TO_PARENT: - case ResizePolicy::SIZE_RELATIVE_TO_PARENT: - case ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT: - { - return NegotiateFromParent( dimension ); - } - - case ResizePolicy::FIT_TO_CHILDREN: - { - return NegotiateFromChildren( dimension ); - } - - case ResizePolicy::DIMENSION_DEPENDENCY: - { - const Dimension::Type dimensionDependency = GetDimensionDependency( dimension ); - - // Custom rules - if( dimension == Dimension::WIDTH && dimensionDependency == Dimension::HEIGHT ) - { - return GetWidthForHeight( GetNegotiatedDimension( Dimension::HEIGHT ) ); - } - - if( dimension == Dimension::HEIGHT && dimensionDependency == Dimension::WIDTH ) - { - return GetHeightForWidth( GetNegotiatedDimension( Dimension::WIDTH ) ); - } - - break; - } - - default: - { - break; - } - } - - return 0.0f; // Default + // Can be overridden in derived class + return mSizer.GetWidthForHeightBase(height); } -Vector2 Actor::ApplySizeSetPolicy( const Vector2& size ) +float Actor::CalculateChildSizeBase(const Dali::Actor& child, Dimension::Type dimension) { - return mRelayoutData->ApplySizeSetPolicy(*this, size); + // Can be overridden in derived class + return mSizer.CalculateChildSizeBase(child, dimension); } -void Actor::SetNegotiatedSize( RelayoutContainer& container ) +bool Actor::RelayoutDependentOnChildrenBase(Dimension::Type dimension) { - // Do the set actor size - Vector2 negotiatedSize( GetLatestSize( Dimension::WIDTH ), GetLatestSize( Dimension::HEIGHT ) ); - - // Adjust for size set policy - negotiatedSize = ApplySizeSetPolicy( negotiatedSize ); - - // Lock the flag to stop recursive relayouts on set size - mRelayoutData->insideRelayout = true; - SetSize( negotiatedSize ); - mRelayoutData->insideRelayout = false; - - // Clear flags for all dimensions - SetLayoutDirty( false ); - - // Give deriving classes a chance to respond - OnRelayout( negotiatedSize, container ); - - if( !mOnRelayoutSignal.Empty() ) - { - Dali::Actor handle( this ); - mOnRelayoutSignal.Emit( handle ); - } + return mSizer.RelayoutDependentOnChildrenBase(dimension); } -void Actor::NegotiateSize( const Vector2& allocatedSize, RelayoutContainer& container ) +float Actor::CalculateChildSize(const Dali::Actor& child, Dimension::Type dimension) { - Relayouter::NegotiateSize(*this, allocatedSize, container); + // Can be overridden in derived class + return mSizer.CalculateChildSizeBase(child, dimension); } -void Actor::SetUseAssignedSize( bool use, Dimension::Type dimension ) +float Actor::GetHeightForWidth(float width) { - if( mRelayoutData ) - { - mRelayoutData->SetUseAssignedSize(use, dimension); - } + // Can be overridden in derived class + return mSizer.GetHeightForWidthBase(width); } -bool Actor::GetUseAssignedSize( Dimension::Type dimension ) const +float Actor::GetWidthForHeight(float height) { - return mRelayoutData && mRelayoutData->GetUseAssignedSize(dimension); + // Can be overridden in derived class + return mSizer.GetWidthForHeightBase(height); } -void Actor::RelayoutRequest( Dimension::Type dimension ) +float Actor::GetRelayoutSize(Dimension::Type dimension) const { - Internal::RelayoutController* relayoutController = Internal::RelayoutController::Get(); - if( relayoutController ) - { - Dali::Actor self( this ); - relayoutController->RequestRelayout( self, dimension ); - } + return mSizer.GetRelayoutSize(dimension); } -void Actor::SetPreferredSize( const Vector2& size ) +void Actor::NegotiateSize(const Vector2& allocatedSize, RelayoutContainer& container) { - EnsureRelayouter().SetPreferredSize(*this, size); + mSizer.NegotiateSize(allocatedSize, container); } -Vector2 Actor::GetPreferredSize() const +void Actor::RelayoutRequest(Dimension::Type dimension) { - if ( mRelayoutData ) - { - return Vector2( mRelayoutData->preferredSize ); - } - - return Relayouter::DEFAULT_PREFERRED_SIZE; + mSizer.RelayoutRequest(dimension); } -void Actor::SetMinimumSize( float size, Dimension::Type dimension ) +void Actor::SetMinimumSize(float size, Dimension::Type dimension) { - EnsureRelayouter().SetMinimumSize(size, dimension); - RelayoutRequest(); + mSizer.SetMinimumSize(size, dimension); } -float Actor::GetMinimumSize( Dimension::Type dimension ) const +float Actor::GetMinimumSize(Dimension::Type dimension) const { - if ( mRelayoutData ) - { - return mRelayoutData->GetMinimumSize(dimension); - } - - return 0.0f; // Default + return mSizer.GetMinimumSize(dimension); } -void Actor::SetMaximumSize( float size, Dimension::Type dimension ) +void Actor::SetMaximumSize(float size, Dimension::Type dimension) { - EnsureRelayouter().SetMaximumSize(size, dimension); - RelayoutRequest(); + mSizer.SetMaximumSize(size, dimension); } -float Actor::GetMaximumSize( Dimension::Type dimension ) const +float Actor::GetMaximumSize(Dimension::Type dimension) const { - if ( mRelayoutData ) - { - return mRelayoutData->GetMaximumSize(dimension); - } - - return FLT_MAX; // Default + return mSizer.GetMaximumSize(dimension); } -void Actor::SetVisibleInternal( bool visible, SendMessage::Type sendMessage ) +void Actor::SetVisibleInternal(bool visible, SendMessage::Type sendMessage) { - if( mVisible != visible ) + if(mVisible != visible) { - if( sendMessage == SendMessage::TRUE ) + if(sendMessage == SendMessage::TRUE) { // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty::Bake, visible ); + SceneGraph::NodePropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mVisible, &AnimatableProperty::Bake, visible); - RequestRenderingMessage( GetEventThreadServices().GetUpdateManager() ); + RequestRenderingMessage(GetEventThreadServices().GetUpdateManager()); } mVisible = visible; // Emit the signal on this actor and all its children - EmitVisibilityChangedSignalRecursively( this, visible, DevelActor::VisibilityChange::SELF ); + mParentImpl.EmitVisibilityChangedSignalRecursively(visible, DevelActor::VisibilityChange::SELF); } } -void Actor::EmitOrderChangedAndRebuild() +void Actor::SetSiblingOrderOfChild(Actor& child, uint32_t order) { - Dali::Actor handle( this ); - mParent->mChildOrderChangedSignal.Emit( handle ); - if( mIsOnScene && mScene ) - { - mScene->RequestRebuildDepthTree(); - } + mParentImpl.SetSiblingOrderOfChild(child, order); } -void Actor::SetSiblingOrder( uint32_t order ) +uint32_t Actor::GetSiblingOrderOfChild(const Actor& child) const { - if( mParent && SiblingHandler::SetSiblingOrder(*(mParent->mChildren), *this, order)) - { - EmitOrderChangedAndRebuild(); - } + return mParentImpl.GetSiblingOrderOfChild(child); } -uint32_t Actor::GetSiblingOrder() const +void Actor::RaiseChild(Actor& child) { - uint32_t order = 0; - if( mParent ) - { - order = SiblingHandler::GetSiblingOrder(*(mParent->mChildren), *this); - } - return order; + mParentImpl.RaiseChild(child); } -void Actor::Raise() +void Actor::LowerChild(Actor& child) { - if( mParent && SiblingHandler::Raise(*(mParent->mChildren), *this) ) - { - EmitOrderChangedAndRebuild(); - } - else - { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); - } + mParentImpl.LowerChild(child); } -void Actor::Lower() +void Actor::RaiseChildToTop(Actor& child) { - if( mParent && SiblingHandler::Lower(*(mParent->mChildren), *this) ) - { - EmitOrderChangedAndRebuild(); - } - else - { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); - } + mParentImpl.RaiseChildToTop(child); } -void Actor::RaiseToTop() +void Actor::LowerChildToBottom(Actor& child) { - if( mParent && SiblingHandler::RaiseToTop(*(mParent->mChildren), *this) ) - { - EmitOrderChangedAndRebuild(); - } - else - { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); - } -} - -void Actor::LowerToBottom() -{ - if( mParent && SiblingHandler::LowerToBottom(*(mParent->mChildren), *this) ) - { - EmitOrderChangedAndRebuild(); - } - else - { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); - } + mParentImpl.LowerChildToBottom(child); } -void Actor::RaiseAbove( Internal::Actor& target ) +void Actor::RaiseChildAbove(Actor& child, Actor& target) { - if( mParent && SiblingHandler::RaiseAbove( *(mParent->mChildren), *this, target )) - { - EmitOrderChangedAndRebuild(); - } - else - { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); - } + mParentImpl.RaiseChildAbove(child, target); } -void Actor::LowerBelow( Internal::Actor& target ) +void Actor::LowerChildBelow(Actor& child, Actor& target) { - if( mParent && SiblingHandler::LowerBelow(*(mParent->mChildren), *this, target ) ) - { - EmitOrderChangedAndRebuild(); - } - else - { - DALI_LOG_WARNING( "Actor must have a parent, Sibling order not changed.\n" ); - } + mParentImpl.LowerChildBelow(child, target); } -void Actor::SetInheritLayoutDirection( bool inherit ) +void Actor::SetInheritLayoutDirection(bool inherit) { - if( mInheritLayoutDirection != inherit ) + if(mInheritLayoutDirection != inherit) { mInheritLayoutDirection = inherit; - if( inherit && mParent ) - { - InheritLayoutDirectionRecursively( this, mParent->mLayoutDirection ); - } - } -} - -void Actor::InheritLayoutDirectionRecursively( ActorPtr actor, Dali::LayoutDirection::Type direction, bool set ) -{ - if( actor && ( actor->mInheritLayoutDirection || set ) ) - { - if( actor->mLayoutDirection != direction ) - { - actor->mLayoutDirection = direction; - actor->EmitLayoutDirectionChangedSignal( direction ); - actor->RelayoutRequest(); - } - - if( actor->GetChildCount() > 0 ) + if(inherit && mParent) { - for( const auto& child : actor->GetChildrenInternal() ) - { - InheritLayoutDirectionRecursively( child, direction ); - } + mParentImpl.InheritLayoutDirectionRecursively(GetParent()->mLayoutDirection); } } } -void Actor::SetUpdateSizeHint( const Vector2& updateSizeHint ) +void Actor::SetUpdateSizeHint(const Vector2& updateSizeHint) { // node is being used in a separate thread; queue a message to set the value & base value - SceneGraph::NodePropertyMessage::Send( GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f ) ); + SceneGraph::NodePropertyMessage::Send(GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f)); } } // namespace Internal