Classe Stack

class substance_painter.textureset.Stack(stack_id: int | Nessuno = Nessuno) substance_painter.textureset.Stack

Una pila colorabile di Substance 3D Painter.

Una pila può contenere un numero di canali (BaseColor, Specular, Rugosità, ecc.) che corrispondono al materiale. La pila appartiene a un set di texture, che può contenere una o più pile.

In genere, viene utilizzato un solo stack, che è trasparente per l’utente. Selezionando il set di texture, viene selezionata la relativa pila. Tuttavia, un set di texture può utilizzare materiali a strati con ombreggiature personalizzate, nel qual caso è necessario selezionare una pila specifica.

Se l’insieme di texture non utilizza la creazione di livelli di materiale, potete recuperarne la pila nel modo seguente:

import substance_painter.textureset

# Get the unnamed stack of "TextureSetName":
paintable_stack = substance_painter.textureset.Stack.from_name("TextureSetName")

# Alternatively, get the stack from a Texture Set instance:
my_texture_set = substance_painter.textureset.TextureSet.from_name("TextureSetName")
paintable_stack = my_texture_set.get_stack()

Se il set di texture utilizza la creazione di livelli di materiale, potete recuperare le sue pile come segue:

import substance_painter.textureset

# Get the stack called "Mask1" from the Texture Set "TextureSetName":
paintable_stack = substance_painter.textureset.Stack.from_name("TextureSetName",
                                                               "Mask1")

# Alternatively, get the stack from a Texture Set instance:
my_texture_set = substance_painter.textureset.TextureSet.from_name("TextureSetName")
paintable_stack = my_texture_set.get_stack("Mask1")

# Show the name of the stack:
print(paintable_stack.name())

È possibile eseguire query, aggiungere, rimuovere o modificare i canali di una pila:

import substance_painter.textureset

# Get the unnamed stack of "TextureSetName":
paintable_stack = substance_painter.textureset.Stack.from_name("TextureSetName")

# List all the channels of the "TextureSetName" Texture Set:
for k,v in paintable_stack.all_channels().items():
    print("{0}: {1}".format(k, str(v.format())))

# Add a scattering channel to the "TextureSetName" Texture Set:
paintable_stack.add_channel(substance_painter.textureset.ChannelType.Scattering,
                            substance_painter.textureset.ChannelFormat.L8)

# Query details of the added scattering channel:
if paintable_stack.has_channel(substance_painter.textureset.ChannelType.Scattering):
    channel = paintable_stack.get_channel(
        substance_painter.textureset.ChannelType.Scattering)
    print("The Texture Set now has a scattering channel with {0} bits per pixel."
        .format(channel.bit_depth()))

# Change the scattering channel to 16 bits inside the "TextureSetName" Texture Set:
paintable_stack.edit_channel(
    channel_type = substance_painter.textureset.ChannelType.Scattering,
    channel_format = substance_painter.textureset.ChannelFormat.L16)

# Remove the scattering channel from "TextureSetName":
paintable_stack.remove_channel(substance_painter.textureset.ChannelType.Scattering)

Parametri: stack_id (int)

static from_name(nome_set_texture: str, nome_stack: str = ‘’) substance_painter.textureset.Stack.from_name

Ottieni una pila dal suo nome.

Parametri:

  • texture_set_name (str) - Nome set di texture.
  • stack_name (str) - Nome stack. Lasciate vuoto se il set di texture non utilizza la creazione di livelli di materiale.
NOTE
I nomi dei set di texture e delle serie fanno distinzione tra maiuscole e minuscole.

Generazioni:

  • Errore progetto - Se non è aperto alcun progetto.
  • ErroreServizioNonTrovato - Se Substance 3D Painter non ha ancora avviato tutti i servizi.
  • Errore valore - Se texture_set_name non è una stringa.
  • Errore valore - Se non esiste un set di texture con il nome texture_set_name.
  • Errore valore - Se non è presente uno stack con il nome stack_name.

Parametri:

  • texture_set_name (str)
  • stack_name (str)

name() -> str substance_painter.textureset.Stack.name

Ottieni il nome dello stack. Il nome di una pila è vuoto se il set di texture a cui appartiene utilizza livelli di materiale.

