Editor → User Interface → gizmo_controller.h
ui::gizmo_controller
| Type | Class |
| Namespace | conjure::editor::ui |
| Include File Path | engine/include/conjure/editor/ui/gizmo_controller.h |
| Source File Path | engine/src/editor/ui/gizmo_controller.cpp |
| API ↗ | The editor, The workspace UI |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | gizmo_controller(); |
Important
Additional constructor overloads have been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~gizmo_controller(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | m | bool | false | |
| private | mDragged | std:: | {} | |
| private | mDragging | bool | false | |
| private | m | gizmo_operation | gizmo_ | |
| private | mDragSession | u64 | 0 | |
| private | mLitAxis | std:: | std::nullopt | |
| private | m | u32 | 0 | |
| private | mOperation | gizmo_operation | gizmo_ | |
| private | mOverHandle | bool | false | |
| private | mPivot | math::mat4 | math::mat4(1.0f) | |
| private | m | f32 | 15.0f | |
| private | mSnapScale | f32 | 0.1f | |
| private | m | f32 | 0.5f | |
| private | mSpace | gizmo_space | gizmo_ | |
| private | mUseSnap | bool | false |
Functions
Public
active_operation
active_operation[[nodiscard]] gizmo_operation active_operation() const noexcept;The tool the gizmo draws and edits with: the open drag's, else the one chosen.
apply_delta
apply_deltavoid apply_delta(
editor_context &context,
const math::mat4 &deltaWorld);Applies a delta matrix to the selection as if the gizmo produced it (tests, keyboard nudges): begins the drag when none is open.
draw
drawbool draw(
editor_context &context,
const math::vec2 &rectMin,
const math::vec2 &rectSize);Draws the gizmo for the current selection inside the viewport rectangle and applies the user's manipulation. Call once per frame between ImGui::Begin and End of the viewport window. Returns true in a frame that moved the selection (ImGuizmo reported a manipulation, or a drag's delta was applied).
end_drag
end_dragvoid end_drag(
editor_context &context);Ends an open drag and its undo transaction (the release does it in draw()). When the left mouse button is still down, the drag was cut short (the viewport was hidden, the selection went away): draw() then shows no gizmo until the button is released, so the press that belonged to the ended drag cannot start another one.
highlight
highlight[[nodiscard]] gizmo_highlight highlight(
const editor_context &context) const;The role the gizmo highlights its handles with (theme_applier.h): ACCENT while editing; while playing or paused PERSIST when every entity the gizmo moves has an entity pin of its own (stopping keeps the drag), PLAY otherwise, a field, component or ancestor pin included (stopping keeps only what those pins cover). draw() colours ImGuizmo with it before every draw.
is_dragging
is_dragging[[nodiscard]] bool is_dragging() const noexcept;is_over
is_over[[nodiscard]] bool is_over() const noexcept;True when the last draw() showed the gizmo and the mouse was over one of its handles (the previous frame's hotspot, as ImGuizmo reports it) or a drag is in progress. False after a draw() that showed no gizmo (no frame, no scene, an empty selection, or a cut-short drag whose button is still down), so the viewport can pick again.
lit_axis
lit_axis[[nodiscard]] const std::optional<gizmo_axis> &lit_axis() const noexcept;The axis whose handle the last draw() lit in its hover colour (gizmo_hover_colour): in an edit, the axis handle (or the plane across that axis) ImGuizmo found under the pointer or dragged in its frame before. Nullopt when that was no axis handle, while playing or paused, and after a draw() that showed no gizmo.
manipulation_count
manipulation_count[[nodiscard]] u32 manipulation_count() const noexcept;operation
operation[[nodiscard]] gizmo_operation operation() const noexcept;The tool chosen; the one an open drag uses is active_operation().
set_operation
set_operationvoid set_operation(
gizmo_operation operation) noexcept;Chooses the tool. An open drag keeps the tool it began with until it ends: ImGuizmo finishes a drag only in the handler of its own operation, so switching mid-drag would leave it open (and its undo transaction with it) and make the entity jump when the tool came back.
set_snap
set_snapSnapping and its steps: world units for translate (and universal), degrees for rotate, a factor for scale. The defaults are 0.5, 15 and 0.1 with snapping off; the workspace toolbar's Snap toggle and step field drive it.
set_space
set_spacevoid set_space(
gizmo_space space) noexcept;snap_enabled
snap_enabled[[nodiscard]] bool snap_enabled() const noexcept;snap_rotate_degrees
snap_rotate_degrees[[nodiscard]] f32 snap_rotate_degrees() const noexcept;snap_scale
snap_scale[[nodiscard]] f32 snap_scale() const noexcept;snap_translate
snap_translate[[nodiscard]] f32 snap_translate() const noexcept;space
space[[nodiscard]] gizmo_space space() const noexcept;Private
apply_axis_style
apply_axis_stylevoid apply_axis_style(
gizmo_highlight highlight,
bool wasOver);begin_drag
begin_dragvoid begin_drag(
editor_context &context);gather_selection
gather_selection[[nodiscard]] bool gather_selection(
editor_context &context);