0
    -- 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) を指定して、そのマテリアルが割り当てられたすべてのポリゴンを選択するにはどうすればよいでしょうか。マテリアルが割り当てられているオブジェクトが複数ある場合があるため、他の編集可能なポリゴン オブジェクトも選択する必要があります。

どこから始めるべきかについて何か考えはありますか?

4

1 に答える 1

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

)

わかった。

于 2014-12-05T19:16:41.433 に答える