Matériau adaptable

Les matériaux adaptables sont des préconfigurations de calques. Ils peuvent être utilisés pour enregistrer et réutiliser une configuration complexe de calques dans des projets qui s’adaptent au modèle 3D.

Exemples

import substance_painter as sp

# Get the currently displayed Stack
stack = sp.textureset.get_active_stack()

# Get top position of the Stack
position_stack_top = sp.layerstack.InsertPosition.from_textureset_stack(stack)

# Insert a Smart Material
smart_material = sp.resource.search("s:starterassets "
                                    "u:smartmaterial "
                                    "n:Aluminium ")[0]
my_smart_material = sp.layerstack.insert_smart_material(
    position_stack_top, smart_material.identifier())

# Print the name of the parent layer node
print(my_smart_material.get_name())

# Select the layers contained by the parent layer
sp.layerstack.set_selected_nodes(my_smart_material.sub_layers())

Fonctions et classes

substance_painter.layerstack.insert_smart_matériau(position : InsertPosition, smart_matériau : ResourceID) -> GroupLayerNode substance_painter.layerstack.insert_smart_material

Insérez un matériau adaptable à la position donnée.

Paramètres :

Élévations :

  • ValueError : si l’insertion a échoué en raison d’une position non valide. Voir InsertPosition.
  • ValueError : si smart_matériau n’est pas une ressource valide ou n’a pas l’utilisation Usage.SMART_MATERIAL.

Renvoie : le nœud inséré.

Type de retour : GroupLayerNode

substance_painter.layerstack.create_smart_matériau(group : GroupLayerNode, name : str) -> Ressource substance_painter.layerstack.create_smart_material

Créez un matériau adaptable nommé name à partir du group donné.

Paramètres :

  • group (GroupLayerNode) : dossier racine du matériau adaptable.
  • name (str) : nom du matériau adaptable.

Renvoie : le matériau adaptable créé en tant que ressource.

Type de retour : Ressource

substance_painter.layerstack.export_as_smart_matériau(group : GroupLayerNode, name : str, path : str) substance_painter.layerstack.export_as_smart_material

Exportez le group donné en tant que matériau adaptable nommé name dans le path donné. Contrairement à substance_painter.layerstack.create_smart_material(), le matériau adaptable n’est pas stocké dans une étagère, mais écrit uniquement sur le système de fichiers.

Paramètres :

  • group (GroupLayerNode) : dossier racine du matériau adaptable.
  • name (str) : nom du matériau adaptable. Ce nom est également utilisé comme nom de fichier. Si le fichier existe déjà, il sera écrasé.
  • chemin (str) : chemin où exporter le matériau adaptable. Si le chemin n’existe pas, il sera créé.
recommendation-more-help
substance-3d-dev-help-painter-python-guide