[Tizen] Fix hit-test RenderTask error 12/309012/3 accepted/tizen/7.0/unified/20240409.073750 accepted/tizen/7.0/unified/20240409.104407
authorhuiyu.eun <huiyu.eun@samsung.com>
Wed, 3 Apr 2024 06:08:22 +0000 (15:08 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Thu, 4 Apr 2024 08:37:39 +0000 (17:37 +0900)
There is a problem that the hit-test does not work properly because the
RenderTask is always fetched with a fixed index from the RenderTaskList.
It is fixed by passing the corresponding SceneView's RenderTask.

Change-Id: Id114c839455613fc4ed6437e2cb8482ee6677be9
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
dali-scene3d/internal/controls/scene-view/scene-view-impl.cpp
dali-scene3d/internal/controls/scene-view/scene-view-impl.h
dali-scene3d/internal/event/collider-mesh-processor-impl.cpp

index 361a1e8..c8b7251 100644 (file)
@@ -874,6 +874,11 @@ bool SceneView::IsEnabledCropToMask()
   return mCropToMask;
 }
 
+Dali::RenderTask SceneView::GetRenderTask()
+{
+  return mRenderTask;
+}
+
 void SceneView::SetProperty(BaseObject* object, Property::Index index, const Property::Value& value)
 {
   Scene3D::SceneView sceneView = Scene3D::SceneView::DownCast(Dali::BaseHandle(object));
index 47ad214..11aada5 100644 (file)
@@ -288,6 +288,11 @@ public:
    */
   bool IsEnabledCropToMask();
 
+  /**
+   * @brief Gets current RenderTask
+   */
+  Dali::RenderTask GetRenderTask();
+
   // Properties
 
   /**
index 5d45d4d..831f269 100644 (file)
@@ -94,11 +94,9 @@ public:
       Vector3     direction;
       cameraActor.ScreenToLocal(x, y, result.x, result.y);
 
-      auto                  list      = Stage::GetCurrent().GetRenderTaskList();
-      [[maybe_unused]] auto taskCount = list.GetTaskCount();
-      renderTask                      = list.GetTask(list.GetTaskCount() - 1);
+      auto sceneViewRenderTask = GetImpl(sceneView).GetRenderTask();
 
-      if(HitTestAlgorithm::BuildPickingRay(renderTask, result, origin, direction))
+      if(sceneViewRenderTask && HitTestAlgorithm::BuildPickingRay(sceneViewRenderTask, result, origin, direction))
       {
         for(auto& mesh : meshData)
         {