Namespaces

namespace alPy

Typedefs

typedef std::function<void(alPy::PythonCallbackMessageResult*)> PythonCallbackFn
typedef std::unordered_map<unsigned long int, PythonCallbackFn> PythonCallbackFns

Functions

void defineAccessTypes(py::module &m)
void defineCamera(py::module &m)
void defineCameraNode(py::module &m)
bool createCanvas(const char *imagePath, bool useConstructionPlane, py::list errorList)

Create a canvas in the Alias Universe with name “Canvas”.

If the userConstructionPlane parameter is set to true, the canvas will be a loaded onto the first construction plane found in the current pick list, else the canvas will be loaded into the active window oriented toward the window’s current. The given image path will be loaded onto the canvas.

NOTE: this function works only in OpenAlias.

Parameters
  • imagePath – the image file path to load onto the canvas.

  • useConstructionPlane – true will load the image canvas onto the picked construction plane, if any, else falls back to loading using the current window oriented towards its camera.

Returns

true - The canvas was successfully created. false - Failed to create the canvas.

bool createCanvas(const char *name, const char *imagePath, bool useConstructionPlane, py::list errorList)

Create a canvas in the Alias Universe.

If the userConstructionPlane parameter is set to true, the canvas will be a loaded onto the first construction plane found in the current pick list, else the canvas will be loaded into the active window oriented toward the window’s current. The given image path will be loaded onto the canvas.

NOTE: this function works only in OpenAlias.

Parameters
  • name – the name given to the canvas node in Alias.

  • imagePath – the image file path to load onto the canvas.

  • useConstructionPlane – true will load the image canvas onto the picked construction plane, if any, else falls back to loading using the current window oriented towards its camera.

  • errorList – a python object list which error messages will be added, if any.

Returns

true - The canvas was successfully created. false - Failed to create the canvas.

void defineCanvas(py::module &m)
void defineCluster(py::module &m)
void defineClusterNode(py::module &m)
void defineConstructionEntity(py::module &m)
void defineConstructionPlane(py::module &m)
void defineCurveNode(py::module &m)
void defineCurveOnSurface(py::module &m)
void defineCurveOnSurfacePoint(py::module &m)
void defineCurvePoint(py::module &m)
void defineDagNode(py::module &m)
void defineExceptions(py::module &m)
void defineFace(py::module &m)
void defineFaceNode(py::module &m)
void defineGroupNode(py::module &m)
void defineHashable(py::module &m)
void defineIKHandle(py::module &m)
void defineIKHandleNode(py::module &m)
void defineIterator(py::module &m)
void defineLayer(py::module &m)
void defineLayeredShader(py::module &m)
void defineLight(py::module &m)
void defineLightNode(py::module &m)
void defineLinkItem(py::module &m)
int isLocatorPicked(const AlLocator &locator)

Check if the AlLocator object is picked or not.

This is a helper method to return the isPicked variable, since python cannot return values by reference for immutable types.

Parameters

locator – - the AlLocator to check

Returns

Return an integer value indicating the result: -1 - failed to check if the locater is picked or not 0 - the locator is not picked 1 - the locator is picked

int isLocatorTemplated(const AlLocator &locator)

Check if the AlLocator object is templated or not.

An AlLocator is said to be templated if it depends on another object which is templated.

This is a helper method to return the templated variable, since python cannot return values by reference for immutable types.

Parameters

locator – - the AlLocator to check

Returns

Return an integer value indicating the result: -1 - failed to check if the locater is templated or not 0 - the locator is not templated 1 - the locator is templated

void defineLocator(py::module &m)
void logMessage(AlOutputType outputType, const char *msg)

Output a message to the given ‘outputType’, using the Alias API print function.

Parameters
  • outputType – the type of output that determines where the message will be sent and displayed.

  • msg – the message to output.

void logToPrompt(const char *msg)

Output a message to the Alias UI prompt and display it in the history.

For OpenModel, this will have the same result as ‘logtoStdout’.

Parameters

msg – the message to output.

void logToPromptNoHistory(const char *msg)

Output a message to the Alias UI prompt.

For OpenModel, this will have the same result as ‘logtoStdout’.

Parameters

msg – the message to output.

void logToStdout(const char *msg)

Output a message to standard output stream.

Parameters

msg – the message to output.

void logToStderr(const char *msg)

Output a message to standard error stream.

Parameters

msg – the message to output.

void logToErrlog(const char *msg)

Output a message to the Alias error log.

Parameters

msg – the message to output.

