@@ -143,29 +143,20 @@ def compose_fabric_transformation_matrix_from_warp_arrays(
143143 position , rotation , scale = _decompose_transformation_matrix (wp .mat44f (fabric_matrices [fabric_index ]))
144144 # update position (check if array has elements, not just if it exists)
145145 if array_positions .shape [0 ] > 0 :
146- if broadcast_positions :
147- index = 0
148- else :
149- index = i
146+ index = wp .select (broadcast_positions , i , 0 )
150147 position [0 ] = array_positions [index , 0 ]
151148 position [1 ] = array_positions [index , 1 ]
152149 position [2 ] = array_positions [index , 2 ]
153150 # update orientation (convert from wxyz to xyzw for Warp)
154151 if array_orientations .shape [0 ] > 0 :
155- if broadcast_orientations :
156- index = 0
157- else :
158- index = i
152+ index = wp .select (broadcast_orientations , i , 0 )
159153 rotation [0 ] = array_orientations [index , 0 ] # x
160154 rotation [1 ] = array_orientations [index , 1 ] # y
161155 rotation [2 ] = array_orientations [index , 2 ] # z
162156 rotation [3 ] = array_orientations [index , 3 ] # w
163157 # update scale
164158 if array_scales .shape [0 ] > 0 :
165- if broadcast_scales :
166- index = 0
167- else :
168- index = i
159+ index = wp .select (broadcast_scales , i , 0 )
169160 scale [0 ] = array_scales [index , 0 ]
170161 scale [1 ] = array_scales [index , 1 ]
171162 scale [2 ] = array_scales [index , 2 ]
@@ -249,27 +240,18 @@ def compose_indexed_fabric_transforms(
249240 position , rotation , scale = _decompose_transformation_matrix (wp .mat44f (fabric_matrices [view_index ]))
250241
251242 if array_positions .shape [0 ] > 0 :
252- if broadcast_positions :
253- index = 0
254- else :
255- index = i
243+ index = wp .select (broadcast_positions , i , 0 )
256244 position [0 ] = array_positions [index , 0 ]
257245 position [1 ] = array_positions [index , 1 ]
258246 position [2 ] = array_positions [index , 2 ]
259247 if array_orientations .shape [0 ] > 0 :
260- if broadcast_orientations :
261- index = 0
262- else :
263- index = i
248+ index = wp .select (broadcast_orientations , i , 0 )
264249 rotation [0 ] = array_orientations [index , 0 ]
265250 rotation [1 ] = array_orientations [index , 1 ]
266251 rotation [2 ] = array_orientations [index , 2 ]
267252 rotation [3 ] = array_orientations [index , 3 ]
268253 if array_scales .shape [0 ] > 0 :
269- if broadcast_scales :
270- index = 0
271- else :
272- index = i
254+ index = wp .select (broadcast_scales , i , 0 )
273255 scale [0 ] = array_scales [index , 0 ]
274256 scale [1 ] = array_scales [index , 1 ]
275257 scale [2 ] = array_scales [index , 2 ]
0 commit comments