Generator effect
GeneratorEffectNode is an effect that takes a Generator substance as input. Generator substances generate a mask or a material based on the mesh topology using the additional maps setup in the TextureSet Settings.
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 Fill Layer
my_fill_layer = sp.layerstack.insert_fill(position_stack_top)
my_fill_layer.set_name("My Fill Layer")
# Add a black Mask
my_fill_layer.add_mask(sp.layerstack.MaskBackground.Black)
# Add a Generator effect with Ambient Occlusion mask generator in the Fill layer mask stack
insertion_position = sp.layerstack.InsertPosition.inside_node(my_fill_layer,
sp.layerstack.NodeStack.Mask)
generator_resource = sp.resource.search("s:starterassets "
"u:generator "
"n:Ambient Occlusion")[0]
my_generator = sp.layerstack.insert_generator_effect(insertion_position,
generator_resource.identifier())
# Select the Generator effect
sp.layerstack.set_selected_nodes([my_generator])
Functions and classes
substance_painter.layerstack.insert_generator_effect(position: InsertPosition, generator_substance: ResourceID | None = None) -> GeneratorEffectNode substance_painter.layerstack.insert_generator_effect
Insert a Generator effect, either empty or with the given filter resource.
Parameters:
- position (InsertPosition) – The insert position must be either inside
aLayerNodewithNodeStack.ContentorNodeStack.Maskor above/below anEffectNode. - generator_substance (ResourceID | None) – Resource to use as generator. The resource must have a
Usage.GENERATORusage.
Raises:
- ValueError – If insertion failed due to an invalid position.
SeeInsertPosition. - ValueError – If generator_substance is not a valid resource or
does not haveUsage.GENERATORusage.
Returns: The inserted node.
Return type: GeneratorEffectNode
class substance_painter.layerstack.GeneratorEffectNode(uid) substance_painter.layerstack.GeneratorEffectNode
Bases: ActiveChannelsMixin, Node
A node allowing manipulation of a Generator effect.
get_source() -> SourceSubstance substance_painter.layerstack.GeneratorEffectNode.get_source
Get the source procedural of the generator, or None if no generator is set.
Returns: The generator’s source.
Return type: SourceSubstance
set_source(res: ResourceID) -> SourceSubstance substance_painter.layerstack.GeneratorEffectNode.set_source
Create and assign a source from the given resource and return the created source.
The resource must have a Usage.GENERATOR usage.
Parameters: res (ResourceID) – The generator material to apply.
Raises:
ValueError – If res is not a valid resource or does not haveUsage.GENERATOR usage.
Returns: The generator’s source.
Return type: SourceSubstance
remove_source() -> None substance_painter.layerstack.GeneratorEffectNode.remove_source
Remove the currently used source.
Return type: None
property active_channels: Set[ChannelType] substance_painter.layerstack.GeneratorEffectNode.active_channels
The set of active channels of the source.
Getter:
Returns the active channels of the source. To get the list of channels
for a given stack, see substance_painter.textureset.Stack.all_channels().
Setter:
Sets the active channels of the source, channels not listed will be
disabled.