User Guide Cancel

event | Substance 3D Painter Python API

event

event module

The event module defines application events and allows to subscribe to notifications.

class substance_painter.event.

Event

Event

Base event class.

Event dispatcher

substance_painter.event.

DISPATCHER

DISPATCHER =

The event dispatcher instance that will be used by the application.

class substance_painter.event.

Dispatcher

Dispatcher

The Event Dispatcher.

connect
connect(event_cls: Type[Event], callback: Callable[[Event], Any]) → None

Connect a callback to handle the given event type.

The callback is stored as a weak reference, it is automatically disconnected once the callback gets garbage collected.

Parameters
  • event_cls (Type[Event]) – An event class.
  • callback (Callable[[Event], Any]) – A method or a bound method that will be called when an instance of the given event is triggered.
connect_strong
connect_strong(event_cls: Type[Event], callback: Callable[[Event], Any]) → None

Connect a callback to handle the given event type.

The callback is stored as a strong reference, it is never automatically disconnected.

Parameters
  • event_cls (Type[Event]) – An event class.
  • callback (Callable[[Event], Any]) – A method or a bound method that will be called when an instance of the given event is triggered.
disconnect
disconnect(event_cls: Type[Event], callback: Callable[[Event], Any]) → None

Disconnect a previously connected callback.

This method can be called to explicitly disconnect a callback.

Parameters
  • event_cls (Type[Event]) – An event class.
  • callback (Callable[[Event], Any]) – A method or a bound method that has been connected to the given event class.

Export events

class substance_painter.event.

ExportTexturesAboutToStart

ExportTexturesAboutToStart(textures: Dict[Tuple[str, str], List[str]])

Event triggered just before a textures export.

textures
textures: Dict[Tuple[str, str], List[str]]

List of texture files to be written to disk, grouped by stack (Texture Set name, stack name).

Type

Dict[Tuple[str, str], List[str]]

class substance_painter.event.

ExportTexturesEnded

ExportTexturesEnded(status: ExportStatus, message: str, textures: Dict[Tuple[str, str], List[str]])

Event triggered after textures export is finished.

message
message: str

Human readable status message.

Type

str

status
status: ExportStatus

Status code.

Type

ExportStatus

textures
textures: Dict[Tuple[str, str], List[str]]

List of texture files written to disk, grouped by stack (Texture Set name, stack name).

Type

Dict[Tuple[str, str], List[str]]

Project events

Note

Project loading is done asynchronously. When the event ProjectOpened or ProjectCreated is triggered, the project may still be loading. The event ProjectEditionEntered is triggered when the project is ready to work with.

class substance_painter.event.

ProjectOpened

ProjectOpened

Event triggered when an existing project has been opened.

class substance_painter.event.

ProjectCreated

ProjectCreated

Event triggered when a new project has been created.

class substance_painter.event.

ProjectAboutToClose

ProjectAboutToClose

Event triggered just before closing the current project.

class substance_painter.event.

ProjectAboutToSave

ProjectAboutToSave(file_path: str)

Event triggered just before saving the current project.

file_path
file_path: str

The destination file.

Type

str

class substance_painter.event.

ProjectSaved

ProjectSaved

Event triggered once the current project is saved.

class substance_painter.event.

ProjectEditionEntered

ProjectEditionEntered

Event triggered when the project is fully loaded and ready to work with.

When edition is entered, it is for example possible to query/edit the project properties, to bake textures or do project export.

class substance_painter.event.

ProjectEditionLeft

ProjectEditionLeft

Event triggered when the current project can non longer be edited.

class substance_painter.event.

BusyStatusChanged

BusyStatusChanged(busy: bool)

Event triggered when Substance 3D Painter busy state changed.

See also

substance_painter.project.execute_when_not_busy(), substance_painter.project.is_busy().

busy
busy: bool

Whether Substance 3D Painter is busy now.

Type

bool

class substance_painter.event.

TextureStateEvent

TextureStateEvent(action: TextureStateEventAction, stack_id: int, tile_indices: Tuple[int, int], channel_type: ChannelType, cache_key: int)

Event triggered when a document texture is added, removed or updated.

action
action: TextureStateEventAction

Performed action (add, remove, update).

Type

TextureStateEventAction

cache_key
cache_key: int

The texture current cache key. Those cache keys are persistent across sessions.

Type

int

channel_type
channel_type: ChannelType

The document channel type.

Type

substance_painter.textureset.ChannelType

stack_id
stack_id: int

The stack the texture bellongs to, can be used to create a substance_painter.textureset.Stack instance.

Type

int

tile_indices
tile_indices: Tuple[int, int]

The uv tile indices.

Type

Tuple[int, int]

class substance_painter.event.

TextureStateEventAction

TextureStateEventAction(value)

The TextureStateEvent possible actions.

Members:

ADD, UPDATE, REMOVE

Shelf events

class substance_painter.event.

ShelfCrawlingStarted

ShelfCrawlingStarted(shelf_name: str)

Event triggered when a shelf starts reading the file system to discover new resources.

See also

Shelf.is_crawling().

shelf_name
shelf_name: str

Name of the shelf discovering resources.

Type

str

class substance_painter.event.

ShelfCrawlingEnded

ShelfCrawlingEnded(shelf_name: str)

Event triggered when a shelf has finished discovering new resources and loading their thumbnails.

See also

Shelf.is_crawling().

shelf_name
shelf_name: str

Name of the shelf that has finished discovering resources.

Type

str

 Adobe

Get help faster and easier

New user?