- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在编写一个maya python脚本来将场景批量渲染为jpg,然后使用ffmpeg将它们变成mov。目前,该脚本将一串命令保存为 bat 文件,该文件运行良好,但我更愿意从 maya 运行 cmd.exe 并执行命令列表,而不先创建该 bat。
我一直在阅读“subprocess.popen()”,但我不知道如何让它遍历每一行,运行该命令,然后在完成后移动到下一个,即:
1) 运行 maya render.exe 并将场景另存为 jpeg
2) ffmpeg jpgs 到 mov
我已经缩短了目录,但本质上是这样的:
`C:\PROGRA~1\Autodesk\Maya2015\bin\Render.exe -r hw2 -s 100 -e 200 -of jpg -fnc 7 -x 1920 -y 1080 -rd
"C:\RENDER"
"C:\SCENE.ma" ffmpeg -y -r 25 -start_number 0100 -i C:\SCENE_%%04d.jpg C:\SCENE.mov
最佳答案
first_process = subprocess.Popen(r'RenderCommand', stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True )
first_out,first_err = first_process.communicate()
first_exicode = first_process.returncode
print(first_out)
if str(first_exicode) != '0':
print(first_err)
second_process = subprocess.Popen(r'SecondCommand', stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True )
second_out,second_err = second_process.communicate()
second_exicode = second_process.returncode
print(second_out)
if str(second_exicode) != '0':
print(second_err)
third_process = subprocess.Popen(r'ConvertCommand', stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True )
third_out,third_err = third_process.communicate()
third_exicode = third_process.returncode
print(third_out)
if str(third_exicode) != '0':
print(third_err)
Popen()
:
subprocess.Popen(r'mayapy.exe R:\paul\Trash\render_and_convert.py 50 100 150', False)
render_and_convert.py
(文件路径、开始/结束帧等...)
import sys
import subprocess
import maya.standalone as std
std.initialize(name='python')
import maya.cmds as cmds
import maya.mel as mel
# store the arguments in variables
first_argument = sys.argv[1] # =50
second_argument = sys.argv[2] # =100
third_argument = sys.argv[3] # =150
first_process = subprocess.Popen(r'RenderCommand ' + first_argument + ' ' + second_argument,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True )
first_out,first_err = first_process.communicate()
first_exicode = first_process.returncode
print(first_out)
if str(first_exicode) != '0':
print(first_err)
second_process = subprocess.Popen(r'SecondCommandWithoutArgs', stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True )
second_out,second_err = second_process.communicate()
second_exicode = second_process.returncode
print(second_out)
if str(second_exicode) != '0':
print(second_err)
third_process = subprocess.Popen(r'ConvertCommand ' + third_argument,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True )
third_out,third_err = third_process.communicate()
third_exicode = third_process.returncode
print(third_out)
if str(third_exicode) != '0':
print(third_err)
关于python - 在 Python 中运行来自 maya 的 cmd.exe 命令列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34295749/
在 Maya 中,当您启用“显示受影响”选项时,受选定节点影响的节点在视口(viewport)中变为粉红色。有没有办法获取这些节点的列表? 更具体地说,需要测试如果我在node_A中设置动画或更改属性
我想要做的是将属性从对象 A 批量连接到对象 B。只是转换属性,所以,我这样做了: import maya.cmds as mc sel = mc.ls(sl=True) mc.connectAttr
如何在 autodesk maya 中找到中心点...我知道使用中心轴,但我找不到点...如何找到使用 autodesk maya 创建的 3d 对象的确切坐标?谢谢。 最佳答案 只需转到菜单,修改
我一直在研究如何让 Autodesk Maya 通过本地主机 ip(最好是 TCP)上的 Web 进行通信,但没有成功。我的目标是使用我编写的快速 Java 应用程序来控制 Maya,以操纵曲线选择等
这个问题已经有答案了: Use 'import module' or 'from module import'? (23 个回答) 已关闭 6 年前。 我想知道以下之间是否有任何区别: import
是否可以使用 python 读取 Maya 场景文件而无需打开并获取相机列表或渲染全局设置或对其执行某些操作。我需要这个,这样如果它们是多个场景文件,我就不必打开每个 Maya 场景,只需从 pyth
Maya 命令库似乎不喜欢使用 python 中内置的十进制模块。我正在尝试通过任意大的 float 来缩放对象以提高精度。据了解,您无法按十进制“对象”进行缩放,这一点很清楚。 我在数学上遇到了麻烦
知道为什么我会因为这段代码而得到“Maya 不是 Maya”吗? if ("Maya" == "Maya") printf("Maya is Maya \n"); else printf(
是否可以从 Windows 中的命令提示符(或 Linux 中的 bash)调用脚本来打开 Maya,然后随后在 Maya 中运行自定义脚本(可能每次运行时都会更改)?我正在寻找比更改 userSet
我通过一个脚本将 Maya 作业提交给 Deadline,在该脚本中我将两个作业文件(maya_deadline_job.job 和 maya_deadline_info.job)作为参数传递给 de
这是一个有趣的...我正在尝试开发一个 Android 应用程序,让用户可以控制 Autodesk Maya(一个 3D 建模应用程序)中的相机。您可以告诉 Maya 在特定端口上监听 Mel 命令(
如何缩放图片以适应窗口/布局? 使用下面的代码,原始图像实际上并没有放大到 300px,而是以原始图像大小显示。 import maya.cmds as cmds if (cmds.window(wi
cmds.scriptEditorInfo(clearHistory=True) print("hi") 最上面一行清除了 Maya 脚本输出窗口,然后下面一行应该打印 hi .但是当你运行它时,它会
我正在尝试构建一个仅在引发未捕获的异常时运行的函数。 我在网上找到的一个解决方案是覆盖/包装sys.excepthook,如下所示: import sys def exception(*args, *
我有两个问题,我不确定这是否可以使用 python 在场景中完成。 我的 Maya 版本未随任何 Mental Ray 一起安装。有时,当我打开文件(随 Mental Ray 安装)时,我不断收到如下
我有一个Python脚本保存到文件中。 测试1.py import maya.cmds as cmds import sys def process(): print 'working' 我需
我正在用 python 为 Maya 编写一个脚本,将顶点位置从一侧交换到另一侧。由于我希望翻转基于拓扑,因此我使用拓扑对称选择工具来查找顶点对应关系。我设法使用 filterExpand 和 xfo
我想找到来自 Maya 中多个对象的一系列顶点的中心(我所说的中心是指默认枢轴位置)。我以为是centroid但似乎这并没有返回正确的坐标。 这是一个例子: 我选择了四个顶点,即每个球体的两个极点。红
假设我在多平面上方有一个定位器。我想要做的是从定位器以负或正 y 进行查找或跟踪,直到它到达 polyPlane 并返回最近点/顶点/uv/的位置 我想这已经完成了一百万次,但我发现的唯一例子是通过基
所以我已经为此寻找了很长一段时间,但到目前为止我还是空手而归。 我想知道是否有任何方法可以通过脚本命令访问 Maya 的网格颜色。 cmds.grid 没有任何标志,我找不到任何其他具有相关标志的命令
我是一名优秀的程序员,十分优秀!