색상 선택 효과

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

색상 선택 효과를 삽입합니다.

매개 변수:

position (InsertPosition) - 삽입 위치는 마스크 스택에서 NodeStack.Mask이(가) 있는 LayerNode 내부 또는 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(params: ColorSelectionEffectParams) -> None substance_painter.layerstack.ColorSelectionEffectNode.set_parameters

이 마스크 비교 효과의 새 매개 변수를 설정합니다.

매개 변수: 매개 변수(ColorSelectionEffectParams) - 새 매개 변수입니다.

상승:

ResourceNotFoundError - params.id_mask 리소스를 찾을 수 없거나 Type.IMAGE이(가) 아닌 경우

반환 형식: 없음

파람스

class substance_painter.layerstack.ColorSelectionEffectParams(id_mask: ResourceID | 없음, 출력_값: 부동, 경도: 부동, 공차: 부동, background_color: ColorSelectionBackgroundColor, 색상: 목록[색상]) substance_painter.layerstack.ColorSelectionEffectParams

색상 선택 효과 매개 변수

매개 변수:

  • id_mask (ResourceID | 없음) - 사용할 색상 맵입니다. 일반적으로 ID 마스크 베이킹된 맵. Usage.TEXTURE이(가) 있어야 하며 프로젝트의 일부여야 합니다.
  • 출력_값 (부동) - 선택 항목이 일치할 때의 출력 값입니다. 0.0에서 1.0 사이입니다.
  • 경도 (부동) - 선택 영역의 경도입니다. 0.0에서 1.0 사이입니다.
  • 허용치(부동) - 선택 영역의 허용치입니다. 0.0에서 1.0 사이입니다.
  • background_color (ColorSelectionBackgroundColor) - 선택 영역이 일치하지 않는 경우 출력 값입니다.
  • 색상 (목록*[색상​]*) - 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