實例層
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.instantiate(position: InsertPosition, layer: LayerNode) -> InstanceLayerNode substance_painter.layerstack.instantiate
實例化給定的層。 如果你不熟悉這個概念,請參閱關於層實例化的文件: Layer Instancing documentation。
參數:
- 位置 (InsertPosition)– 插入位置。
- 層 (LayerNode)– 要實例化的層。
加薪:
ValueError – 若插入因位置無效而失敗。 參見 InsertPosition。
回傳: 插入的節點。
回傳類型:InstanceLayerNode
class substance_painter.layerstack.InstanceLayerNode(uid) substance_painter.layerstack.InstanceLayerNode
一個允許操作實例層的節點。
若要從來源層檢索 的 InstanceLayerNode 清單,請參見 LayerNode.instances()
instance_source() -> 層節點 substance_painter.layerstack.InstanceLayerNode.instance_source
回傳這個實例的來源層。
回傳: 本實例的來源層。
回傳類型:LayerNode
recommendation-more-help
substance-3d-dev-help-painter-python-guide