贴图色彩空间被锁定的情况,解锁所有节点贴图的贴图色彩空间选项:
import maya.cmds as cmds for i in cmds.ls(type='file'): cmds.connectAttr(":defaultColorMgtGlobals.cme",i+".cme",f=1)
脚本切换渲染器:
cmds.setAttr("defaultRenderGlobals.currentRenderer", "arnold", type="string")
获取当前视图快照拍屏:
ws = cmds.workspace(q = True, fullName = True) wsp = ws + "/" + "images" imageSnapshot = wsp + "/" + "endSnapshot.jpg" cmds.refresh(cv=True, fe = "jpg", fn = imageSnapshot)
脚本设置渲染设置的输出序列图选项:
mc.setAttr("defaultRenderGlobals.animation", True) # 开启动画帧序列 mc.setAttr("defaultRenderGlobals.animationRange",1) # 开启动画帧的范围 mc.setAttr("defaultRenderGlobals.outFormatControl", 1) # 设置帧格式 mc.setAttr("defaultRenderGlobals.putFrameBeforeExt", 1) # 设置图片格式在数字后面(name.#.ext)
创建多相机渲染:
- 选择相机>AtteibutsEdit>OutputSettings>Renderable(勾选)
- RenderSetting>RednderableCamera>Add RenderableCamera
Arnold开关运动模糊要同时设置运动模糊可见性:
mc.setAttr("defaultRenderGlobals.motionBlur", 0) #关闭运动模糊(针对于Arnold) mc.setAttr("defaultArnoldRenderOptions.motion_blur_enable", 0) #关闭运动模糊可见性 mc.setAttr("defaultRenderGlobals.motionBlur", 1) #开启运动模糊 mc.setAttr("defaultArnoldRenderOptions.motion_blur_enable", 1) #开启运动模糊可见性
脚本打印部分渲染节点属性名称和值的方式:
import maya.cmds as cmds render_glob = "defaultRenderGlobals" list_Attr = cmds.listAttr(render_glob, r=True, s=True) for attr in list_Attr: get_attr_name = "%s.%s"%(render_glob, attr) print "setAttr %s %s"%(get_attr_name, cmds.getAttr(get_attr_name))
mtoa 创建和访问AOV:
import mtoa.aovs as aovs # 添加aov aovs.AOVInterface().addAOV('aov名称', aovType='float') # 列出活动状态的aovs aovs.AOVInterface().getAOVs()
Arnold代码加载arnold渲染器并创建默认节点:
import maya.cmds as mc import mtoa.core mc.setAttr("defaultRenderGlobals.currentRenderer","arnold",typ="string") mtoa.core.createOptions() # 创建ar默认节点网络
查看 mel 函数帮助:
使用 “whatIs ‘mel命令’;” 可以查看mel函数帮助。设置maya视图窗口为非显卡(不使用显卡)支持的窗口模式:
import maya.cmds as mc def switch_preview(): all_model_panel = mc.getPanel(typ="modelPanel") for each in all_model_panel: mc.modelEditor(each,e=True,rnm="base_OpenGL_Renderer") # 查询可用的渲染器名称 mc.modelEditor(each,q=True,rendererList=True)
Xgen相关:
import xgenm.xmaya.xgmExternalAPI as xgenmExternalAPI import xgenm as xg palettes = xg.palettes() # 获取Xgen 所有描述 if not (xgenmExternalAPI.xgg.DescriptionEditor is None): xgenmExternalAPI.xgg.DescriptionEditor.refresh("Full") # 刷新所有Xgen面板
开启软件时关闭材质刷新
cmds.scriptJob(event=('SceneOpened','cmds.renderThumbnailUpdate(False)'))
添加回调
import maya.OpenMaya as OpenMaya OpenMaya.MSceneMessage().addCallback(37, funcName)
清除进程任务
import pymel.core.language as pcl _jobs =pcl.scriptJob(lj=1) #.清除内存任务 if._jobs: for _job in _jobs: job_id = int(_job.split(':')[0]) print(u'清除进程任务:%s' % _job) try: pcl.scriptJob(kill=job_id, force=True) except: pass
快速烘焙动画
进行动画烘培(Bake Simu ation)的时候,Mava跳过逐帧跑一谝时间滑块。import maya.cmds as cmds start =int(cmds.playbackOptions(q=True, minTime=True)) end = int(cmds.playbackOptions(q=True, maxTime=True)) cmds.bakeResults(simulation=False, t=(start, end))
12代 Intel cpu 不兼容py插件问题:
添加环境变量不要py中ssl相关的东西变量名:OPENSSL_ia32cap 变量值:~0x200000200000000
Maya软件小知识点
作者: Mirror
文章链接: http://mirrorcg.github.io/posts/20220503a4.html
版权声明:本博客所有文章除特别声明外,均采用CC BY-NC-SA 4.0 协议。转载请注明出处!