very informative, Im gona try it out when I get the chance. Thanks a lot for the help djx.
so I take it that zip is suppose to combine the u and the v into one list ?
I assumed the pymel was at least faster than maya.cmds in terms of getting uv coordinates. Because when I was researching methods on how to query uv coordinates with a reasonable speed, I came across this thread Fast UDIM detection where the author was trying to code a fast UDIM tile detection function. He did a test on grabbing UVs from a polysphere with 1000x200 subdivision with 3 methods: maya.cmds , PyMel, OpenMaya/API. Out of all of them OpenMaya/API was the fastest, then Pymel was second and maya.cmds was last.
I understand that OpenMaya/API is the fastest. But Im not skilled enough to integrate both into one code.
this was the code that I was trying to alter, but failed in getting it to give me a list that corresponds to the .map[ID]
not sure if its just me, but both Pymel and openmaya seems to be more stricter in syntax. I have so much problems troubleshooting syntax errors when the documentations dont give examples.
import maya.OpenMaya as om
def om_getuvs(mesh_string):
"""return a list of two lists, idx 0 is U, idx 1 is V"""
selection_list = om.MSelectionList()
mObject_holder = om.MObject()
u = om.MFloatArray()
v = om.MFloatArray()
function_set = om.MFnMesh()
# for a note on why this, instead of a flat selection_list.add.
om.MGlobal.getSelectionListByName(mesh_string, selection_list)
iterator = om.MItSelectionList(selection_list)
iterator.getDependNode(mObject_holder)
function_set.setObject(mObject_holder)
function_set.getUVs(u,v)
return [u,v]