SourceSubstance

SourceSubstance은(는) substance 리소스를 연결할 수 있는 원본 유형입니다.

자세한 내용은 모듈 resource 및 colormanagement을(를) 참조하십시오.

예

import substance_painter as sp

# Get the currently displayed stack
stack = sp.textureset.get_active_stack()

# Insert a fill layer
position = sp.layerstack.InsertPosition.from_textureset_stack(stack)
fill = sp.layerstack.insert_fill(position)

# Apply "Graphic to Material" in `Material` mode
graphic_to_material = sp.resource.search("s:starterassets "
                                         "u:substance "
                                         'n:"graphictomaterial"')[0]
source = fill.set_material_source(graphic_to_material.identifier())

# Substances can have image inputs which are sources themselves
# In this case, we use the input identifier instead of the channel type to query and edit the source
logo = sp.resource.search("s:starterassets "
                          "u:alpha "
                          'n:"logo painter"')[0]

assert "custom_image" in source.image_inputs
input_source = source.set_source("custom_image", logo)

# `input_source` is now a BitmapSource
# see BitmapSource example for further information on its interface

# In `Material` mode, you can specify how the outputs of the substance are plugged in the fill's channels
default_mapping = {
    sp.textureset.ChannelType.BaseColor: "basecolor",
    sp.textureset.ChannelType.Metallic: "metallic",
    sp.textureset.ChannelType.Roughness: "roughness",
    sp.textureset.ChannelType.Height: "height"
}
for dst_chn, identifier in default_mapping.items():
    assert identifier in source.image_outputs
    source.output_mapping[dst_chn] = identifier

# If not in `Material` mode, choose which output of the substance is active
# source.active_output = "basecolor"

# Retrieve and edit the substance parameters
params = source.get_parameters()
for prop_name in params.keys():
    print(prop_name)

new_params = {
    "outline_color": sp.colormanagement.Color(0.9, 0.7, 0.4),
    "roughness": params["roughness"] / 2,
    # Boolean parameters are treated as integer, if you use `True` or `False` you will get an error message:
    # >>> Bad value for property 'channel_roughness': expected value of type <int32> but got <bool>
    "channel_roughness": 1,
}
source.set_parameters(new_params)

# Query embedded presets and apply the first one
presets = source.get_preset_list()
for preset_name in presets:
    print(preset_name)

if presets:
    source.apply_preset(presets[0])

# Select the Fill layer
sp.layerstack.set_selected_nodes([fill])

class substance_painter.source.SourceSubstance(uid) substance_painter.source.SourceSubstance

프로시저 소스를 나타내는 클래스.

property resource_id: ResourceID substance_painter.source.SourceSubstance.resource_id

소스의 현재 Substance 리소스입니다.

Getter: 원본의 리소스를 반환합니다.

property output_mapping: OutputMapping substance_painter.source.SourceSubstance.output_mapping

다중 출력 컨텍스트의 출력 매핑 속성입니다.

Getter: 출력 매핑 속성을 반환합니다.

Setter: 출력 매핑 속성을 설정합니다.

property active_output: str substance_painter.source.SourceSubstance.active_output

단일 출력 컨텍스트에서 소스의 활성 출력입니다.

Getter:​에서 출력 식별자를 반환합니다.

Setter: 출력 식별자를 설정합니다.

property mask_output: str substance_painter.source.SourceSubstance.mask_output

다중 출력 컨텍스트에서 소스의 마스크 출력 식별자

Getter:​에서 마스크 출력 식별자를 반환합니다.

Setter: 마스크 출력 식별자를 설정합니다.

property image_inputs: List[str] substance_painter.source.SourceSubstance.image_inputs

현재 그래프의 식별자 입력 이미지 목록입니다.

Getter: 식별자에서 이미지 입력 목록을 반환합니다.

property image_outputs: List[str] substance_painter.source.SourceSubstance.image_outputs

이미지 목록에서 현재 그래프의 식별자를 출력합니다.

Getter: 이미지 출력 목록을 식별자으로 반환합니다.

get_source(식별자: str) -> SourceUniformColor | 소스 비트맵 | SourceVectorial | SourceSubstance | SourceReference | SourceFont substance_painter.source.SourceSubstance.get_source

지정된 입력 식별자의 소스를 가져옵니다.

매개 변수: 식별자(str) - 입력 식별자.

반환: 입력에 대한 원본입니다.

반환 형식: SourceUniformColor | 소스 비트맵 | SourceVectorial | SourceSubstance | SourceReference | SourceFont

set_source(식별자: str, 소스: ResourceID | 색상 | AnchorPointEffectNode) -> SourceUniformColor | 소스 비트맵 | SourceVectorial | SourceSubstance | SourceReference | SourceFont substance_painter.source.SourceSubstance.set_source

지정된 입력 식별자의 소스를 설정합니다.

