Added properties

This commit is contained in:
Vulpovile
2022-10-22 08:47:07 -07:00
parent 0b8847cd8e
commit ec0ae415f7
9 changed files with 46 additions and 60 deletions

View File

@@ -675,14 +675,22 @@
</Filter> </Filter>
</Filter> </Filter>
<Filter <Filter
Name="Properties" Name="PropertiesV2"
> >
<File <File
RelativePath=".\src\source\Properties\BoolProperty.cpp" RelativePath=".\src\source\PropertiesV2\BaseProperty.cpp"
> >
</File> </File>
<File <File
RelativePath=".\src\source\Properties\Property.cpp" RelativePath=".\src\source\PropertiesV2\BoolProperty.cpp"
>
</File>
<File
RelativePath=".\src\source\PropertiesV2\Property.cpp"
>
</File>
<File
RelativePath=".\src\source\PropertiesV2\StringProperty.cpp"
> >
</File> </File>
</Filter> </Filter>
@@ -960,14 +968,22 @@
</Filter> </Filter>
</Filter> </Filter>
<Filter <Filter
Name="Properties" Name="PropertiesV2"
> >
<File <File
RelativePath=".\src\include\Properties\BoolProperty.h" RelativePath=".\src\include\PropertiesV2\BaseProperty.h"
> >
</File> </File>
<File <File
RelativePath=".\src\include\Properties\Property.h" RelativePath=".\src\include\PropertiesV2\BoolProperty.h"
>
</File>
<File
RelativePath=".\src\include\PropertiesV2\Property.h"
>
</File>
<File
RelativePath=".\src\include\PropertiesV2\StringProperty.h"
> >
</File> </File>
</Filter> </Filter>

View File

@@ -1,6 +1,7 @@
#pragma once #pragma once
#include <G3DAll.h> #include <G3DAll.h>
#include "propertyGrid.h" #include "propertyGrid.h"
#include "PropertiesV2/StringProperty.h"
#include "map" #include "map"
class Instance class Instance
@@ -26,12 +27,18 @@ public:
void clearChildren(); void clearChildren();
Instance* getParent(); Instance* getParent();
virtual Instance* clone() const { return new Instance(*this); } virtual Instance* clone() const { return new Instance(*this); }
//Deprecated
virtual std::vector<PROPGRIDITEM> getProperties(); virtual std::vector<PROPGRIDITEM> getProperties();
//Deprecated
virtual void PropUpdate(LPPROPGRIDITEM &pItem); virtual void PropUpdate(LPPROPGRIDITEM &pItem);
virtual std::vector<BaseProperty> collectProperties();
int listicon; int listicon;
protected: protected:
std::string className; std::string className;
Instance* parent; // Another pointer. Instance* parent; // Another pointer.
//Deprecated
PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[] = NULL); PROPGRIDITEM createPGI(LPSTR catalog, LPSTR propName, LPSTR propDesc, LPARAM curVal, INT type, TCHAR choices[] = NULL);
private: private:
static const std::map<std::string, Instance> g_logLevelsDescriptions; static const std::map<std::string, Instance> g_logLevelsDescriptions;

View File

@@ -16,6 +16,7 @@ public:
bool nameShown; bool nameShown;
bool controllerFlagShown; bool controllerFlagShown;
Enum::Controller::Value controller; Enum::Controller::Value controller;
virtual void makeJoints();
protected: protected:
CoordinateFrame cFrame; CoordinateFrame cFrame;
static G3D::Color3 getControllerColor(int controller) static G3D::Color3 getControllerColor(int controller)

View File

@@ -1,12 +0,0 @@
#pragma once
#include "Property.h"
class BoolProperty : public Property<bool>
{
public:
BoolProperty(std::string name, bool& value, Instance& owner)
{
Property<bool>(name, value, owner);
}
~BoolProperty(void);
PROPGRIDITEM getPropGridItem();
};

View File

@@ -1,30 +0,0 @@
#pragma once
#include "DataModelV2/Instance.h"
#include <string>
class Instance;
template <typename T>
class Property
{
public:
Property(std::string name, T& value, Instance& owner)
{
_value = value;
_owner = owner;
}
~Property(void);
const T getValue()
{
return _value;
}
const void setValue(T val)
{
_value = val;
}
virtual PROPGRIDITEM getPropGridItem();
void setProperty(LPPROPGRIDITEM item);
protected:
Instance* _owner;
std::string _name;
T* _value;
};

View File

@@ -80,6 +80,13 @@ std::vector<PROPGRIDITEM> Instance::getProperties()
} }
std::vector<BaseProperty> Instance::collectProperties()
{
std::vector<BaseProperty> properties;
properties.push_back(StringProperty("Name", "The name of this instance", "Properties", name, this, &Instance::setName));
return properties;
}
Instance::~Instance(void) Instance::~Instance(void)
{ {

View File

@@ -90,6 +90,15 @@ std::vector<PROPGRIDITEM> PVInstance::getProperties()
return properties; return properties;
} }
void PVInstance::makeJoints()
{
for(size_t i = 0; i < children.size(); i++)
{
}
}
void PVInstance::PropUpdate(LPPROPGRIDITEM &pItem) void PVInstance::PropUpdate(LPPROPGRIDITEM &pItem)
{ {
if(strcmp(pItem->lpszPropName, "NameShown") == 0) if(strcmp(pItem->lpszPropName, "NameShown") == 0)

View File

@@ -1,5 +0,0 @@
//#include "Properties/BoolProperty.h"
//PROPGRIDITEM BoolProperty::getPropGridItem()
//{
//return PROPGRIDITEM();
//}

View File

@@ -1,7 +0,0 @@
#include "Properties/Property.h"
template <typename T>
void Property<T>::setProperty(LPPROPGRIDITEM item)
{
_owner->propertiesChanged();
}