diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2025-03-31 12:02:44 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2025-03-31 12:02:44 -0400 |
| commit | 89614d1dee1049a08e64aead95de6fb28fa7b150 (patch) | |
| tree | 77e59a92c370154d7b7d859506e570a1fffd66c3 /src/ecs.cpp | |
| parent | 119c83096a81c5aef45a0dbef029bd2e49d2e977 (diff) | |
pke: parse uuid from scene and project files
Diffstat (limited to 'src/ecs.cpp')
| -rw-r--r-- | src/ecs.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
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; |
