paya.runtime.rigs.Rig#

class Rig#

Inheritance

Trunk

Warning

This is a stub / beta class, and should not be relied on for production purposes.

classmethod getAssetName()#
Returns

A basename for the asset associated with this rig class. In this implementation, this is merely the non-capitalized name of this class, but can be overriden freely.

Return type

str

classmethod findTrunkScene(name)#

Convenience method. Looks for a Maya scene dependency across this rig’s trunk directories.

Parameters

name (str) – the name of the scene (e.g. 'layout.ma'); if the extension is omitted, both Maya extensions ('.ma' and '.mb') will be considered

Returns

The path to a matching scene, if one is found.

Return type

Path, None

classmethod exportAllToTrunkScene(name)#

Exports the full contents of the currently-open scene to the trunk directory for this rig class.

Example

cls.exportAllToTrunkScene('layout.ma')
Parameters

name (str) – the name of the scene to save into; if the extension is omitted, it will be set to '.ma' (mayaAscii)

Returns

The full export path.

Return type

Path

classmethod referenceTrunkScene(name, namespace=None, **kwargs)#

Locates and references the specified trunk scene.

Parameters
  • name (str) – the name of the scene to retrieve; if the extension is omitted, both ASCII and binary scene files will be considered

  • namespace/ns (str) – a namespace for the reference; if omitted, it will be set to the file basename; defaults to None

  • **kwargs – forwarded to file()

Returns

The retrieved file path.

Return type

Path

classmethod unreferenceTrunkScene(name)#

Looks for any matches for the specified trunk scene amongst current references and removes them.

Parameters

name (str) – the name of the trunk scene; if the extension is omitted, both ASCII and binary scene files will be considered

Returns

A list of matching reference paths that were removed (without copy numbers).

Return type

[Path]

classmethod getSnapshotsDir(create=False)#
Returns

The directory for rig build snapshots. In this implementation, it’s '<maya project>/rig_build_snapshots', but can be overriden freely.

Return type

Path

classmethod snapshotExists(stageName)#
Parameters

stageName (str) – the name of the stage for which to source a snapshot

Returns

True if there’s a snapshot for the specified build stage, otherwise False.

Return type

bool

classmethod removeSnapshot(stageName)#

Removes the snapshot for the specified stage name, if it exists.

Parameters

stageName (str) – the build stage for the snapshot

classmethod clearSnapshots()#

Deletes the snapshots directory along with its contents.

classmethod getSnapshotScene(stageName)#
Parameters

stageName (str) – the name of the build stage for which to source a snapshot scene.

Returns

The path to a Maya scene snapshot for the specified stage. Note that this does not check whether the file actually exists.

Return type

Path

classmethod pruneSnapshots(dirtyStages=None)#

Performs housekeeping on build-stage snapshots. For every stage, if there isn’t a snapshot, snapshots for all downstream stages are also deleted.

Parameters

dirtyStages (str, [str]) – one or more stages for which snapshots should be explicitly deleted, along with those of all their descendants; defaults to None

classmethod getBuildGraph()#
Returns

An evaluation graph built off the connection segments in the __graph__ attribute on this class.

Return type

EvalGraph

classmethod build(targetStages=None, rebuildDependencies=True, clearSnapshots=False, dirtyStages=None)#

Runs a rig-building sequence.

Parameters
  • targetStages (str, [str]) – one or more build stages to evaluate for; if this is omitted, the entire build graph will be evaluated; defaults to None

  • rebuildDependencies (bool) – rebuild stage dependencies instead of relying on snapshots; defaults to True

  • clearSnapshots (bool) – clear all snapshots before building; defaults to False

  • dirtyStages (str, [str]) – one or more stages which should be considered ‘dirty’, meaning their snapshots, and those of their descendants, should be cleared before building; defaults to None