/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
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("updateAreaHint", VECTOR4, true, false, false, Dali::Actor::Property::UPDATE_AREA_HINT)
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)
if(mScene)
{
BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
- return CalculateActorScreenPosition(*this, bufferIndex);
+ if(mLayer3DParentsCount == 0)
+ {
+ // We can assume that this actor is under 2d layer. Use faster, but imprecise algorithm
+ return CalculateActorScreenPosition(*this, bufferIndex);
+ }
+ else
+ {
+ return CalculateActorScreenPositionRenderTaskList(*this, bufferIndex);
+ }
}
return Vector2::ZERO;
}
mName(),
mSortedDepth(0u),
mDepth(0u),
+ mLayer3DParentsCount(0),
mIsRoot(ROOT_LAYER == derivedType),
mIsLayer(LAYER == derivedType || ROOT_LAYER == derivedType),
mIsOnScene(false),
mParentImpl.UnparentChildren();
}
-void Actor::ConnectToScene(uint32_t parentDepth, bool notify)
+void Actor::ConnectToScene(uint32_t parentDepth, uint32_t layer3DParentsCount, bool notify)
{
// This container is used instead of walking the Actor hierarchy.
// It protects us when the Actor hierarchy is modified during OnSceneConnectionExternal callbacks.
}
// This stage is not interrupted by user callbacks.
- mParentImpl.RecursiveConnectToScene(connectionList, parentDepth + 1);
+ mParentImpl.RecursiveConnectToScene(connectionList, layer3DParentsCount, parentDepth + 1);
// Notify applications about the newly connected actors.
for(const auto& actor : connectionList)
Actor* parentActor = static_cast<Actor*>(parent);
mScene = parentActor->mScene;
- if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ if(!EventThreadServices::IsShuttingDown() && // Don't emit signals or send messages during Core destruction
parentActor->OnScene())
{
// Instruct each actor to create a corresponding node in the scene graph
- ConnectToScene(parentActor->GetHierarchyDepth(), notify);
+ ConnectToScene(parentActor->GetHierarchyDepth(), parentActor->GetLayer3DParentCount(), notify);
}
// Resolve the name and index for the child properties if any
mParent = nullptr;
- if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
+ if(!EventThreadServices::IsShuttingDown() && // Don't emit signals or send messages during Core destruction
OnScene())
{
// Disconnect the Node & its children from the scene-graph.
Rect<> Actor::CalculateScreenExtents() const
{
- auto screenPosition = GetCurrentScreenPosition();
- BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
- return CalculateActorScreenExtents(*this, screenPosition, bufferIndex);
+ if(mLayer3DParentsCount == 0)
+ {
+ // We can assume that this actor is under 2d layer. Use faster, but imprecise algorithm
+ auto screenPosition = GetCurrentScreenPosition();
+ BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
+ return CalculateActorScreenExtents(*this, screenPosition, bufferIndex);
+ }
+ else
+ {
+ BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
+ return CalculateActorScreenExtentsRenderTaskList(*this, bufferIndex);
+ }
}
Vector3 Actor::GetAnchorPointForPosition() const
}
}
-void Actor::SetUpdateSizeHint(const Vector2& updateSizeHint)
+void Actor::SetUpdateAreaHint(const Vector4& updateAreaHint)
{
// node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodePropertyMessage<Vector3>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &AnimatableProperty<Vector3>::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f));
+ SceneGraph::NodePropertyMessage<Vector4>::Send(GetEventThreadServices(), &GetNode(), &GetNode().mUpdateAreaHint, &AnimatableProperty<Vector4>::Bake, updateAreaHint);
}
} // namespace Internal