Maya 2023 Very slow setting weight attrs

56 views
Skip to first unread message

mattschiller

unread,
Mar 10, 2023, 6:25:48 PM3/10/23
to Python Programming for Autodesk Maya
I am seeing extreme slow downs when getting/setting weights using point indexes in Maya 2023. Especially on getting, 100x slow downs. Using iomode improves setting weight speeds to close to 2022 speeds but does not help getting. Using open maya gets around this problem in 2023 but open maya and setAttr, used in this way, was the same speed in 2022 and below. 

In this example, getting the weights takes in the hundredths of second in 2022 and 3-5 seconds in 2023. Any one have a clue? Affects all updates of 2023.

import maya.cmds as mc
import time

mc.dgcontrol(iomode=True)

# Build a 30K point plane and cluster
geo = mc.polyPlane(sx=100, sy=300)[0]
cluster = mc.cluster(geo)[0]

# Weights
pnt_count = mc.polyEvaluate(geo, v=1)
weight_attr = f"{cluster}.wl[0].w[0:{pnt_count-1}]"

# Get weights
start_time = time.time()
weight_array = mc.getAttr(weight_attr)
print('GET Weights Time', time.time() - start_time)

# Set weights
start_time = time.time()
mc.setAttr(weight_attr, *weight_array)
print('SET Weights Time', time.time() - start_time)

mc.dgcontrol(iomode=False)

Reply all
Reply to author
Forward
0 new messages