-- this function selects polygons assigned to mat and assigns a matid of count
-- mat is the mat to select the polys by and count is the mat id to assign to the polys
function assignMatId mat count = (
-- set the mat into meditMaterials in the second slot
meditMaterials[2] = mat
-- set the second slot to the active one
medit.SetActiveMtlSlot 2 true
-- select the polys assigned to mat
objarr = for obj in objects where obj.material == meditMaterials[medit.getActiveMtlSlot()] collect o
--assign selected polys a matid of count
--.. still writing this code
)这就是我想要写的函数。然而,我目前被困在选择分配给mat的多个策略上。所以我的问题是:
我将如何给出选定的材料(activeSlot in meditMaterials),选择分配给他们的所有材料。材料可能被分配给多个对象,所以它也需要选择其他可编辑的多个对象。
对从哪里开始有什么想法吗?
发布于 2014-12-05 19:16:41
function assignMatId mat count = (
--collect all of our objects that are editable polys
objs = for x in $* where classOf x == PolyMeshObject collect x
-- collect all of our objects where the material is the same as the mat
objarr = for obj in objs where obj.material == mat collect obj
-- go through and assign the correct mat id
for obj in objarr do polyop.setFaceMatID obj #{1..obj.numfaces} count)
这样啊,原来是这么回事。
https://stackoverflow.com/questions/27310755
复制相似问题