@@ -13,7 +13,7 @@ export function thinInstanceSetBuffer(
1313 ? node . hasThinInstances
1414 ? node . thinInstanceSetBuffer (
1515 attribute ,
16- value instanceof Function ? value ( ( node . metadata . data ?? [ { } ] ) , node , i ) : value ,
16+ value instanceof Function ? value ( ( node . metadata ? .data ?? [ { } ] ) , node , i ) : value ,
1717 stride ,
1818 staticBuffer ,
1919 )
@@ -35,7 +35,7 @@ export function thinInstancePosition(
3535 ? ( ( ) => {
3636 let bufferMatrices = new Float32Array ( node . thinInstanceCount * 16 ) ;
3737 let matrices = node . thinInstanceGetWorldMatrices ( ) ;
38- let data = ( node . metadata . data ?? [ { } ] ) ;
38+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
3939 data . forEach ( ( e , j ) => {
4040 let evaluated = value instanceof Function ? value ( e , node , j ) : value ;
4141 let matrix = matrices [ j ] . setTranslation ( evaluated ) ;
@@ -61,7 +61,7 @@ export function thinInstanceScaling(
6161 ? ( ( ) => {
6262 let bufferMatrices = new Float32Array ( node . thinInstanceCount * 16 ) ;
6363 let matrices = node . thinInstanceGetWorldMatrices ( ) ;
64- let data = ( node . metadata . data ?? [ { } ] ) ;
64+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
6565 data . forEach ( ( e , j ) => {
6666 let evaluated = value instanceof Function ? value ( e , node , j ) : value ;
6767 let previousMatrix = matrices [ j ] ;
@@ -93,7 +93,7 @@ export function thinInstanceRotation(
9393 ? ( ( ) => {
9494 let bufferMatrices = new Float32Array ( node . thinInstanceCount * 16 ) ;
9595 let matrices = node . thinInstanceGetWorldMatrices ( ) ;
96- let data = ( node . metadata . data ?? [ { } ] ) ;
96+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
9797 data . forEach ( ( e , j ) => {
9898 let evaluated = value instanceof Function ? value ( e , node , j ) : value ;
9999 let previousMatrix = matrices [ j ] ;
@@ -125,7 +125,7 @@ export function thinInstanceColor(
125125 if ( node instanceof Mesh && node . hasThinInstances ) {
126126 let colorMatrices = new Float32Array ( node . thinInstanceCount * 4 ) ;
127127 if ( value instanceof Function ) {
128- let data = ( node . metadata . data ?? [ { } ] ) ;
128+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
129129 data . forEach ( ( e , j ) => {
130130 let evaluated = value ( e , node , j ) ;
131131 colorMatrices [ j * 4 + 0 ] = evaluated . r ;
@@ -170,11 +170,11 @@ export function thinInstanceSetAttribute(
170170 this . selected . forEach ( ( node , i ) => {
171171 node instanceof Mesh
172172 ? node . hasThinInstances
173- ? ( node . metadata . data ?? [ { } ] ) . forEach ( ( d , k ) => {
173+ ? ( node . metadata ? .data ?? [ { } ] ) . forEach ( ( d , k ) => {
174174 node . thinInstanceSetAttributeAt (
175175 attribute ,
176176 k ,
177- value instanceof Function ? value ( ( node . metadata . data ?? [ { } ] ) , node , i ) : value ,
177+ value instanceof Function ? value ( ( node . metadata ? .data ?? [ { } ] ) , node , i ) : value ,
178178 ) ;
179179 } )
180180 : console . warn ( node + 'has no thin instances, skipping' )
@@ -191,14 +191,14 @@ export function thinInstanceAttributeAt(
191191 value : any | ( ( d : any , n : Node , i : number ) => any ) ,
192192) : Selection {
193193 this . selected . forEach ( ( node , i ) => {
194- let evaluated = value instanceof Function ? value ( ( node . metadata . data [ index ] ?? [ { } ] ) , node , index ) : value ;
194+ let evaluated = value instanceof Function ? value ( ( node . metadata ? .data [ index ] ?? [ { } ] ) , node , index ) : value ;
195195
196196 node instanceof Mesh
197197 ? node . hasThinInstances
198198 ? node . thinInstanceSetAttributeAt (
199199 attribute ,
200200 index ,
201- value instanceof Function ? value ( ( node . metadata . data ?? [ { } ] ) , node , i ) : value ,
201+ value instanceof Function ? value ( ( node . metadata ? .data ?? [ { } ] ) , node , i ) : value ,
202202 )
203203 : console . warn ( node + 'has no thin instances, skipping' )
204204 : console . warn ( node + 'Node is not a mesh, skipping' ) ;
@@ -213,7 +213,7 @@ export function thinInstanceMatrixAt(
213213 value : Matrix | ( ( d : any , n : Node , i : number ) => Matrix ) ,
214214) : Selection {
215215 this . selected . forEach ( ( node , i ) => {
216- let evaluated = value instanceof Function ? value ( ( node . metadata . data [ index ] ?? [ { } ] ) , node , index ) : value ;
216+ let evaluated = value instanceof Function ? value ( ( node . metadata ? .data [ index ] ?? [ { } ] ) , node , index ) : value ;
217217 node instanceof Mesh
218218 ? node . hasThinInstances
219219 ? node . thinInstanceSetMatrixAt ( index , evaluated )
@@ -233,7 +233,7 @@ export function thinInstancePositionAt(
233233 node instanceof Mesh
234234 ? node . hasThinInstances
235235 ? ( ( ) => {
236- let evaluated = value instanceof Function ? value ( ( node . metadata . data [ index ] ?? [ { } ] ) , node , index ) : value ;
236+ let evaluated = value instanceof Function ? value ( ( node . metadata ? .data [ index ] ?? [ { } ] ) , node , index ) : value ;
237237 let previousMatrix = node . thinInstanceGetWorldMatrices ( ) [ index ] ;
238238 let matrix = previousMatrix . setTranslation ( evaluated ) ;
239239 node . thinInstanceSetMatrixAt ( index , matrix ) ;
@@ -254,7 +254,7 @@ export function thinInstanceScalingAt(
254254 node instanceof Mesh
255255 ? node . hasThinInstances
256256 ? ( ( ) => {
257- let evaluated = value instanceof Function ? value ( ( node . metadata . data [ index ] ?? [ { } ] ) , node , index ) : value ;
257+ let evaluated = value instanceof Function ? value ( ( node . metadata ? .data [ index ] ?? [ { } ] ) , node , index ) : value ;
258258 let previousMatrix = node . thinInstanceGetWorldMatrices ( ) [ index ] ;
259259 let matrix = Matrix . ComposeToRef (
260260 evaluated ,
@@ -280,7 +280,7 @@ export function thinInstanceRotationAt(
280280 node instanceof Mesh
281281 ? node . hasThinInstances
282282 ? ( ( ) => {
283- let evaluated = value instanceof Function ? value ( ( node . metadata . data [ index ] ?? [ { } ] ) , node , index ) : value ;
283+ let evaluated = value instanceof Function ? value ( ( node . metadata ? .data [ index ] ?? [ { } ] ) , node , index ) : value ;
284284 let previousMatrix = node . thinInstanceGetWorldMatrices ( ) [ index ] ;
285285 let previousScale = new Vector3 ( ) ;
286286 previousMatrix . decompose ( previousScale ) ;
@@ -308,7 +308,7 @@ export function thinInstanceColorAt(
308308 node instanceof Mesh
309309 ? node . hasThinInstances
310310 ? ( ( ) => {
311- let evaluated = value instanceof Function ? value ( ( node . metadata . data [ index ] ?? [ { } ] ) , node , index ) : value ;
311+ let evaluated = value instanceof Function ? value ( ( node . metadata ? .data [ index ] ?? [ { } ] ) , node , index ) : value ;
312312 node . thinInstanceSetAttributeAt ( 'color' , index , [ evaluated . r , evaluated . g , evaluated . b , evaluated . a ] ) ;
313313 } ) ( )
314314 : console . warn ( node + 'has no thin instances, skipping' )
@@ -325,12 +325,12 @@ export function thinInstanceMatrixFor(
325325) : Selection {
326326 this . selected . forEach ( ( node , i ) => {
327327 if ( node instanceof Mesh && node . hasThinInstances ) {
328- let data = ( node . metadata . data ?? [ { } ] ) ;
328+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
329329 data . forEach ( ( d , k ) => {
330330 if ( method ( d , node , k ) ) {
331331 node . thinInstanceSetMatrixAt (
332332 k ,
333- value instanceof Function ? value ( ( node . metadata . data ?? [ { } ] ) , node , k ) : value ,
333+ value instanceof Function ? value ( ( node . metadata ? .data ?? [ { } ] ) , node , k ) : value ,
334334 false ,
335335 ) ;
336336 }
@@ -351,7 +351,7 @@ export function thinInstancePositionFor(
351351 if ( node instanceof Mesh && node . hasThinInstances ) {
352352 let bufferMatrices = new Float32Array ( node . thinInstanceCount * 16 ) ;
353353 let matrices = node . thinInstanceGetWorldMatrices ( ) ;
354- let data = ( node . metadata . data ?? [ { } ] ) ;
354+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
355355 data . forEach ( ( e , j ) => {
356356 if ( method ( e , node , j ) ) {
357357 let evaluated = value instanceof Function ? value ( e , node , j ) : value ;
@@ -376,7 +376,7 @@ export function thinInstanceRotationFor(
376376 if ( node instanceof Mesh && node . hasThinInstances ) {
377377 let bufferMatrices = new Float32Array ( node . thinInstanceCount * 16 ) ;
378378 let matrices = node . thinInstanceGetWorldMatrices ( ) ;
379- let data = ( node . metadata . data ?? [ { } ] ) ;
379+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
380380 data . forEach ( ( e , j ) => {
381381 if ( method ( e , node , j ) ) {
382382 let evaluated = value instanceof Function ? value ( e , node , j ) : value ;
@@ -408,7 +408,7 @@ export function thinInstanceScalingFor(
408408 if ( node instanceof Mesh && node . hasThinInstances ) {
409409 let bufferMatrices = new Float32Array ( node . thinInstanceCount * 16 ) ;
410410 let matrices = node . thinInstanceGetWorldMatrices ( ) ;
411- let data = ( node . metadata . data ?? [ { } ] ) ;
411+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
412412 data . forEach ( ( e , j ) => {
413413 if ( method ( e , node , j ) ) {
414414 let evaluated = value instanceof Function ? value ( e , node , j ) : value ;
@@ -438,7 +438,7 @@ export function thinInstanceColorFor(
438438 if ( node instanceof Mesh && node . hasThinInstances ) {
439439 let bufferMatrices = new Float32Array ( node . thinInstanceCount * 16 ) ;
440440 let matrices = node . thinInstanceGetWorldMatrices ( ) ;
441- let data = ( node . metadata . data ?? [ { } ] ) ;
441+ let data = ( node . metadata ? .data ?? [ { } ] ) ;
442442 data . forEach ( ( e , j ) => {
443443 if ( method ( e , node , j ) ) {
444444 let evaluated = value instanceof Function ? value ( e , node , j ) : value ;
0 commit comments