智慧材料
智慧材質是圖層的預設。 它們可用於儲存並重複使用跨專案的複雜圖層設置,並能適應 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_material(position: InsertPosition, smart_material: ResourceID) -> GroupLayerNode substance_painter.layerstack.insert_smart_material
在指定位置插入智慧材料。
參數:
- 位置(InsertPosition 🔗)-插入位置必須在 內
GroupLayerNodeNodeStack.Substack,或位於LayerNode。 - smart_material (ResourceID) – 用於實例化的智慧素材。 資源必須有
Usage.SMART_MATERIAL其用途。
加薪:
- ValueError – 若插入因位置無效而失敗。 參見
InsertPosition。 - ValueError – 如果 smart_material 不是有效資源或沒有
Usage.SMART_MATERIAL使用。
回傳: 插入的節點。
回傳類型:GroupLayerNode
substance_painter.layerstack.create_smart_material(group: GroupLayerNode, name: str) -> Resource substance_painter.layerstack.create_smart_material
建立一個包含 name 名稱的 group智慧素材。
參數:
- 群組 (GroupLayerNode)— 智慧素材的根目錄。
- 名稱 (STR)– 智慧材料的名稱。
回報: 將智慧素材作為資源所創造。
回傳類型:資源
substance_painter.layerstack.export_as_smart_material(群組:GroupLayerNode,名稱:str,路徑:str) substance_painter.layerstack.export_as_smart_material
將 given group 匯出為 smart material,名稱 name 為 path。 與 substance_painter.layerstack.create_smart_material()不同,智慧資料不會儲存在書架上,而是僅寫入檔案系統。
參數:
- 群組 (GroupLayerNode)— 智慧素材的根目錄。
- 名稱 (STR)– 智慧材料的名稱。 這個名稱同時也被用作檔案名稱。 如果檔案已經存在,將會被覆寫。
- 路徑 (str)-將智慧材料匯出的路徑。 如果沒有路徑,它就會被創造出來。
recommendation-more-help
substance-3d-dev-help-painter-python-guide