Huge per-vertex operations are typically slow when going with just maya.cmds and pymel due to the nature of the programming language (Python). What I would suggest is to use the Maya API instead. Easiest stepping-stone into that would be the Python bindings (OpenMaya). Create a vertex iterator (MItMeshVertex class) and…
Using openmaya will make it orders of magnitude faster which is usually enough. As I said above the problem is in the way Maya's standard python API deals with lists of Maya objects - which is slow. Openmaya sidesteps that
Hello! I just finished doing a small script that is really helpful to encode proximity data from scalp to cards. The issue I have right now is that the script is really... REALLY heavy, like it takes a long time to process 50k tries. Anyone has tips on how to improve the result? Thanks alot! import maya.cmds as cmds import…
quick OpenMaya example of using a mesh intersector to get closest point on surface import maya.OpenMaya as OpenMaya def getDagPath(obj): selectionList = OpenMaya.MSelectionList() try: selectionList.add(obj) except RuntimeError: return None dagPath = OpenMaya.MDagPath() try: selectionList.getDagPath(0, dagPath) except…
You are having a loop inside a loop. If both list of vertices have 50k entries, that means you have to iterate 2,500,000,000 times. And everytime you do a (nested) squareroot operation with list accesses etc. There is no way that you can use another library and it will be fast all of the sudden. You have to rethink your…
I would use Open Maya 2.0 and iterate on MfnMesh points. Should be a lot faster. https://help.autodesk.com/view/MAYAUL/2022/ENU/?guid=Maya_SDK_py_ref_index_html
I don't do much Maya scripting anymore because I hate it. But. Maya is really slow when dealing with lists of vertices and other similar objects. Using openmaya will help. Alternatively using the string name representation of the vertices rather than the object itself can help in certain circumstances. Anything to avoid…