New in 2019.3

This page lists changes in version 2019.3 affecting user-facing APIs. Current C API is now 1.10

  • VRRemoveCallback Ex variants added, this allows you to remove callbacks specific to a piece of user data.

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...
}


No Results.

Getting StartedArchitectureBest PracticesHow ToAdvanced TopicsChangelogvrtreevrtree_cppvtCoreCoreForeign Function InterfaceMetanodesMigrationsObserversPropertiesSettingsTreeUtilitiesAPI DefinitionsVR ExchangePluginsLua API