]> git.jsancho.org Git - lugaru.git/commitdiff
Fixes #88 Fixed joints and muscles loading for an existing skeleton object
authorCôme Chilliet <come@chilliet.eu>
Wed, 1 Feb 2017 18:39:13 +0000 (19:39 +0100)
committerCôme Chilliet <come@chilliet.eu>
Wed, 1 Feb 2017 18:39:13 +0000 (19:39 +0100)
Source/Animation/Joint.cpp
Source/Animation/Skeleton.cpp

index b6ad7070b81530652ca3cc2c223729a452ecf864..87d0a33678821f28b40f110ad2548b2eeb516fb6 100644 (file)
@@ -52,6 +52,8 @@ void Joint::load(FILE* tfile, std::vector<Joint>& joints)
     funpackf(tfile, "Bi", &parentID);
     if (hasparent) {
         parent = &joints[parentID];
+    } else {
+        parent = nullptr;
     }
     velocity = 0;
     oldposition = position;
index 89144f69f937320e36d78e075b8fb9fb14cecdfd..a2f919253d342a8844b55a3bbaf6054444abcc1b 100644 (file)
@@ -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...