9#include "../NodeGraphCore/GlobalTemplateBlackboard.h"
10#include "../system/system_utils.h"
11#include "../json_helper.h"
35 const std::vector<GlobalEntryDefinition>&
globalVars =
gtb.GetAllVariables();
67 const std::vector<GlobalEntryDefinition>&
globalVars =
gtb.GetAllVariables();
163 SYSTEM_LOG <<
"[EntityBlackboard] ERROR: Global variable not found: '" <<
globalKey <<
"'\n";
164 throw std::runtime_error(
"Global variable not found: " +
globalKey);
187 SYSTEM_LOG <<
"[EntityBlackboard] Lazy-synced missing global variable for set: '" <<
globalKey
192 SYSTEM_LOG <<
"[EntityBlackboard] ERROR: Global variable not found for set: '" <<
globalKey <<
"'\n";
193 throw std::runtime_error(
"Global variable not found: " +
globalKey);
273 std::ostringstream
oss;
340 if (!data.is_object())
347 for (
auto it = data.begin();
it != data.end(); ++
it)
349 const std::string&
key =
it.key();
355 SYSTEM_LOG <<
"[EntityBlackboard] WARNING: Global variable '" <<
key <<
"' not found in registry\n";
388 const float x =
valueNode[
"x"].get<
float>();
389 const float y =
valueNode[
"y"].get<
float>();
390 const float z =
valueNode[
"z"].get<
float>();
399 SYSTEM_LOG <<
"[EntityBlackboard] WARNING: Type mismatch for global '" <<
key <<
"'\n";
406 catch (
const std::exception&
e)
408 SYSTEM_LOG <<
"[EntityBlackboard] EXCEPTION importing global '" <<
key <<
"': " <<
e.what() <<
"\n";
ComponentTypeID GetComponentTypeID_Static()
Per-entity instance of global blackboard.
json ExportGlobalsToJson() const
TaskValue GetValueScoped(const std::string &varName) const
void Initialize(const TaskGraphTemplate &tmpl, const std::unordered_map< std::string, TaskValue > *globalOverrides=nullptr)
uint32_t GetEntityID() const
TaskValue GetLocalValue(const std::string &localKey) const
bool HasVariableScoped(const std::string &varName) const
std::string DebugSummary() const
EntityBlackboard(uint32_t entityID=0)
void SetLocalValue(const std::string &localKey, const TaskValue &value)
size_t GetTotalVariableCount() const
std::unordered_map< std::string, VariableType > m_globalTypes
void SetValueScoped(const std::string &varName, const TaskValue &value)
size_t GetLocalVariableCount() const
TaskValue GetGlobalValue(const std::string &globalKey) const
size_t GetGlobalVariableCount() const
bool ImportGlobalsFromJson(const json &data)
std::unordered_map< std::string, TaskValue > m_globalVars
static void ParseScopedName(const std::string &scopedName, std::string &outPrefix, std::string &outName)
bool HasGlobalVariable(const std::string &globalKey) const
bool HasLocalVariable(const std::string &localKey) const
void SetGlobalValue(const std::string &globalKey, const TaskValue &value)
static GlobalTemplateBlackboard & Get()
void Reset()
Resets all variables to their default values.
void Initialize(const TaskGraphTemplate &tmpl)
Initialises the blackboard from a template.
bool HasVariable(const std::string &varName) const
Returns true if a variable with the given name is registered.
void SetValue(const std::string &varName, const TaskValue &value)
Sets the value of a variable.
TaskValue GetValue(const std::string &varName) const
Returns the current value of a variable.
Immutable, shareable task graph asset.
C++14-compliant type-safe value container for task parameters.
int AsInt() const
Returns the int value.
::Vector AsVector() const
Returns the Vector value.
EntityID AsEntityID() const
Returns the EntityID value.
float AsFloat() const
Returns the float value.
bool IsNone() const
Returns true if the value has not been set (type == None).
std::string AsString() const
Returns the string value.
bool AsBool() const
Returns the bool value.
VariableType GetType() const
Returns the VariableType tag of the stored value.
< Provides AssetID and INVALID_ASSET_ID
VariableType
Type tags used by TaskValue to identify stored data.
@ Int
32-bit signed integer
@ Float
Single-precision float.
@ Vector
3-component vector (Vector from vector.h)
@ None
Uninitialized / empty value.
@ EntityID
Entity identifier (uint64_t)
static std::string VariableTypeToString(VariableType type)
Converts a VariableType to its canonical string representation.