- Modules
- Master Controllers
- Referring to the Master Controller Node
Referring to the Master Controller Node
T-HSCP-002-017
It is possible for the Master Controller node to refer to itself. The path to its own node is available in the global Controller object. Because this object is created by the Master Controller node, it is specific to that node.
function myCallback(newValue)
{
// Get the parent node of the Master Controller by using its path from the
// Controller.
var masterControllerParentNode = node.srcNode(myController.node, 0);
}
The example above does not refer to the Controller object directly, but rather, to an object named myController. This is because the Controller object is only available at the root level of the script or within its own methods. To use the Controller object in other function in the script, it must be stored in a global variable:
// The script context will be initialized when Show Controls will be called.
// Keep a script global copy of the Controller object.
var myController = Controller;
function point2dValueChanged(newPointValue)
{
// Not OK, the Controller global object isn’t available in callbacks
var masterControllerParentNode = node.srcNode(Controller.node, 0);
// OK, use a copy from the script global scope
var masterControllerParentNode = node.srcNode(myController.node, 0);
}
// Called when the user shows the Master Controller module controls
Controller.onShowControl = function()
{
Controller.controls = [];
Controller.controls.push(new Point2dWidget);
Controller.controls[0].valueChanged.connect(point2dValueChanged);
}
Time Estimated 25 mins
Difficulty Level Advanced
Topics List
- Introduction to Master Controllers
- Creating a Master Controller
- Creating Master Controller Widgets
- Setting the Properties of a Master Controller Widget
- Updating an Element's Attribute when Manipulating a Master Controller Widget
- Linking Attributes Between Master Controller Widgets
- Updating the Attributes of a Master Controller Widget
- Connecting Master Controller Widgets to Nodes
- Applying the Coordinates of a Master Controller Widget to Nodes
- Applying the Coordinates of a Master Controller Widget to Deformers
- Controlling Nodes Connected to a Master Controller
- Referring to the Master Controller Node
- Master Controllers Examples
Support
Help and FAQ
Toon Boom Forum
Contact us