void defineLogger(py::module &m)
void defineMenu(py::module &m)
void defineMesh(py::module &m)
void defineMeshNode(py::module &m)
void defineMessage(py::module &m)
void defineObject(py::module &m)
void defineOrthographicCamera(py::module &m)
void definePerspectiveCamera(py::module &m)
void definePickList(py::module &m)
void definePoint(py::module &m)
py::dict getProductInformation()

Get and return the Alias production information.

Returns

Python dictionary containing the Alias product information.

void defineProduct(py::module &m)
std::vector<AlReferenceFileSet*> getAlternatives(AlReferenceFile *refFile)

Get all the alternatives this reference belongs to.

Returns

A list of AlReferenceFileSet objects.

std::vector<AlReferenceFile*> getReferences(AlReferenceFileSet *refFileSet)

Get all the references belonging to the current alternative.

Returns

A list of AlReferenceFile objects.

std::vector<unsigned int> getUuid(AlReferenceFile *refFile)

Convert the AlReferenceFile UUID to a type consumable by python.

Converts the UUID struct to a python list.

Parameters

refFile – - the AlReferenceFile to get the UUID

Returns

A python list of length 4 that contains the UUID value.

std::vector<AlReferenceFileSet*> getAlternatives()

Get a list of all the alternatives of the current file.

Returns

A list of AlReferenceFileSet objects.

AlReferenceFileSet *getAlternativeByName(const std::string &name)

Get an Alias alternative given its name.

Parameters

name – name of the Alternative we want to retrieve

Returns

The AlReferenceFileSet object.

AlReferenceFileSet *createAlternative(const std::string &name, bool force)

Create an Alias alternative.

Parameters

name – name of the Alternative we want to create

Returns

The AlReferenceFileSet object.

bool hasReference()

Check if there are any AlReferenceFiles in the Alias Universe.

Returns

True if there are any AlReferenceFiles found in the Alias Universe, else False.

std::vector<AlReferenceFile*> getReferences()

Get a list of all the references of the current file.

Returns

A list of AlReferenceFile objects.

AlReferenceFile *getReferenceByPath(const std::string &path)

Find a reference file given its path.

Parameters

path – path to the reference file

Returns

The AlReferenceFile object.

AlReferenceFile *getReferenceByName(const std::string &name)

Find a reference file given its name.

Parameters

name – name to the reference file.

Returns

The AlReferenceFile object.

AlReferenceFile *getReferenceByUUID(py::list uuid)

Find a reference file given its UUID.

This method requires Alias version > v2020.2

Parameters

uuid – UUID to the reference file.

Returns

The AlReferenceFile object.

AlReferenceFile *createReference(const std::string &path)

Create a reference given its path.

Parameters

path – path to the file to use as a reference

Returns

The AlReferenceFile object.

AlReferenceFile *updateReference(const std::string &oldPath, const std::string &newPath)

Update a reference by deleting the old one and creating a new one.

Parameters
  • oldPath – path to the reference file to delete

  • newPath – path to the reference file to create

Returns

The AlReferenceFile object.

void defineReference(py::module &m)
void defineShader(py::module &m)
void defineShell(py::module &m)
void defineShellNode(py::module &m)
void defineSpacePoint(py::module &m)
Stage *getCurrentStage()

Get the current stage.

Returns

The Stage object.

std::string getCurrentPath()

Get the path to the current file.

Returns

The path to the current file.

bool isStageEmpty()

Check if the current stage is empty or not.

Useful when you want to create a new file.

A stage is empty if it has at least one AlDagNode that is not an AlGroupNode, and is not one of the default AlCameraNodes in the default AlGroupNode.

Returns

true is the stage is empty, otherwise false.

statusCode saveFile()

Save the current file.

statusCode saveFileAs(const std::string &path)

Save the current file to the given location.

Parameters

path – the path to save the file to

Throws

AliasPythonException – if:

  1. There was an error saving the file

  2. The given path points to a stage set file (.stg)

Returns

The resulting status code for the save as operation: sSuccess - the file was saved successfully sFailure - the file was not saved successfully (file may have been saved but failed to name the stage correctly)

statusCode openFile(const std::string &path, bool new_stage, bool delete_current)

Open an Alias file.

Parameters
  • path – path to the file to open

  • new_stage – if set to true, open the file in a new stage. Otherwise open the file in the current stage

  • delete_current – if set to true, when opening a file in the current stage, be sure the content of the file won’t be happen to the stage but will replace the current one.

void importFile(const std::string &path)

