2
0
Эх сурвалжийг харах

When animating an object that has a renderable but no skeleton, don't use the skinning shader
When starting in-editor animation playback, save object state and then restore it back when playback is stopped

BearishSun 9 жил өмнө
parent
commit
82a7abb179

+ 6 - 0
Source/MBansheeEditor/Windows/AnimationWindow.cs

@@ -741,6 +741,7 @@ namespace BansheeEditor
         }
 
         private State state = State.Normal;
+        private SerializedSceneObject soState;
 
         /// <summary>
         /// Transitions the window into a different state. Caller must validate state transitions.
@@ -804,6 +805,8 @@ namespace BansheeEditor
             EditorAnimClipTangents unused;
             clipInfo.Apply(out unused);
 
+            soState = new SerializedSceneObject(selectedSO, true);
+
             Animation animation = selectedSO.GetComponent<Animation>();
             if (animation != null)
             {
@@ -824,6 +827,9 @@ namespace BansheeEditor
             if (animation != null)
                 animation.EditorStop();
 
+            if(soState != null)
+                soState.Restore();
+
             playButton.Value = false;
         }
 

+ 3 - 2
Source/MBansheeEngine/Animation/Animation.cs

@@ -1022,7 +1022,8 @@ namespace BansheeEngine
         }
 
         /// <summary>
-        /// Registers an <see cref="Renderable"/> component with the animation. Rendering will be affected by the animation.
+        /// Registers an <see cref="Renderable"/> component with the animation. When registered the animation will use the
+        /// renderable's bounds for culling, and the animation override bounds will be applied to the renderable.
         /// </summary>
         /// <param name="renderable">Component that was added</param>
         internal void RegisterRenderable(Renderable renderable)
@@ -1033,7 +1034,7 @@ namespace BansheeEngine
         }
 
         /// <summary>
-        /// Removes renderable from the animation component. Rendering will no longer be affected by animation.
+        /// Removes renderable from the animation component. <see cref="RegisterRenderable"/>.
         /// </summary>
         internal void UnregisterRenderable()
         {

+ 5 - 1
Source/MBansheeEngine/Rendering/Renderable.cs

@@ -164,8 +164,12 @@ namespace BansheeEngine
         /// <param name="animation">Component that was added</param>
         internal void RegisterAnimation(Animation animation)
         {
-            this.animation = animation;
+            bool isMeshAnimated = serializableData.mesh != null && serializableData.mesh.Skeleton != null; // TODO - Also check for blend shapes here
+
+            if (!isMeshAnimated)
+                return;
 
+            this.animation = animation;
             if (_native != null)
             {
                 _native.Animation = animation.Native;