Kjoe's blog

笔记#06 | 常用脚本插件备忘

2022-01-28 · 2 min read
笔记

“这是一个备忘录,不定期补充”

Maya常用脚本备忘

导出

string $objname[]  =`ls -sl`;
string $savePath = ”D:/Data/houdini 建模素材_v01-1109/立体仓库/轨道“;//替换路径
for ($SObjname in $objname ){
  file -force -options ”v=0;“ -typ ”FBX export“ -pr -es ($savePath +”/“ + $SObjname+”.fbx“);
  }

合并顶点

import maya.cmds as cmds
#全选合并点
cmds.selectType( v=True )
cmds.polyMergeVertex(d=0.0001)
#法线一致
cmds.polyNormal(nm=True)

测量尺寸

import maya.cmds as cmds
from collections import Counter
from functools import partial

JobSelected=cmds.scriptJob(event=[”SelectionChanged“, ”AutoUpdateInfo()“])

def KillJob():
   cmds.scriptJob( kill=JobSelected, force=True)
   
def AutoUpdateInfo():
    ObjectSelect=cmds.ls(sl=True,fl=True)
    transforms = cmds.listRelatives(ObjectSelect,typ=”mesh“)

    yep=cmds.listRelatives(transforms, p=True,pa=True)

    try:
        for i in yep:
            queryNameObject=cmds.text(”TitleText“,e=True,l=str(i)+” Size“)
            List =cmds.listRelatives(i,f=True)
            transforms1 = cmds.listRelatives(i,typ=”mesh“)
            for j in List:
                if j.find(’MesuresGRP_‘) != -1 or j.find(’_BoundingBox‘) != -1:
                    sizeX=cmds.getAttr(”Distance_X_“+str(transforms1[0])+”.distance“)
                    sizeY=cmds.getAttr(”Distance_Y_“+str(transforms1[0])+”.distance“)
                    sizeZ=cmds.getAttr(”Distance_Z_“+str(transforms1[0])+”.distance“)
                   
                    round(sizeX,3),round(sizeY,3),round(sizeZ,3)  
                    sizeX,sizeY,sizeZ=round(sizeX,3),round(sizeY,3),round(sizeZ,3)
                   
                    cmds.textField(”sizeXTextField“,e=True,tx=sizeX)
                    cmds.textField(”sizeYTextField“,e=True,tx=sizeY)
                    cmds.textField(”sizeZTextField“,e=True,tx=sizeZ)
                    cmds.textField(”NewSizeX“,e=True,tx=sizeX)
                    cmds.textField(”NewSizeY“,e=True,tx=sizeY)
                    cmds.textField(”NewSizeZ“,e=True,tx=sizeZ)                    
                else:
                    cmds.textField(”sizeXTextField“,e=True,tx=0)
                    cmds.textField(”sizeYTextField“,e=True,tx=0)
                    cmds.textField(”sizeZTextField“,e=True,tx=0)
                    cmds.textField(”NewSizeX“,e=True,tx=0)
                    cmds.textField(”NewSizeY“,e=True,tx=0)
                    cmds.textField(”NewSizeZ“,e=True,tx=0)  
     
    except:
        pass      



def QueryUnit()

Unity插件备忘

ASE插件

Amplify Shader Editor

网盘链接

输出视频/图片 插件

Recorder

>————————这是底线————————<