RotationYWidget Class Reference

The RotationYWidget JavaScript class. A rotatable circle widget around the y axis. More...

Signals

void valueChanged (float y)
 
- 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
Attributedata (int index=0)
 

Detailed Description

The RotationYWidget JavaScript class. A rotatable circle widget around the y axis.

A rotation script widget along the y axis. This widget offers a circle in the XZ axis. The circle can be picked and dragged by the user to generate a rotation around the y axis. The following properties are supported by the widget:

Property Type Default Value Description
data String - The name of the automatically generated double floating point attribute (if none is provided)
data Attribute - An attribute of double (floating point) type that can be shared with another widget or node.
radius float 1 The radius of the circle in fields.
width float 0.03 The width between the external and internal circles (band) in fields.
color ColorRGBA 0, 255, 0, 120 The colour of the circle manipulator.
selection_color ColorRGBA light green The colour of the circle manipulator when selected.

The following components constitute the widget:

Component Type
attribute DOUBLE
drag_manipulator ROTATION_Y
painter CIRCLE_Y
picker MONO
local_transformation ROTATION_Y

Connect to this scriptWidget valueChanged signal to be notified when a modification has been applied to the widget.

{
var myRotationYdWidget = new RotationYWidget(
{
data : "myRotation",
radius : 2,
width : 0.05,
color : ColorRGBA(0,255,0, 120),
selected_color : ColorRGBA(128,255,128, 120)
} );
// Register a callback for when a transformation tool value changes.
myRotationYdWidget.valueChanged.connect(myRotationChanged);
Controller.controls.push(myRotationYdWidget);
}

In the callback function, convert the widget value into an action.

function myRotationChanged(newRotation)
{
// Create a rotation matrix based on the 3D rotation of the widget.
var yaxis = new Vector3d( 0,1,0 );
var rotationMatrix = new Matrix4x4();
rotationMatrix.rotateDegrees( newRotation, yaxis );
// Rotate the original position of a series of pegs
for(var i=0; i < myPegs.length; ++i)
{
var newPosition = rotationMatrix.multiply(myPegs[i].position);
node.setTextAttr(myPegs[i].path, "POSITION.X", frame.current(), newPosition.x);
node.setTextAttr(myPegs[i].path, "POSITION.Y", frame.current(), newPosition.y);
node.setTextAttr(myPegs[i].path, "POSITION.Z", frame.current(), newPosition.z);
}
}

Member Function Documentation

◆ valueChanged

void RotationYWidget::valueChanged ( float  y)
signal