mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
fix: destroyed skeleton config access on skeleton reload
This commit is contained in:
parent
33db2633a2
commit
9893c09fd5
9 changed files with 35 additions and 22 deletions
|
|
@ -78,7 +78,7 @@ namespace rigging {
|
|||
};
|
||||
|
||||
struct Skeleton {
|
||||
const SkeletonConfig* config;
|
||||
std::shared_ptr<const SkeletonConfig> config;
|
||||
Pose pose;
|
||||
Pose calculated;
|
||||
std::vector<BoneFlags> flags;
|
||||
|
|
@ -89,13 +89,15 @@ namespace rigging {
|
|||
|
||||
util::VecInterpolation<3, float> interpolation {false};
|
||||
|
||||
Skeleton(const SkeletonConfig* config);
|
||||
Skeleton(std::shared_ptr<const SkeletonConfig> config);
|
||||
|
||||
dv::value serialize(bool saveTextures, bool savePose) const;
|
||||
void deserialize(const dv::value& root);
|
||||
|
||||
void setConfig(std::shared_ptr<const SkeletonConfig> config);
|
||||
};
|
||||
|
||||
class SkeletonConfig {
|
||||
class SkeletonConfig : public std::enable_shared_from_this<SkeletonConfig> {
|
||||
std::string name;
|
||||
std::unique_ptr<Bone> root;
|
||||
std::unordered_map<std::string, size_t> indices;
|
||||
|
|
@ -135,7 +137,7 @@ namespace rigging {
|
|||
) const;
|
||||
|
||||
Skeleton instance() const {
|
||||
return Skeleton(this);
|
||||
return Skeleton(shared_from_this());
|
||||
}
|
||||
|
||||
const Bone* find(std::string_view str) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue