From: Eunki Hong Date: Tue, 6 Feb 2024 15:35:48 +0000 (+0900) Subject: [Tizen] Get the id of animation and render task X-Git-Tag: accepted/tizen/8.0/unified/20240409.150700~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35d5d520bff9b218fd2206bff0befdae1f2885fe;p=platform%2Fcore%2Fuifw%2Fdali-core.git [Tizen] Get the id of animation and render task Let we support to get the id of Animation and RenderTask, follow by NotifyInterface notify id. Change-Id: I56b6a0d27ceae4024fb52255062ebd00b87332eb Signed-off-by: Eunki Hong --- diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index f360cbd..c2705c1 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -15947,3 +15947,23 @@ int UtcDaliAnimationPlayBlendQuaternion(void) END_TEST; } + +int UtcDaliAnimationGetAnimationId(void) +{ + TestApplication application; + + Animation animation = Animation::New(1.0f); + + // Let we check id is not zero + DALI_TEST_CHECK(animation.GetAnimationId() != 0u); + + auto previousId = animation.GetAnimationId(); + + animation.Clear(); + + // Let we check id is same even after we call Clear() + DALI_TEST_CHECK(animation.GetAnimationId() != 0u); + DALI_TEST_CHECK(animation.GetAnimationId() == previousId); + + END_TEST; +} \ No newline at end of file diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index 1d08d66..cf7bd97 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -4384,3 +4384,28 @@ int UtcDaliRenderTaskOrderIndex02(void) END_TEST; } + +int UtcDaliRenderTaskGetRenderTaskId(void) +{ + TestApplication application; + tet_infoline("Testing RenderTask Id get"); + + Stage stage = Stage::GetCurrent(); + Vector2 stageSize(stage.GetSize()); + + RenderTaskList renderTaskList = stage.GetRenderTaskList(); + + RenderTask renderTask1 = renderTaskList.CreateTask(); + RenderTask renderTask2 = renderTaskList.CreateTask(); + RenderTask renderTask3 = renderTaskList.CreateTask(); + + DALI_TEST_CHECK(renderTask1.GetRenderTaskId() != 0u); + DALI_TEST_CHECK(renderTask2.GetRenderTaskId() != 0u); + DALI_TEST_CHECK(renderTask3.GetRenderTaskId() != 0u); + + DALI_TEST_CHECK(renderTask1.GetRenderTaskId() != renderTask2.GetRenderTaskId()); + DALI_TEST_CHECK(renderTask2.GetRenderTaskId() != renderTask3.GetRenderTaskId()); + DALI_TEST_CHECK(renderTask3.GetRenderTaskId() != renderTask1.GetRenderTaskId()); + + END_TEST; +} diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index ba2b1ab..5ef758c 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -192,6 +192,10 @@ void Animation::CreateSceneObject() // Create a new animation, Keep a const pointer to the animation. mAnimation = SceneGraph::Animation::New(mDurationSeconds, mSpeedFactor, mPlayRange, mLoopCount, mEndAction, mDisconnectAction); + + // Set id of scene graph animation + mAnimationId = mAnimation->GetNotifyId(); + OwnerPointer transferOwnership(const_cast(mAnimation)); AddAnimationMessage(mEventThreadServices.GetUpdateManager(), transferOwnership); @@ -209,6 +213,9 @@ void Animation::DestroySceneObject() // Remove animation using a message to the update manager RemoveAnimationMessage(mEventThreadServices.GetUpdateManager(), *mAnimation); mAnimation = nullptr; + + // Reset id + mAnimationId = 0u; } } @@ -1095,6 +1102,11 @@ Dali::Animation::LoopingMode Animation::GetLoopingMode() const return mAutoReverseEnabled ? Dali::Animation::AUTO_REVERSE : Dali::Animation::RESTART; } +uint32_t Animation::GetAnimationId() const +{ + return mAnimationId; +} + bool Animation::CompareConnectorEndTimes(const Animation::ConnectorTargetValues& lhs, const Animation::ConnectorTargetValues& rhs) { return ((lhs.timePeriod.delaySeconds + lhs.timePeriod.durationSeconds) < (rhs.timePeriod.delaySeconds + rhs.timePeriod.durationSeconds)); diff --git a/dali/internal/event/animation/animation-impl.h b/dali/internal/event/animation/animation-impl.h index dd91ff8..ab23d10 100644 --- a/dali/internal/event/animation/animation-impl.h +++ b/dali/internal/event/animation/animation-impl.h @@ -401,6 +401,11 @@ public: */ Dali::Animation::LoopingMode GetLoopingMode() const; + /** + * @copydoc Dali::Animation::GetAnimationId() + */ + uint32_t GetAnimationId() const; + public: // For connecting animators to animations /** * Add an animator connector. @@ -562,6 +567,8 @@ private: AnimatorConnectorContainer mConnectors{}; ///< Owned by the Animation ConnectorTargetValuesContainer mConnectorTargetValues{}; //< Used to store animating property target value information + uint32_t mAnimationId{0u}; + AlphaFunction mDefaultAlpha; Vector2 mPlayRange{0.0f, 1.0f}; float mBlendPoint{0.0f}; diff --git a/dali/internal/event/render-tasks/render-task-impl.cpp b/dali/internal/event/render-tasks/render-task-impl.cpp index 72c65b6..7ceaeb3 100644 --- a/dali/internal/event/render-tasks/render-task-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-impl.cpp @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include // for strcmp +#include "render-task-impl.h" // INTERNAL INCLUDES #include @@ -617,7 +618,12 @@ void RenderTask::SetOrderIndex(int32_t orderIndex) if(mOrderIndex != orderIndex) { mOrderIndex = orderIndex; - mRenderTaskList.RequestToSort(); + + // We only need to sort render task list if it is valid. + if(GetRenderTaskSceneObject()) + { + mRenderTaskList.RequestToSort(); + } } } @@ -626,6 +632,11 @@ int32_t RenderTask::GetOrderIndex() const return mOrderIndex; } +uint32_t RenderTask::GetRenderTaskId() const +{ + return mRenderTaskId; +} + const SceneGraph::RenderTask* RenderTask::GetRenderTaskSceneObject() const { return static_cast(mUpdateObject); @@ -939,6 +950,9 @@ RenderTask::RenderTask(const SceneGraph::RenderTask* sceneObject, RenderTaskList mCullMode(Dali::RenderTask::DEFAULT_CULL_MODE), mRequiresSync(false) { + // Set id of render task + mRenderTaskId = sceneObject->GetNotifyId(); + DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::RenderTask(this:%p)\n", this); // scene object handles observation of source and camera } diff --git a/dali/internal/event/render-tasks/render-task-impl.h b/dali/internal/event/render-tasks/render-task-impl.h index 62ddd86..f8897b0 100644 --- a/dali/internal/event/render-tasks/render-task-impl.h +++ b/dali/internal/event/render-tasks/render-task-impl.h @@ -279,6 +279,11 @@ public: */ int32_t GetOrderIndex() const; + /** + * @copydoc Dali::RenderTask::GetRenderTaskId() + */ + uint32_t GetRenderTaskId() const; + public: // Used by RenderTaskList, which owns the SceneGraph::RenderTasks /** * Retrieve the scene-graph RenderTask object. @@ -402,6 +407,8 @@ private: uint32_t mRenderPassTag{0u}; int32_t mOrderIndex{0u}; + uint32_t mRenderTaskId{0u}; + bool mExclusive : 1; ///< True if the render-task has exclusive access to the source Nodes. bool mInputEnabled : 1; ///< True if the render-task should be considered for input handling. bool mClearEnabled : 1; ///< True if the render-task should be clear the color buffer. diff --git a/dali/public-api/animation/animation.cpp b/dali/public-api/animation/animation.cpp index 53e8ee0..ba93d6f 100644 --- a/dali/public-api/animation/animation.cpp +++ b/dali/public-api/animation/animation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -166,6 +166,11 @@ Animation::LoopingMode Animation::GetLoopingMode() const return GetImplementation(*this).GetLoopingMode(); } +uint32_t Animation::GetAnimationId() const +{ + return GetImplementation(*this).GetAnimationId(); +} + Animation::AnimationSignalType& Animation::FinishedSignal() { return GetImplementation(*this).FinishedSignal(); diff --git a/dali/public-api/animation/animation.h b/dali/public-api/animation/animation.h index 639bfb6..fafc1f0 100644 --- a/dali/public-api/animation/animation.h +++ b/dali/public-api/animation/animation.h @@ -2,7 +2,7 @@ #define DALI_ANIMATION_H /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2024 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. @@ -523,6 +523,14 @@ public: LoopingMode GetLoopingMode() const; /** + * @brief Get the unique id of Animation. It could be 0 given animation is invalid. + * + * @SINCE_2_3.14 + * @return The unique id of Animation, or 0 if invalid. + */ + uint32_t GetAnimationId() const; + + /** * @brief Connects to this signal to be notified when an Animation's animations have finished. * * @SINCE_1_0.0 diff --git a/dali/public-api/render-tasks/render-task.cpp b/dali/public-api/render-tasks/render-task.cpp index aaa1328..4521f44 100644 --- a/dali/public-api/render-tasks/render-task.cpp +++ b/dali/public-api/render-tasks/render-task.cpp @@ -302,6 +302,11 @@ int32_t RenderTask::GetOrderIndex() const return GetImplementation(*this).GetOrderIndex(); } +uint32_t RenderTask::GetRenderTaskId() const +{ + return GetImplementation(*this).GetRenderTaskId(); +} + RenderTask::RenderTask(Internal::RenderTask* internal) : Handle(internal) { diff --git a/dali/public-api/render-tasks/render-task.h b/dali/public-api/render-tasks/render-task.h index ea4265f..6eab3d4 100644 --- a/dali/public-api/render-tasks/render-task.h +++ b/dali/public-api/render-tasks/render-task.h @@ -571,6 +571,14 @@ public: */ int32_t GetOrderIndex() const; + /** + * @brief Get the unique id of RenderTask. It could be 0 given render task is invalid. + * + * @SINCE_2_3.10 + * @return The unique id of RenderTask, or 0 if invalid. + */ + uint32_t GetRenderTaskId() const; + public: // Signals /** * @brief If the refresh rate is REFRESH_ONCE, connect to this signal to be notified when a RenderTask has finished.