rigImGui 0.1.1
RigKit pack API - rigImGui
Loading...
Searching...
No Matches
PropEditors.h File Reference
#include "ecs/PropertyReflection.h"
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <cstdint>
#include <functional>
#include <string>
#include <variant>
#include <vector>
Include dependency graph for PropEditors.h:

Classes

struct  rigkit::PropCommit
 One committed widget edit: drag released, checkbox toggled, text defocused. More...
struct  rigkit::ScenePropPatchRequest
 Queued "patch this prop into the Node Editor" request. More...
struct  rigkit::ScenePropPatchSource
 One row in the property right-click menu (Sound → Level, and so on). More...
struct  rigkit::ScenePropLfoChoice
 One existing LFO the property menu can wire instead of spawning. More...
struct  rigkit::PropDragSource
 RAII BeginPropDragSource / EndPropDragSource. More...

Typedefs

using rigkit::PropValue
 Value snapshot of one sProp field for undo records.
using rigkit::PropCommitFn = std::function<void(const PropCommit&)>
 Called by RenderProps when an edit commits; hosts push undo records here.

Functions

PropValue rigkit::readPropValue (const sProp &prop)
 Read the field behind prop into a PropValue (unsupported types read as int 0).
void rigkit::writePropValue (const sProp &prop, const PropValue &value)
 Write value back through prop.data when the type alternative matches.
bool rigkit::RenderProps (const char *headerName, std::vector< sProp > &props, uint32_t entityId=kPropDragNoEntity, const PropCommitFn &onCommit={})
 Edit sProp fields with ImGui.
void rigkit::BeginPropDragSource (uint32_t entityId)
 Default entity for offerScenePropDrag(name, type) (nested; last Begin wins).
void rigkit::offerScenePropDrag (uint32_t entityId, const char *propName, int propType, const void *ecsTag=nullptr, float rangeMin=0.f, float rangeMax=1.f, bool hasRange=false)
 Make the last widget's field name a Node Editor drop source.
void rigkit::setScenePropPatchSources (std::vector< ScenePropPatchSource > sources)
 Replace the right-click source list (Sound, and any later groups).
void rigkit::setScenePropLfoChoices (const void *ecsTag, std::vector< ScenePropLfoChoice > choices)
 Replace the existing-LFO list for ecsTag.
void rigkit::requestScenePropPatch (uint32_t entityId, const char *propName, int propType, bool withLfo, const void *ecsTag=nullptr, const char *sourceType=nullptr, const char *sourcePin=nullptr, bool hasMapRange=false, float mapOutMin=0.f, float mapOutMax=1.f, bool unpatch=false, uint32_t reuseLfo=0)
 Queue a patch request (no-op when entityId is kPropDragNoEntity).
std::vector< ScenePropPatchRequest > rigkit::takeScenePropPatchRequests (const void *consumerEcs=nullptr)
 Drain pending patch requests for the editor bound to consumerEcs.

Variables

constexpr uint32_t rigkit::kPropDragNoEntity = 0xFFFFFFFFu
 "No entity" sentinel for the prop-drag API (entt::to_integral(entt::null)).

Typedef Documentation

◆ PropValue

Initial value:
std::variant<bool, int, float, double, std::string, glm::vec2, glm::vec3, glm::vec4>

Value snapshot of one sProp field for undo records.

Int-backed types (int / uint / enum) share the int alternative, matching how the editors write them. Vec4 covers color too.

Function Documentation

◆ BeginPropDragSource()

void rigkit::BeginPropDragSource ( uint32_t entityId)

Default entity for offerScenePropDrag(name, type) (nested; last Begin wins).

Custom panels: PropDragSource src(entityId); then widget + offerScenePropDrag("Width", EPT_INT);. Properties / RenderProps do this for you.

◆ offerScenePropDrag()

void rigkit::offerScenePropDrag ( uint32_t entityId,
const char * propName,
int propType,
const void * ecsTag = nullptr,
float rangeMin = 0.f,
float rangeMax = 1.f,
bool hasRange = false )

Make the last widget's field name a Node Editor drop source.

Overlays the label (right of the value). Drag the name; the number still edits. Hold Alt to drag from the value itself. propName is the GetProperties() / drive-slot name applyRefWrites matches. entityId == kPropDragNoEntity uses BeginPropDragSource.

Parameters
ecsTagOwning ECS (opaque) for multi-scene hosts - see RigScenePropPayload::ecsTag. Null = engine registry.
hasRangeWhen true, Sound patches seed the Map output with rangeMin / rangeMax (the slider limits).

◆ RenderProps()

bool rigkit::RenderProps ( const char * headerName,
std::vector< sProp > & props,
uint32_t entityId = kPropDragNoEntity,
const PropCommitFn & onCommit = {} )

Edit sProp fields with ImGui.

Returns true if any value changed.

Parameters
headerNameCollapsingHeader label; null = draw widgets only.
entityIdWhen not kPropDragNoEntity, each row gets a patch pin (RIG_SCENE_PROP) for the Node Editor - the automatic path for any app using Properties.
onCommitWhen set, fires once per finished edit (a whole drag = one commit) with before/after values - the seam for undo records.

◆ setScenePropLfoChoices()

void rigkit::setScenePropLfoChoices ( const void * ecsTag,
std::vector< ScenePropLfoChoice > choices )

Replace the existing-LFO list for ecsTag.

Pass an empty list when the graph has no LFOs. Other ECS entries stay. The property menu reads this while it is open.

◆ takeScenePropPatchRequests()

std::vector< ScenePropPatchRequest > rigkit::takeScenePropPatchRequests ( const void * consumerEcs = nullptr)

Drain pending patch requests for the editor bound to consumerEcs.

Takes untagged requests plus those tagged with consumerEcs; requests tagged for another ECS stay queued for that editor (multi-deck hosts render one editor per deck). Requests older than a couple frames are dropped either way. Null consumerEcs takes everything (single-editor apps).

Variable Documentation

◆ kPropDragNoEntity

uint32_t rigkit::kPropDragNoEntity = 0xFFFFFFFFu
inlineconstexpr

"No entity" sentinel for the prop-drag API (entt::to_integral(entt::null)).

Entity id 0 is a real entt entity (the first one created), so 0 must NOT be used to mean "none".