Skip to content

Commit f7aa195

Browse files
authored
Merge pull request #16932 from Mugen87/dev31
Points: Make updateMorphTargets() more robust.
2 parents a642a21 + d355347 commit f7aa195

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

src/objects/Points.js

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,29 +143,43 @@ Points.prototype = Object.assign( Object.create( Object3D.prototype ), {
143143
var geometry = this.geometry;
144144
var m, ml, name;
145145

146-
var morphAttributes = geometry.morphAttributes;
147-
var keys = Object.keys( morphAttributes );
146+
if ( geometry.isBufferGeometry ) {
148147

149-
if ( keys.length > 0 ) {
148+
var morphAttributes = geometry.morphAttributes;
149+
var keys = Object.keys( morphAttributes );
150150

151-
var morphAttribute = morphAttributes[ keys[ 0 ] ];
151+
if ( keys.length > 0 ) {
152152

153-
if ( morphAttribute !== undefined ) {
153+
var morphAttribute = morphAttributes[ keys[ 0 ] ];
154154

155-
this.morphTargetInfluences = [];
156-
this.morphTargetDictionary = {};
155+
if ( morphAttribute !== undefined ) {
157156

158-
for ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) {
157+
this.morphTargetInfluences = [];
158+
this.morphTargetDictionary = {};
159159

160-
name = morphAttribute[ m ].name || String( m );
160+
for ( m = 0, ml = morphAttribute.length; m < ml; m ++ ) {
161161

162-
this.morphTargetInfluences.push( 0 );
163-
this.morphTargetDictionary[ name ] = m;
162+
name = morphAttribute[ m ].name || String( m );
163+
164+
this.morphTargetInfluences.push( 0 );
165+
this.morphTargetDictionary[ name ] = m;
166+
167+
}
164168

165169
}
166170

167171
}
168172

173+
} else {
174+
175+
var morphTargets = geometry.morphTargets;
176+
177+
if ( morphTargets !== undefined && morphTargets.length > 0 ) {
178+
179+
console.error( 'THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.' );
180+
181+
}
182+
169183
}
170184

171185
},

0 commit comments

Comments
 (0)