Browse Source

Removing unnecessary Animated Sprite prefab workaround, surpassing bone creation in editor until tagging system can be introduced

Josh Engebretson 9 years ago
parent
commit
cc8fc411c7

+ 17 - 3
Source/Atomic/Graphics/AnimatedModel.cpp

@@ -757,6 +757,15 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         return;
     }
 
+// ATOMIC BEGIN
+
+    // We don't create bones in editor for now until can address prefabs using temporary flag
+    // ie. prefab and bone nodes should use tags
+
+    bool dontCreateBonesHack = context_->GetEditorContext();
+
+// ATOMIC END
+
     if (isMaster_)
     {
         // Check if bone structure has stayed compatible (reloading the model.) In that case retain the old bones and animations
@@ -800,9 +809,13 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         FinalizeBoneBoundingBoxes();
 
         Vector<Bone>& bones = skeleton_.GetModifiableBones();
+
+// ATOMIC BEGIN
         // Create scene nodes for the bones
-        if (createBones)
+        if (createBones && !dontCreateBonesHack)
         {
+// ATOMIC END
+
             for (Vector<Bone>::Iterator i = bones.Begin(); i != bones.End(); ++i)
             {
                 // Create bones as local, as they are never to be directly synchronized over the network
@@ -837,9 +850,10 @@ void AnimatedModel::SetSkeleton(const Skeleton& skeleton, bool createBones)
         AnimatedModel* master = node_->GetComponent<AnimatedModel>();
         if (master && master != this)
             master->FinalizeBoneBoundingBoxes();
-
-        if (createBones)
+// ATOMIC BEGIN
+        if (createBones && !dontCreateBonesHack)
         {
+// ATOMIC END
             Vector<Bone>& bones = skeleton_.GetModifiableBones();
             for (Vector<Bone>::Iterator i = bones.Begin(); i != bones.End(); ++i)
             {

+ 0 - 15
Source/Atomic/Scene/PrefabComponent.cpp

@@ -6,7 +6,6 @@
 #include <Atomic/Resource/ResourceEvents.h>
 
 #include <Atomic/Physics/RigidBody.h>
-#include <Atomic/Atomic2D/AnimatedSprite2D.h>
 
 #include "PrefabEvents.h"
 #include "PrefabComponent.h"
@@ -130,20 +129,6 @@ void PrefabComponent::BreakPrefab()
         if (rootComponents[i]->IsTemporary())
         {
             rootComponents[i]->SetTemporary(false);
-
-            // Animated sprites contain a temporary node we don't want to save in the prefab
-            // it would be nice if this was general purpose because have to test this when
-            // saving a prefab as well
-
-            if (rootComponents[i]->GetType() == AnimatedSprite2D::GetTypeStatic())
-            {
-// ATOMIC_UPDATE_FIX_BEGIN
-//                AnimatedSprite2D* asprite = (AnimatedSprite2D*) rootComponents[i].Get();
-//                if (asprite->GetRootNode())
-//                    filterNodes.Push(asprite->GetRootNode());
-// ATOMIC_UPDATE_FIX_END
-            }
-
         }
     }
 

+ 0 - 14
Source/ToolCore/Assets/PrefabImporter.cpp

@@ -25,7 +25,6 @@
 #include <Atomic/Scene/Scene.h>
 #include <Atomic/Scene/PrefabEvents.h>
 #include <Atomic/Scene/PrefabComponent.h>
-#include <Atomic/Atomic2D/AnimatedSprite2D.h>
 #include <Atomic/IO/FileSystem.h>
 
 #include "Asset.h"
@@ -90,19 +89,6 @@ void PrefabImporter::HandlePrefabSave(StringHash eventType, VariantMap& eventDat
         {
             rootComponents[i]->SetTemporary(false);
             tempComponents.Push(rootComponents[i]);
-
-            // Animated sprites contain a temporary node we don't want to save in the prefab
-            // it would be nice if this was general purpose because have to test this when
-            // breaking node as well
-            if (rootComponents[i]->GetType() == AnimatedSprite2D::GetTypeStatic())
-            {
-// ATOMIC_UPDATE_FIX_BEGIN
-                //AnimatedSprite2D* asprite = (AnimatedSprite2D*) rootComponents[i].Get();
-                //if (asprite->GetRootNode())
-                //    filterNodes.Push(asprite->GetRootNode());
-// ATOMIC_UPDATE_FIX_END
-            }
-
         }
     }