智能材质
智能材质是图层的预设。 它们可用于跨适应3D模型的项目保存和重新使用复杂的图层设置。
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 a Smart Material
smart_material = sp.resource.search("s:starterassets "
"u:smartmaterial "
"n:Aluminium ")[0]
my_smart_material = sp.layerstack.insert_smart_material(
position_stack_top, smart_material.identifier())
# Print the name of the parent layer node
print(my_smart_material.get_name())
# Select the layers contained by the parent layer
sp.layerstack.set_selected_nodes(my_smart_material.sub_layers())
函数和类
substance_painter.layerstack.insert_smart_node(position: InsertPosition, smart_材料: ResourceID) -> GroupLayerNode材料 substance_painter.layerstack.insert_smart_material
在给定位置插入智能材质。
参数:
- 位置 (InsertPosition) — 插入位置必须位于带有
NodeStack.Substack的GroupLayerNode内或高于/低于LayerNode。 - smart_材料 (资源ID) — 要实例化的智能材质。 资源必须具有
Usage.SMART_MATERIAL用法。
引发:
- ValueError — 如果由于位置无效而导致插入失败。 请参阅
InsertPosition。 - ValueError — 如果smart_材料不是有效资源或没有
Usage.SMART_MATERIAL用法。
返回:插入的节点。
返回类型: GroupLayerNode
substance_painter.layerstack.create_smart_node(组:GroupLayerNode,名称:str) ->资源材料 substance_painter.layerstack.create_smart_material
从给定的group创建名为name的智能材质。
参数:
- 组 (GroupLayerNode) -智能材质的根文件夹。
- 名称 (str) -智能材质的名称。
返回:已创建的智能材质作为资源。
返回类型: 资源
substance_painter.layerstack.export_as_smart_node(组:GroupLayerNode,名称:str,材料:str) substance_painter.layerstack.export_as_smart_material
将给定group导出为给定path中名为name的智能材质。 与substance_painter.layerstack.create_smart_material()不同,智能材质不是存储在工具架中,而是写入文件系统上。
参数:
- 组 (GroupLayerNode) -智能材质的根文件夹。
- 名称 (str) -智能材质的名称。 此名称也用作文件名。 如果文件已存在,则将覆盖该文件。
- path (str) — 导出智能材质的路径。 如果路径不存在,则会创建路径。
recommendation-more-help
substance-3d-dev-help-painter-python-guide