频道类
类substance_painter.textureset.Channel(channel_id: int |无=无) {#substance_painter.textureset.Channel}
Substance 3D Painter频道。
通道可以是预定义类型之一(基色、Specular、粗糙度等) 或用户定义类型(从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}
获取用户通道的用户标签(用户0到用户31)。
返回:此渠道用户标签。 这是非用户通道的空字符串。
返回类型: str
>[!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_深度() -> int {#substance_painter.textureset.Channel.bit_depth}
获取每个组件的位数。
返回:每个组件的通道位深度。
返回类型:整型
type() -> ChannelType {#substance_painter.textureset.Channel.type}
获取频道类型。
返回:此通道类型。
返回类型: ChannelType
>[!TIP]
>
> 另请参阅:Channel.label()。编辑(channel_format: ChannelFormat,标签: str |无=无) ->无 {#substance_painter.textureset.Channel.edit}
更改频道格式和标签。
参数:
- channel_format (ChannelFormat) — 通道的新纹理格式。
- 标签 (str*,* 可选) — 频道标签,如果用户频道为类型。
引发:
- ProjectError — 如果未打开项目。
- ValueError — 如果此纹理集中没有标记为
stack_id的堆叠。- ValueError — 如果此纹理集中没有类型为
channel_type的通道。- ValueError — 如果提供了标签,但
channel_type不是用户类型。 标准渠道类型具有固定标签。- ValueError — 如果通道无效。
返回类型:无
recommendation-more-help
substance-3d-dev-help-painter-python-guide