SourceReference
SourceReference est un type de source où vous pouvez utiliser un AnchorPointEffectNode de la pile de calques.
Exemple
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])
classe substance_painter.source.SourceReference(uid) substance_painter.source.SourceReference
Classe qui représente une référence à un point d’ancrage.
propriété channel_mapping : ChannelMapping substance_painter.source.SourceReference.channel_mapping
Propriété mapping de canaux.
Accélérateur : renvoie la propriété de mappage des canaux.
Élévations :
EditionContextException : si le contexte actuel de la référence n’est pas multicanal.
propriété references_channel : ChannelType substance_painter.source.SourceReference.referenced_channel
Canal référencé de la source.
Accélérateur : renvoie le canal référencé de la source.
Setter: Définissez le canal référencé de la source.
Élévations :
EditionContextException : si le contexte actuel de la référence n’est pas monocanal ou si le contexte du point d’ancrage cible n’est pas multicanal.
ancre de propriété : AnchorPointEffectNode substance_painter.source.SourceReference.anchor
Ancrage utilisé par cette source.
Accentuation : renvoie l’ancrage utilisé par la source.
propriété alpha_matte : AlphaMatte substance_painter.source.SourceReference.alpha_matte
Cache alpha utilisé par cette source.
Accentuation : renvoie le cache alpha de la source.
Définisseur : définissez le cache alpha de la source.
get_levels() -> LevelsParamsMono | LevelsParamsRGB substance_painter.source.SourceReference.get_levels
Obtient les paramètres utilisés par les niveaux de cette source.
Renvoie : les paramètres utilisés par les niveaux de cette source.
Type de retour : LevelsParamsMono | LevelsParamsRGB
set_levels(params : LevelsParamsMono | LevelsParamsRGB) -> Aucun substance_painter.source.SourceReference.set_levels
Définissez les paramètres utilisés par les niveaux de cette source.
Paramètres : params (LevelsParamsMono | LevelsParamsRGB) : paramètres utilisés par les niveaux de cette source.
Type de retour : Aucun
classe substance_painter.source.ChannelMapping(uid) substance_painter.source.ChannelMapping
Cette classe donne accès aux canaux actifs d’une référence source d’une manière semblable à un dict. Voir la propriété channel_mapping.
Exemple :
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])
Énumérations
classe substance_painter.source.AlphaMatte(value) substance_painter.source.AlphaMatte
Membres :
KeepAlphaExtractAlphaDefaultBackgroundColor