mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
make entity skeleton optional
This commit is contained in:
parent
1186011dcf
commit
9fff79f8e2
3 changed files with 26 additions and 17 deletions
|
|
@ -59,7 +59,11 @@ entityid_t Entities::spawn(
|
|||
if (assets) {
|
||||
skeleton = assets->get<rigging::SkeletonConfig>(def.skeletonName);
|
||||
if (skeleton == nullptr) {
|
||||
throw std::runtime_error("skeleton " + def.skeletonName + " not found");
|
||||
if (def.skeletonName == def.name) {
|
||||
logger.warning() << "skeleton " + def.skeletonName + " not found";
|
||||
} else {
|
||||
throw std::runtime_error("skeleton " + def.skeletonName + " not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
entityid_t id;
|
||||
|
|
@ -100,7 +104,9 @@ entityid_t Entities::spawn(
|
|||
|
||||
auto& scripting = registry->emplace<ScriptComponents>(entity);
|
||||
if (assets) {
|
||||
registry->emplace<rigging::Skeleton>(entity, skeleton->instance());
|
||||
registry->emplace<rigging::Skeleton>(
|
||||
entity, skeleton ? skeleton->instance() : rigging::Skeleton(nullptr)
|
||||
);
|
||||
}
|
||||
|
||||
for (auto& instance : def.components) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue