assemblyReference踩坑记录


含AR节点的动画文件拍屏失败

报错
C++运行错误 R6025

原因 AR节点initialRep属性锁定


for ar_node in pm.ls(typ='assemblyReference'):
    ar_node.initialRep.unlock()

材质节点锁定

cmds.lockNode('initialShadingGroup', lu=False, lock=False)

AR节点的物体掉落到大纲中

ar_node = 'Animation_AR'
if not pm.objExists('hyperLayout1'):
    hyperlayout = pm.createNode('hyperLayout', n='hyperLayout1')
    hyperlayout.ihi.set(0)
    hyperlayout.hyp.set(s=15)
else:
    connect = pm.listConnections('hyperLayout1.msg', plugs=1, s=0, d=1)
    if not connect or len(connect) != 1 or connect[0] != pm.PyNode('Animation_AR.hl'):
        for each in connect:
            each.disconnect()

pm.connectAttr('hyperLayout1.msg', 'Animation_AR.hl', f=1)

删除AR节点的根组

Animation_AR根组删掉
if pm.objExists('Animation_AR'):
    pm.delete('Animation_AR')
try:
    asb = pm.ls(type='assemblyReference')
    for i in asb:
        if not i.getParent() or i.getParent().nodeType() != 'assemblyReference':
            pm.delete(i)
except:
    pass	

评论
  目录