Import a file into the current one.

void reset()

Reset the current Alias session by deleting all the stages and setting the default window.

statusCode createStage(const std::string &name)

Create a new stage in Alias.

Parameters

name – the stage name.

std::vector<Stage*> getStages()

Get all the existing stages of the current Alias session.

Returns

A list of Stage objects.

void defineStage(py::module &m)
void defineSurface(py::module &m)
void defineSurfaceNode(py::module &m)
void defineSurfacePoint(py::module &m)
void defineSwitchShader(py::module &m)
void defineTextureNode(py::module &m)
void defineTransformMatrix(py::module &m)
int deleteNullNodes()

Delete all the null nodes of the current scene.

Returns

The number of of dag nodes being changed.

int cleanupGeometryModel(bool faceToSurf, bool splitC1Breaks, bool splitClosedBasis, bool shrinkClosedSurf, bool setPersistentIds, bool splitSphere, bool pickedDagsOnly, bool splitMultiknots, bool delNullNodes, bool delDegenerateGeo)

Clean up geometry in the model.

This function will clean up the geometry in the model by performing all the actions specified by the user.

Parameters
  • face_to_surf – if True, convert all FaceNode to trimmed surface

  • split_c1_breaks – if True, split C1 breaks to multiple surfaces

  • split_closed_basis – if True, divide a closed surface to multiple surfaces and split a closed trimming curve to two pieces

  • shrink_closed_surf – if True, shrink closed basis surface of a region

  • set_persistent_id – if True, set persistent ID for each node, region

  • split_sphere – if True, split sphere at equator

  • picked_dags_only – if True, only picked node will be checked and changed if False, the actions will be performed for all the nodes

  • split_multiknots – if True, detach all multiknots

  • delete_degenerate_geo – if True, delete degenerate geometry

  • delete_null_nodes – if True, delete all null nodes

Returns

The number of of dag nodes being changed.

void defineUniverse(py::module &m)
template<typename T, unsigned int N>
std::array<T, N> toArray(const T cstyleArray[N])
template<typename T, unsigned int N>
void toCStyleArray(const std::array<T, N> &arr, T cstyleArray[N])
template<typename T, unsigned int ROWS, unsigned int COLS>
std::array<std::array<T, COLS>, ROWS> toArray2D(const T cstyleArray[ROWS][COLS])
template<typename T, unsigned int ROWS, unsigned int COLS>
void toCStyleArray2D(const std::array<std::array<T, COLS>, ROWS> &arr, T cstyleArray[ROWS][COLS])
void defineMath(py::module &m)
void defineVariant(py::module &m)
void defineWindow(py::module &m)
int isConstructionEntityTemplated(const AlConstructionEntity &entity)

Check if the AlConstructionEntity object is templated or not.

An AlConstructionEntity is said to be templated if it depends on another object which is templated.

This is a helper method to return the templated variable, since python cannot return values by reference for immutable types.

Parameters

entity – - the AlConstructionEntity to check

Returns

Return an integer value indicating the result: -1 - failed to check if the locater is templated or not 0 - the locator is not templated 1 - the locator is templated

void importSubdivision(std::string path)

DEPRECATED - Import the subdivision for the given path.

Throws AliasPythonException on failure to import.

This function will be removed.

Parameters

path – the import path

py::list vec3_to_list(const alPyMath::Vec3 &v)
class AliasPythonException : public std::exception
#include <exception.h>

A custom exception class to report errors to Python callers.

class Menu
#include <menu.h>

A menu object that can be added to the Alias menu bar.

This class object is only available in OpenAlias.

class MenuItem
#include <menu.h>

An item that can be added to the Menu class object.

This class object is only available in OpenAlias.

class Message
#include <message.h>
class PyAlIterator : public AlIterator
struct PythonCallbackMessageResult
#include <message.h>
class Stage
#include <stage.h>

Object encapsulating an Alias stage.

class Variant
#include <variant.h>

Warning

doxygennamespace: Cannot find namespace “alPyOA” in doxygen xml output for project “alias-python-api” from directory: C:/Jenkins/workspace/d-shotgun_alias-python-api_PR-44/build/python3_AliasSurface2019/bin/Release/docs//doxygen/xml

Warning

doxygennamespace: Cannot find namespace “alPyOM” in doxygen xml output for project “alias-python-api” from directory: C:/Jenkins/workspace/d-shotgun_alias-python-api_PR-44/build/python3_AliasSurface2019/bin/Release/docs//doxygen/xml

namespace alPyMath