Smart material

Smart Materials are presets of layers. They can be used to save and re-use complex setup of layers across projects that adapt to the 3D model.

Examples

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

Functions and classes

substance_painter.layerstack.insert_smart_material(position: InsertPosition, smart_material: ResourceID) -> GroupLayerNode substance_painter.layerstack.insert_smart_material

Insert a smart material at the given position.

Parameters:

Raises:

  • ValueError – If insertion failed due to an invalid position.
    See InsertPosition.
  • ValueError – If smart_material is not a valid resource or does not have
    Usage.SMART_MATERIAL usage.

Returns: The inserted node.

Return type: GroupLayerNode

substance_painter.layerstack.create_smart_material(group: GroupLayerNode, name: str) -> Resource substance_painter.layerstack.create_smart_material

Create a smart material with name name from the given group.

Parameters:

  • group (GroupLayerNode) – The root folder of the smart material.
  • name (str) – The name of the smart material.

Returns: The created smart material as a resource.

Return type: Resource

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

Export the given group as a smart material with name name in the given path.
Unlike substance_painter.layerstack.create_smart_material(), the smart material is not
stored in a shelf but only written on the filesystem.

Parameters:

  • group (GroupLayerNode) – The root folder of the smart material.
  • name (str) – The name of the smart material. This name is also used as the file name.
    If the file already exists, it will be overwritten.
  • path (str) – The path where to export the smart material. If the path does not exist,
    it will be created.
recommendation-more-help
substance-3d-dev-help-painter-python-guide