どうも!たっくんです!
あれこれ試したりし、解析したりした内容になりますが、今回は「オーバーライド」周りを書いていきたいと思います!
Absolute Overrideの作成/値の設定
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') # Absolute Overrideを作成。 override = collect.createAbsoluteOverride('persp', 'visibility') override.setAttrValue(False)
Relative Overrideの作成/値の設定
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') # Relative Overrideの作成 override = collect.createRelativeOverride('persp', 'tx') override.setMultiply(1) override.setOffset(1)
Connection Overrideの作成/値の設定
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') # Connection Overrideの作成 override = collect.createConnectionOverride('persp', 'v') override.setSource('locator1.v')
Shader Overrideの作成/値の設定
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') # Shader Overrideの作成 # 汎用的なcreateOverrideを使って、Typeを指定する override = collect.createOverride('lambert2SG', typeIDs.shaderOverride) override.setShader('blinn1', '.outColor')
Type | 内容 |
---|---|
typeIDs.absOverride | Absolute Override |
typeIDs.relOverride | Relative Override |
typeIDs.connectionOverride | Connection Override |
typeIDs.shaderOverride | Shader Override |
typeIDs.materialOverride | Material Override |
Matrial Overrideの作成/値の設定
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') # Matrial Overrideの作成 # 汎用的なcreateOverrideを使って、Typeを指定する override = collect.createOverride('lambert2SG', typeIDs.materialOverride) override.setMaterial('blinn1SG')
Type | 内容 |
---|---|
typeIDs.absOverride | Absolute Override |
typeIDs.relOverride | Relative Override |
typeIDs.connectionOverride | Connection Override |
typeIDs.shaderOverride | Shader Override |
typeIDs.materialOverride | Material Override |
オーバーライドの取得
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') # コレクションのオーバーライドを全て取得 overrides = collect.getOverrides()
オーバーライドの削除
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') overrides = collect.getOverrides() for override_ in overrides: override.delete(override_)
オーバーライドの削除は、overrideモジュールのdeleteを使います。
オーバーライド名の取得/設定
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') overrides = collect.getOverrides() for override_ in overrides: # 名前の取得 print override_.name() # 名前の設定 print override_.name('Override_' + override_.name())
オーバーライドの有効/無効
rs = renderSetup.instance() layer = rs.getRenderLayer('renderSetupLayer1') collect = layer.getCollectionByName('collection1') overrides = collect.getOverrides() for override_ in overrides: # 有効/無効の取得 print override_.isSelfEnabled() # 有効/無効の設定 override_.setSelfEnabled(False)