海峽級

類別 substance_painter.textureset.Channel(channel_id: int |None = None) {#substance_painter.textureset.Channel}

一個Substance 3D Painter通道。

通道可以是預先定義的類型之一(如基底色、鏡面、粗糙度等)。 或是使用者定義的類型(User0 到 User31),對應於教材。 該通道屬於一個堆疊。 堆疊可以有一個或多個,但每個 只能有一個通道。ChannelType

範例

import substance_painter.textureset


# Get the unnamed stack of "TextureSetName":
paintable_stack = substance_painter.textureset.Stack.from_name("TextureSetName")


# Get the channel "BaseColor" of that stack:
base_color_channel = paintable_stack.get_channel(
        substance_painter.textureset.ChannelType.BaseColor)


# Print the color format and bit depth of the base color channel:
print("The channel format uses {0} {1}.".format(
        "RGB" if base_color_channel.is_color() else "L",
        base_color_channel.bit_depth()))


# Change the format and bit depth of the base color channel:
base_color_channel.edit(
        channel_format = substance_painter.textureset.ChannelFormat.RGB16)

參數:​channel_id (int)

format() -> ChannelFormat {#substance_painter.textureset.Channel.format}

取得頻道格式。 格式同時顯示通道是彩色還是灰階、動態範圍、每個元件的位元數,以及儲存是線性還是 sRGB。

回播: 此頻道格式。

回傳類型:​ChannelFormat

label() -> str {#substance_painter.textureset.Channel.label}

取得使用者頻道的使用者標籤(從 User0 到 User31)。

退貨: 此頻道用戶標籤。 這是非使用者頻道的空字串。

回傳類型: 力量

​>[!TIP]
​>
​> 另見:​Channel.type(), ChannelType。

is_color() -> bool {#substance_painter.textureset.Channel.is_color}

檢查頻道是彩色還是灰階格式。

返回:True如果通道格式是彩色格式。

回傳類型: bool

is_floating() -> bool {#substance_painter.textureset.Channel.is_floating}

檢查通道是浮點還是正規化固定點格式。

返回:True若通道格式為浮點數格式。

回傳類型: bool

bit_depth() -> int {#substance_painter.textureset.Channel.bit_depth}

取得每個元件的位元數。

回報: 每個元件的通道位元深度。

回傳類型: int

type() -> 通道類型 {#substance_painter.textureset.Channel.type}

取得頻道類型。

退貨: 此頻道類型。

回傳類型:​ChannelType

​>[!TIP]
​>
​> 另見:​Channel.label()。

編輯(channel_format:ChannelFormat,標籤:str |None = None) -> None {#substance_painter.textureset.Channel.edit}

更換頻道格式和標籤。

參數:

  • channel_format​(ChannelFormat)– 頻道的新材質格式。
  • label*(str​ , ​可選*)— 若使用者通道為類型時,通道的標籤。

加薪:

  • ProjectError – 如果沒有專案被開啟。
  • ValueError – 如果此材質集中沒有標記 stack_id 的堆疊。
  • ValueError – 如果此紋理集中沒有 的通道 channel_type 。
  • ValueError – 如果標籤已提供但 channel_type 非使用者類型。 標準頻道類型有固定標籤。
  • ValueError – 如果通道無效。

返回類型: 無

recommendation-more-help
substance-3d-dev-help-painter-python-guide