Stackクラス
class substance_painter.textureset.スタック(スタックid: int |なし=なし) substance_painter.textureset.Stack
ペイント可能スタック。
スタックには、マテリアルに対応する複数のチャンネル(BaseColor、Specular、ラフネスなど)を含めることができます。 スタックは、1つ以上のスタックを含むテクスチャセットに属しています。
通常、使用されるスタックは1つだけで、そのスタックはユーザーに対して透過的です。 テクスチャセットを選択すると、そのスタックが選択されます。 ただし、テクスチャセットはカスタムシェーダでレイヤ化されたマテリアルを使用できます。この場合、特定のスタックを選択する必要があります。
テクスチャセットでマテリアルレイヤーが使用されていない場合は、次の手順でスタックを取得できます。
import substance_painter.textureset
# Get the unnamed stack of "TextureSetName":
paintable_stack = substance_painter.textureset.Stack.from_name("TextureSetName")
# Alternatively, get the stack from a Texture Set instance:
my_texture_set = substance_painter.textureset.TextureSet.from_name("TextureSetName")
paintable_stack = my_texture_set.get_stack()
テクスチャセットがマテリアルレイヤーを使用している場合は、次のようにスタックを取得できます。
import substance_painter.textureset
# Get the stack called "Mask1" from the Texture Set "TextureSetName":
paintable_stack = substance_painter.textureset.Stack.from_name("TextureSetName",
"Mask1")
# Alternatively, get the stack from a Texture Set instance:
my_texture_set = substance_painter.textureset.TextureSet.from_name("TextureSetName")
paintable_stack = my_texture_set.get_stack("Mask1")
# Show the name of the stack:
print(paintable_stack.name())
スタックのチャンネルを問い合わせ、追加、削除、編集することができます。
import substance_painter.textureset
# Get the unnamed stack of "TextureSetName":
paintable_stack = substance_painter.textureset.Stack.from_name("TextureSetName")
# List all the channels of the "TextureSetName" Texture Set:
for k,v in paintable_stack.all_channels().items():
print("{0}: {1}".format(k, str(v.format())))
# Add a scattering channel to the "TextureSetName" Texture Set:
paintable_stack.add_channel(substance_painter.textureset.ChannelType.Scattering,
substance_painter.textureset.ChannelFormat.L8)
# Query details of the added scattering channel:
if paintable_stack.has_channel(substance_painter.textureset.ChannelType.Scattering):
channel = paintable_stack.get_channel(
substance_painter.textureset.ChannelType.Scattering)
print("The Texture Set now has a scattering channel with {0} bits per pixel."
.format(channel.bit_depth()))
# Change the scattering channel to 16 bits inside the "TextureSetName" Texture Set:
paintable_stack.edit_channel(
channel_type = substance_painter.textureset.ChannelType.Scattering,
channel_format = substance_painter.textureset.ChannelFormat.L16)
# Remove the scattering channel from "TextureSetName":
paintable_stack.remove_channel(substance_painter.textureset.ChannelType.Scattering)
TextureSet、テクスチャセットドキュメント。パラメーター: スタック_id (int)
static from_name(テクスチャセット名: str, スタック名: str = ") substance_painter.textureset.Stack.from_name
名前からスタックを取得します。
パラメーター:
- テクスチャ_set_name (str) - テクスチャセット名
- スタック_name (str) - スタック名 テクスチャセットでマテリアルレイヤーが使用されていない場合は、空のままにします。
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ServiceNotFoundError - Substance 3D Painterがまだ一部のサービスを開始していない場合。
- ValueError -
texture_set_nameが文字列でない場合。 - ValueError – 名前
texture_set_nameのテクスチャセットがない場合。 - ValueError – 名前
stack_nameのスタックがない場合。
パラメーター:
- テクスチャ_set_name (str)
- スタック_name (str)
TextureSet.all_stacks()、TextureSet.get_stack()も参照してください。name() -> str substance_painter.textureset.Stack.name
スタック名を取得します。 属するスタックがマテリアルレイヤーを使用する場合、テクスチャセット名は空になります。
返される値: スタック名。
戻り値の型: str
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ServiceNotFoundError - Substance 3D Painterがまだ一部のサービスを開始していない場合。
- ValueError - スタックが無効な場合。
マテリアル() substance_painter.textureset.Stack.material
このスタックが属するテクスチャセットを取得します。
返される値:このスタックが属するテクスチャセット。
戻り値の型: TextureSet
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ServiceNotFoundError - Substance 3D Painterがまだ一部のサービスを開始していない場合。
- ValueError - スタックが無効な場合。
TextureSet、all_texture_sets()も参照してください。all_channels() -> Dict[ChannelType, Channel] substance_painter.textureset.Stack.all_channels
スタックのすべてのチャンネルを一覧表示します。
戻り値: スタックのすべてのチャンネルのマップ。
戻り値の型: dict[ChannelType, Channel]
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ServiceNotFoundError - Substance 3D Painterがまだ一部のサービスを開始していない場合。
Stack.add_channel()、Stack.remove_channel()も参照してください。add_channel(channel_type: ChannelType, channel_format: ChannelFormat, label: str | None = None) ->チャンネル substance_painter.textureset.Stack.add_channel
スタックに新しいチャンネルを追加します。
パラメーター:
- channel_type (ChannelType) – チャネルの種類。
- channel_format (ChannelFormat) – 新しいチャンネルのテクスチャ形式。
- label (str*,* optional) – 型としてユーザーチャネルの場合のチャネルのラベル。
戻り値:作成されたチャネル。
戻り値の型: チャネル
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ValueError – 型
channel_typeのチャンネルがこのテクスチャセットに既に存在する場合。 - ValueError – ラベルが指定されたが、
channel_typeがユーザーの種類ではない場合。 標準チャネルタイプには固定ラベルがあります。 - ValueError - スタックが無効な場合。
- ValueError - テクスチャセットがマテリアルレイヤーを使用しているかどうか。
remove_channel(channel_type: ChannelType) -> None substance_painter.textureset.Stack.remove_channel
スタックからチャンネルを削除します。
パラメーター: channel_type (ChannelType) – チャネルの種類。
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ValueError – このテクスチャセットに型
channel_typeのチャンネルがない場合。 - ValueError - スタックが無効な場合。
- ValueError - テクスチャセットがマテリアルレイヤーを使用しているかどうか。
戻り値の型:なし
edit_channel(channel_type: ChannelType, channel_format: ChannelFormat, label: str | None = None) -> None substance_painter.textureset.Stack.edit_channel
チャンネルのテクスチャ形式とラベルを変更します。
パラメーター:
- channel_type (ChannelType) – チャネルの種類。
- channel_format (ChannelFormat) – チャンネルの新しいテクスチャフォーマットです。
- label (str*,* optional) – 型としてユーザーチャネルの場合のチャネルのラベル。
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ValueError – このテクスチャセットに
stack_idというラベルのスタックがない場合。 - ValueError – このテクスチャセットに型
channel_typeのチャンネルがない場合。 - ValueError – ラベルが指定されたが、
channel_typeがユーザーの種類ではない場合。 標準チャネルタイプには固定ラベルがあります。 - ValueError - スタックが無効な場合。
戻り値の型:なし
Stack.add_channel()、Stack.remove_channel()も参照してください。has_channel(channel_type: ChannelType) -> bool substance_painter.textureset.Stack.has_channel
スタックにチャンネルが存在するかどうかを確認します。
パラメーター: channel_type (ChannelType) – チャネルの種類。
指定された型のチャンネルをスタックが持つ場合は Trueを返し、それ以外の場合はFalseを返します。
戻り値の型: bool
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ValueError - スタックが無効な場合。
Stack.add_channel()、Stack.remove_channel()も参照してください。get_channel(channel_type: ChannelType) -> Channel substance_painter.textureset.Stack.get_channel
既存のチャンネルをタイプから取得します。
パラメーター: チャネル_type (チャネル) – チャネルの種類。
チャネルを返す:。
戻り値の型: チャネル
Rails:
- プロジェクトエラー – プロジェクトが開かれていない場合。
- ServiceNotFoundError - Substance 3D Painterがまだ一部のサービスを開始していない場合。
- ValueError – チャネルが存在しない場合。