Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions src/GLTFLoaderAnimationPointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,23 +247,29 @@ export class GLTFAnimationPointerExtension {
const pathStartNode = path.substring( 0, pathIndexNode );
targetProperty = path.substring( pathIndexNode );

switch ( targetProperty ) {

case 'translation':
targetProperty = 'position';
break;
case 'rotation':
targetProperty = 'quaternion';
break;
case 'scale':
targetProperty = 'scale';
break;
case 'weights':
targetProperty = 'morphTargetInfluences';
break;
case "extensions/KHR_node_visibility/visible":
targetProperty = 'visible';
break;
if ( targetProperty.startsWith( 'weights/' ) ) {
// `/nodes/{}/weights/{}` - control individual morph weights
const weightIndex = targetProperty.substring( 'weights/'.length );
targetProperty = 'morphTargetInfluences[' + weightIndex + ']';
} else {
switch ( targetProperty ) {

case 'translation':
targetProperty = 'position';
break;
case 'rotation':
targetProperty = 'quaternion';
break;
case 'scale':
targetProperty = 'scale';
break;
case 'weights':
targetProperty = 'morphTargetInfluences';
break;
case "extensions/KHR_node_visibility/visible":
targetProperty = 'visible';
break;
}
}

path = pathStartNode + targetProperty;
Expand Down Expand Up @@ -385,8 +391,11 @@ export class GLTFAnimationPointerExtension {

// specially handle the morphTargetInfluences property for multi-material meshes
// in which case the target object is a Group and the children are the actual targets
// Note that there is also morphTargetInfluences[i] for individual morph targets
// see NE-3311
if ( parts[ 3 ] === 'morphTargetInfluences' ) {
if ( parts[ 3 ].startsWith( 'morphTargetInfluences' ) ) {

const property = parts[ 3 ];

if ( node.type === 'Group' ) {

Expand All @@ -399,7 +408,7 @@ export class GLTFAnimationPointerExtension {
if ( ch instanceof SkinnedMesh && ch.morphTargetInfluences ) {

parts[ 3 ] = ch.name;
parts[ 4 ] = 'morphTargetInfluences';
parts[ 4 ] = property;
__createTrack( this.parser );

}
Expand Down