实例图层
InstanceLayerNode是一种节点类型,它允许跨多个图层和纹理集同步图层参数,同时仍然能够生成与网格相关的结果。 只能修改源图层。
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")
# Create two instances of the Fill layer
insert_position = sp.layerstack.InsertPosition.below_node(my_fill_layer)
instance1 = sp.layerstack.instantiate(insert_position, my_fill_layer)
instance1.set_name("Instance 1")
instance2 = sp.layerstack.instantiate(insert_position, my_fill_layer)
instance2.set_name("Instance 2")
# Print instances of the parent layer
instances = my_fill_layer.instances()
print("Instances of " + my_fill_layer.get_name() + ":")
for instance in instances:
print("- " + instance.get_name())
# Print parent of each instance
print("Parent of " + instance1.get_name() + ": " + instance1.instance_source().get_name())
print("Parent of " + instance2.get_name() + ": " + instance2.instance_source().get_name())
# Select the Instances
sp.layerstack.set_selected_nodes([instance1, instance2])
函数和类
substance_painter.layerstack.实例化(位置: InsertPosition,图层: LayerNode) -> InstanceLayerNode substance_painter.layerstack.instantiate
实例化给定图层。 如果您不熟悉概念,请参阅有关图层实例化的文档: 图层实例化文档。
参数:
引发:
ValueError — 如果由于位置无效而导致插入失败。 请参阅InsertPosition。
返回:插入的节点。
返回类型: InstanceLayerNode
类substance_painter.layerstack.InstanceLayerNode(uid) substance_painter.layerstack.InstanceLayerNode
允许操作实例层的节点。
若要从源图层检索InstanceLayerNode的列表,请参阅LayerNode.instances()
instance_source() -> LayerNode substance_painter.layerstack.InstanceLayerNode.instance_source
返回此实例的源图层。
返回:如果存在此实例,则为源图层。
返回类型: LayerNode
recommendation-more-help
substance-3d-dev-help-painter-python-guide