【问题标题】:Select Polys by material maxscript按材料 maxscript 选择多边形
【发布时间】:2015-02-03 07:40:58
【问题描述】:
    -- 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
    )

这是我正在尝试编写的函数。但是我目前停留在选择分配给垫子的多边形上。 所以我的问题是:

我将如何给一个选定的材料(meditMaterials 中的 activeSlot)选择所有分配有该材料的多边形。材质可能分配给多个对象,因此它也需要选择到其他可编辑的多边形对象中。

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

【问题讨论】:

    标签: 3dsmax maxscript


    【解决方案1】:
    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
    

    )

    我明白了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-01
      • 2019-04-11
      • 2021-02-17
      • 2020-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多