fix: destroyed skeleton config access on skeleton reload

This commit is contained in:
MihailRis 2026-04-05 10:31:44 +03:00
parent 33db2633a2
commit 9893c09fd5
9 changed files with 35 additions and 22 deletions

View file

@ -7,9 +7,9 @@ using namespace rigging;
NamedSkeletons::NamedSkeletons() = default;
std::shared_ptr<rigging::Skeleton> NamedSkeletons::createSkeleton(
const std::string& name, const SkeletonConfig* config
const std::string& name, std::shared_ptr<const SkeletonConfig> config
) {
auto skeleton = std::make_shared<Skeleton>(config);
auto skeleton = std::make_shared<Skeleton>(std::move(config));
skeletons[name] = skeleton;
return skeleton;
}

View file

@ -14,7 +14,8 @@ public:
NamedSkeletons();
std::shared_ptr<rigging::Skeleton> createSkeleton(
const std::string& name, const rigging::SkeletonConfig* config
const std::string& name,
std::shared_ptr<const rigging::SkeletonConfig> config
);
rigging::Skeleton* getSkeleton(const std::string& name);

View file

@ -113,7 +113,9 @@ WorldRenderer::WorldRenderer(
content.getDefaults()["hand-skeleton"].asString()
);
hands = std::make_unique<HandsRenderer>(
assets, *modelBatch, skeletons->createSkeleton("hand", &skeletonConfig)
assets,
*modelBatch,
skeletons->createSkeleton("hand", skeletonConfig.shared_from_this())
);
shadowMapping = std::make_unique<Shadows>(level);
debugLines = std::make_unique<DebugLinesRenderer>(level);