PDA

View Full Version : HowTo delete VMAP without removing points



KANUSO
04-22-2018, 03:43 AM
Some time ago I encountered a Problem with VMaps that where not removed on "Close All".

The VMaps are not listed in the Modelers Dropdown for VMaps, but if you browse the VMaps, they will be listed. Because there sare no Points or Polygons after a "Close All", you can't empty the VMap by removing all Points in it (no pointID left), I searched for a possibility to remove them anyway.

Here is how I was able to do this:



def delete_all_vmaps(type): # tested with lwsdk.LWVMAP_TXUV
names=[]
idx=lwsdk.LWObjectFuncs().numVMaps(type)
for i in range(0,idx):
name=lwsdk.LWObjectFuncs().vmapName(type,i)
names.append(name)
for i in range(0,idx): # to not destroy the index-list, a separat for loop is required
print names[i]
mesh_edit_op=cmop.editBegin(0, 0, lwsdk.OPSEL_USER) # cmop=mod_command
vmid=mesh_edit_op.vMapSelect(mesh_edit_op.state,na mes[i],lwsdk.LWVMAP_TXUV,2)
if vmid!=None:
mesh_edit_op.vMapRemove(mesh_edit_op.state)
print "removed"
mesh_edit_op.done(mesh_edit_op.state, lwsdk.EDERR_NONE, 0)


I did not test this with other maps than UV-Texture, but it should function with every type.

Regards,
KANUSO