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
Name="Properties"
Name="PropertiesV2"
>
<File
RelativePath=".\src\source\Properties\BoolProperty.cpp"
RelativePath=".\src\source\PropertiesV2\BaseProperty.cpp"
>
</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>
</Filter>
@@ -960,14 +968,22 @@
</Filter>
</Filter>
<Filter
Name="Properties"
Name="PropertiesV2"
>
<File
RelativePath=".\src\include\Properties\BoolProperty.h"
RelativePath=".\src\include\PropertiesV2\BaseProperty.h"
>
</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>
</Filter>

View File

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

View File

@@ -16,6 +16,7 @@ public:
bool nameShown;
bool controllerFlagShown;
Enum::Controller::Value controller;
virtual void makeJoints();
protected:
CoordinateFrame cFrame;
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)
{

View File

@@ -90,6 +90,15 @@ std::vector<PROPGRIDITEM> PVInstance::getProperties()
return properties;
}
void PVInstance::makeJoints()
{
for(size_t i = 0; i < children.size(); i++)
{
}
}
void PVInstance::PropUpdate(LPPROPGRIDITEM &pItem)
{
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();
}