API ReferenceGE Extensionsflowgraphnodesuiimguielemental
ImGui Number
- **Node Name:** `im Number`
Overview
- Node Name:
im Number - Category:
repeat_instant - File:
extensions/flowgraph/nodes/ui/imgui/elemental/imNumbers.lua
Displays a numeric input widget in an ImGui window. Supports multiple input modes: Int, Float, SliderInt, SliderFloat, DragInt, DragFloat.
Pin Schema
Input Pins
| Pin | Type | Default | Description |
|---|---|---|---|
set | flow | - | When active, resets value to setVal (hidden) |
setVal | number | 0 | Initial / reset value (hidden, hardcoded) |
min | number | 0 | Minimum for sliders/drags (hidden, hardcoded) |
max | number | 10 | Maximum for sliders/drags (hidden, hardcoded) |
step | number | 1 | Step for inputs, speed for drags (hidden, hardcoded) |
format | string | "%0.2f" | Printf format for floats (hidden, hardcoded) |
power | number | 1 | Power curve for float sliders (hidden, hardcoded) |
text | any | - | Label for the number input |
Output Pins
| Pin | Type | Description |
|---|---|---|
value | number | Current numeric value |
changed | flow (impulse) | Fires when the value changes (hidden) |
Internals
Input Modes
| Mode | ImGui Function | Description |
|---|---|---|
Int | im.InputInt | Integer text input with step buttons |
Float | im.InputFloat | Float text input with step |
SliderInt | im.SliderInt | Integer slider (min–max) |
SliderFloat | im.SliderFloat | Float slider (min–max) |
DragInt | im.DragInt | Integer drag input |
DragFloat | im.DragFloat | Float drag input |
The mode is selected via drawCustomProperties() in the editor and serialized with the node.
Key Methods
| Method | Description |
|---|---|
work() | Initializes value, handles set input, draws the appropriate ImGui widget, clamps to min/max |
drawCustomProperties() | Mode selection combo box |
_onSerialize(res) | Saves mode |
_onDeserialized(data) | Restores mode |
How It Works
- Value initializes to
setValon first frame or whensetflow is active. - Draws the appropriate ImGui widget based on the selected mode.
- Clamps the result to
min/maxif set. - Outputs the current value and fires
changedimpulse when the user modifies it.
Usage Example
-- Flowgraph:
-- [im Begin] → [im Number (text="Speed", mode=SliderFloat, min=0, max=100)]
-- → (value) → [Set Vehicle Speed]
-- → (changed) → [Log Change]
-- Under the hood (SliderFloat mode):
local val = im.FloatPtr(50)
if im.SliderFloat("Speed##42", val, 0, 100, "%0.2f", 1) then
-- value changed
endKey Dependencies
ui_imgui- ImGui bindings (InputInt,InputFloat,SliderInt,SliderFloat,DragInt,DragFloat)
See Also
- im Begin (Flowgraph Node) - Related reference
- im Button (Flowgraph Node) - Related reference
- im Checkbox (Flowgraph Node) - Related reference
- FlowGraph Guide - Guide