typedef struct MyManager_
{
uint32_t property;
void (*translate)(HNode vrNode, const char* text);
} MyManager;
void onValuesChanged(HNode node, void* userData)
{
MyManager* manager = (MyManager*)userData;
size_t length = VRGetPropertyValueSizeEx(node, manager->property);
auto text = (char*)malloc(length);
VRGetPropertyStringEx(node, manager->property, text, length);
if(manager->translate && length > 0)
manager->translate(node, text);
free(text);
}
void init(const char* metaName, MyManager* manager)
{
VRAddCallbackNodeValuesChanged(metaName, &onValuesChanged, manager);
}
void release(const char* metaName, MyManager* manager)
{
VRRemoveCallbackNodeValuesChangedEx(metaName, &onValuesChanged, manager);
}
using namespace vrtree;
using namespace vrtree_cpp;
struct MyManager2
: public NodeManager
{
MyManager2()
{
registerObserver(Meta_MetaDataString::Name());
registerUpdateable();
}
~MyManager2()
{
unRegisterObserver(Meta_MetaDataString::Name());
unRegisterUpdateable();
}
void update(double deltaTime) override
{
//TODO: do stuff every step
}
void nodeValuesChanged(HNodeR& node) override
{
//TODO: respond to stuff
}
// More functions avaliable to override in NodeManager class...
}