SourceReference

SourceReference è un tipo di origine in cui è possibile utilizzare un elemento AnchorPointEffectNode dallo stack dei livelli.

Esempio

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 che rappresenta un riferimento a un punto di ancoraggio.

proprietà channel_mapping: ChannelMapping substance_painter.source.SourceReference.channel_mapping

Proprietà di mapping dei canali.

Get: restituisce la proprietà di mapping dei canali.

Generazioni:

EditionContextException - Se il contesto corrente del riferimento non è multicanale.

proprietà referenced_channel: ChannelType substance_painter.source.SourceReference.referenced_channel

Canale di riferimento della sorgente.

Get: restituisce il canale di riferimento dell’origine.

Setter: Imposta il canale di riferimento dell’origine.

Generazioni:

EditionContextException - Se il contesto corrente del riferimento non è a canale singolo o se il contesto del punto di ancoraggio di destinazione non è a canale multiplo.

ancoraggio proprietà: AnchorPointEffectNode substance_painter.source.SourceReference.anchor

Ancoraggio utilizzato da questa sorgente.

Recupero: Restituisce l’ancoraggio utilizzato dall’origine.

proprietà alpha_matte: AlphaMatte substance_painter.source.SourceReference.alpha_matte

Mascherino alfa utilizzato da questa sorgente.

Recupero: restituisce il mascherino alfa dell’origine.

Setter: Imposta il mascherino alfa dell’origine.

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

Ottiene i parametri utilizzati dai livelli di questa origine.

Restituisce: i parametri utilizzati dai livelli dell’origine.

Tipo restituito: LevelsParamsMono | ParamLivelliRGB

set_levels(params: LevelsParamsMono | ValoriParamRGB) -> Nessuno substance_painter.source.SourceReference.set_levels

Imposta i parametri utilizzati dai livelli di questa origine.

Parametri: param (LevelsParamsMono | LevelsParamsRGB): i parametri utilizzati dai livelli di questa origine.

Tipo restituito: Nessuno

classe substance_painter.source.ChannelMapping(uid) substance_painter.source.ChannelMapping

Questa classe fornisce l’accesso ai canali attivi di un riferimento di origine in modo simile ai puntini. Vedere la proprietà channel_mapping.

Esempio:

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
Vedere anche: Per ulteriori informazioni tecniche, vedere la documentazione ufficiale del contenitore KeysView ABCs e i metodi __getitem__ e __setitem__.

Enums

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

Membri:

Nome
Descrizione
KeepAlpha
Tenete il canale alfa.
ExtractAlpha
Estrai il canale alfa.
DefaultBackgroundColor
Aggiungete un mascherino all’alfa con un colore di sfondo predefinito.
NOTE
Il nome utilizzato per definire i membri è disponibile come stringa tramite l'attributo .name (vedere python enum.Enum).
recommendation-more-help
substance-3d-dev-help-painter-python-guide