Browse Source

Merge pull request #1359 from AtomicGameEngine/JME-ATOMIC-1348

Fix for animated model bone issue
JoshEngebretson 9 years ago
parent
commit
614f7b1eff
2 changed files with 21 additions and 1 deletions
  1. 12 1
      Source/Atomic/Graphics/AnimatedModel.cpp
  2. 9 0
      Source/Atomic/Scene/Node.cpp

+ 12 - 1
Source/Atomic/Graphics/AnimatedModel.cpp

@@ -822,7 +822,9 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         // Create scene nodes for the bones
         if ((createBones && !dontCreateBonesHack)|| boneCreationOverride_)
         {
-// ATOMIC END
+            // Remove "atomic_temporary" once prefabs no longer depend on the temporary flag (prefabs 2.0)
+            // https://github.com/AtomicGameEngine/AtomicGameEngine/issues/780
+            const String tempTag = "atomic_temporary";
 
             for (Vector<Bone>::Iterator i = bones.Begin(); i != bones.End(); ++i)
             {
@@ -832,6 +834,15 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
                 boneNode->SetTransform(i->initialPosition_, i->initialRotation_, i->initialScale_);
                 // Copy the model component's temporary status
                 boneNode->SetTemporary(IsTemporary());
+
+                // Rather mark the nodes as temporary, remove for prefabs 2.0
+                if (boneCreationOverride_)
+                {
+                    if(boneNode->GetScene() != NULL)
+                        boneNode->AddTag(tempTag);
+                }
+// ATOMIC END
+
                 i->node_ = boneNode;
             }
 

+ 9 - 0
Source/Atomic/Scene/Node.cpp

@@ -219,6 +219,15 @@ bool Node::SaveXML(XMLElement& dest) const
         if (node->IsTemporary())
             continue;
 
+// ATOMIC BEGIN
+
+        // Can remove this check once bone nodes use temporary flag instead and new prefabs no longer use temporary flag.
+        // https://github.com/AtomicGameEngine/AtomicGameEngine/issues/780
+        if (node->HasTag("atomic_temporary"))
+            continue;
+
+// ATOMIC END
+
         XMLElement childElem = dest.CreateChild("node");
         if (!node->SaveXML(childElem))
             return false;