GDtrack_edit
Synopsis
define a virtual trackball editor for the Graphics Display Kit transform
GDtrack_edit_notify_templ
group _GDtrack_edit_notify_templ
{
int _event;
int _x;
int _y;
int time;
int reset, normalize, center;
GDview_ref_templ+read+nonotify &view;
method+notify_inst+notify_val upd_func = "GDtrack_edit_update";
method+notify_deinst del_func() = "GDtrack_edit_delete";
};
GDtrack_edit_templ
GDtrack_edit_notify_templ GDtrack_edit_templ
{
int _mode;
enum rot_mode { choices = {"Arbitrary", "XY", "Z"}; } = 0;
enum scale_mode { choices = {"Uniform", "Non-Uniform"}; } = 0;
enum xlate_mode { choices = {"Arbitrary", "X", "Y". "XY"}; } = 0;
enum trans_mode { choices = {"Object", "Camera", "Light"}; };
enum space { choices = {"Global", "Local"}; } = 0;
int cur_light = 0;
func+virtual track_func;
GDcamera_templ _*camera;
GDobject_templ _*obj;
};
PDRrotate
GDtrack_edit_templ _PDRrotate
{
mode = 0;
func+virtual _track_func = "GDtrack_rotate";
};
PDRscale
GDtrack_edit_templ _PDRscale
{
mode = 1;
func+virtual _track_func = "GDtrack_scale";
};
PDRtranslate
GDtrack_edit_templ _PDRtranslate
{
mode = 2;
func+virtual _track_func = "GDtrack_xlate";
};
PDRzlate
GDtrack_edit_templ _PDRzlate
{
mode = 3;
func+virtual _track_func = "GDtrack_zlate";
};
GDtrack_edit
GDtrack_edit_templ _GDtrack_edit
{
mode = 0;
ptr+nonotify_ local_ptr;
};
Description
These templates define the virtual trackball editor for the Graphics Display Kit. GDtrack_edit_notify_templ define the elements that cause the editor's update method to execute. PDRrotate, PDRscale, PDRtranslate, and PDRzlate define the virtual functions that perform the rotation, scaling, XY translation, and Z translation. GDtrack_edit, which sets the intial value of mode, is the template that should be instanced.
The virtual trackball editor takes in screen space XY coordinates, a view, a camera, and an object and produces a transformation matrix that rotates, scales, or translates the input object.
As an alternative to defining your own user interface for a track editor, you can use TrackEditor, an application component. TrackEditor contains GDtrack_edit and defines a user interface.
Input
event
This input is the event. It is typically connected to the UItwoPoint's state subobject.
Value
|
Meaning
|
0
|
Start event
|
1
|
Run event
|
2
|
Stop event
|
x
y
These inputs are the XY screen space position of the cursor at the time of the event. They are typically connected to the x and y subobjects of the UItwoPoint to which event is connected.
view
camera
A connection to a camera. Typically, you connect the camera to the view's picked camera.
obj
A connection to an object. Typically, you connect obj to the current object from an object selector. Alternatively, you can connect the object to the view's picked object.
Parameters
time
This parameter is the time at which the event occurred. This is used to determine if track rolling should be enabled.
reset
This parameter when set causes the object, camera or light transformation to be reset to its default -- the identity matrix.
normalize
This parameter when set causes the object to be normalized to the view.
center
This parameter when set causes the object's center of rotation to be set to the extents of the data.
mode
This parameter controls which of the virtual functions is called when the track editor's update method executes. The following values are valid:
Value
|
Meaning
|
0
|
Rotate
|
1
|
Scale
|
2
|
XY Translate
|
3
|
Z Translate
|
rot_mode
This parameter affects the transformation matrix produced when the mode is set to "rotate". The following values are valid:
Value
|
Meaning
|
Symbolic constant
|
0
|
Allow arbitrary rotation.
|
GD_ROTATE_ARBITRARY
|
1
|
Constrain rotation to the XY axis. Select the largest angle of rotation.
|
GD_ROTATE_CONSTRAIN_XY
|
2
|
Constrain rotation to the Z axis.
|
GD_ROTATE_Z
|
scale_mode
This parameter affects the transformation matrix produced when the mode is set to "scale". The following values are valid:
Value
|
Meaning
|
Symbolic constant
|
0
|
Allow uniform scaling
|
GD_SCALE_UNIFORM
|
1
|
Allow non-uniform scaling
|
GD_SCALE_NON_UNIFORM
|
xlate_mode
This parameter affects the transformation matrix produced when the mode is set to "translate". The following values are valid:
Value
|
Meaning
|
Symbolic constant
|
0
|
Allow arbitrary translation
|
GD_XLATE_ARBITRARY
|
1
|
Constrain translation to the X axis
|
GD_XLATE_CONSTRAIN_X
|
2
|
Constrain translation to the Y axis
|
GD_XLATE_CONSTRAIN_Y
|
3
|
Constrain translation to the closest axis
|
GD_XLATE_CONSTRAIN_CLOSE
|
trans_mode
This parameter affects which transform is affected. The following values are valid:
Value
|
Meaning
|
Symbolic constant
|
0
|
Edit object transform.
|
GD_TRANS_OBJECT
|
1
|
Edit camera transform
|
GD_TRANS_CAMERA
|
2
|
Edit light transform
|
GD_TRANS_LIGHT
|
space
This parameter controls the coordinate system in which the object is edited. The following values are valid:
Value
|
Meaning
|
Symbolic constant
|
0
|
Edit in global coordinate system
|
GD_XFORM_GLOBAL
|
1
|
Edit in object's local coordinate system
|
GD_XFORM_LOCAL
|
Output Port
Example
Libraries.Graphics_Display.Editors.UI_Editors.TrackEditor
File
v/gd.v
See also related modules