Skip to content

Commit 9fd6a1a

Browse files
committed
Rigbits: Proxy Slicer: Code review cleanup
Convert MDoubleArray to list before grouping loop for 2-3x faster Python indexing. Replace cmds.error with cmds.warning for graceful handling from menu callbacks. Initialize parent_grp before conditional block to prevent potential UnboundLocalError.
1 parent 3e00a50 commit 9fd6a1a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

release/scripts/mgear/rigbits/proxySlicer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def slice(parent=False, oSel=None, *args):
251251
meshes = cmds.ls(selection=True, long=True)
252252

253253
if not meshes:
254-
cmds.error("No object selected.")
254+
cmds.warning("No object selected.")
255255
return
256256

257257
for mesh in meshes:
@@ -302,6 +302,8 @@ def _slice_single(oSel, parent=False):
302302
weights, num_inf, inf_names = _get_skin_weights(
303303
shape, skin_name
304304
)
305+
# Convert MDoubleArray to list for faster Python indexing
306+
weights = list(weights)
305307
vert_counts, vert_indices = _get_face_vertex_map(shape)
306308

307309
log.info(
@@ -317,6 +319,7 @@ def _slice_single(oSel, parent=False):
317319
original_locks = _save_lock_state(oSel)
318320

319321
# Create parent group for world-space mode
322+
parent_grp = None
320323
if not parent:
321324
if cmds.objExists("ProxyGeo"):
322325
parent_grp = "ProxyGeo"

0 commit comments

Comments
 (0)