functions module

Module functions contains functions that can be called by Substance Designer application, if it is configured in the preferences.

functions.getGraphExportOptions(aContext, aPackageFileAbsPath='', aGraphIdentifier='')

Get the options used to fill the widget used to export a graph outputs

Parameters:
  • aContext (context.Context) – Execution context

  • aPackageFileAbsPath (str) – The absolute path of the package (i.e. the .sbs file)

  • aGraphIdentifier (str) – The identifier of the graph

Returns:

a ReturnValue object that contains the following keys:

  • outputDirAbsPath: absolute path of the directory used to export

  • fileExtension: the image file extension (png, tga, …)

functions.onAfterFileSaved(aContext, aFileAbsPath='', aSucceed=True, aUserData='')

This function can be called by Substance Designer if configured to. It is called after a save process has been triggered. The parameter names of this function must not be changed otherwise the call from SD will fail.

Parameters:
  • aContext (context.Context) – Execution context

  • aFileAbsPath (str) – The absolute path of the file

  • aSucceed (bool) – The result of the save process

  • aUserData (str) – The userData value set in field “userData’ of the returnValue object returned by the function onBeforeFileSaved()

Returns:

Nothing

functions.onBeforeFileSaved(aContext, aFileAbsPath='', aPackageFileAbsPath='')

This function can be called by Substance Designer if configured to. It is called when a file is about to be saved on disk. The parameter names of this function must not be changed otherwise the call from SD will fail.

Parameters:
  • aContext (context.Context) – Execution context

  • aFileAbsPath (str) – The absolute path of the file

  • aPackageFileAbsPath (str) – The path of the package that contains the exported data (if any)

Returns:

a ReturnValue object that contains the following keys:

  • userData: User data as string