錨點
AnchorPointEffectNode 是一種節點類型,允許在層堆疊中暴露任何資源或元素,並在不同區域以不同目的及調整方式參照它。
TIP
另見:錨點文件。
範例
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])
函數與類別
substance_painter.layerstack.insert_anchor_point_effect(position: InsertPosition, name: str) -> AnchorPointEffectNode substance_painter.layerstack.insert_anchor_point_effect
插入錨點效果。
參數:
- 位置(插入位置🔗)– 插入位置必須位於
LayerNode帶有NodeStack.Content的 或NodeStack.Mask的 內,或高於/低於 的EffectNode。 - 名稱 (str)– 錨點名稱。
加薪:
ValueError – 若插入因位置無效而失敗。 參見 InsertPosition。
回歸: 新的錨點。
回傳類型:AnchorPointEffectNode
class substance_painter.layerstack.AnchorPointEffectNode(uid) substance_painter.layerstack.AnchorPointEffectNode
一個可以操控錨點效果的節點。
recommendation-more-help
substance-3d-dev-help-painter-python-guide