BBMOD_Gizmo

A constructor defined in BBMOD_Gizmo.gml

Implements BBMOD_IDestructible

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
AngleSnap Angle snapping size. Default value is 1.
ButtonDrag The mouse button used for dragging the gizmo. Default is mb_left.
EditAxis Determines on which axes are the selected instances edited. Use values from BBMOD_EEditAxis.
EditSpace Determines the space in which are the selected instances transformed. Use values from BBMOD_EEditSpace.
EditType Determines how are the selected instances transformed (translated/rotated/scaled. Use values from BBMOD_EEditType.
EnableAngleSnap Enables angle snapping when rotating objects. Default value is true.
EnableGridSnap Enables snapping to grid when moving objects. Default value is true.
GetInstanceGlobalMatrix A function that the gizmo uses to retrieve an instance's global matrix. Normally this is an identity matrix. If the instance is attached to another instance for example, then this will be that instance's transformation matrix. Must take the instance as the first argument and return a BBMOD_Matrix. Defaults to a function that always returns an identity matrix.
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.
GridSize The size of the grid. Default value is (1, 1, 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.
KeyCancel The virtual key used to cancel editing and revert changes. Default is vk_escape.
KeyEditFaster The virtual key used to increase speed of editing (e.g. rotate objects by a larger angle). Default is vk_shift.
KeyEditSlower The virtual key used to decrease speed of editing (e.g. rotate objects by a smaller angle). Default is vk_control.
KeyIgnoreSnap The virtual key used to ignore grid and angle snapping when they are enabled. Default is vk_alt.
KeyNextEditSpace The virtual key used to switch to the next edit space. Default is vk_space.
KeyNextEditType The virtual key used to switch to the next edit type. Default is vk_tab.
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.
destroy Frees memory used by the struct.
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 © 2024, BlueBurn. Built on April 26, 2024 using GMDoc.