【问题标题】:how can search an outside file structure from inside of Maya using python如何使用 python 从 Maya 内部搜索外部文件结构
【发布时间】:2019-01-08 03:16:57
【问题描述】:

我是一位经验丰富的 Maya 用户,但对编程还很陌生,我正在努力解决一些问题。 我正在尝试创建一个在 Maya 内部使用的函数,它允许我在文件结构中搜索纹理文件。

我想要它做的是:

if texture_name is missing:
    access folder containing this scene
    go up one file to character folder
    if textures folder exists:
        if object matching texture_name exists:
            set this folder as new texture path

或者它可以做这样的事情:

texture path is A:B/C/D/texture_name
    if A:B/C/D/texture_name == False:
        if A:B/C/E/texture_name == False:
            if A:B/F/E/texture_name == False:

等等。 一次替换一层纹理路径,直到它起作用

编辑: 我找到了一种解决方法,可以生成我需要的纹理路径,但我仍在寻找一种方法来查询某个文件是否存在。与 objExists 函数类似,但用于检查 Maya 场景之外的文件。

【问题讨论】:

    标签: python textures maya autodesk pymel


    【解决方案1】:

    您可以使用 os 模块来检查它是否存在。 有os.path,os.path.isfile()

    extracting only texture filenames being used in maya file from the list of filename paths

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-11-26
      • 1970-01-01
      • 1970-01-01
      • 2019-03-30
      • 2012-06-18
      • 1970-01-01
      • 1970-01-01
      • 2019-09-15
      相关资源
      最近更新 更多