色彩選擇效應
ColorSelectionEffectNode 這是一種效果,允許從點陣圖(通常是基於網格的 ID 映射)中提取一種或多種顏色,以建立黑白遮罩。 它只能在遮罩效果堆疊中使用。
範例
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")
# Add a mask and a Color Selection effect in the mask stack
my_fill_layer.add_mask(sp.layerstack.MaskBackground.Black)
inside_mask = sp.layerstack.InsertPosition.inside_node(
my_fill_layer, sp.layerstack.NodeStack.Mask)
my_color_selection_effect = sp.layerstack.insert_color_selection_effect(inside_mask)
# Update the Color Selection effect parameters
parameters = my_color_selection_effect.get_parameters()
# Add red, green and blue colors
parameters.colors = [
sp.colormanagement.Color(1.0, 0.0, 0.0),
sp.colormanagement.Color(0.0, 1.0, 0.0),
sp.colormanagement.Color(0.0, 0.0, 1.0)]
my_color_selection_effect.set_parameters(parameters)
# Select the Color Selection effect
sp.layerstack.set_selected_nodes([my_color_selection_effect])
函數與類別
substance_painter.layerstack.insert_color_selection_effect(position: InsertPosition) -> ColorSelectionEffectNode substance_painter.layerstack.insert_color_selection_effect
插入色彩選擇效果。
參數:
位置(InsertPosition 🔗)– 插入位置必須在遮罩堆疊中,或LayerNode位於 和 NodeStack.Mask EffectNode 的上方/下方。
加薪:
ValueError – 若插入因位置無效而失敗。 參見 InsertPosition。
回傳: 插入的節點。
返回類型:ColorSelectionEffectNode
class substance_painter.layerstack.ColorSelectionEffectNode(uid) substance_painter.layerstack.ColorSelectionEffectNode
基地: Node
一個允許操作色彩選擇效果的節點。
get_parameters() -> ColorSelectionEffectParams substance_painter.layerstack.ColorSelectionEffectNode.get_parameters
取得這個色彩選擇效果的最新參數。
返回: 此色彩選擇效果的當前參數。
回傳類型:ColorSelectionEffectParams
set_parameters(參數:ColorSelectionEffectParams) -> 無 substance_painter.layerstack.ColorSelectionEffectNode.set_parameters
設定新的參數,比較遮罩效果。
參數:參數(ColorSelectionEffectParams)– 新的參數。
加薪:
ResourceNotFoundError – 如果找不到資源 params.id_mask 或不屬於 Type.IMAGE。
返回類型: 無
參數
class substance_painter.layerstack.ColorSelectionEffectParams(id_mask: ResourceID |無,output_value:float,硬度:float,公差:float,background_color:ColorSelectionBackgroundColor,顏色:List[Color]) substance_painter.layerstack.ColorSelectionEffectParams
一個色彩選擇效果參數。
參數:
- id_mask (ResourceID | 無)– 使用哪種顏色地圖。 通常是 ID Mask 烘焙的貼圖。 必須擁有
Usage.TEXTURE並參與這個專案。 - output_value*(float*)– 選擇匹配時的輸出值。介於0.0到1.0之間。
- 硬度 (float)-選擇的硬度。 介於0.0到1.0之間。
- 公差 (浮動數)– 選擇的公差。 介於0.0到1.0之間。
- background_color (ColorSelectionBackgroundColor) – 當選取不符時的輸出值。
- **顏色(List[*Color *])– 在 id_mask 中匹配的顏色清單。
class substance_painter.layerstack.ColorSelectionBackgroundColor(value) substance_painter.layerstack.ColorSelectionBackgroundColor
成員:
名稱
說明
Transparent濾鏡背景是透明的。
Black濾鏡背景是黑色。
White濾鏡背景是白色。
Gray濾鏡背景是灰色的。
NOTE
用來定義成員的名稱可透過 .name 屬性以字串形式取得(參見 python enum。Enum)。
recommendation-more-help
substance-3d-dev-help-painter-python-guide