Open 3D Engine WhiteBox Gem API Reference 26.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
WhiteBox::NumericInputState Struct Reference

#include <WhiteBoxNumericInput.h>

Public Member Functions

void Begin (NumericOpMode mode)
 
void SetAxis (NumericAxisConstraint axis)
 
void AppendDigit (char digit)
 
void AppendDecimal ()
 
void AppendOperator (char op)
 
void Backspace ()
 
void Reset ()
 
bool IsActive () const
 
bool IsEmpty () const
 Returns true if no digits have been entered yet (expression is empty).
 
float GetValue () const
 Evaluates the expression and returns the result.
 
AZ::Vector3 GetAxisVector () const
 
AZStd::string GetStatusText () const
 

Public Attributes

NumericOpMode m_mode = NumericOpMode::None
 
NumericAxisConstraint m_axis = NumericAxisConstraint::Free
 
AZStd::string m_lhs
 First operand (left-hand side)
 
char m_op = '\0'
 Binary operator: '\0', '+', '-', '*', '/'.
 
AZStd::string m_rhs
 Second operand (right-hand side)
 
bool m_active = false
 

Detailed Description

Tracks the state of a Blender-style numeric input session.

Supports simple two-operand expressions: lhs [op] rhs e.g. "5" -> 5 "-5" -> -5 "10*2" -> 20 "10/4" -> 2.5 "3+2" -> 5 "10-3" -> 7

Member Function Documentation

◆ AppendOperator()

void WhiteBox::NumericInputState::AppendOperator ( char  op)
inline

Handle an operator key: + - * / Rules:

  • leading '-' when nothing typed yet -> start a negative number
  • leading '+' when nothing typed yet -> no-op (already positive)
  • any operator after the first operand -> record it and start the rhs buffer
  • pressing the same operator again -> cancel it (back to lhs editing) Handle an operator key: + - * /

Leading '-' -> start a negative first operand (e.g. "-5"). Leading '+' -> no-op (already positive). Leading '*' or '/' -> implicit LHS of "1" (so "*2" = 1x2 = 2; "/4" = 1/4 = 0.25). This lets you type J *2 Enter to scalex2, or J /2 Enter to scalex0.5. After a first operand is complete -> set the binary operator and start the RHS. Pressing the same operator again -> cancel it (back to LHS editing). Pressing a different operator while RHS is empty -> change operator.

◆ GetStatusText()

AZStd::string WhiteBox::NumericInputState::GetStatusText ( ) const
inline

Status string suitable for a viewport overlay. Example: "Move X: 5*2_" or "Rotate: 90_" or "Scale: -0.5_"


The documentation for this struct was generated from the following file: