参考資料

シーン内のすべてのオブジェクトから頂点カラーマップを削除するmodoスクリプト

MrUzuさんが、シーン内のすべてのオブジェクトから頂点カラーマップを削除するスクリプトを公開しています。
シンプルなコードなので、他のVmapの編集スクリプトの参考になりそうです。

https://discord.com/channels/267112699517861888/1446995922088362056

#python
#Modo Nerdistry - Remove all RGB and RGBA vertex maps from all objects in the scene
import modo
meshItems = []
mapsToDel = {'rgba':'rgba','rgb':'rgb'}
shortNameDict = {'weight' : 'wght', 'texture' : 'txuv','subweight' : 'subd','subvweight' : 'subd','morph' : 'morf','absmorph' : 'spot','normal' : 'norm','edgepick' : 'epck','rgba':'rgba','harddge':'hard','rgb':'rgb','Vector':'vect','pick':'pick',}

lx.eval("select.drop item")
for items in modo.Scene().iterItems():
		if items.type == "mesh":
			meshItems.append(items.name)
for index in range(len(meshItems)):
	lx.eval("select.item {%s} add" % meshItems[index])
	try:
		for x in lx.eval("query layerservice vmaps ?"):
			vmapName = lx.eval("query layerservice vmap.name ? {0:}".format(x))
			vmapType = lx.eval("query layerservice vmap.type ? {0:}".format(x))
			if vmapType not in mapsToDel:
				lx.eval('!!select.vertexMap {%s} {%s} remove' % (vmapName, shortNameDict[vmapType]))
			else:
				lx.eval('!!select.vertexMap {%s} {%s} add' % (vmapName, shortNameDict[vmapType]))
	
		lx.eval('!!vertMap.delete rgba')
		lx.eval('!!vertMap.delete rgb')
	except:
		pass

lx.eval("select.drop item")

コメントを残す