rjBakeInstancer package

Module contents

Bake an instancer node to individual animated pieces of geometry. Useful for people that haven’t switched to Maya 2017 yet, where this is standard functionality.

https://github.com/robertjoosten/rjBakeInstancer/raw/master/README.gif

Link to Video

Installation

Copy the rjBakeInstancer folder to your Maya scripts directory

C:/Users/<USER>/Documents/maya/scripts

Usage

Display the UI with the following code

import rjBakeInstancer.ui
rjBakeInstancer.ui.show()

Command line

import rjBakeInstancer
rjBakeInstancer.bake(
    instancer,
    start,
    end,
)

Note

This script lets you bake an instancer node into individual animated pieces of geometry. Usefull for people that haven’t switched over to Maya 2017 yet, where this is standard functionality.

Code

rjBakeInstancer.asMDagPath(obj)

OpenMaya.MObject -> OpenMaya.MDagPath

Parameters:obj (OpenMaya.MObject) –
Return type:OpenMaya.MDagPath
rjBakeInstancer.asMFnTransform(dag)

OpenMaya.MDagPath -> OpenMaya.MFnTransform

Parameters:dag (OpenMaya.MDagPath) –
Return type:OpenMaya.MFnTransform
rjBakeInstancer.asMObject(path)

str -> OpenMaya.MObject

Parameters:path (str) – Path to Maya object
Return type:OpenMaya.MObject
rjBakeInstancer.bake(instancerName, start, end, progress=None)

Process an instancer node over the specified frame range, reading the positions and objects. With this data objects are duplicated and positioned to mimic the instancer. With the particle data individual objects can be matched over the different frames and animated. When a particle “dies”, the visibility is turned off.

Parameters:
  • instancerName (str) – Name if the instancer to bake
  • start (int) – Start frame
  • end (int) – End frame
  • progress (QProgressBar) – Update ui ( Optional )
Returns:

Group that contains all of the baked information

Return type:

str

Raises:
  • RuntimeError – When the instancer doesn’t exist
  • RuntimeError – When there are no particles attached
rjBakeInstancer.keyTransform(path, t)

Key transform, loop over translate, rotate and scale and set keys with their current value.

Parameters:
  • path (str) – path to Maya object
  • t (int) – time
rjBakeInstancer.keyVisibility(path, t, v)

Key visibility, will create a switch putting a a key with the specified value on the time parsed. But will also put the reverse value on t-1.

Parameters:
  • path (str) – path to Maya object
  • t (int) – time
  • v (int) – value