feat: add "Add component" button

This commit is contained in:
2026-08-12 01:18:47 +02:00
parent 8c7302de49
commit c3c1d5ae28
5 changed files with 146 additions and 59 deletions
+29
View File
@@ -13,6 +13,8 @@
#include <destrum/ObjectModel/GameObject.h>
#include <destrum/Scene/Scene.h>
#include <destrum/Scene/SceneManager.h>
#include <destrum/Serialization/ComponentFactory.h>
#include <destrum/Serialization/ComponentRegistry.h>
#include <destrum/Serialization/SceneSerializer.h>
#include <destrum/Physics/SimplePhysicsWorld.h>
#include <destrum/Physics/JoltPhysicsWorld.h>
@@ -161,6 +163,32 @@ namespace {
SceneManager::GetInstance().Destroy();
}
void testEngineComponentRegistration()
{
RegisterEngineComponents();
const char* canonicalNames[] = {
"MeshRendererComponent",
"Rotator",
"Spinner",
"OrbitAndSpin",
"Animator",
"Rigidbody",
"BoxCollider",
"SphereCollider",
"CapsuleCollider"
};
for (const char* name : canonicalNames) {
check(ComponentFactory::IsRegistered(name),
"all canonical engine component names must be registered");
}
check(!ComponentFactory::IsRegistered("MeshRenderer"),
"MeshRenderer legacy alias must not be registered");
check(!ComponentFactory::IsRegistered("RigidBody"),
"RigidBody legacy alias must not be registered");
}
void testAssetPathValidation()
{
const auto root = std::filesystem::temp_directory_path() / "destrum_asset_test";
@@ -440,6 +468,7 @@ int main()
testEventMutation();
testEventRemoval();
testComponentRemoval();
testEngineComponentRegistration();
testAssetPathValidation();
testLegacySceneLoad();
testSceneLoadRollback();