kubectl 获取不到node_Maya中代理文件的贴图路径获取方案

2ec2194a006b8b3302e4177b90ece7c7.png

    往往我们拿到一些客户灯光整合文件中存在很多代理文件,比如Arnold的ass文件,Redshift的rs文件,正常来说这些代理文件不会二次赋予材质,材质都是写在代理文件里面的,材质的贴图路径你是看不到的,但是我们又必须check这些贴图是否存在,这里有两段代码,分别获取rs文件和ass文件的所使用到的贴图路径,运行代码很简单,打开Maya,随便导一些ass文件或者rs文件进来,然后在Script Editor中执行下面的Python代码即可获得所有贴图路径(这两段代码来自羊厂长打包王工具里的部分代码),代码到用时方恨少。

    获取Redshift渲染器rs代理文件所有贴图路径代码:

import reimport codecsfrom pprint import pprintimport maya.cmds as cmdsdef readFileCode_bag2(path):    con = ""    if os.path.exists(path):        Arg = codecs.open(path, "r")        con = Arg.read()        Arg.close()    return congetAllRs = []getAllNodes = cmds.ls(type="RedshiftProxyMesh")tm = re.compile("(\\x00\\x00\\x00[A-Za-z]:/.*?\\x00)+")tm2 = re.compile("(\\x00\\x00\\x00//[0-9].*?\\x00)+")for node in getAllNodes:    getPath = cmds.getAttr(node + ".fileName")    if getPath and getPath not in getAllRs:        getAllRs.append(getPath)for oneProxy in getAllRs:    getAllPath = []    print(oneProxy)    getCon = readFileCode_bag2(oneProxy)    getResult = tm.findall(getCon)    getResult2 = tm2.findall(getCon)    for oneString in getResult:        if oneString and "\\" not in oneString and "_map_auto" not in oneString and "/" in oneString:            getPathMap = oneString.split("\x00\x00\x00")[1][:-1]            if getPathMap and getPathMap not in getAllPath:                getAllPath.append(getPathMap)    for oneString in getResult2:        if oneString and "\\" not in oneString and "_map_auto" not in oneString and "/" in oneString:            getPathMap = oneString.split("\x00\x00\x00")[1][:-1]            if getPathMap and getPathMap not in getAllPath:                getAllPath.append(getPathMap)    pprint(getAllPath)

    获取Arnold渲染器ass代理文件所有贴图路径代码:

from pprint import pprintimport maya.cmds as cmdsimport arnold as ar# 分析ass代理文件贴图路径getAllAss = []getAllNodes = cmds.ls(type="aiStandIn")for node in getAllNodes:    getPath = cmds.getAttr(node + ".dso")    if getPath and getPath not in getAllAss:        getAllAss.append(getPath)for ass in getAllAss:    getAllPath = []    print(ass)    ar.AiBegin()    ar.AiMsgSetConsoleFlags(ar.AI_LOG_ALL)    ar.AiASSLoad(ass, ar.AI_NODE_ALL)    iterator = ar.AiUniverseGetNodeIterator(ar.AI_NODE_ALL)    while not ar.AiNodeIteratorFinished(iterator):        node = ar.AiNodeIteratorGetNext(iterator)        if ar.AiNodeIs(node, "MayaFile") or ar.AiNodeIs(node, "image"):            getPath = ar.AiNodeGetStr(node, "filename")            if getPath and getPath not in getAllPath:                getAllPath.append(getPath)    ar.AiNodeIteratorDestroy(iterator)    ar.AiEnd()    pprint(getAllPath)

    文字思路如果对你有用,就给作者赞赏加个鸡腿吧,蟹蟹~(3)~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值