SourceVectorial

SourceVectorial 是一種可以連接向量資源的來源。

欲了解更多資訊,請參閱模組 resource。

TIP
另見:​向量圖形記錄。

範例

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)

# Setup triplanar projection
fill.set_projection_mode(sp.layerstack.ProjectionMode.Triplanar)
params = fill.get_projection_parameters()
params.projection_3d.scale = [0.5, 0.5, 0.5]
fill.set_projection_parameters(params)

# Pick a vectorial resource
svg = sp.resource.search("u:vectorial")[0]
source = fill.set_source(sp.textureset.ChannelType.BaseColor, svg.identifier())

# Customize vectorial parameters
params = source.get_parameters()
params.resolution.mode = sp.source.ResolutionMode.Manual
params.resolution.value = [2048, 2048]
source.set_parameters(params)

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

class substance_painter.source.SourceVectorial(uid) substance_painter.source.SourceVectorial

一個代表向量源的類別。

屬性resource_id:ResourceID substance_painter.source.SourceVectorial.resource_id

來源的當前向量資源。

Getter: 回傳來源所用向量的資源識別碼。

get_parameters() -> SourceVectorialParams substance_painter.source.SourceVectorial.get_parameters

取得來源參數。

回報: 來源參數。

回傳類型:​SourceVectorialParams

set_parameters(參數:SourceVectorialParams) -> 無 substance_painter.source.SourceVectorial.set_parameters

設定來源參數。

參數:​params(SourceVectorialParams)– 來源參數。

加薪:

ValueError – 若參數要求未達標,請參見 SourceVectorialParams。

返回類型: 無

uid() -> int substance_painter.source.SourceVectorial.uid

取得物件內部的 UID。

回傳: 物件的內部識別碼為整數。

回傳類型: int

參數

類別 substance_painter.source.SourceVectorialParams(artboard_id: str |無,作用域:str |無,解析:ResolutionOverride,crop_area_mode:CropAreaMode,crop_area_value:元組[浮點,float,float,float,float,fit_to_square]: bool = True) substance_painter.source.SourceVectorialParams

來源向量參數。

參數:

  • 美術板_id (str | 無)– .ai 檔案的美術板 ID。
  • scope (str | none)– 你想匯入階層的根元素。
  • 解析度 (ResolutionOverride)— 資源的解析度參數。
  • resolution_mode​(ResolutionMode)– 自 0.3.4 起已棄用。改用mode解析度​ 參數的 ​屬性。
  • resolution_value (Tuple ​ int [​, int​ ]) – 自 0.3.4 起已棄用。改用value解析度​ ​參數的**​屬性。
  • crop_area_mode (CropAreaMode) – 作物區域模式。
  • crop_area_value(Tuple ​ float[​,float ​,float,*** float***])– 裁切_area_mode時使用的裁切區域為 CropAreaMode。Manual,格式為[左角 x、左角 y、裁切區域寬度、裁切區域高度]。***寬度與高度值必須為正值。
  • fit_to_square (布爾)– 強制裁切區域為方形。

枚舉

substance_painter.source.向量解析度模式 substance_painter.source.VectorialResolutionMode

別名。ResolutionMode

WARNING
自 0.3.4 版本起已棄用,請改用 ResolutionMode 。
NOTE
用來定義成員的名稱可透過 .name 屬性以字串形式取得(參見 python enum。Enum)。

class substance_painter.source.CropAreaMode(value) substance_painter.source.CropAreaMode

成員:

名稱
說明
DocumentBounds
作物面積會根據向量文件自動計算。 這對應於 Painter 介面中的資產邊界選項。
Manual
作物區域由使用者明確定義。 這對應於 Painter 介面中的自訂區域選項。
NOTE
用來定義成員的名稱可透過 .name 屬性以字串形式取得(參見 python enum。Enum)。
recommendation-more-help
substance-3d-dev-help-painter-python-guide