Skip to content

Commit bc05118

Browse files
authored
FBXLoader: Guard against orphaned animation curve nodes. (#33327)
1 parent e62f72d commit bc05118

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

examples/jsm/loaders/FBXLoader.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,11 +2750,15 @@ class AnimationParser {
27502750

27512751
if ( layerCurveNodes[ i ] === undefined ) {
27522752

2753-
const modelID = connections.get( child.ID ).parents.filter( function ( parent ) {
2753+
const filteredParents = connections.get( child.ID ).parents.filter( function ( parent ) {
27542754

27552755
return parent.relationship !== undefined;
27562756

2757-
} )[ 0 ].ID;
2757+
} );
2758+
2759+
if ( filteredParents.length === 0 ) return;
2760+
2761+
const modelID = filteredParents[ 0 ].ID;
27582762

27592763
if ( modelID !== undefined ) {
27602764

@@ -2814,11 +2818,15 @@ class AnimationParser {
28142818

28152819
if ( layerCurveNodes[ i ] === undefined ) {
28162820

2817-
const deformerID = connections.get( child.ID ).parents.filter( function ( parent ) {
2821+
const filteredParents = connections.get( child.ID ).parents.filter( function ( parent ) {
28182822

28192823
return parent.relationship !== undefined;
28202824

2821-
} )[ 0 ].ID;
2825+
} );
2826+
2827+
if ( filteredParents.length === 0 ) return;
2828+
2829+
const deformerID = filteredParents[ 0 ].ID;
28222830

28232831
const morpherID = connections.get( deformerID ).parents[ 0 ].ID;
28242832
const geoID = connections.get( morpherID ).parents[ 0 ].ID;

0 commit comments

Comments
 (0)