class SceneHandles

Inherits: IScriptExportable, std::enable_shared_from_this<SceneHandles>

The central place for interacting with and drawing handles.

Public

Constructors

SceneHandles

SceneHandles(PrivatelyConstruct, const SPtr<EditorSceneInstance> &scene)

Methods

~SceneHandles

virtual ~SceneHandles() noexcept

BeginInput

void BeginInput()

Triggers handle pre-input callbacks.

Must be called before all updateInput() calls and followed by endInput(). This should be called once per frame.

UpdateInput

bool UpdateInput(const HCamera &camera, const Vector2I &inputPos, const Vector2I &inputDelta)

To be called every frame.

Updates interactable handle sliders based on provided input. Make sure to call beginInput() before this method, followed by endInput() when done.

camera
Camera that the input positions are relative to.
inputPos
Position of the pointer, relative to the provided camera viewport.
inputDelta
Determines pointer movement since last call to this method.

Returns: True if handle slider hover state changed, false otherwise.

EndInput

void EndInput()

Triggers handle post-input callbacks.

Must be called after all updateInput() calls and after beginInput(). This should be called once per frame.

Draw

virtual void Draw(const HCamera &camera)

Gathers all handles in the scene submits them for drawing from the provided camera's perspective.

TrySelect

bool TrySelect(const HCamera &camera, const Vector2I &inputPos)

Select a handle slider at the specified location, if there is any under the pointer.

Makes the selected slider active and draggable.

camera
Camera that the input positions are relative to, and destination to draw the handles to.
inputPos
Position of the pointer, relative to the provided camera viewport.

Returns: True if handle slider active state changed, false otherwise.

ClearSelection

void ClearSelection(const HCamera &camera)

Clears the currently selected/active handle slider for the specified camera.

IsHandleActive

bool IsHandleActive(const HCamera &camera) const

Is any handle slider selected/active on the specified camera.

GetHandleSize

float GetHandleSize(const HCamera &camera, const Vector3 &handlePos) const

Returns the uniform size for a handle rendered in , at the world position .

The handles will be scaled so that they appear the same size regardless of distance from camera.

SetDefaultHandleSize

void SetDefaultHandleSize(float value)

Sets the default handle size.

This controls the uniform scale returned from getHandleSize() method.

SetSettings

void SetSettings(const SPtr<EditorSettings> &settings)

Sets editor settings that will be used for controlling various handle behaviour.

staticCreate

static SPtr<SceneHandles> Create(const SPtr<EditorSceneInstance> &scene)

Creates a new scene handles object associated with the provided scene.

Internal

Methods

GetSliderManager

HandleSliderManager &GetSliderManager() const

Returns the manager that can be used for interacting with handle sliders.

staticSetFactory

static void SetFactory(const SPtr<SceneHandlesFactory> &factory)

Sets the object that will be used for creating now SceneHandles objects when Create() is called.

If null is provided, then Create() will output default SceneHandles object types.

Protected

Methods

GetDrawHelper

DrawHelper &GetDrawHelper() const

Returns an object that converts draw commands into meshes that will be drawn.

UpdateFromEditorSettings

void UpdateFromEditorSettings()

Updates the internal properties from editor settings.

TriggerPreInput

virtual void TriggerPreInput() = 0

Called during handle update.

Allows handle sliders to be created or destroyed before any input is handled.

TriggerPostInput

virtual void TriggerPostInput() = 0

Called during handle update after handle input is processed.

Allows implementation to respond to delta values calculated in sliders due to input.

QueueDrawCommands

virtual void QueueDrawCommands()

Queues handle draw commands from all the registered handles.

To be implemented by base classes.

Fields

mSliderManager

HandleSliderManager * mSliderManager

mDefaultHandleSize

float mDefaultHandleSize

mInputStarted

bool mInputStarted

mSettings

SPtr<EditorSettings> mSettings

mSettingsHash

u32 mSettingsHash

mLastDrawFrameIndex

u64 mLastDrawFrameIndex

mActiveMeshes

Vector<Vector<DrawHelper::ShapeMeshData>> mActiveMeshes

mLastFrameIndex

u64 mLastFrameIndex

mRenderer

mDrawHelper

DrawHelper * mDrawHelper