レイヤースタックの選択
layerstackモジュールを使用すると、レイヤーおよび効果を選択できます。
例
特定のチャネルのアクティブ化
# This example shows how to activate specific channels on selected nodes in the layerstack.
# Before running this example, open a project and select some layers/effects from the UI
import substance_painter as sp
# Get the active stack
stack = sp.textureset.get_active_stack()
# Get the selected nodes in the layerstack
selected_nodes = sp.layerstack.get_selected_nodes(stack)
updated_nodes = []
# Iterate over the selected nodes
for node in selected_nodes:
if type(node) is sp.layerstack.FillLayerNode or type(node) is sp.layerstack.FillEffectNode:
# Set the active channels of the Fill to BaseColor
node.active_channels = {sp.layerstack.ChannelType.BaseColor}
updated_nodes.append(node)
# Select the edited nodes
sp.layerstack.set_selected_nodes(updated_nodes)
選択範囲を取得
substance_painter.layerstack.get_selected_nodes(スタック:スタック) -> List[LayerNode | GroupLayerNode | PaintLayerNode | InstanceLayerNode | FillLayerNode | GeneratorEffectNode | PaintEffectNode | FillEffectNode | LevelsEffectNode | CompareMaskEffectNode | FilterEffectNode | ColorSelectionEffectNode | AnchorPointEffectNode] substance_painter.layerstack.get_selected_nodes
スタックの選択したノードを、レイヤースタック内と同じ順序で取得します。
パラメーター: スタック (スタック) – クエリのスタック。
戻り値: スタックの選択されたノード。
戻り値の型: List[LayerNode | GroupLayerNode | PaintLayerNode | InstanceLayerNode | FillLayerNode | GeneratorEffectNode | PaintEffectNode | FillEffectNode | LevelsEffectNode | CompareMaskEffectNode | FilterEffectNode | ColorSelectionEffectNode | AnchorPointEffectNode]
substance_painter.layerstack.get_selection_type(layer: LayerNode) -> SelectionType substance_painter.layerstack.get_selection_type
選択されているレイヤーの部分(コンテンツ、マスクなど)を返します。
パラメーター: レイヤー (LayerNode) – クエリするレイヤー。
Rails: ValueError – レイヤーが現在選択されているテクスチャセットに属していない場合。
戻り値:選択されたレイヤーの一部です。
戻り値の型: SelectionType
選択範囲を設定
substance_painter.layerstack.set_selected_nodes(nodes: List[GeneratorEffectNode | PaintEffectNode | FillEffectNode | LevelsEffectNode | CompareMaskEffectNode | FilterEffectNode | ColorSelectionEffectNode | AnchorPointEffectNode] |リスト[LayerNode]) substance_painter.layerstack.set_selected_nodes
レイヤースタック UIで指定のノードを選択します。
Pararmノード:選択するノード。
Rails:
- ValueError – ノードが現在選択されているテクスチャセットに属していない場合。
- RuntimeError -
ScopedModificationセクションから呼び出された場合
パラメーター: ノード (リスト**[GeneratorEffectNode | PaintEffectNode | FillEffectNode | レベル効果ノード | 比較マスク効果ノード | FilterEffectNode | ColorSelectionEffectNode | *AnchorPointEffectNode *] | リスト*[*LayerNode *]*
substance_painter.layerstack.set_selection_type(layer: LayerNode, layer_selection_type: SelectionType) substance_painter.layerstack.set_selection_type
レイヤーのどの部分を選択するかを選択します。
パラメーター:
- レイヤー (レイヤーノード) – 選択するレイヤー。
- layer_selection_type (SelectionType) – 選択するレイヤーの一部(コンテンツ、マスクなど)。
Rails:
- 値エラー – レイヤーが現在選択されているテクスチャセットに属していない場合。
- RuntimeError -
ScopedModificationセクションから呼び出された場合
列挙
class substance_painter.layerstack.SelectionType(value) substance_painter.layerstack.SelectionType
メンバー:
ContentMaskGeometryMaskProperties