The Point2dWidget JavaScript class. A 2 dimensional point widget of various shape. More...
Signals | |
void | valueChanged (QScriptValue &point2d) |
Signal notifying the user that the 2d point value was modified by the Transform Tool. More... | |
Signals inherited from WidgetBase | |
void | dragStarted (QScriptValue dragContext) |
signal called on mouse down when picking this widget with the Transform tool More... | |
void | drag (QScriptValue dragContext) |
signal called when this widget is dragged with the Transform tool More... | |
void | dragEnded () |
signal called on mouse up after having manipulated this widget with the Transform tool More... | |
Additional Inherited Members | |
Public Slots inherited from WidgetBase | |
Attribute * | data (int index=0) |
void | updateProperties (QScriptValue properties) |
The Point2dWidget JavaScript class. A 2 dimensional point widget of various shape.
A 2 dimensional point script widget that can be dragged inside a bounding box specified by the user. The widget manipulator is 2 concentric circles. The color of each circle can be specified at the object creation. The widget can be dragged in the Camera view while using the Transform tool. Dragging the widget will modify the value of the widget position in model Field coordinates.
If no 2d position attribute is given at the construction of this object, the object will generate one of the proper type.
The following properties are supported by the widget:
Property | Type | Default Value | Description |
---|---|---|---|
data | String | - | The name of the automatically generated 2d position attribute (if none is provided) |
data | Attribute | - | An attribute of 2d position type that can be shared with another widget or node. |
size | float | 0.01 | The size (diameter) of the point manipulator in percentage of 350 pixels. |
color | ColorRGBA | 255, 0, 0 | The colour of the point manipulator. |
inner_color | ColorRGBA | color value | The colour of the inner point manipulator (override the color property if both are found). |
outer_color | ColorRGBA | color value | The colour of the outer point manipulator (override the color property if both are found). |
selection_color | ColorRGBA | light blue | The colour of the point manipulator when selected. |
xmin | float | -float max | The left boundary of the point bounding box in fields. |
xmax | float | float max | The right boundary of the point bounding box in fields. |
ymin | float | -float max | The bottom boundary of the point bounding box in fields. |
ymax | float | float max | The top boundary of the point bounding box in fields. |
show_limits | bool | false | Draw the bounding box |
box_color | ColorRGBA | 0, 0, 0 | Bounding box color |
point_style | String | "Circle" | Point Style ("Circle","Square","Triangle", "Diamond") |
label | String | "text" | Label text |
label_color | ColorRGBA | 255, 255, 255 | Label foreground (text) color. |
label_bg_color | ColorRGBA | 0, 0, 0, 128 | Label background color. Accepts transparency values. |
label_font | String | "Arial" | Label font name. |
label_size | float | 10.0 | Label font size, in points. |
label_pos | Point2d | Point2d(0,0) | Label position, in fields. |
label_justify | String | "Left" | Horizontal label text alignment ("Left"/"Center"). |
label_screenspace | bool | true | Forces the label size to remain constant relative to screen. |
label_screenspace_offset | Point2d | Point2d(0,0) | Label position offset, in screen space. |
The following components constitute the widget:
Component | Type |
---|---|
attribute | POSITION_2D |
drag_manipulator | POSITION_2D |
painter | POINT_2D |
picker | MULTI |
local_transformation | - |
Connect to this scriptWidget valueChanged signal to be notified when a modification has been applied to the widget. In the callback function, transfer the new widget value into an action (like modifying a peg attribute value).
Create a point 2d widget in the Controller onShowControl method. Extrapolate its default valuel from a peg position.
When the value of the script widget changes, update the peg position from the point position in its bounding box.
When the current frame changes, update the widget position from the position of the peg at the new current frame.
|
signal |
Signal notifying the user that the 2d point value was modified by the Transform Tool.
point2d | the new 2d point value. point2d is of JavaScript type Point2d |