소스 검색

Merge pull request #7299 from BabylonJS/drigax/AddSkeletalAnimationGroupSerialization

Modify Animation Group Serialization to include all animated nodes in scene
David Catuhe 5 년 전
부모
커밋
13a12a81a1
2개의 변경된 파일8개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 1
      dist/preview release/what's new.md
  2. 3 4
      serializers/src/glTF/2.0/glTFAnimation.ts

+ 5 - 1
dist/preview release/what's new.md

@@ -208,6 +208,11 @@
 
 - Added Light intensity output to LightInformationBlock ([Drigax](https://github.com/drigax))
 
+### Serializers
+- Added support for `AnimationGroup` serialization ([Drigax](https://github.com/drigax/))
+- Expanded animation group serialization to include all targeted TransformNodes ([Drigax]https://github.com/drigax/)
+
+
 ### Documentation
 
 - Added a note on shallow bounding of getBoundingInfo ([tibotiber](https://github.com/tibotiber))
@@ -217,7 +222,6 @@
 
 - Fixed Textblock line spacing evaluation when linespacing > 0 ([Deltakosh](https://github.com/deltakosh/))
 - Fixed Xbox One gamepad controller button schemes ([MackeyK24](https://github.com/MackeyK24/))
-- Added support for `AnimationGroup` serialization ([Drigax](https://github.com/drigax/))
 - Removing `assetContainer` from scene will also remove gui layers ([TrevorDev](https://github.com/TrevorDev))
 - A scene's input manager not adding key listeners when the canvas is already focused ([Poolminer](https://github.com/Poolminer))
 - Runtime animation `goToFrame` when going back in time now correctly triggers future events when reached ([zakhenry](https://github.com/zakhenry))

+ 3 - 4
serializers/src/glTF/2.0/glTFAnimation.ts

@@ -5,7 +5,6 @@ import { Vector3, Quaternion } from "babylonjs/Maths/math";
 import { Tools } from "babylonjs/Misc/tools";
 import { Animation } from "babylonjs/Animations/animation";
 import { TransformNode } from "babylonjs/Meshes/transformNode";
-import { Mesh } from "babylonjs/Meshes/mesh";
 import { Scene } from "babylonjs/scene";
 
 import { _BinaryWriter } from "./glTFExporter";
@@ -241,13 +240,13 @@ export class _GLTFAnimation {
                 for (let targetAnimation of animationGroup.targetedAnimations) {
                     let target = targetAnimation.target;
                     let animation = targetAnimation.animation;
-                    if (target instanceof Mesh || target.length === 1 && target[0] instanceof Mesh) { // TODO: Update to support bones
+                    if (target instanceof TransformNode || target.length === 1 && target[0] instanceof TransformNode) {
                         let animationInfo = _GLTFAnimation._DeduceAnimationInfo(targetAnimation.animation);
                         if (animationInfo) {
-                            let babylonMesh = target instanceof Mesh ? target : target[0] as Mesh;
+                            let babylonTransformNode = target instanceof TransformNode ? target as TransformNode : target[0] as TransformNode;
                             _GLTFAnimation.AddAnimation(`${animation.name}`,
                                 glTFAnimation,
-                                babylonMesh,
+                                babylonTransformNode,
                                 animation,
                                 animationInfo.dataAccessorType,
                                 animationInfo.animationChannelTargetPath,