Restituisce: Il nome dello stack.

Tipo restituito: str

Generazioni:

material() substance_painter.textureset.Stack.material

Ottieni il set di texture a cui appartiene questa pila.

Restituisce: Il set di texture a cui appartiene questo stack.

Tipo restituito: TextureSet

Generazioni:

TIP
Vedere anche: TextureSet, all_texture_sets().

all_channel() -> Dict[ChannelType, Channel] substance_painter.textureset.Stack.all_channels

Elencare tutti i canali di una pila.

Restituisce: mappa di tutti i canali dello stack.

Tipo di valore restituito: dict[ChannelType, Channel]

Generazioni:

add_channel(channel_type: ChannelType, channel_format: ChannelFormat, label: str | Nessuno = Nessuno) -> Canale substance_painter.textureset.Stack.add_channel

Aggiungi un nuovo canale a una pila.

NOTE
add_channel non è disponibile con la creazione di livelli di materiale.

Parametri:

  • channel_type (ChannelType): il tipo di canale.
  • canale_formato (FormatoCanale) - Formato texture del nuovo canale.
  • etichetta (str*,* facoltativo): etichetta del canale in caso di tipo Canale utente.

Restituisce: Il canale creato.

Tipo restituito: Canale

Generazioni:

  • Errore progetto - Se non è aperto alcun progetto.
  • Errore valore - Se un canale di tipo channel_type esiste già in questo set di texture.
  • Errore valore - Se è stata specificata un’etichetta ma channel_type non è un tipo utente. I tipi di canale standard hanno etichette fisse.
  • Errore valore - Se lo stack non è valido.
  • Errore valore - Se il set di texture utilizza livelli di materiale.

remove_channel(channel_type: ChannelType) -> Nessuno substance_painter.textureset.Stack.remove_channel

Rimuovere un canale da una pila.

NOTE
remove_channel non è disponibile con la creazione di livelli di materiale.

Parametri: canale_type (ChannelType) - Tipo di canale.

Generazioni:

  • Errore progetto - Se non è aperto alcun progetto.
  • Errore valore - Se in questo set di texture non è presente alcun canale di tipo channel_type.
  • Errore valore - Se lo stack non è valido.
  • Errore valore - Se il set di texture utilizza livelli di materiale.

Tipo restituito: Nessuno

edit_channel(channel_type: ChannelType, channel_format: ChannelFormat, label: str | Nessuno = Nessuno) -> Nessuno substance_painter.textureset.Stack.edit_channel

Modificare il formato di texture e l’etichetta di un canale.

Parametri:

  • channel_type (ChannelType): il tipo di canale.
  • canale_formato (FormatoCanale) - Il nuovo formato di texture del canale.
  • etichetta (str*,* facoltativo): etichetta del canale in caso di tipo Canale utente.

Generazioni:

  • Errore progetto - Se non è aperto alcun progetto.
  • Errore valore - Se non è presente uno stack con etichetta stack_id in questo set di texture.
  • Errore valore - Se in questo set di texture non è presente alcun canale di tipo channel_type.
  • Errore valore - Se è stata specificata un’etichetta ma channel_type non è un tipo utente. I tipi di canale standard hanno etichette fisse.
  • Errore valore - Se lo stack non è valido.

Tipo restituito: Nessuno

has_channel(channel_type: ChannelType) -> bool substance_painter.textureset.Stack.has_channel

Verificare se in una pila esiste un canale.

Parametri: canale_type (ChannelType) - Tipo di canale.

Restituisce: True se lo stack dispone di un canale del tipo specificato, False in caso contrario.

Tipo restituito: bool

Generazioni:

  • Errore progetto - Se non è aperto alcun progetto.
  • Errore valore - Se lo stack non è valido.

get_channel(channel_type: ChannelType) -> Canale substance_painter.textureset.Stack.get_channel

Ottieni un canale esistente dal suo tipo.

Parametri: canale_type (Canale) - Tipo di canale.

Restituisce: Il canale.

Tipo restituito: Canale

Generazioni:

recommendation-more-help
substance-3d-dev-help-painter-python-guide