【问题标题】:Maya 2017 Autoselect or export viewport objectsMaya 2017 自动选择或导出视口对象
【发布时间】:2018-10-03 18:35:24
【问题描述】:

我想批量选择选定列表中的对象,我该如何用python呢?

  1. 在 3D 视口或大纲视图中使用鼠标选择一些对象。
  2. 从选定对象中获取列表。
  3. 我想将列出的项目中的批次(逐个对象)导出为不同的文件,每个文件都来自列出的对象。

当我使用我的脚本导出 rsProxy(像 OBJ 一样的 Redshift 代理)时,所有对象都导出到同一个场景。但我想从整体选定的对象中进行批处理。

Thnax。 F

【问题讨论】:

    标签: python maya mel


    【解决方案1】:

    我不知道 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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-06
      • 2017-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-07
      相关资源
      最近更新 更多