天天看点

自动检查顶点色、2U、ID、坐标轴的测试

自动检查部分(顶点色、2U、ID、坐标轴)的测试
global CPVobj = #()
global UV2obj = #()
global CPVobj1 = #()
global UV2obj1 = #()
global PTobj = #()
global IDobj = #()
global PTobj1 = #()
global IDobj1 = #()
--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
fn checkpoly =     --**定义检查是否为poly物体的函数,对skin物体还是有bug**
(
    sel = getCurrentSelection()
    ------------------------------------
    for a= to sel.count do
    (
    if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then  
    --判断是否有加了skin修改器,原始层次是否为poly
        (
            pasteS = copy sel[a].modifiers[#skin]               
            --定义一个变量,复制skin修改器
                  skinOps.SaveEnvelope sel[a].modifiers[#Skin]  
                  --保存skin文件
            ConvertToPoly sel[a]                                
            --转为poly
            --粘贴上之前复制的skin修改器
                  skinOps.LoadEnvelope sel[a].modifiers[#Skin] 
                  --加载skin文件
         )
    )
        --------------------------
    for a= to sel.count do
    (
        if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then print sel[a].name
    )
        ------------------------------
    for a= to sel.count do
    (
        if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then print sel[a].name
    )
        --------------------------------
    for a= to sel.count do
    (
        if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then ConvertToPoly sel[a]
    )
)
-----------------------------------------------------
fn getCPVobj =   --定义函数,收集有顶点色的物体
    (
    sel = getCurrentSelection()
    for a= to sel.count do
    (
        if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then
            (
                --if getnumCPVverts sel[a] != 0 then append CPVobj sel[a].name    
                --**getnumVPCverts只能针对mesh类操作**
                --if getnumCPVverts sel[a] != 0 then append CPVobj1 sel[a]
                if sel[a].GetMapChannelActive  == true then append CPVobj sel[a].name   

            --**$.GetMapChannelActive 0 == true 判断通道信息里的0通道是否为真,真表示存在顶点色**
                if sel[a].GetMapChannelActive  == true then append CPVobj1 sel[a]  
                print CPVobj
            )
    )
    for a= to sel.count do
    (
        if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then
            (
                if sel[a].GetMapChannelActive  == true then append CPVobj sel[a].name
                if sel[a].GetMapChannelActive  == true then append CPVobj1 sel[a]
                print CPVobj
            )
    )
    for a= to sel.count do
        (
        if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then
            (
                if sel[a].GetMapChannelActive  == true then append CPVobj sel[a].name
                if sel[a].GetMapChannelActive  == true then append CPVobj1 sel[a]
                print CPVobj
            )

        )
    for a= to sel.count do
        (
        if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then
            (
                if sel[a].GetMapChannelActive  == true then append CPVobj sel[a].name
                if sel[a].GetMapChannelActive  == true then append CPVobj1 sel[a]
                print CPVobj
            )

        )
    )

    --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\    
fn getUV2obj =     --定义函数,收集有2U的物体
    (
        sel = getCurrentSelection()
        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then
                (
                if meshop.GetMapSupport sel[a]  == true then append UV2obj sel[a].name
                --**GetMapSupport可以有meshop和polyop两种,分别针对mesh物体和poly物体**
                if meshop.GetMapSupport sel[a]  == true then append UV2obj1 sel[a]
                print UV2obj
                )
        )
        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then
            (
                if polyop.GetMapSupport sel[a]  == true then append UV2obj sel[a].name
                if polyop.GetMapSupport sel[a]  == true then append UV2obj1 sel[a]
                print UV2obj
            )
        )
        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then
                (
                    if meshop.GetMapSupport sel[a]  == true then append UV2obj sel[a].name
                    if meshop.GetMapSupport sel[a]  == true then append UV2obj1 sel[a]
                    print UV2obj
                )
        )
        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then
                (
                    if polyop.GetMapSupport sel[a]  == true then append UV2obj sel[a].name
                    if polyop.GetMapSupport sel[a]  == true then append UV2obj1 sel[a]
                    print UV2obj
                )
        )
    )
    --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
fn getPTobj =   --定义函数,收集物体坐标为归零的物体
    (
        sel = getCurrentSelection()
        for a= to sel.count do
        (
            if sel[a].pivot != [,,] then append PTobj sel[a].name
            if sel[a].pivot != [,,] then append PTobj1 sel[a]
            print PTobj
        )
    )
    --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
fn getIDobj =   --定义函数,收集ID不为一的物体
    (
    sel = getCurrentSelection()

        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject != editable_poly then
            (
            Faceid = getFaceMatID sel[a]      
            --**mesh物体直接用 getFaceMatID $ 1;poly物体用polyop.getFaceMatID $ 1**
            if Faceid !=  then append IDobj sel[a].name
            if Faceid !=  then append IDobj1 sel[a]
            print IDobj
            )
        )

        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] != undefined and classof sel[a].baseobject == editable_poly then
            (
            Faceid = polyop.getFaceMatID sel[a] 
            if Faceid !=  then append IDobj sel[a].name
            if Faceid !=  then append IDobj1 sel[a]
            print IDobj
            )
        )
        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject == editable_poly then
            (
            Faceid = polyop.getFaceMatID sel[a] 
            if Faceid !=  then append IDobj sel[a].name
            if Faceid !=  then append IDobj1 sel[a]
            print IDobj
            )
        )
        for a= to sel.count do
        (
            if sel[a].modifiers[#skin] == undefined and classof sel[a].baseobject != editable_poly then
            (
            Faceid = getFaceMatID sel[a] 
            if Faceid !=  then append IDobj sel[a].name
            if Faceid !=  then append IDobj1 sel[a]
            print IDobj
            )
        )
    )
fn checkSel =     --定义一个函数,检查是否选择了物体
(
    sel = getCurrentSelection()
    sel1 = #()
    if sel.count ==  then messagebox "请先选择要操作的物体!"
        for i in sel do
        (
        if classof i == editable_poly do join sel1 i
        )
        return sel1
    )

--=======================================================
--checkpoly()
getCPVobj()
getUV2obj()
getPTobj()
getIDobj()
    print CPVobj
        print UV2obj
    print CPVobj1
        print UV2obj1
    print PTobj
    print IDobj
    print PTobj1
    print IDobj1