Point d’ancrage
AnchorPointEffectNode est un type de nœud qui permet d’exposer à n’importe quelle ressource ou élément de la pile de calques de données et de la référencer dans différentes zones de la pile de calques de données à des fins différentes et avec un ensemble de réglages différent.
TIP
Voir aussi : Documentation sur le point d'ancrage.
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 Fill Layer
my_fill_layer = sp.layerstack.insert_fill(position_stack_top)
my_fill_layer.set_name("My Fill Layer")
# Apply a material
aluminium_material = sp.resource.search("s:starterassets "
"u:substance "
"n:metal")[0]
my_fill_layer.set_material_source(aluminium_material.identifier())
# Add an anchor point
insert_position = sp.layerstack.InsertPosition.inside_node(
my_fill_layer, sp.layerstack.NodeStack.Content)
anchor_point = sp.layerstack.insert_anchor_point_effect(insert_position, "My Anchor Point")
# Insert Fill Layer
my_fill_layer2 = sp.layerstack.insert_fill(position_stack_top)
my_fill_layer2.set_name("My Fill Layer 2")
# Add a black mask and a fill effect in the mask stack
my_fill_layer2.add_mask(sp.layerstack.MaskBackground.Black)
insert_position = sp.layerstack.InsertPosition.inside_node(
my_fill_layer2, sp.layerstack.NodeStack.Mask)
my_fill_effect = sp.layerstack.insert_fill(insert_position)
# Load the anchor point on the Fill effect
my_fill_effect.set_source(None, anchor_point) # Use None as the mask stack is mono-channel
# Print the parent of the Anchor Point
print("Parent of " + anchor_point.get_name() + ": " + anchor_point.get_parent().get_name())
# Select the Fill effect
sp.layerstack.set_selected_nodes([my_fill_effect])
Fonctions et classes
substance_painter.layerstack.insert_anchor_point_effect(position : InsertPosition, nom : str) -> AnchorPointEffectNode substance_painter.layerstack.insert_anchor_point_effect
Insérez un effet de point d’ancrage.
Paramètres :
- position (InsertPosition) : la position d’insertion doit se trouver à l’intérieur d’un
LayerNodeavecNodeStack.ContentouNodeStack.Maskou au-dessus/au-dessous d’unEffectNode. - name (str) : nom du point d’ancrage.
Élévations :
ValueError : si l’insertion a échoué en raison d’une position non valide. Voir InsertPosition.
Renvoie : le nouveau point d’ancrage.
Type de retour : AnchorPointEffectNode
classe substance_painter.layerstack.AnchorPointEffectNode(uid) substance_painter.layerstack.AnchorPointEffectNode
Nœud permettant de manipuler un effet de point d’ancrage.
recommendation-more-help
substance-3d-dev-help-painter-python-guide