Getting Correct UVW info
Im currently fighting with 3dmax to give me the correct information regarding UVW maps. If I have 6 UVW unwraps listed in the modifiers window, all on different channels, and my current selection is editable mesh; 3d max will tell me that only 2 uvw channels exist when I use meshop.getNumMaps geometry[1]. Its not till I click the very top modifier, does it actually give me the correct number of UVW channels. So I tried to do the following work around, but I find it quite time consuming as it takes around 2 seconds to process for each object. I have also tried collapseStack, but that took the same amount of time and I would prefer to not collapse the modifiers list. Is there a faster way to get the information I need?
if (geometry[f].modifiers.count) != 0 then ( i=1 do ( if (geometry[f].modifiers[i].enabled and ((classOf geometry[f].modifiers[i]) == Unwrap_UVW or (classOf geometry[f].modifiers[i])== VertexPaint)) then ( modpanel.setCurrentObject geometry[f].modifiers[i] found = true ) i+= 1 ) while (found == false and i <= geometry[f].modifiers.count) ) if (meshop.getMapSupport geometry[f] 0) then (vertColor = 1) for i=1 to meshop.getNumMaps geometry[f] do ( if (meshop.getMapSupport geometry[f] i) then ( textNum += 1 append mapVerts (meshop.getNumMapVerts geometry[f] i) ) )
Comments
Same issue
Lets say my modifiers box looks like
Unwrap UVW (channel 4)
Unwrap UVW (channel 3)
Unwrap UVW (channel 2)
Unwrap UVW (channel 1)
Editable Mesh
So if I click on editable mesh and run the code, it will tell me the there is only 1 map channel. If I click on Unwrap UVW with channel 2, it will tell me that there is 2 map channels.
Now if I switch it up so the order is
Unwrap UVW (channel 4)
Unwrap UVW (channel 1)
Unwrap UVW (channel 2)
Unwrap UVW (channel 3)
Editable Mesh
It will spit 1 for editable mesh, 3 for unwrap uvw channels 1, 2, and 3. And finally 4 for channel 4. So what ever is the highest channel from where I clicked and down, is what it will spit out. I would like it to give me 4 no matter where I clicked or what the order is.
solution2
This work with multiple selection, UnwrapUVW and UVWMap modifiers
Try the code and let me know if it works
bga
Works
I like it. Much faster than what I have right now.
Thanks.
Yep, because you need only
Yep, because you need only mapchannel value from mods and not mesh faceID's. Reordering of modifiers don't affect final result.
Glad you like it.
Cheers!
bga
solution
A test this code on 3 Cylinder:
Cylinder001 have 6 UVWmap mods with different channels, Cylinder002 have 2 UVWmap etc....
bga