資料來源參考

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

一個代表指向錨點的類別。

屬性channel_mapping:頻道地圖 substance_painter.source.SourceReference.channel_mapping

通道映射屬性。

Getter: 回傳通道映射屬性。

加薪:

EditionContextException – 如果該參考文獻目前的上下文不是多通道。

屬性referenced_channel:ChannelType substance_painter.source.SourceReference.referenced_channel

來源的參考通道。

Getter: 回傳來源的參考通道。

設定器: 設定來源的參考通道。

加薪:

EditionContextException – 如果參考的當前上下文不是單通道,或目標錨點的上下文不是多通道。

屬性錨點:AnchorPointEffectNode substance_painter.source.SourceReference.anchor

這個來源所使用的錨點。

Getter: 回傳來源使用的錨點。

屬性alpha_matte:AlphaMatte substance_painter.source.SourceReference.alpha_matte

這個來源使用的 alpha 遮罩。

Getter: 回傳來源的 alpha matte。

設定器: 設定來源的 alpha 遮罩。

get_levels() -> LevelsParamsMono |LevelsParamsRGB substance_painter.source.SourceReference.get_levels

取得該來源各層級所使用的參數。

回報: 該來源層級所使用的參數。

回傳類型:​LevelsParamsMono | LevelsParamsRGB

set_levels(參數:LevelsParamsMono |LevelsParamsRGB) -> 無 substance_painter.source.SourceReference.set_levels

設定該音源電平所使用的參數。

參數:​參數(LevelsParamsMono 🔗 |** LevelsParamsRGB *)— 此來源層級所使用的參數。​***

返回類型: 無

class substance_painter.source.ChannelMapping(uid) substance_painter.source.ChannelMapping

此類別以類似字令的方式,提供存取來源參考的主動通道。 請參閱 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
另見: 欲了解更多技術資訊,請參閱官方 KeysView ABCs 容器 文件,以及 [__getitem_](https://docs.python.org/3/reference/datamodel.html#object.getitem) __ 和 __setitem___ 方法。

枚舉

class substance_painter.source.AlphaMatte(value) substance_painter.source.AlphaMatte

成員:

名稱
說明
KeepAlpha
保留阿爾法。
ExtractAlpha
救出阿爾法。
DefaultBackgroundColor
用預設背景色遮光 alpha。
NOTE
用來定義成員的名稱可透過 .name 屬性以字串形式取得(參見 python enum。Enum)。
recommendation-more-help
substance-3d-dev-help-painter-python-guide