매개 변수:

반환: 입력의 원본입니다.

반환 형식: SourceUniformColor | 소스 비트맵 | SourceVectorial | SourceSubstance | SourceReference | SourceFont

reset_source(식별자: str) -> 없음 substance_painter.source.SourceSubstance.reset_source

지정된 입력 식별자의 소스를 다시 설정합니다.

매개 변수: 식별자(str) - 입력 식별자.

반환 형식: 없음

remove_source(식별자: str) -> 없음 substance_painter.source.SourceSubstance.remove_source

지정된 입력 식별자의 소스를 제거합니다.

매개 변수: 식별자(str) - 입력 식별자.

반환 형식: 없음

get_parameters() -> Dict[str, bool | int | Tuple[int, int] | Tuple[int, int, int] | Tuple[int, int, int, int] | float | Tuple[float, float] | Tuple[float, float, float] | 색상 | Tuple[색상, 부동 소수점] | Tuple[float, float, float, float] | str] substance_painter.source.SourceSubstance.get_parameters

소스 프로시저 매개 변수를 가져옵니다. 소스의 각 속성에 대해 결과 사전에는 속성 이름을 키로 하고 속성 값을 값으로 하는 항목이 포함됩니다.

반환: 원본 프로시저 매개 변수입니다.

반환 형식: Dict[str, bool | int | 튜플[ int, int] | 튜플[ int, int, int] | 튜플[ int, int, int, int] | float | 튜플[​부동, 부동] | 튜플[​부동, 부동, 부동] | 색상 | 튜플[색상, 부동] | 튜플[​부동, 부동, 부동, 부동] | str]

set_parameters(property_values: Dict[str, bool | int | Tuple[int, int] | Tuple[int, int, int] | Tuple[int, int, int, int] | float | Tuple[float, float] | Tuple[float, float, float] | 색상 | Tuple[색상, 부동 소수점] | Tuple[float, float, float, float] | str]) -> 없음 substance_painter.source.SourceSubstance.set_parameters

소스 프로시저 매개 변수를 설정합니다.

매개 변수: 속성_값 (Dict​ [ ​str​**, bool | int | 튜플​**​[int, int​**] | 튜플​**​[int, int , int] | 튜플​ [ ​int​**, int ​**, int​**, int*]* | 부동 | 튜플​ [ ​부동​**, 부동*]* | 튜플​ [ ​부동​**, float*,* float​**] | 색상 | 튜플*​[색상​,* float​**] | 튜플*​[​ float,* float​**, float*,* float **​ | str]) - 해당 값으로 설정할 속성의 dict입니다.]*

반환 형식: 없음

WARNING
부울 매개 변수는 정수로 처리됩니다. True 또는 False를 사용하면 다음과 같은 오류 메시지가 표시됩니다.
>>> Bad value for property ‘<property\_name>’: expected value of type <int32> but got <bool>

get_properties() -> Dict[str, 속성] substance_painter.source.SourceSubstance.get_properties

소스 프로시저 속성을 가져옵니다.

반환: 원본 프로시저 속성입니다.

반환 형식: Dict[str, 속성]

get_preset_list() -> 목록[str] substance_painter.source.SourceSubstance.get_preset_list

이 소스에 대해 사용 가능한 모든 사전 설정 목록을 가져옵니다.

반환: 사용 가능한 모든 사전 설정 이름의 배열입니다.

반환 형식: 목록[​문자열]

apply_preset(name: str) substance_painter.source.SourceSubstance.apply_preset

사전 설정의 이름을 적용합니다. 이 이름의 사전 설정이 없으면 아무 작업도 수행되지 않습니다.

매개 변수: 이름 (str) - 적용할 사전 설정의 이름입니다.

속성 확인: ResolutionOverride substance_painter.source.SourceSubstance.resolution

이 물질의 해상도 매개변수입니다.

Getter:​에서 해상도 매개 변수를 반환합니다.

Setter: 해상도 매개 변수를 설정합니다.

상승:

ValueError - 소스가 substance_painter.layerstack.FilterEffectNode에서 사용되는 경우

class substance_painter.source.OutputMapping(uid) substance_painter.source.OutputMapping

이 클래스는 소스 출력 매핑에 dict 방식으로 프로시저로 액세스할 수 있도록 합니다. output_mapping 속성을 참조하십시오.

예:

import substance_painter as sp
mapping = a_substance_source.output_mapping
mapping[sp.textureset.ChannelType.BaseColor] = sp.textureset.ChannelType.Specular
for channel in mapping:
    print(mapping[channel])
TIP
참고 항목: 자세한 기술 정보는 공식 KeysView ABCs 컨테이너 설명서 및 __getitem__ 및 __setitem__ 메서드를 참조하십시오.
recommendation-more-help
substance-3d-dev-help-painter-python-guide