BBMOD_Gizmo

Extends BBMOD_Class

constructor

new BBMOD_Gizmo([_size])

Description

A gizmo for transforming instances.

Arguments

Name Type Description
_size Real The size of the gizmo. Default value is 10 units.

Properties

Name Description
ButtonDrag The mouse button used for dragging the gizmo.
EditAxis Determines on which axes are the selected instances edited.
EditSpace Determines the space in which are the selected instances transformed.
EditType Determines how are the selected instances transformed (translated/rotated/scaled.
GetInstancePositionX A function that the gizmo uses to retrieve an instance's position on the X axis. Must take the instance as the first argument and return a real. Defaults to a function that returns the instance's x variable.
GetInstancePositionY A function that the gizmo uses to retrieve an instance's position on the Y axis. Must take the instance as the first argument and return a real. Defaults to a function that returns the instance's y variable.
GetInstancePositionZ A function that the gizmo uses to retrieve an instance's position on the Z axis. Must take the instance as the first argument and return a real. Defaults to a function that returns the instance's z variable.
GetInstanceRotationX A function that the gizmo uses to retrieve an instance's rotation on the X axis. Must take the instance as the first argument and return a real. Defaults to a function that always returns 0.
GetInstanceRotationY A function that the gizmo uses to retrieve an instance's rotation on the Y axis. Must take the instance as the first argument and return a real. Defaults to a function that always returns 0.
GetInstanceRotationZ A function that the gizmo uses to retrieve an instance's rotation on the Z axis. Must take the instance as the first argument and return a real. Defaults to a function that returns the instance's image_angle variable.
GetInstanceScaleX A function that the gizmo uses to retrieve an instance's scale on the X axis. Must take the instance as the first argument and return a real. Defaults to a function that returns the instance's image_xscale variable.
GetInstanceScaleY A function that the gizmo uses to retrieve an instance's scale on the Y axis. Must take the instance as the first argument and return a real. Defaults to a function that returns the instance's image_yscale variable.
GetInstanceScaleZ A function that the gizmo uses to retrieve an instance's scale on the Z axis. Must take the instance as the first argument and return a real. Defaults to a function that always returns 1.
InstanceExists A function that the gizmo uses to check whether an instance exists. Must take the instance as the first argument and return a bool. Defaults a function that returns the result of instance_exists.
IsEditing If true then the gizmo is editing selected instances.
KeyEditFaster The virtual key used to increase speed of editing (e.g. rotate objects by a larger angle).
KeyEditSlower The virtual key used to decrease speed of editing (e.g. rotate objects by a smaller angle).
KeyNextEditSpace The virtual key used to switch to the next edit space.
KeyNextEditType The virtual key used to switch to the next edit type.
MaterialsSelect Materials used when mouse-picking the gizmo.
Models Gizmo models for individual edit modes.
Position The gizmo's position in world-space.
Rotation The gizmo's rotation in euler angles.
Selected A list of selected instances.
SetInstancePositionX A function that the gizmo uses to change an instance's position on the X axis. Must take the instance as the first argument and its new position on the X axis as the second argument. Defaults to a function that assings the new position to the instance's x variable.
SetInstancePositionY A function that the gizmo uses to change an instance's position on the Y axis. Must take the instance as the first argument and its new position on the Y axis as the second argument. Defaults to a function that assings the new position to the instance's y variable.
SetInstancePositionZ A function that the gizmo uses to change an instance's position on the Z axis. Must take the instance as the first argument and its new position on the Z axis as the second argument. Defaults to a function that assings the new position to the instance's Z variable.
SetInstanceRotationX A function that the gizmo uses to change an instance's rotation on the X axis. Must take the instance as the first argument and its new rotation on the X axis as the second argument. Defaults to a function that does not do anything.
SetInstanceRotationY A function that the gizmo uses to change an instance's rotation on the Y axis. Must take the instance as the first argument and its new rotation on the Y axis as the second argument. Defaults to a function that does not do anything.
SetInstanceRotationZ A function that the gizmo uses to change an instance's rotation on the Z axis. Must take the instance as the first argument and its new rotation on the Z axis as the second argument. Defaults to a function that assings the new rotation to the instance's image_angle variable.
SetInstanceScaleX A function that the gizmo uses to change an instance's scale on the X axis. Must take the instance as the first argument and its new scale on the X axis as the second argument. Defaults to a function that assings the new scale to the instance's image_xscale variable.
SetInstanceScaleY A function that the gizmo uses to change an instance's scale on the Y axis. Must take the instance as the first argument and its new scale on the Y axis as the second argument. Defaults to a function that assings the new scale to the instance's image_yscale variable.
SetInstanceScaleZ A function that the gizmo uses to change an instance's scale on the Z axis. Must take the instance as the first argument and its new scale on the Z axis as the second argument. Defaults to a function that does not do anything.
Size The size of the gizmo. Default value is 10.

Methods

Name Description
clear_selection Removes all instances from selection.
get_instance_position_vec3 Retrieves an instance's position as BBMOD_Vec3.
get_instance_rotation_vec3 Retrieves an instance's rotation as BBMOD_Vec3.
get_instance_scale_vec3 Retrieves an instance's scale as BBMOD_Vec3.
is_selected Checks whether an instance is selected.
render Enqueues the gizmo for rendering.
select Adds an instance to selection.
set_instance_position_vec3 Changes an instance's position using a BBMOD_Vec3.
set_instance_rotation_vec3 Changes an instance's rotation using a BBMOD_Vec3.
set_instance_scale_vec3 Changes an instance's scale using a BBMOD_Vec3.
submit Immediately submits the gizmo for rendering.
toggle_select Unselects an instance if it's selected, or selects if it isn't.
unselect Removes an instance from selection.
update Updates the gizmo. Should be called every frame.
update_position Updates the gizmo's position, based on its selected instances.

Note

This requries synchronnous loading of models, therefore it cannot be used on platforms like HTML5, which require asynchronnous loading. You also must use BBMOD_Camera for the gizmo to work properly!

Do you find this page helpful?

Copyright © 2022, BlueBurn. Built on June 19, 2022 using GMDoc.