From 89614d1dee1049a08e64aead95de6fb28fa7b150 Mon Sep 17 00:00:00 2001 From: Jonathan Bradley Date: Mon, 31 Mar 2025 12:02:44 -0400 Subject: pke: parse uuid from scene and project files --- src/ecs.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/ecs.cpp') diff --git a/src/ecs.cpp b/src/ecs.cpp index 048669d..4f81ac0 100644 --- a/src/ecs.cpp +++ b/src/ecs.cpp @@ -439,7 +439,7 @@ CompGrBinds *ECS_GetGrBinds(pk_handle_bucket_index_T bucketIndex, pk_handle_item return ecs.bc.grBinds.buckets[bucketIndex]; } -CompInstance *ECS_CreateInstance(Entity_Base *entity, CompGrBinds *entityTypeGrBinds) { +CompInstance *ECS_CreateInstance(Entity_Base *entity, pk_uuid uuid, CompGrBinds *entityTypeGrBinds) { assert(entity != nullptr && entity != CAFE_BABE(Entity_Base)); InstanceHandle instanceHandle{Buckets_NewHandle(ecs.bc.instances)}; @@ -449,9 +449,10 @@ CompInstance *ECS_CreateInstance(Entity_Base *entity, CompGrBinds *entityTypeGrB new (comp) CompInstance{}; comp->entHandle = entity->handle; comp->instanceHandle = instanceHandle; - // TODO this should be passed in - currently generating a new one each time - // Consider making a Component_Base that has a UUID, and pass in similar to ECS_CreateEntity - if (comp->uuid == pk_uuid_zed || comp->uuid == pk_uuid_max) comp->uuid = pk_uuid_new_v7(); + comp->uuid = uuid; + if (comp->uuid == pk_uuid_zed || comp->uuid == pk_uuid_max) { + comp->uuid = pk_uuid_new_v7(); + } if (entityTypeGrBinds != nullptr) { comp->grBindsHandle = entityTypeGrBinds->grBindsHandle; -- cgit v1.2.3