首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >按材料maxscript选择Polys

按材料maxscript选择Polys
EN

Stack Overflow用户
提问于 2014-12-05 07:14:29
回答 1查看 1.6K关注 0票数 0
代码语言:javascript
复制
    -- 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),选择分配给他们的所有材料。材料可能被分配给多个对象,所以它也需要选择其他可编辑的多个对象。

对从哪里开始有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-05 19:16:41

代码语言:javascript
复制
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

)

这样啊,原来是这么回事。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27310755

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档