--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
search = set|*|*|nurbsSphereShape*
api = 27.6180000305
cmds = 27.018999815
vs
search = nurbsSphereShape*
api = 0.956000089645
cmds = 0.403000116348
import maya.OpenMaya as om
import maya.cmds as cmds
import time
#search = "set|*|*|nurbsSphereShape*"
search = "nurbsSphereShape*"
print ("search = %s" % search )
# API based
start = time.time()
sel = om.MSelectionList()
sel.add( search )
iter = om.MItSelectionList(sel)
depFn = om.MFnDependencyNode()
mObj = om.MObject()
while not iter.isDone():
iter.getDependNode( mObj )
depFn.setObject(mObj)
depFn.findPlug("castsShadows").setBool(True)
iter.next()
end = time.time()-start
print ('api = %s' % end)
# maya.cmds based
start = time.time()
sel = cmds.ls( search )
for each in sel:
cmds.setAttr("{0}.castsShadows".format(each), 1)
end = time.time()-start
print ('cmds = %s' % end)
Yeah, again it was a contrived example, in production lighters will definitely be using whatever bizarro wildcards they can muster.
As you say it appears to be a core limitation of wildcards, will have to rethink how we let lighters define object selections. In this case maybe we just can't let lighters use wildcards, instead they'll have to pre-define it using sets. Or possibly pre-filtering to specific object types, and running list comprehensions on that.
Hmm, houdini's smart bundles would come in handy here... (dynamic sets based on wildcards, they run surprisingly fast)
Thanks again for the help Justin, you saved me several days worth of research. :)
--
--