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])

类substance_painter.source.SourceReference(uid) substance_painter.source.SourceReference

表示对锚点的引用的类。

属性channel_mapping: ChannelMapping substance_painter.source.SourceReference.channel_mapping

通道映射属性。

Getter:​返回通道映射属性。

引发:

EditionContextException — 如果引用的当前上下文不是多通道。

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

源的引用通道。

Getter:​返回引用的源通道。

Setter:​设置源的引用通道。

引发:

EditionContextException — 如果引用的当前上下文不是单通道,或者目标锚点的上下文不是多通道。

属性锚点: AnchorPointEffectNode substance_painter.source.SourceReference.anchor

此源使用的锚点。

Getter:​返回源使用的锚点。

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

此源使用的Alpha遮罩。

Getter:​返回源的Alpha遮罩。

Setter:​设置源的Alpha遮罩。

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

获取此源的级别使用的参数。

返回:​此源的级别使用的参数。

返回类型: LevelsParamsMono | LevelsParamsRGB

set_levels(params: LevelsParamsMono | LevelsParamsRGB) ->无 substance_painter.source.SourceReference.set_levels

设置此源的级别使用的参数。

参数: 参数 (LevelsParamsMono | LevelsParamsRGB) — 此源的级别使用的参数。

返回类型:​无

类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__和__setitem__方法。

枚举

类substance_painter.source.AlphaMatte(value) substance_painter.source.AlphaMatte

成员:

名称
描述
KeepAlpha
保留阿尔法。
ExtractAlpha
提取Alpha。
DefaultBackgroundColor
使用默认背景颜色遮罩Alpha。
NOTE
用于定义成员的名称可通过.name属性以字符串形式提供(请参见python enum.Enum)。
recommendation-more-help
substance-3d-dev-help-painter-python-guide