SourceVectorial

SourceVectorial is a type of source where you can connect a vectorial resource.

For more information, see module resource.

Example

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

A class that represents a vectorial source.

property resource_id: ResourceID substance_painter.source.SourceVectorial.resource_id

The current vectorial resource of the source.

Getter: Returns the resource identifier of the vectorial used by the source.

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

Get the source parameters.

Returns: The source parameters.

Return type: SourceVectorialParams

set_parameters(params: SourceVectorialParams) -> None substance_painter.source.SourceVectorial.set_parameters

Set the source parameters.

Parameters: params (SourceVectorialParams) – The source parameters.

Raises:

ValueError – If the parameters requirements are not met,
see SourceVectorialParams.

Return type: None

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

Get the object internal uid.

Returns: The internal identifier of the object as an integer.

Return type: int

Params

class substance_painter.source.SourceVectorialParams(artboard_id: str | None, scope: str | None, resolution: ResolutionOverride, crop_area_mode: CropAreaMode, crop_area_value: Tuple[float, float, float, float], fit_to_square: bool = True) substance_painter.source.SourceVectorialParams

The source vectorial parameters.

Parameters:

  • artboard_id (str | None) – The artboard id, for .ai file.
  • scope (str | None) – The root element of the hierarchy you want to import.
  • resolution (ResolutionOverride) – Resolution parameters of the resource.
  • resolution_mode (ResolutionMode) – Deprecated since 0.3.4. Use mode attribute from resolution
    parameter instead.
  • resolution_value (Tuple*[int,* int*]*) – Deprecated since 0.3.4. Use value attribute from resolution
    parameter instead.
  • crop_area_mode (CropAreaMode) – The crop area mode.
  • crop_area_value (Tuple*[float,* float*,* float*,* float*]*) – The crop area to use when crop_area_mode is CropAreaMode.Manual,
    formatted as [left corner x, left corner y, crop area width, crop area height].
    width and height values must be positive.
  • fit_to_square (bool) – Force the crop area to be square.

Enums

substance_painter.source.VectorialResolutionMode substance_painter.source.VectorialResolutionMode

Alias for ResolutionMode.

WARNING
Deprecated since 0.3.4, use ResolutionMode instead.
NOTE
The name used to define members is available as a string via the .name attribute (see python enum.Enum).

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

Members:

Name
Description
DocumentBounds
The crop area is automatically calculated based on the vector document. This corresponds to the Asset bounds option available in Painter’s UI.
Manual
The crop area is explicitly defined by the user. This corresponds to the Custom area option available in Painter’s UI.
NOTE
The name used to define members is available as a string via the .name attribute (see python enum.Enum).
recommendation-more-help
substance-3d-dev-help-painter-python-guide