颜色选择效果
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) — 插入位置必须位于蒙版堆叠中具有NodeStack.Mask的LayerNode之内或高于/低于EffectNode。
引发:
ValueError — 如果由于位置无效而导致插入失败。 请参阅InsertPosition。
返回:插入的节点。
返回类型: ColorSelectionEffectNode
类substance_painter.layerstack.ColorSelectionEffectNode(uid) substance_painter.layerstack.ColorSelectionEffectNode
基数: Node
允许操作颜色选择效果的节点。
get_parameters() -> ColorSelectionEffectParams substance_painter.layerstack.ColorSelectionEffectNode.get_parameters
获取此颜色选择效果的当前参数。
返回:此颜色选择效果的当前参数。
返回类型: ColorSelectionEffectParams
set_parameters(params: ColorSelectionEffectParams) -> None substance_painter.layerstack.ColorSelectionEffectNode.set_parameters
设置此比较蒙版效果的新参数。
参数: 参数 (ColorSelectionEffectParams) — 新参数。
引发:
ResourceNotFoundError — 找不到资源params.id_mask或该资源不是Type.IMAGE。
返回类型:无
参数
类substance_painter.layerstack.ColorSelectionEffectParams(id_mask: ResourceID | None,output_value:浮点,硬度:浮点,容差:浮点,background_color: ColorSelectionBackgroundColor,color: List[Color]) substance_painter.layerstack.ColorSelectionEffectParams
颜色选择效果参数。
参数:
- id_mask (ResourceID | 无) — 要使用的颜色映射。 通常是ID蒙版已烘焙贴图。 必须具有
Usage.TEXTURE并且是项目的一部分。 - output_value (float) — 选择匹配时的输出值。 介于0.0和1.0之间。
- 硬度 (浮动) — 所选内容的硬度。 介于0.0和1.0之间。
- 容差 (浮动) — 选区的容差。 介于0.0和1.0之间。
- background_color (ColorSelectionBackgroundColor) — 选择不匹配时的输出值。
- 颜色 (列表*[颜色]*) - id_mask中要匹配的颜色列表。
类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