如何在覆盖中设置属性("primaryVisibility"(。AbsOverride maya 2018或2019
import maya.app.renderSetup.model.override as override
import maya.app.renderSetup.model.selector as selector
import maya.app.renderSetup.model.collection as collection
import maya.app.renderSetup.model.renderLayer as renderLayer
import maya.app.renderSetup.model.renderSetup as renderSetup
import maya.cmds as cmds
rs = renderSetup.instance()
# Create render layer
r1 = rs.createRenderLayer("char_beauty")
# Create collections
c1 = r1.createCollection("char")
c2 = r1.createCollection("trk_geo")
c2pv=c2.createCollection("PV")
c2pv.getSelector().setFilterType(2)
so=c2.createOverride('PV', override.AbsOverride.kTypeId)
so.setattribute("主可见性"(
尝试创建primaryVisibility属性。。对于trk_geo集合。。不知道在AbsOverride中设置primaryVisibility属性。
您的代码似乎缺少对重写的finalize
方法调用:
import maya.app.renderSetup.model.override as override
import maya.app.renderSetup.model.selector as selector
import maya.app.renderSetup.model.collection as collection
import maya.app.renderSetup.model.renderLayer as renderLayer
import maya.app.renderSetup.model.renderSetup as renderSetup
import maya.cmds as cmds
rs = renderSetup.instance()
# Create render layer
r1 = rs.createRenderLayer("char_beauty")
# Create collections
c1 = r1.createCollection("char")
c2 = r1.createCollection("trk_geo")
c2pv=c2.createCollection("PV")
c2pv.getSelector().setFilterType(2)
# Create override
so = c2.createOverride('PV', override.AbsOverride.kTypeId)
so.finalize('visibility')
如果您不知道属性的名称,可以跳过上一次finalize
调用,然后通过从属性编辑器中拖放属性手动指定覆盖,然后调用print so.attributeName()
以查看实际名称。