From ad6e136b758996db756f7784e978426ba5a703dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Wed, 1 Feb 2017 19:39:13 +0100 Subject: [PATCH] Fixes #88 Fixed joints and muscles loading for an existing skeleton object --- Source/Animation/Joint.cpp | 2 ++ Source/Animation/Skeleton.cpp | 2 ++ 2 files changed, 4 insertions(+) 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... -- 2.39.5