- Modules
- Master Controllers
- Setting the Properties of a Master Controller Widget
Setting the Properties of a Master Controller Widget
T-HSCP-002-005
When creating a widget, you can customize it by declaring its properties. These properties can be passed as parameters in the constructor of the widget. For example, the following code creates a Slider widget with a full set of custom properties:
Controller.controls.push(new SliderWidget(
{
data : "mySlider", // name of the created attribute
width : 0.15, // width of the slider frame
height : 0.2, // height of the slider frame
min : 0, // minimum value of the slider
max : 100, // maximum value of the slider
frame_color : ColorRGBA(40,100,150), // the colour of the slider frame
slider_color : ColorRGBA(135,135,135), // the colour of the slider handle
slider_selection_color : ColorRGBA(200,200,150), // the colour of the slider frame when selected
}));
The data property of a widget can be set to a string that uniquely identifies its attributes. Hence, if two widgets are created with an identical data property, they will have the same attribute, like in this example:
// Create a 2d point widget.
Controller.controls.push(new Point2dWidget(
{
data : "Magnet", // name of the created attribute
size : 0.05, // the diameter of the point
selection_color : ColorRGBA(80,50,50) // the colour of the point manipulator when selected.
}));
// Create a 2d point widget.
Controller.controls.push(new Point2dWidget(
{
data : "Magnet", // name of the created attribute
size : 0.1, // the diameter of the point
selection_color : ColorRGBA(20,70,70) // the colour of the point manipulator when selected.
}));
Each type of Master Controller widget has its own set of properties that can be set at its creation. All of their properties are optional and have default values if not set.
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