From: Côme Chilliet Date: Wed, 1 Feb 2017 18:39:13 +0000 (+0100) Subject: Fixes #88 Fixed joints and muscles loading for an existing skeleton object X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=commitdiff_plain;h=ad6e136b758996db756f7784e978426ba5a703dc Fixes #88 Fixed joints and muscles loading for an existing skeleton object --- diff --git a/Source/Animation/Joint.cpp b/Source/Animation/Joint.cpp index b6ad707..87d0a33 100644 --- a/Source/Animation/Joint.cpp +++ b/Source/Animation/Joint.cpp @@ -52,6 +52,8 @@ void Joint::load(FILE* tfile, std::vector& joints) funpackf(tfile, "Bi", &parentID); if (hasparent) { parent = &joints[parentID]; + } else { + parent = nullptr; } velocity = 0; oldposition = position; diff --git a/Source/Animation/Skeleton.cpp b/Source/Animation/Skeleton.cpp index 89144f6..a2f9192 100644 --- a/Source/Animation/Skeleton.cpp +++ b/Source/Animation/Skeleton.cpp @@ -717,6 +717,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfilename, // read num_joints funpackf(tfile, "Bi", &num_joints); + joints.clear(); joints.resize(num_joints); // read info for each joint @@ -728,6 +729,7 @@ void Skeleton::Load(const std::string& filename, const std::string& lowfilename, funpackf(tfile, "Bi", &num_muscles); // allocate memory + muscles.clear(); muscles.resize(num_muscles); // for each muscle...