【问题标题】:Maya: Python: How to open arnoldRenderView in the script editorMaya:Python:如何在脚本编辑器中打开 arnoldRenderView
【发布时间】:2018-10-11 16:04:33
【问题描述】:

我被 Arnold 的 Python 命令列表困住了。 对于当前的练习,我需要在 Maya 中制作一个光绘器(例如 https://evermotion.org/articles/show/8837/light-painter-1-0)。

我需要让 ArnoldRenderView 自动打开。 我一直在寻找这个很长一段时间了。 我所能找到的只是:“from mtoa.cmds.arnoldRenderView import arnoldRenderView”。

我在哪里可以找到可以用来打开 ArnoldRenderView(通过单击按钮)的标志?

或者有没有更简单的方法来打开 ArnoldRenderView 而无需访问“mtoa.cmds.arnoldRenderView”?

致以诚挚的问候, 里克。

编辑: 我为 arnold 在 Maya (Python) 中找到了两个有用的脚本链接: https://arnoldsupport.com/2015/03/04/arnold-getting-started-with-the-arnold-python-api/https://trac.solidangle.com/arnoldpedia/chrome/site/Arnold-4.1.3.3/doc/api/index.html

【问题讨论】:

  • 了解一下 Arnold 本身的执行方式应该会有所帮助。查看您的 MtoA 目录:C:\solidangle\MtoADeploy\2018\scripts\mtoa\ui\arnoldmenu.py。如果您选择菜单项,您将在那里找到执行的命令,实际上似乎是 cmds.arnoldRenderView()。由于arnoldRenderView是一个插件命令,您应该能够通过帮助(cmds.arnoldRenderView)获得任何命令行选项。
  • 感谢您的信息,我不知道可以访问这种文件。我会检查一下,看看我是否能找到解决我的问题的方法。如果我发现了什么,我会告诉你的。

标签: python scripting maya


【解决方案1】:

我找到了问题的答案。

# import libraries (Maya Commands Library and mtoa Core Library)
import maya.cmds as cmds
import mtoa.core as core

就像 haggi krey 说的,你会在 arnoldmenu.py 文件中找到必要的函数

#Copy paste both functions from the arnoldmenu.py Script (filepath: "C:\solidangle\mtoadeploy\2018\scripts\mtoa\ui\arnoldmenu.py")
def arnoldOpenMtoARenderView():
    core.createOptions()
    cmds.arnoldRenderView(mode ="open")

def arnoldMtoARenderView():
    # core.ACTIVE_CAMERA is not set, anything we could do here ?
    #if core.ACTIVE_CAMERA != None:
    #    cmds.arnoldRenderView(cam=core.ACTIVE_CAMERA)
    # so instead we're calling it without any argument
    core.createOptions()
    cmds.arnoldRenderView()

#execute both functions
arnoldOpenMtoARenderView()
arnoldMtoARenderView()

此脚本以与您上次关闭时相同的状态打开 arnoldRenderView。

【讨论】:

    猜你喜欢
    • 2013-11-21
    • 2016-04-11
    • 1970-01-01
    • 2013-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多