/*
- * 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.
model.AddModelNode(node);
DALI_TEST_EQUALS(node.HasColliderMesh(), true, TEST_LOCATION);
+ // Scene off model, and add,remove model node.
+ model.Unparent();
+ DALI_TEST_EQUALS(node.HasColliderMesh(), true, TEST_LOCATION);
+
+ model.RemoveModelNode(node);
+ DALI_TEST_EQUALS(node.HasColliderMesh(), true, TEST_LOCATION);
+
+ model.AddModelNode(node);
+ DALI_TEST_EQUALS(node.HasColliderMesh(), true, TEST_LOCATION);
+
+ // Reset collider mesh
+ node.SetColliderMesh(nullptr);
+ DALI_TEST_EQUALS(node.HasColliderMesh(), false, TEST_LOCATION);
+
+ model.RemoveModelNode(node);
+ DALI_TEST_EQUALS(node.HasColliderMesh(), false, TEST_LOCATION);
+
+ model.AddModelNode(node);
+ DALI_TEST_EQUALS(node.HasColliderMesh(), false, TEST_LOCATION);
+
END_TEST;
}
\ No newline at end of file
if(modelNode.HasColliderMesh())
{
RegisterColliderMesh(modelNode);
- Scene3D::ColliderMeshProcessor::Get().ColliderMeshChanged(this);
+ Scene3D::ColliderMeshProcessor::Get().ColliderMeshChanged(*this);
}
if(Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE))
mColliderMeshes[modelNode.GetProperty<int>(Actor::Property::ID)] = modelNode;
// Add processor
- Scene3D::ColliderMeshProcessor::Get().ColliderMeshChanged(this);
+ Scene3D::ColliderMeshProcessor::Get().ColliderMeshChanged(*this);
}
void Model::RemoveColliderMesh(Scene3D::ModelNode& node)
return mIsShadowReceiving;
}
-
///////////////////////////////////////////////////////////
//
// Private methods
/*
- * 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.
}
}
-void ColliderMeshProcessor::ColliderMeshChanged(Collidable* collidable)
+void ColliderMeshProcessor::ColliderMeshChanged(Collidable& collidable)
{
- if(!collidable)
- {
- DALI_LOG_ERROR("The collider should not be null.\n");
- }
-
- Actor actor = collidable->GetCollidableActor();
+ Actor actor = collidable.GetCollidableActor();
if(actor)
{
if(actor.GetProperty<bool>(Actor::Property::CONNECTED_TO_SCENE))
{
- AddSceneViewParentToProcessingQueue(collidable->GetCollidableActor());
+ AddSceneViewParentToProcessingQueue(collidable.GetCollidableActor());
}
else
{
// TODO: Check if signal already connected
- collidable->GetCollidableActor().OnSceneSignal().Connect(this, &ColliderMeshProcessor::ModelOnScene);
+ collidable.GetCollidableActor().OnSceneSignal().Connect(this, &ColliderMeshProcessor::ModelOnScene);
}
}
}
#pragma once
/*
- * 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.
~ColliderMeshProcessor();
- void ColliderMeshChanged(Collidable* collidable);
+ void ColliderMeshChanged(Collidable& collidable);
private:
void ModelOnScene(Actor actor);
/*
- * 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.
return processor;
}
-void ColliderMeshProcessor::ColliderMeshChanged(Collidable* collidable)
+void ColliderMeshProcessor::ColliderMeshChanged(Collidable& collidable)
{
GetImpl(*this).ColliderMeshChanged(collidable);
}
#pragma once
/*
- * 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.
// EXTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali/integration-api/debug.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/object/weak-handle.h>
-#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-scene3d/public-api/controls/model/model.h>
static ColliderMeshProcessor Get();
- void ColliderMeshChanged(Collidable* collidable);
+ void ColliderMeshChanged(Collidable& collidable);
private:
explicit ColliderMeshProcessor(Internal::ColliderMeshProcessor* impl);