rigComponent 0.1.1
RigKit pack API - rigComponent
Loading...
Searching...
No Matches
EntityProperty.h File Reference

Reads and writes reflected entity properties by name. More...

#include <glm/glm.hpp>
#include <optional>
#include <string_view>
#include "ecs/MEcs.h"
#include "ecs/PropertyReflection.h"
Include dependency graph for EntityProperty.h:

Functions

bool rigkit::ecs::writeEntityProperty (MEcs &ecs, entt::entity entity, std::string_view propertyKey, float value)
 Write a reflected float/int/bool property on an entity by name.
bool rigkit::ecs::writeEntityProperty (MEcs &ecs, std::string_view entityName, std::string_view propertyKey, float value)
 Resolve entity by name, then writeEntityProperty.
std::optional< float > rigkit::ecs::readEntityProperty (MEcs &ecs, entt::entity entity, std::string_view propertyKey)
 Read a reflected float (int/bool coerced) if present.
bool rigkit::ecs::writeEntityVec2Property (MEcs &ecs, entt::entity entity, std::string_view propertyKey, glm::vec2 value)
 Write two floats into a vec2 property, or two named float props.
std::optional< sProp > rigkit::ecs::findEntityProperty (MEcs &ecs, entt::entity entity, std::string_view propertyKey)
 Resolve a GetProperties row by propertyKey.
void rigkit::ecs::invalidateEntityPropertyCache ()
 Drop cached GetProperties pointers.

Detailed Description

Reads and writes reflected entity properties by name.

Numeric scalars only, resolved through GetProperties. Dotted contract keys such as position.y map onto the display names the components register.

Function Documentation

◆ findEntityProperty()

std::optional< sProp > rigkit::ecs::findEntityProperty ( MEcs & ecs,
entt::entity entity,
std::string_view propertyKey )

Resolve a GetProperties row by propertyKey.

Same name matching as read/write (dotted aliases, display names). The returned sProp.data points into live component storage.

Returns
Empty when the entity or key does not match a registered field.

◆ invalidateEntityPropertyCache()

void rigkit::ecs::invalidateEntityPropertyCache ( )

Drop cached GetProperties pointers.

Call when reflected data moves (e.g. pullEffectDriveSlots rebuilds driveSlots). The next write re-resolves.

◆ writeEntityProperty()

bool rigkit::ecs::writeEntityProperty ( MEcs & ecs,
entt::entity entity,
std::string_view propertyKey,
float value )

Write a reflected float/int/bool property on an entity by name.

Resolves propertyKey against GetProperties / registered props. Accepts dotted contract keys (position.y to Position Y) and exact prop names.

Returns
True when a matching writable property was found.