define a virtual trackball editor for the Graphics Display Kit transform
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_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;
};
GDtrack_edit_templ PDRrotate
{
mode = 0;
func+virtual track_func = "GDtrack_rotate";
};
GDtrack_edit_templ PDRscale
{
mode = 1;
func+virtual track_func = "GDtrack_scale";
};
GDtrack_edit_templ PDRtranslate
{
mode = 2;
func+virtual track_func = "GDtrack_xlate";
};
GDtrack_edit_templ PDRzlate
{
mode = 3;
func+virtual track_func = "GDtrack_zlate";
};
GDtrack_edit_templ GDtrack_edit
{
mode = 0;
ptr+nonotify local_ptr;
};
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.
This input is the event. It is typically connected to the UItwoPoint's state subobject.
|
|
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.
A connection to a camera. Typically, you connect the camera to the view's picked camera.
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.
This parameter is the time at which the event occurred. This is used to determine if track rolling should be enabled.
This parameter when set causes the object, camera or light transformation to be reset to its default -- the identity matrix.
This parameter when set causes the object to be normalized to the view.
This parameter when set causes the object's center of rotation to be set to the extents of the data.
This parameter controls which of the virtual functions is called when the track editor's update method executes. The following values are valid:
|
|
This parameter affects the transformation matrix produced when the mode is set to "rotate". The following values are valid:
|
|
|
Constrain rotation to the XY axis. Select the largest angle of rotation. | ||
This parameter affects the transformation matrix produced when the mode is set to "scale". The following values are valid:
|
|
|
This parameter affects the transformation matrix produced when the mode is set to "translate". The following values are valid:
|
|
|
This parameter affects which transform is affected. The following values are valid:
|
|
|
This parameter controls the coordinate system in which the object is edited. The following values are valid:
|
|
|
Libraries.Graphics_Display.Editors.UI_Editors.TrackEditor