【发布时间】:2018-10-03 18:35:24
【问题描述】:
我想批量选择选定列表中的对象,我该如何用python呢?
- 在 3D 视口或大纲视图中使用鼠标选择一些对象。
- 从选定对象中获取列表。
- 我想将列出的项目中的批次(逐个对象)导出为不同的文件,每个文件都来自列出的对象。
当我使用我的脚本导出 rsProxy(像 OBJ 一样的 Redshift 代理)时,所有对象都导出到同一个场景。但我想从整体选定的对象中进行批处理。
Thnax。 F
【问题讨论】:
我想批量选择选定列表中的对象,我该如何用python呢?
当我使用我的脚本导出 rsProxy(像 OBJ 一样的 Redshift 代理)时,所有对象都导出到同一个场景。但我想从整体选定的对象中进行批处理。
Thnax。 F
【问题讨论】:
我不知道 Redshift 的确切语法,但这里有一个关于如何在列表中逐个对象导出对象的一般示例。您最终会得到一堆文件,每个文件都包含您在循环的每次迭代中选择的内容。
import pymel.core as pm
# get a list of the selected objects / nodes to export
export_objects = pm.ls(selection=True)
for obj in export_objects:
# generate unique filepath
filepath = "C:\some\export\path\{}.obj".format(obj.shortName())
# select just one of your objects for export
pm.select(obj, replace=True)
# use exportSelected for most filetypes
# (or the redshift export command in your case)
pm.exportSelected(filepath)
【讨论】: