add addProperties for Workspace

This commit is contained in:
floralrainfall 2023-07-17 19:28:06 -04:00
parent 73ab158eec
commit a74117d95f
3 changed files with 15 additions and 0 deletions

View File

@ -25,6 +25,7 @@ namespace RNR
Camera* getCurrentCamera() const;
void setCurrentCamera(Camera *value);
private:
virtual void addProperties(std::vector<ReflectionProperty>& properties);
virtual void deserializeProperty(char* prop_name, pugi::xml_node prop);
void buildGeomInstance(Instance* instance);

View File

@ -26,6 +26,8 @@ namespace RNR
std::string ReflectionProperty::toString()
{
if(m_getter(m_object) == 0)
return std::string("NULL");
switch(m_type)
{
case PROPERTY_STD_STRING:

View File

@ -105,4 +105,16 @@ namespace RNR
printf("Workspace::deserializeProperty: camera ref invalid (%s)\n", node.text().as_string());
}
}
void Workspace::addProperties(std::vector<ReflectionProperty>& properties)
{
ReflectionProperty _properties[] = {
{ this, std::string("CurrentCamera"), std::string(""),
ACCESS_NONE, OPERATION_READWRITE, PROPERTY_INSTANCE,
REFLECTION_GETTER(Workspace* instance = (Workspace*)object; return instance->currentCamera.get(); ),
REFLECTION_SETTER(Workspace* instance = (Workspace*)object; instance->setCurrentCamera((Camera*)value); ) },
};
properties.insert(properties.end(), _properties, _properties+(sizeof(_properties)/sizeof(ReflectionProperty)));
}
}