From: seungho baek Date: Tue, 18 Apr 2023 11:05:14 +0000 (+0900) Subject: [Tizen] Add Post Constraint that works after transform X-Git-Tag: accepted/tizen/7.0/unified/20230424.020508~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F05%2F291605%2F1;p=platform%2Fcore%2Fuifw%2Fdali-core.git [Tizen] Add Post Constraint that works after transform Change-Id: I90a7b2d731623691915ed5c01500ac6928d25112 Signed-off-by: seungho baek --- diff --git a/automated-tests/src/dali/utc-Dali-Constraint.cpp b/automated-tests/src/dali/utc-Dali-Constraint.cpp index 30b361f88..e0255b231 100644 --- a/automated-tests/src/dali/utc-Dali-Constraint.cpp +++ b/automated-tests/src/dali/utc-Dali-Constraint.cpp @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -1627,5 +1628,68 @@ int UtcDaliConstraintComponentNonTransformPropertyConstraintP(void) ComponentTest::CheckComponentProperty(application, actor, Actor::Property::COLOR_BLUE); // Component 2 ComponentTest::CheckComponentProperty(application, actor, Actor::Property::COLOR_ALPHA); // Component 3 + END_TEST; +} + + +namespace PostConstraintTest +{ +void CheckComponentProperty(TestApplication& application, Actor& actor, Handle target) +{ + actor.SetProperty(Actor::Property::POSITION, Vector3::ONE); + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ONE, TEST_LOCATION); + + application.SendNotification(); + application.Render(); + + actor.SetProperty(Actor::Property::POSITION, Vector3::ONE * 2.0f); + + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION), Vector3::ONE * 2.0f, TEST_LOCATION); + DALI_TEST_EQUALS(actor.GetCurrentProperty(Actor::Property::POSITION), Vector3::ONE, TEST_LOCATION); + + Property::Index prePropertyIndex = target.RegisterProperty("testPreProperty", Vector3::ZERO); + Constraint preConstraint = Constraint::New(target, prePropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs) { + output = inputs[0]->GetVector3(); + }); + preConstraint.AddSource(Source{actor, Actor::Property::WORLD_POSITION}); + preConstraint.Apply(); + + Property::Index postPropertyIndex = target.RegisterProperty("testPostProperty", Vector3::ZERO); + Constraint postConstraint = Constraint::New(target, postPropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs) { + output = inputs[0]->GetVector3(); + }); + postConstraint.AddSource(Source{actor, Actor::Property::WORLD_POSITION}); + postConstraint.ApplyPost(); + + application.SendNotification(); + application.Render(); + + DALI_TEST_EQUALS(target.GetCurrentProperty(prePropertyIndex), Vector3(-239.0, -399.0, 1.0), TEST_LOCATION); + DALI_TEST_EQUALS(target.GetCurrentProperty(postPropertyIndex), Vector3(-238.0, -398.0, 2.0), TEST_LOCATION); + + preConstraint.Remove(); + postConstraint.Remove(); +} +} + +int UtcDaliConstraintApplyPost(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + application.GetScene().Add(actor); + + Geometry targetGeometry = CreateQuadGeometry(); + Shader targetShader = CreateShader(); + Renderer targetRenderer = Renderer::New(targetGeometry, targetShader); + Actor targetActor = Actor::New(); + RenderTaskList taskList = application.GetScene().GetRenderTaskList(); + + application.GetScene().Add(targetActor); + PostConstraintTest::CheckComponentProperty(application, actor, targetShader); // Shader + PostConstraintTest::CheckComponentProperty(application, actor, targetRenderer); // Renderer + PostConstraintTest::CheckComponentProperty(application, actor, targetActor); // Actor(Node) + PostConstraintTest::CheckComponentProperty(application, actor, taskList.GetTask(0u)); // RenderTask + END_TEST; } \ No newline at end of file diff --git a/dali/internal/event/animation/constraint-base.cpp b/dali/internal/event/animation/constraint-base.cpp index 24230a783..d41825d2f 100644 --- a/dali/internal/event/animation/constraint-base.cpp +++ b/dali/internal/event/animation/constraint-base.cpp @@ -62,7 +62,8 @@ ConstraintBase::ConstraintBase(Object& object, Property::Index targetPropertyInd mRemoveAction(Dali::Constraint::DEFAULT_REMOVE_ACTION), mTag(0), mApplied(false), - mSourceDestroyed(false) + mSourceDestroyed(false), + mIsPreConstraint(true) { ObserveObject(object); } @@ -103,15 +104,25 @@ void ConstraintBase::AddSource(Source source) } } -void ConstraintBase::Apply() +void ConstraintBase::Apply(bool isPreConstraint) { if(mTargetObject && !mApplied && !mSourceDestroyed) { mApplied = true; - ConnectConstraint(); + mIsPreConstraint = isPreConstraint; + ConnectConstraint(mIsPreConstraint); mTargetObject->ApplyConstraint(*this); } + else + { + DALI_LOG_ERROR("Fail to apply constraint\n"); + } +} + +void ConstraintBase::ApplyPost() +{ + Apply(false); } void ConstraintBase::Remove() @@ -122,6 +133,7 @@ void ConstraintBase::Remove() { mTargetObject->RemoveConstraint(*this); } + mIsPreConstraint = true; } void ConstraintBase::RemoveInternal() @@ -137,7 +149,14 @@ void ConstraintBase::RemoveInternal() { const SceneGraph::PropertyOwner& propertyOwner = mTargetObject->GetSceneObject(); // Remove from scene-graph - RemoveConstraintMessage(GetEventThreadServices(), propertyOwner, *(mSceneGraphConstraint)); + if(mIsPreConstraint) + { + RemoveConstraintMessage(GetEventThreadServices(), propertyOwner, *(mSceneGraphConstraint)); + } + else + { + RemovePostConstraintMessage(GetEventThreadServices(), propertyOwner, *(mSceneGraphConstraint)); + } // mSceneGraphConstraint will be deleted in update-thread, remove dangling pointer mSceneGraphConstraint = nullptr; } @@ -186,7 +205,7 @@ void ConstraintBase::SceneObjectAdded(Object& object) (nullptr == mSceneGraphConstraint) && mTargetObject) { - ConnectConstraint(); + ConnectConstraint(mIsPreConstraint); } } diff --git a/dali/internal/event/animation/constraint-base.h b/dali/internal/event/animation/constraint-base.h index 2b8ba2138..e286e43d3 100644 --- a/dali/internal/event/animation/constraint-base.h +++ b/dali/internal/event/animation/constraint-base.h @@ -82,7 +82,12 @@ public: /** * @copydoc Dali::Constraint::Apply() */ - void Apply(); + void Apply(bool isPreConstraint = true); + + /** + * @copydoc Dali::Constraint::ApplyPost() + */ + void ApplyPost(); /** * @copydoc Dali::Constraint::Remove() @@ -172,7 +177,7 @@ private: /** * Connect the constraint */ - virtual void ConnectConstraint() = 0; + virtual void ConnectConstraint(bool isPreConstraint = true) = 0; protected: /** @@ -221,6 +226,7 @@ protected: uint32_t mTag; bool mApplied : 1; ///< Whether the constraint has been applied bool mSourceDestroyed : 1; ///< Is set to true if any of our input source objects are destroyed + bool mIsPreConstraint : 1; ///< Is set to true if this constraint is run before transform. }; } // namespace Internal diff --git a/dali/internal/event/animation/constraint-impl.h b/dali/internal/event/animation/constraint-impl.h index 7b7ec2691..1fdb68ea4 100644 --- a/dali/internal/event/animation/constraint-impl.h +++ b/dali/internal/event/animation/constraint-impl.h @@ -106,7 +106,7 @@ private: /** * @copydoc ConstraintBase::ConnectConstraint() */ - void ConnectConstraint() final + void ConnectConstraint(bool isPreConstraint) final { // Should not come here if target object has been destroyed DALI_ASSERT_DEBUG(nullptr != mTargetObject); @@ -148,7 +148,14 @@ private: resetter = SceneGraph::ConstraintResetter::New(targetObject, *targetProperty, *mSceneGraphConstraint); } OwnerPointer transferOwnership(const_cast(mSceneGraphConstraint)); - ApplyConstraintMessage(GetEventThreadServices(), targetObject, transferOwnership); + if(isPreConstraint) + { + ApplyConstraintMessage(GetEventThreadServices(), targetObject, transferOwnership); + } + else + { + ApplyPostConstraintMessage(GetEventThreadServices(), targetObject, transferOwnership); + } if(resetter) { AddResetterMessage(GetEventThreadServices().GetUpdateManager(), resetter); @@ -256,7 +263,7 @@ private: /** * @copydoc ConstraintBase::ConnectConstraint() */ - void ConnectConstraint() final + void ConnectConstraint(bool isPreConstraint) final { // Should not come here if target object has been destroyed DALI_ASSERT_DEBUG(nullptr != mTargetObject); @@ -295,7 +302,14 @@ private: if(mSceneGraphConstraint) { OwnerPointer transferOwnership(const_cast(mSceneGraphConstraint)); - ApplyConstraintMessage(GetEventThreadServices(), targetObject, transferOwnership); + if(isPreConstraint) + { + ApplyConstraintMessage(GetEventThreadServices(), targetObject, transferOwnership); + } + else + { + ApplyPostConstraintMessage(GetEventThreadServices(), targetObject, transferOwnership); + } if(resetterRequired) { OwnerPointer resetter = SceneGraph::ConstraintResetter::New(targetObject, *targetProperty, *mSceneGraphConstraint); diff --git a/dali/internal/update/common/property-owner-messages.h b/dali/internal/update/common/property-owner-messages.h index d6d24e2ab..9dce203b9 100644 --- a/dali/internal/update/common/property-owner-messages.h +++ b/dali/internal/update/common/property-owner-messages.h @@ -248,6 +248,31 @@ inline void RemoveConstraintMessage(EventThreadServices& eventThreadServices, co new(slot) LocalType(&owner, &PropertyOwner::RemoveConstraint, &constraint); } +inline void ApplyPostConstraintMessage(EventThreadServices& eventThreadServices, const PropertyOwner& owner, OwnerPointer& constraint) +{ + using LocalType = MessageValue1 >; + + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalType(&owner, &PropertyOwner::ApplyPostConstraint, constraint); +} + +inline void RemovePostConstraintMessage(EventThreadServices& eventThreadServices, const PropertyOwner& owner, const ConstraintBase& constConstraint) +{ + // The update-thread can modify this object. + ConstraintBase& constraint = const_cast(constConstraint); + + using LocalType = MessageValue1; + + // Reserve some memory inside the message queue + uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType)); + + // Construct message in the message queue memory; note that delete should not be called on the return value + new(slot) LocalType(&owner, &PropertyOwner::RemovePostConstraint, &constraint); +} + inline void AddUniformMapMessage(EventThreadServices& eventThreadServices, const PropertyOwner& owner, UniformPropertyMapping map) { using LocalType = MessageValue1; diff --git a/dali/internal/update/common/property-owner.cpp b/dali/internal/update/common/property-owner.cpp index e23831f73..f5fd5861c 100644 --- a/dali/internal/update/common/property-owner.cpp +++ b/dali/internal/update/common/property-owner.cpp @@ -83,6 +83,7 @@ void PropertyOwner::Destroy() // Remove all constraints when disconnected from scene-graph mConstraints.Clear(); + mPostConstraints.Clear(); } void PropertyOwner::ConnectToSceneGraph() @@ -111,6 +112,7 @@ void PropertyOwner::DisconnectFromSceneGraph(BufferIndex updateBufferIndex) // Remove all constraints when disconnected from scene-graph mConstraints.Clear(); + mPostConstraints.Clear(); } void PropertyOwner::ReserveProperties(int propertyCount) @@ -149,6 +151,32 @@ void PropertyOwner::RemoveConstraint(ConstraintBase* constraint) //it may be that the constraint has already been removed e.g. from disconnection from scene graph, so nothing needs to be done } +ConstraintOwnerContainer& PropertyOwner::GetPostConstraints() +{ + return mPostConstraints; +} + +void PropertyOwner::ApplyPostConstraint(OwnerPointer& constraint) +{ + constraint->OnConnect(); + mPostConstraints.PushBack(constraint.Release()); +} + +void PropertyOwner::RemovePostConstraint(ConstraintBase* constraint) +{ + const ConstraintIter constraintEndIter = mPostConstraints.End(); + for(ConstraintIter iter = mPostConstraints.Begin(); constraintEndIter != iter; ++iter) + { + if(*iter == constraint) + { + mPostConstraints.Erase(iter); + return; // We're finished + } + } + + //it may be that the constraint has already been removed e.g. from disconnection from scene graph, so nothing needs to be done +} + PropertyOwner::PropertyOwner() : mUpdated(false), mIsConnectedToSceneGraph(false) diff --git a/dali/internal/update/common/property-owner.h b/dali/internal/update/common/property-owner.h index 1d3fee7fa..51fad150e 100644 --- a/dali/internal/update/common/property-owner.h +++ b/dali/internal/update/common/property-owner.h @@ -190,12 +190,30 @@ public: */ void RemoveConstraint(ConstraintBase* constraint); + /** + * Apply a post constraint. + * @param[in] constraint The constraint to apply. + */ + void ApplyPostConstraint(OwnerPointer& constraint); + + /** + * Begin removal of post constraints. + * @param[in] constraint The constraint to remove. + */ + void RemovePostConstraint(ConstraintBase* constraint); + /** * Retrieve the constraints that are currently applied. * @return A container of constraints. */ ConstraintOwnerContainer& GetConstraints(); + /** + * Retrieve the post constraints that are currently applied. + * @return A container of post constraints. + */ + ConstraintOwnerContainer& GetPostConstraints(); + /** * @copydoc UniformMap::Add */ @@ -257,6 +275,7 @@ private: ObserverContainer mObservers; ///< Container of observer raw-pointers (not owned) ConstraintOwnerContainer mConstraints; ///< Container of owned constraints + ConstraintOwnerContainer mPostConstraints; ///< Container of owned constraints }; } // namespace SceneGraph diff --git a/dali/internal/update/manager/update-algorithms.cpp b/dali/internal/update/manager/update-algorithms.cpp index 98e5a9378..46e2b7e2a 100644 --- a/dali/internal/update/manager/update-algorithms.cpp +++ b/dali/internal/update/manager/update-algorithms.cpp @@ -51,9 +51,9 @@ Debug::Filter* gUpdateFilter = Debug::Filter::New(Debug::Concise, false, "LOG_UP * @param propertyOwner to constrain * @param updateBufferIndex buffer index to use */ -void ConstrainPropertyOwner(PropertyOwner& propertyOwner, BufferIndex updateBufferIndex) +void ConstrainPropertyOwner(PropertyOwner& propertyOwner, BufferIndex updateBufferIndex, bool isPreConstraint) { - ConstraintOwnerContainer& constraints = propertyOwner.GetConstraints(); + ConstraintOwnerContainer& constraints = (isPreConstraint) ? propertyOwner.GetConstraints() : propertyOwner.GetPostConstraints(); const ConstraintIter endIter = constraints.End(); for(ConstraintIter iter = constraints.Begin(); iter != endIter; ++iter) @@ -97,14 +97,19 @@ inline void UpdateNodeOpacity(Node& node, NodePropertyFlags nodeDirtyFlags, Buff /** * This is called recursively for all children of the root Node */ -inline NodePropertyFlags UpdateNodes(Node& node, - NodePropertyFlags parentFlags, - BufferIndex updateBufferIndex, - RenderQueue& renderQueue, - bool updated) +inline NodePropertyFlags UpdateNodes(Node& node, + NodePropertyFlags parentFlags, + BufferIndex updateBufferIndex, + RenderQueue& renderQueue, + PropertyOwnerContainer& postPropertyOwners, + bool updated) { // Apply constraints to the node ConstrainPropertyOwner(node, updateBufferIndex); + if(!node.GetPostConstraints().Empty()) + { + postPropertyOwners.PushBack(&node); + } // Some dirty flags are inherited from parent NodePropertyFlags nodeDirtyFlags = node.GetDirtyFlags() | node.GetInheritedDirtyFlags(parentFlags); @@ -135,6 +140,7 @@ inline NodePropertyFlags UpdateNodes(Node& node, nodeDirtyFlags, updateBufferIndex, renderQueue, + postPropertyOwners, updated); } @@ -144,9 +150,10 @@ inline NodePropertyFlags UpdateNodes(Node& node, /** * The root node is treated separately; it cannot inherit values since it has no parent */ -NodePropertyFlags UpdateNodeTree(Layer& rootNode, - BufferIndex updateBufferIndex, - RenderQueue& renderQueue) +NodePropertyFlags UpdateNodeTree(Layer& rootNode, + BufferIndex updateBufferIndex, + RenderQueue& renderQueue, + PropertyOwnerContainer& postPropertyOwners) { DALI_ASSERT_DEBUG(rootNode.IsRoot()); @@ -182,6 +189,7 @@ NodePropertyFlags UpdateNodeTree(Layer& rootNode, nodeDirtyFlags, updateBufferIndex, renderQueue, + postPropertyOwners, updated); } diff --git a/dali/internal/update/manager/update-algorithms.h b/dali/internal/update/manager/update-algorithms.h index eeeb09eff..ce0ed897f 100644 --- a/dali/internal/update/manager/update-algorithms.h +++ b/dali/internal/update/manager/update-algorithms.h @@ -32,12 +32,15 @@ class Layer; class PropertyOwner; class RenderQueue; +using PropertyOwnerContainer = Dali::Vector; + /** * Constrain the local properties of the PropertyOwner. * @param[in] propertyOwner The PropertyOwner to constrain * @param[in] updateBufferIndex The current update buffer index. + * @param[in] isPreConstraint True if the constraint is performed before transform. */ -void ConstrainPropertyOwner(PropertyOwner& propertyOwner, BufferIndex updateBufferIndex); +void ConstrainPropertyOwner(PropertyOwner& propertyOwner, BufferIndex updateBufferIndex, bool isPreConstraint = true); /** * Update a tree of nodes @@ -45,11 +48,13 @@ void ConstrainPropertyOwner(PropertyOwner& propertyOwner, BufferIndex updateBuff * @param[in] rootNode The root of a tree of nodes. * @param[in] updateBufferIndex The current update buffer index. * @param[in] renderQueue Used to query messages for the next Render. + * @param[out] postPropertyOwner property owners those have post constraint. * @return The cumulative (ORed) dirty flags for the updated nodes */ -NodePropertyFlags UpdateNodeTree(Layer& rootNode, - BufferIndex updateBufferIndex, - RenderQueue& renderQueue); +NodePropertyFlags UpdateNodeTree(Layer& rootNode, + BufferIndex updateBufferIndex, + RenderQueue& renderQueue, + PropertyOwnerContainer& postPropertyOwners); /** * This updates all the sub-layer's reusability flags without affecting * the root layer. diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index c89ecbd3c..b344c9d1b 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -817,16 +817,20 @@ bool UpdateManager::Animate(BufferIndex bufferIndex, float elapsedSeconds) return animationActive; } -void UpdateManager::ConstrainCustomObjects(BufferIndex bufferIndex) +void UpdateManager::ConstrainCustomObjects(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex) { //Constrain custom objects (in construction order) for(auto&& object : mImpl->customObjects) { ConstrainPropertyOwner(*object, bufferIndex); + if(!object->GetPostConstraints().Empty()) + { + postPropertyOwners.PushBack(object); + } } } -void UpdateManager::ConstrainRenderTasks(BufferIndex bufferIndex) +void UpdateManager::ConstrainRenderTasks(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex) { // Constrain render-tasks for(auto&& scene : mImpl->scenes) @@ -837,17 +841,25 @@ void UpdateManager::ConstrainRenderTasks(BufferIndex bufferIndex) for(auto&& task : tasks) { ConstrainPropertyOwner(*task, bufferIndex); + if(!task->GetPostConstraints().Empty()) + { + postPropertyOwners.PushBack(task); + } } } } } -void UpdateManager::ConstrainShaders(BufferIndex bufferIndex) +void UpdateManager::ConstrainShaders(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex) { // constrain shaders... (in construction order) for(auto&& shader : mImpl->shaders) { ConstrainPropertyOwner(*shader, bufferIndex); + if(!shader->GetPostConstraints().Empty()) + { + postPropertyOwners.PushBack(shader); + } } } @@ -888,18 +900,22 @@ void UpdateManager::ForwardCompiledShadersToEventThread() } } -void UpdateManager::UpdateRenderers(BufferIndex bufferIndex) +void UpdateManager::UpdateRenderers(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex) { for(auto&& renderer : mImpl->renderers) { //Apply constraints ConstrainPropertyOwner(*renderer, bufferIndex); + if(!renderer->GetPostConstraints().Empty()) + { + postPropertyOwners.PushBack(renderer); + } mImpl->renderingRequired = renderer->PrepareRender(bufferIndex) || mImpl->renderingRequired; } } -void UpdateManager::UpdateNodes(BufferIndex bufferIndex) +void UpdateManager::UpdateNodes(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex) { mImpl->nodeDirtyFlags = NodePropertyFlags::NOTHING; @@ -911,7 +927,8 @@ void UpdateManager::UpdateNodes(BufferIndex bufferIndex) // And add the renderers to the sorted layers. Start from root, which is also a layer mImpl->nodeDirtyFlags |= UpdateNodeTree(*scene->root, bufferIndex, - mImpl->renderQueue); + mImpl->renderQueue, + postPropertyOwners); } } } @@ -979,8 +996,9 @@ uint32_t UpdateManager::Update(float elapsedSeconds, //Animate bool animationActive = Animate(bufferIndex, elapsedSeconds); - //Constraint custom objects - ConstrainCustomObjects(bufferIndex); + PropertyOwnerContainer postPropertyOwners; + // Constraint custom objects + ConstrainCustomObjects(postPropertyOwners, bufferIndex); //Clear the lists of renderers from the previous update for(auto&& scene : mImpl->scenes) @@ -1003,15 +1021,15 @@ uint32_t UpdateManager::Update(float elapsedSeconds, mImpl->frameCallbackProcessor->Update(bufferIndex, elapsedSeconds); } - //Update node hierarchy, apply constraints, - UpdateNodes(bufferIndex); + // Update node hierarchy, apply constraints, + UpdateNodes(postPropertyOwners, bufferIndex); - //Apply constraints to RenderTasks, shaders - ConstrainRenderTasks(bufferIndex); - ConstrainShaders(bufferIndex); + // Apply constraints to RenderTasks, shaders + ConstrainRenderTasks(postPropertyOwners, bufferIndex); + ConstrainShaders(postPropertyOwners, bufferIndex); - //Update renderers and apply constraints - UpdateRenderers(bufferIndex); + // Update renderers and apply constraints + UpdateRenderers(postPropertyOwners, bufferIndex); //Update the transformations of all the nodes if(mImpl->transformManager.Update()) @@ -1019,7 +1037,13 @@ uint32_t UpdateManager::Update(float elapsedSeconds, mImpl->nodeDirtyFlags |= NodePropertyFlags::TRANSFORM; } - //Initialise layer renderable reuse + // Constraint applied after transform manager updated. Only required property owner processed. + for(auto&& propertyOwner : postPropertyOwners) + { + ConstrainPropertyOwner(*propertyOwner, bufferIndex, false); + } + + // Initialise layer renderable reuse UpdateLayers(bufferIndex); //Process Property Notifications diff --git a/dali/internal/update/manager/update-manager.h b/dali/internal/update/manager/update-manager.h index d1f82beb7..bd9b2a9fb 100644 --- a/dali/internal/update/manager/update-manager.h +++ b/dali/internal/update/manager/update-manager.h @@ -706,21 +706,24 @@ private: /** * Applies constraints to CustomObjects + * @param[out] postPropertyOwner property owners those have post constraint. * @param[in] bufferIndex to use */ - void ConstrainCustomObjects(BufferIndex bufferIndex); + void ConstrainCustomObjects(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex); /** * Applies constraints to RenderTasks + * @param[out] postPropertyOwner property owners those have post constraint. * @param[in] bufferIndex to use */ - void ConstrainRenderTasks(BufferIndex bufferIndex); + void ConstrainRenderTasks(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex); /** * Applies constraints to Shaders + * @param[out] postPropertyOwner property owners those have post constraint. * @param[in] bufferIndex to use */ - void ConstrainShaders(BufferIndex bufferIndex); + void ConstrainShaders(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex); /** * Perform property notification updates @@ -735,9 +738,10 @@ private: /** * Update node shaders, opacity, geometry etc. + * @param[out] postPropertyOwner property owners those have post constraint. * @param[in] bufferIndex to use */ - void UpdateNodes(BufferIndex bufferIndex); + void UpdateNodes(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex); /** * initialize layer renderables @@ -747,9 +751,10 @@ private: /** * Update Renderers + * @param[out] postPropertyOwner property owners those have post constraint. * @param[in] bufferIndex to use */ - void UpdateRenderers(BufferIndex bufferIndex); + void UpdateRenderers(PropertyOwnerContainer& postPropertyOwners, BufferIndex bufferIndex); private: // needs to be direct member so that getter for event buffer can be inlined diff --git a/dali/public-api/animation/constraint.cpp b/dali/public-api/animation/constraint.cpp index 41759198d..442969b3a 100644 --- a/dali/public-api/animation/constraint.cpp +++ b/dali/public-api/animation/constraint.cpp @@ -70,6 +70,11 @@ void Constraint::Apply() GetImplementation(*this).Apply(); } +void Constraint::ApplyPost() +{ + GetImplementation(*this).ApplyPost(); +} + void Constraint::Remove() { GetImplementation(*this).Remove(); diff --git a/dali/public-api/animation/constraint.h b/dali/public-api/animation/constraint.h index 6bdcb7cb9..ff8b61a9b 100644 --- a/dali/public-api/animation/constraint.h +++ b/dali/public-api/animation/constraint.h @@ -454,15 +454,28 @@ public: void AddSource(ConstraintSource source); /** - * @brief Applies this constraint. + * @brief Applies this constraint to be computed before transform. * * @SINCE_1_0.0 * @pre The constraint must be initialized. * @pre The target object must still be alive. * @pre The source inputs should not have been destroyed. + * + * @note This method cannot be called with ApplyPost at the same time. */ void Apply(); + /** + * @brief Applies this constraint to be computed after transform. + * + * @pre The constraint must be initialized. + * @pre The target object must still be alive. + * @pre The source inputs should not have been destroyed. + * + * @note This method cannot be called with Apply at the same time. + */ + void ApplyPost(); + /** * @brief Removes this constraint. * @SINCE_1_0.0