SourceReference
SourceReferenceは、layerstackからAnchorPointEffectNodeを使用できるソースの一種です。
例
import substance_painter as sp
# Get the currently displayed stack
stack = sp.textureset.get_active_stack()
# Insert a paint layer
position = sp.layerstack.InsertPosition.from_textureset_stack(stack)
paint = sp.layerstack.insert_paint(position)
# Insert an anchor point in the content stack
position = sp.layerstack.InsertPosition.inside_node(paint, sp.layerstack.NodeStack.Content)
anchor = sp.layerstack.insert_anchor_point_effect(position, "anchor")
# Insert a fill layer with a mask
position = sp.layerstack.InsertPosition.from_textureset_stack(stack)
fill = sp.layerstack.insert_fill(position)
fill.add_mask(sp.layerstack.MaskBackground.White)
# Insert a reference on `anchor` in multi-channel context
source = fill.set_material_source(anchor)
# Edit the channel mapping
new_mapping = {
sp.textureset.ChannelType.BaseColor: sp.textureset.ChannelType.Metallic,
sp.textureset.ChannelType.Metallic: sp.textureset.ChannelType.BaseColor,
sp.textureset.ChannelType.Roughness: sp.textureset.ChannelType.Height,
sp.textureset.ChannelType.Normal: sp.textureset.ChannelType.BaseColor,
sp.textureset.ChannelType.Height: sp.textureset.ChannelType.Metallic
}
for dst_chn, src_chn in new_mapping.items():
source.channel_mapping[dst_chn] = src_chn
# Select the Fill layer
sp.layerstack.set_selected_nodes([fill])
class substance_painter.source.SourceReference(uid) substance_painter.source.SourceReference
アンカーポイントへの参照を表すクラスです。
property channel_mapping: ChannelMapping substance_painter.source.SourceReference.channel_mapping
チャンネルマッピングプロパティ。
Getter:チャネルマッピングプロパティを返します。
Rails:
EditionContextException – 参照の現在のコンテキストがマルチチャネルでない場合。
property referenced_channel: ChannelType substance_painter.source.SourceReference.referenced_channel
ソースの参照チャンネル。
Getter:ソースの参照チャネルを返します。
設定:ソースの参照チャネルを設定します。
Rails:
EditionContextException – 参照の現在のコンテキストが単一チャネルではない場合、またはターゲットアンカーポイントのコンテキストが複数チャネルではない場合。
プロパティアンカー: AnchorPointEffectNode substance_painter.source.SourceReference.anchor
このソースで使用されるアンカーです。
取得メソッド:ソースが使用するアンカーを返します。
property alpha_matte: AlphaMatte substance_painter.source.SourceReference.alpha_matte
このソースで使用されるアルファマット。
取得メソッド:ソースのアルファマットを返します。
設定:ソースのアルファマットを設定します。
get_levels() -> LevelsParamsMono | LevelsParamsRGB substance_painter.source.SourceReference.get_levels
このソースのレベルで使用されるパラメーターを取得します。
戻り値:このソースのレベルによって使用されるパラメーター。
戻り値の型: LevelsParamsMono | LevelsParamsRGB
set_levels(params: LevelsParamsMono | LevelsParamsRGB) -> None substance_painter.source.SourceReference.set_levels
このソースのレベルで使用されるパラメーターを設定します。
パラメーター: params (LevelsParamsMono | LevelsParamsRGB) – このソースのレベルによって使用されるパラメーター。
戻り値の型:なし
class substance_painter.source.ChannelMapping(uid) substance_painter.source.ChannelMapping
このクラスは、ソース参照のアクティブなチャンネルにdict形式でアクセスします。 channel_mappingプロパティを参照してください。
例:
import substance_painter as sp
mapping = some_SourceReference_object.channel_mapping
mapping[sp.textureset.ChannelType.BaseColor] = sp.textureset.ChannelType.Specular
for channel in mapping:
print(mapping[channel])
TIP
列挙
class substance_painter.source.AlphaMatte(value) substance_painter.source.AlphaMatte
メンバー:
名前
説明
KeepAlphaアルファはそのままにします。
ExtractAlphaアルファを抽出します。
DefaultBackgroundColorデフォルトの背景色でアルファをマットします。
NOTE
メンバーの定義に使用される名前は、.name属性を使用して文字列として使用できます(python enum.Enumを参照)。
recommendation-more-help
substance-3d-dev-help-painter-python-guide