Node Creation User Callbacks

Golaem provides callback functions mechanism which is triggered every time a new Golaem node is created. They can be used to edit default node parameters or call custom pipeline code. The available callbacks are:

addCrowdBehaviorUserCallback // whenever a new behavior is created
addCrowdBe[BehaviorName]UserCallback
addCrowdFieldUserCallback
addTerrainLocatorUserCallback
addPerceptionLocatorUserCallback
addPhysicsLocatorUserCallback
addFlockLocatorUserCallback
addTrafficLocatorUserCallback
addTheCharacterMakerLocatorUserCallback
addCrowdEntityTypeNodeUserCallback
addCrowdGroupEntityTypeNodeUserCallback
addSensorLocatorUserCallback
addTheCrowdManagerNodeUserCallback
glmPopToolHandleConnectionsUserCallback

Python

To register a callback function you can call the following utilty function available in the glm.crowdutils module:

def registerNodeCreationUserCallback(callbackName, function)

To deregister a callback function you can call the following utilty function available in the glm.crowdutils module:

def deregisterNodeCreationUserCallback(callbackName)

Those callback functions all share the same prototype:

def [functionName](nodeName)

Here is an example of an implemented callback called whenever a new Motion Behavior is created:

def motionCbExample(nodeName):
    cmds.setAttr(nodeName + '.loop', 0)

glm.crowdUtils.registerNodeCreationUserCallback('addCrowdBeMotionUserCallback', motionCbExample)

MEL

Those callback functions all share the same prototype:

global proc [callbackFunctionName](string $nodeName);

The following functions are available for a callback to be implemented. When implemented and sourced in the Maya session, they will be called when the corresponding node is created via the Golaem Shelf or the Golaem Menus:

Here is an example of an implemented callback called whenever a new Motion Behavior is created:

global proc addCrowdBeMotionUserCallback(string $nodeName)
{
  setAttr ($nodeName + ".loop") 0; // disable looping by default
}