Querying colorset indices

51 views
Skip to first unread message

Farhan Noor

unread,
Aug 11, 2015, 7:41:47 PM8/11/15
to Python Programming for Autodesk Maya
Heya,

I recently made a cleanup script that would go through a bunch of specific things including UVsets and colorsets and remove any extraneous ones on selected meshes.

While I wrote a working function to check / remove colorsets,  can't help but feel there was a better way. 

With UVsets I can get a list [0,1,2,3, etc] returned with pm.polyUVSet(obj, query=True, allUVSetsIndices=True) and then iterate through each one.

I ended up using a while loop along with try/except to iterate through all existing colorsets on a mesh, which works but feels kinda messy compared to what I had to do for UVsets.

Is there an equivalent of allUVSetsIndices for pm.polyColorSet? I couldn't seem to find any in the pymel documentation and I feel like I'm missing out on something obvious here.



Farhan Noor

unread,
Aug 13, 2015, 2:25:18 PM8/13/15
to Python Programming for Autodesk Maya
After fishing around it seemed like I was overthinking the problem and looking at the wrong thing.
I could have / should have done this:

colorSets = pm.polyColorSet((obj), query=True, allColorSets=True)

for i in range (len(colorSets)):


which behaves similiarly to:


UVsets = pm.polyUVSet(obj, query=True, allUVSetsIndices=True)

for i in UVsets[:] 


Don't I feel dumb :/

Reply all
Reply to author
Forward
0 new messages