Compare commits
5 Commits
Modnark
...
feature/pr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71b75d583c | ||
|
|
fc9e953554 | ||
|
|
78f135732e | ||
|
|
793e85a57f | ||
|
|
ec0ae415f7 |
@@ -509,10 +509,6 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV2\RunServiceInstance.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\DataModelV2\SelectionService.cpp"
|
||||
>
|
||||
@@ -679,14 +675,26 @@
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Properties"
|
||||
Name="PropertiesV2"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\source\Properties\BoolProperty.cpp"
|
||||
RelativePath=".\src\source\PropertiesV2\BoolProperty.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\Properties\Property.cpp"
|
||||
RelativePath=".\src\source\PropertiesV2\Color3Property.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\PropertiesV2\Property.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\PropertiesV2\StringProperty.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\source\PropertiesV2\Vector3Property.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
@@ -906,10 +914,6 @@
|
||||
RelativePath=".\src\include\DataModelV2\PVInstance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV2\RunServiceInstance.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\DataModelV2\SelectionService.h"
|
||||
>
|
||||
@@ -968,14 +972,26 @@
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Properties"
|
||||
Name="PropertiesV2"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\include\Properties\BoolProperty.h"
|
||||
RelativePath=".\src\include\PropertiesV2\BoolProperty.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\Properties\Property.h"
|
||||
RelativePath=".\src\include\PropertiesV2\Color3Property.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\PropertiesV2\Property.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\PropertiesV2\StringProperty.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\PropertiesV2\Vector3Property.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
@@ -987,6 +1003,14 @@
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="B3DEnum"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\src\include\Enum\B3DEnum.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include "XplicitNgine/XplicitNgine.h"
|
||||
#include "SoundService.h"
|
||||
#include "LightingInstance.h"
|
||||
#include "RunServiceInstance.h"
|
||||
|
||||
// Libraries
|
||||
#include "rapidxml/rapidxml.hpp"
|
||||
@@ -39,7 +38,6 @@ public:
|
||||
ThumbnailGeneratorInstance* getThumbnailGenerator();
|
||||
SoundService* getSoundService();
|
||||
LightingInstance* getLighting();
|
||||
RunService* getRunService();
|
||||
|
||||
std::string message;
|
||||
std::string _loadedFileName;
|
||||
@@ -49,7 +47,7 @@ public:
|
||||
SelectionService* getSelectionService();
|
||||
PartInstance* makePart();
|
||||
void clearLevel();
|
||||
void toggleRun(bool doRun);
|
||||
void toggleRun();
|
||||
bool isRunning();
|
||||
void resetEngine();
|
||||
#if _DEBUG
|
||||
@@ -74,8 +72,6 @@ private:
|
||||
XplicitNgine* xplicitNgine;
|
||||
SoundService* soundService;
|
||||
LightingInstance* lightingInstance;
|
||||
RunService* runService;
|
||||
|
||||
bool running;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include <G3DAll.h>
|
||||
#include "propertyGrid.h"
|
||||
#include "PropertiesV2/StringProperty.h"
|
||||
#include "PropertiesV2/BoolProperty.h"
|
||||
#include "map"
|
||||
|
||||
class Instance
|
||||
@@ -26,12 +28,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<Property *> 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;
|
||||
|
||||
@@ -13,9 +13,13 @@ public:
|
||||
virtual void postRender(RenderDevice* rd);
|
||||
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||
virtual std::vector<Property*> collectProperties();
|
||||
bool nameShown;
|
||||
bool controllerFlagShown;
|
||||
Enum::Controller::Value controller;
|
||||
virtual void makeJoints();
|
||||
virtual void setNameShown(bool nameShown);
|
||||
virtual void setControllerFlagShown(bool controllerFlagShown);
|
||||
protected:
|
||||
CoordinateFrame cFrame;
|
||||
static G3D::Color3 getControllerColor(int controller)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
#include "PVInstance.h"
|
||||
#include "Enum.h"
|
||||
#include "PropertiesV2/Color3Property.h"
|
||||
#include "PropertiesV2/Vector3Property.h"
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
@@ -59,6 +61,7 @@ public:
|
||||
//Setters
|
||||
void setParent(Instance* parent);
|
||||
void setPosition(Vector3);
|
||||
void setColor(Color3 color);
|
||||
void setVelocity(Vector3);
|
||||
void setRotVelocity(Vector3);
|
||||
void setCFrame(CoordinateFrame);
|
||||
@@ -83,6 +86,7 @@ public:
|
||||
//Properties
|
||||
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||
virtual std::vector<Property *> collectProperties();
|
||||
private:
|
||||
bool anchored;
|
||||
Vector3 position;
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
#include "Instance.h"
|
||||
|
||||
class RunService :
|
||||
public Instance
|
||||
{
|
||||
public:
|
||||
RunService(void);
|
||||
~RunService(void);
|
||||
|
||||
void run();
|
||||
void pause();
|
||||
void reset();
|
||||
};
|
||||
@@ -12,4 +12,3 @@ public:
|
||||
void zoomToExtents();
|
||||
std::vector<PartInstance *> partObjects;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
namespace Enum
|
||||
{
|
||||
@@ -7,6 +9,30 @@ namespace Enum
|
||||
enum Value {
|
||||
Smooth = 0, Bumps = 1, Hinge = 2, Motor = 3, StepperMotor = 4, Spawn = 5
|
||||
};
|
||||
static std::pair<std::string, Value> map_data[] = {
|
||||
std::make_pair("Smooth", Smooth),
|
||||
std::make_pair("Bumps", Bumps),
|
||||
std::make_pair("Hinge", Hinge),
|
||||
std::make_pair("Motor", Motor),
|
||||
std::make_pair("StepperMotor", StepperMotor),
|
||||
std::make_pair("Spawn", Spawn)
|
||||
};
|
||||
static std::map<std::string, Value> nameMap(map_data,
|
||||
map_data + sizeof map_data / sizeof map_data[0]);
|
||||
|
||||
static Value getByName(std::string name) {
|
||||
if(nameMap.find(name) != nameMap.end()){
|
||||
return nameMap[name];
|
||||
}
|
||||
return Smooth;
|
||||
}
|
||||
|
||||
static std::string getName(Value value) {
|
||||
for (std::map<std::string, Value>::iterator it = nameMap.begin(); it != nameMap.end(); ++it)
|
||||
if (it->second == value)
|
||||
return it->first;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
namespace Shape
|
||||
{
|
||||
|
||||
24
src/include/Enum/B3DEnum.h
Normal file
24
src/include/Enum/B3DEnum.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
namespace Enum
|
||||
{
|
||||
class B3DEnum {
|
||||
public:
|
||||
B3DEnum(int id, std::string name)
|
||||
{
|
||||
this->id = id;
|
||||
this->name = name;
|
||||
}
|
||||
const int getId() {
|
||||
return id;
|
||||
}
|
||||
const std::string getName() {
|
||||
return name;
|
||||
}
|
||||
virtual B3DEnum getByName(std::string name);
|
||||
virtual B3DEnum getById(int id);
|
||||
private:
|
||||
int id;
|
||||
std::string name;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
};
|
||||
@@ -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;
|
||||
};
|
||||
23
src/include/PropertiesV2/BoolProperty.h
Normal file
23
src/include/PropertiesV2/BoolProperty.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "Property.h"
|
||||
|
||||
class BoolProperty : public Property
|
||||
{
|
||||
public:
|
||||
typedef void (Instance::*instanceSetter)(bool);
|
||||
//Win32 why
|
||||
~BoolProperty(void);
|
||||
BoolProperty(LPSTR name, LPSTR desc, LPSTR catalog, bool value, Instance * owner, instanceSetter setterFunc)
|
||||
:Property(name, desc, catalog, (void*)value, owner)
|
||||
{
|
||||
this->setterFunc = setterFunc;
|
||||
}
|
||||
const void setValue(bool val){
|
||||
(_owner->*setterFunc)(val);
|
||||
_value = (void *)val;
|
||||
}
|
||||
PROPGRIDITEM getPropGridItem();
|
||||
void setProperty(LPPROPGRIDITEM &pItem);
|
||||
private:
|
||||
instanceSetter setterFunc;
|
||||
};
|
||||
24
src/include/PropertiesV2/Color3Property.h
Normal file
24
src/include/PropertiesV2/Color3Property.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "Property.h"
|
||||
|
||||
class Color3Property : public Property
|
||||
{
|
||||
public:
|
||||
typedef void (Instance::*instanceSetter)(Color3);
|
||||
~Color3Property(void){};
|
||||
Color3Property(LPSTR name, LPSTR desc, LPSTR catalog, Color3 value, Instance * owner, instanceSetter setterFunc)
|
||||
:Property(name, desc, catalog, &_value, owner)
|
||||
{
|
||||
this->_value = value;
|
||||
this->setterFunc = setterFunc;
|
||||
}
|
||||
const void setValue(Color3 val){
|
||||
(_owner->*setterFunc)(val);
|
||||
_value = val;
|
||||
}
|
||||
PROPGRIDITEM getPropGridItem();
|
||||
void setProperty(LPPROPGRIDITEM &pItem);
|
||||
private:
|
||||
Color3 _value;
|
||||
instanceSetter setterFunc;
|
||||
};
|
||||
38
src/include/PropertiesV2/Property.h
Normal file
38
src/include/PropertiesV2/Property.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include <G3DAll.h>
|
||||
#include "propertyGrid.h"
|
||||
|
||||
class Instance;
|
||||
|
||||
class Property
|
||||
{
|
||||
public:
|
||||
Property(LPSTR name, LPSTR desc, LPSTR catalog, Instance * owner){
|
||||
_name = name;
|
||||
_desc = desc;
|
||||
_catalog = catalog;
|
||||
_owner = owner;
|
||||
}
|
||||
Property(LPSTR name, LPSTR desc, LPSTR catalog, void* value, Instance * owner){
|
||||
_name = name;
|
||||
_desc = desc;
|
||||
_catalog = catalog;
|
||||
_owner = owner;
|
||||
_value = value;
|
||||
}
|
||||
~Property(void){}
|
||||
const void* getValue() {
|
||||
return _value;
|
||||
}
|
||||
const LPSTR getName() {
|
||||
return _name;
|
||||
}
|
||||
virtual PROPGRIDITEM getPropGridItem();
|
||||
virtual void setProperty(LPPROPGRIDITEM &pItem);
|
||||
protected:
|
||||
Instance* _owner;
|
||||
LPSTR _name;
|
||||
LPSTR _desc;
|
||||
LPSTR _catalog;
|
||||
void* _value;
|
||||
};
|
||||
24
src/include/PropertiesV2/StringProperty.h
Normal file
24
src/include/PropertiesV2/StringProperty.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "Property.h"
|
||||
|
||||
class StringProperty : public Property
|
||||
{
|
||||
public:
|
||||
typedef void (Instance::*instanceSetter)(std::string);
|
||||
~StringProperty(void){};
|
||||
StringProperty(LPSTR name, LPSTR desc, LPSTR catalog, std::string value, Instance * owner, instanceSetter setterFunc)
|
||||
:Property(name, desc, catalog, &_value, owner)
|
||||
{
|
||||
this->_value = value;
|
||||
this->setterFunc = setterFunc;
|
||||
}
|
||||
const void setValue(std::string val){
|
||||
(_owner->*setterFunc)(val);
|
||||
_value = val;
|
||||
}
|
||||
PROPGRIDITEM getPropGridItem();
|
||||
void setProperty(LPPROPGRIDITEM &pItem);
|
||||
private:
|
||||
std::string _value;
|
||||
instanceSetter setterFunc;
|
||||
};
|
||||
26
src/include/PropertiesV2/Vector3Property.h
Normal file
26
src/include/PropertiesV2/Vector3Property.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include "Property.h"
|
||||
#include <sstream>
|
||||
|
||||
class Vector3Property : public Property
|
||||
{
|
||||
public:
|
||||
typedef void (Instance::*instanceSetter)(Vector3);
|
||||
~Vector3Property(void){};
|
||||
Vector3Property(LPSTR name, LPSTR desc, LPSTR catalog, Vector3 value, Instance * owner, instanceSetter setterFunc)
|
||||
:Property(name, desc, catalog, &_value, owner)
|
||||
{
|
||||
this->_value = value;
|
||||
this->setterFunc = setterFunc;
|
||||
}
|
||||
const void setValue(Vector3 val){
|
||||
(_owner->*setterFunc)(val);
|
||||
_value = val;
|
||||
}
|
||||
PROPGRIDITEM getPropGridItem();
|
||||
void setProperty(LPPROPGRIDITEM &pItem);
|
||||
private:
|
||||
Vector3 _value;
|
||||
std::string stringRep;
|
||||
instanceSetter setterFunc;
|
||||
};
|
||||
@@ -15,4 +15,5 @@ private:
|
||||
HWND _explorerComboBox;
|
||||
void _resize();
|
||||
void clearExplorer();
|
||||
void deleteProperties();
|
||||
};
|
||||
@@ -192,8 +192,6 @@ void Application::onInit() {
|
||||
tool = new Tool();
|
||||
// Called before Application::run() beings
|
||||
cameraController.setFrame(Vector3(0,2,10));
|
||||
cameraController.Zoom(-1);
|
||||
|
||||
_dataModel = new DataModelInstance();
|
||||
_dataModel->setParent(NULL);
|
||||
_dataModel->setName("undefined");
|
||||
|
||||
@@ -25,10 +25,7 @@ DataModelInstance::DataModelInstance(void)
|
||||
workspace = new WorkspaceInstance();
|
||||
guiRoot = new GuiRootInstance();
|
||||
level = new LevelInstance();
|
||||
runService = new RunService();
|
||||
|
||||
//thumbnailGenerator = new ThumbnailGeneratorInstance();
|
||||
|
||||
thumbnailGenerator = new ThumbnailGeneratorInstance();
|
||||
soundService = new SoundService();
|
||||
lightingInstance = new LightingInstance();
|
||||
|
||||
@@ -70,10 +67,9 @@ XplicitNgine * DataModelInstance::getEngine()
|
||||
return xplicitNgine;
|
||||
}
|
||||
|
||||
// Please use RunService->run(); & RunService->pause(); instead
|
||||
void DataModelInstance::toggleRun(bool doRun)
|
||||
void DataModelInstance::toggleRun()
|
||||
{
|
||||
running = doRun;
|
||||
running = !running;
|
||||
//if(!running)
|
||||
//resetEngine();
|
||||
}
|
||||
@@ -94,6 +90,7 @@ void DataModelInstance::modXMLLevel(float modY)
|
||||
_modY += modY;
|
||||
clearLevel();
|
||||
debugGetOpen();
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -645,7 +642,6 @@ void DataModelInstance::drawMessage(RenderDevice* rd)
|
||||
}
|
||||
}
|
||||
|
||||
// Instance getters
|
||||
WorkspaceInstance* DataModelInstance::getWorkspace()
|
||||
{
|
||||
return workspace;
|
||||
@@ -679,9 +675,4 @@ SoundService* DataModelInstance::getSoundService()
|
||||
LightingInstance* DataModelInstance::getLighting()
|
||||
{
|
||||
return lightingInstance;
|
||||
}
|
||||
|
||||
RunService* DataModelInstance::getRunService()
|
||||
{
|
||||
return runService;
|
||||
}
|
||||
@@ -80,6 +80,13 @@ std::vector<PROPGRIDITEM> Instance::getProperties()
|
||||
}
|
||||
|
||||
|
||||
std::vector<Property *> Instance::collectProperties()
|
||||
{
|
||||
std::vector<Property *> properties;
|
||||
properties.push_back(new StringProperty("Name", "The name of this instance", "Properties", name, this, &Instance::setName));
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
Instance::~Instance(void)
|
||||
{
|
||||
|
||||
@@ -183,26 +183,26 @@ void LevelInstance::winCondition()
|
||||
{
|
||||
DataModelInstance* DataModel = (DataModelInstance*)getParent(); //If level parent gets changed to something other than Datamodel it could cause nasty data corruption bugs
|
||||
DataModel->setMessage(winMessage);
|
||||
DataModel->getRunService()->pause();
|
||||
DataModel->toggleRun();
|
||||
}
|
||||
|
||||
void LevelInstance::loseCondition()
|
||||
{
|
||||
DataModelInstance* DataModel = (DataModelInstance*)getParent();
|
||||
DataModel->setMessage(loseMessage);
|
||||
DataModel->getRunService()->pause();
|
||||
DataModel->toggleRun();
|
||||
}
|
||||
|
||||
void LevelInstance::pauseCondition()
|
||||
{
|
||||
DataModelInstance* DataModel = (DataModelInstance*)getParent();
|
||||
DataModel->getRunService()->pause();
|
||||
DataModel->toggleRun();
|
||||
}
|
||||
|
||||
void LevelInstance::drawCondition()
|
||||
{
|
||||
DataModelInstance* DataModel = (DataModelInstance*)getParent();
|
||||
DataModel->getRunService()->pause();
|
||||
DataModel->toggleRun();
|
||||
}
|
||||
|
||||
void LevelInstance::Step(SimTime sdt)
|
||||
|
||||
@@ -63,6 +63,33 @@ static Enum::Controller::Value strEnum(TCHAR * tval)
|
||||
}
|
||||
|
||||
|
||||
std::vector<Property *> PVInstance::collectProperties()
|
||||
{
|
||||
std::vector<Property *> properties = Instance::collectProperties();
|
||||
properties.push_back(new BoolProperty(
|
||||
"NameShown",
|
||||
"This chooses whether the item name is shown",
|
||||
"Item",
|
||||
nameShown,
|
||||
this,
|
||||
(BoolProperty::instanceSetter)&PVInstance::setNameShown));
|
||||
properties.push_back(new BoolProperty(
|
||||
"ControllerFlagShown",
|
||||
"This chooses whether the item's ControllerFlag is shown",
|
||||
"Item",
|
||||
controllerFlagShown,
|
||||
this,
|
||||
(BoolProperty::instanceSetter)&PVInstance::setControllerFlagShown));
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
||||
void PVInstance::setNameShown(bool nameShown){
|
||||
this->nameShown = nameShown;
|
||||
}
|
||||
void PVInstance::setControllerFlagShown(bool controllerFlagShown){
|
||||
this->controllerFlagShown = controllerFlagShown;
|
||||
}
|
||||
|
||||
std::vector<PROPGRIDITEM> PVInstance::getProperties()
|
||||
{
|
||||
@@ -90,6 +117,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)
|
||||
|
||||
@@ -674,6 +674,49 @@ void PartInstance::PropUpdate(LPPROPGRIDITEM &item)
|
||||
else PVInstance::PropUpdate(item);
|
||||
}
|
||||
|
||||
void PartInstance::setColor(Color3 color)
|
||||
{
|
||||
this->color = color;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
std::vector<Property *> PartInstance::collectProperties()
|
||||
{
|
||||
std::vector<Property *> properties = PVInstance::collectProperties();
|
||||
properties.push_back(new Color3Property(
|
||||
"Color3",
|
||||
"The color of the selected part",
|
||||
"Properties",
|
||||
color,
|
||||
this,
|
||||
(Color3Property::instanceSetter)&PartInstance::setColor));
|
||||
|
||||
properties.push_back(new BoolProperty(
|
||||
"Anchored",
|
||||
"Whether the block can move or not",
|
||||
"Item",
|
||||
anchored,
|
||||
this,
|
||||
(BoolProperty::instanceSetter)&PartInstance::setAnchored));
|
||||
|
||||
properties.push_back(new Vector3Property(
|
||||
"Offset",
|
||||
"The position of the object in the workspace",
|
||||
"Item",
|
||||
position,
|
||||
this,
|
||||
(Vector3Property::instanceSetter)&PartInstance::setPosition));
|
||||
|
||||
properties.push_back(new Vector3Property(
|
||||
"Size",
|
||||
"The size of the object in the workspace",
|
||||
"Item",
|
||||
size,
|
||||
this,
|
||||
(Vector3Property::instanceSetter)&PartInstance::setSize));
|
||||
return properties;
|
||||
}
|
||||
|
||||
// This needs to be changed, buffer size of 12 is way too small
|
||||
// Crash occurs if you put a huge number in
|
||||
char changeTimerTxt[12];
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#include "DataModelV2/RunServiceInstance.h"
|
||||
#include "DataModelV2/ToggleImageButtonInstance.h"
|
||||
#include "Globals.h"
|
||||
|
||||
RunService::RunService()
|
||||
{
|
||||
// Run Service, not RunService, because Roblox themselves did it. Why? IDK!
|
||||
name = "Run Service";
|
||||
className = "RunService";
|
||||
canDelete = false;
|
||||
}
|
||||
|
||||
RunService::~RunService(void)
|
||||
{
|
||||
}
|
||||
|
||||
void RunService::run()
|
||||
{
|
||||
// Tell GUI that we are running
|
||||
Instance* go = g_dataModel->getGuiRoot()->findFirstChild("go");
|
||||
g_dataModel->toggleRun(true);
|
||||
((ToggleImageButtonInstance*)go)->checked = true;
|
||||
}
|
||||
|
||||
void RunService::pause()
|
||||
{
|
||||
// Tell GUI that we paused
|
||||
Instance* go = g_dataModel->getGuiRoot()->findFirstChild("go");
|
||||
g_dataModel->toggleRun(false);
|
||||
((ToggleImageButtonInstance*)go)->checked = false;
|
||||
}
|
||||
|
||||
void RunService::reset()
|
||||
{
|
||||
// Can't really implement right now
|
||||
}
|
||||
@@ -6,12 +6,8 @@ void MenuButtonListener::onButton1MouseClick(BaseButtonInstance* button)
|
||||
{
|
||||
if(button->name == "go")
|
||||
{
|
||||
bool isRunning = g_dataModel->isRunning();
|
||||
if(isRunning)
|
||||
g_dataModel->getRunService()->pause();
|
||||
else
|
||||
g_dataModel->getRunService()->run();
|
||||
//((ToggleImageButtonInstance*)button)->checked = !isRunning;
|
||||
g_dataModel->toggleRun();
|
||||
((ToggleImageButtonInstance*)button)->checked = g_dataModel->isRunning();
|
||||
}
|
||||
else if(button->name == "file")
|
||||
{
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
//#include "Properties/BoolProperty.h"
|
||||
//PROPGRIDITEM BoolProperty::getPropGridItem()
|
||||
//{
|
||||
//return PROPGRIDITEM();
|
||||
//}
|
||||
@@ -1,7 +0,0 @@
|
||||
#include "Properties/Property.h"
|
||||
|
||||
template <typename T>
|
||||
void Property<T>::setProperty(LPPROPGRIDITEM item)
|
||||
{
|
||||
_owner->propertiesChanged();
|
||||
}
|
||||
16
src/source/PropertiesV2/BoolProperty.cpp
Normal file
16
src/source/PropertiesV2/BoolProperty.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "PropertiesV2/BoolProperty.h"
|
||||
|
||||
PROPGRIDITEM BoolProperty::getPropGridItem(){
|
||||
PROPGRIDITEM pItem;
|
||||
PropGrid_ItemInit(pItem);
|
||||
pItem.lpszCatalog=_catalog;
|
||||
pItem.lpszPropName=_name;
|
||||
pItem.lpszPropDesc=_desc;
|
||||
pItem.lpCurValue=_value > 0;
|
||||
pItem.iItemType=PIT_CHECK;
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void BoolProperty::setProperty(LPPROPGRIDITEM &pItem){
|
||||
setValue(pItem->lpCurValue == TRUE);
|
||||
}
|
||||
21
src/source/PropertiesV2/Color3Property.cpp
Normal file
21
src/source/PropertiesV2/Color3Property.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "PropertiesV2/Color3Property.h"
|
||||
|
||||
PROPGRIDITEM Color3Property::getPropGridItem(){
|
||||
PROPGRIDITEM pItem;
|
||||
PropGrid_ItemInit(pItem);
|
||||
pItem.lpszCatalog=_catalog;
|
||||
pItem.lpszPropName=_name;
|
||||
pItem.lpszPropDesc=_desc;
|
||||
pItem.lpCurValue=RGB((_value.r*255),(_value.g*255),(_value.b*255));
|
||||
pItem.iItemType=PIT_COLOR;
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void Color3Property::setProperty(LPPROPGRIDITEM &pItem){
|
||||
|
||||
setValue(Color3(
|
||||
GetRValue(pItem->lpCurValue)/255.0F,
|
||||
GetGValue(pItem->lpCurValue)/255.0F,
|
||||
GetBValue(pItem->lpCurValue)/255.0F
|
||||
));
|
||||
}
|
||||
14
src/source/PropertiesV2/Property.cpp
Normal file
14
src/source/PropertiesV2/Property.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "PropertiesV2/Property.h"
|
||||
|
||||
PROPGRIDITEM Property::getPropGridItem(){
|
||||
PROPGRIDITEM pItem;
|
||||
PropGrid_ItemInit(pItem);
|
||||
pItem.lpszCatalog=_catalog;
|
||||
pItem.lpszPropName=_name;
|
||||
pItem.lpszPropDesc=_desc;
|
||||
pItem.iItemType=PIT_EDIT;
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void Property::setProperty(LPPROPGRIDITEM &pItem){
|
||||
}
|
||||
16
src/source/PropertiesV2/StringProperty.cpp
Normal file
16
src/source/PropertiesV2/StringProperty.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "PropertiesV2/StringProperty.h"
|
||||
|
||||
PROPGRIDITEM StringProperty::getPropGridItem(){
|
||||
PROPGRIDITEM pItem;
|
||||
PropGrid_ItemInit(pItem);
|
||||
pItem.lpszCatalog=_catalog;
|
||||
pItem.lpszPropName=_name;
|
||||
pItem.lpszPropDesc=_desc;
|
||||
pItem.lpCurValue=(LPARAM)_value.c_str();
|
||||
pItem.iItemType=PIT_EDIT;
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void StringProperty::setProperty(LPPROPGRIDITEM &pItem){
|
||||
setValue((LPSTR)pItem->lpCurValue);
|
||||
}
|
||||
33
src/source/PropertiesV2/Vector3Property.cpp
Normal file
33
src/source/PropertiesV2/Vector3Property.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "PropertiesV2/Vector3Property.h"
|
||||
|
||||
PROPGRIDITEM Vector3Property::getPropGridItem(){
|
||||
std::stringstream s;
|
||||
s << _value.x << ", " << _value.y << ", " << _value.z;
|
||||
stringRep = s.str();
|
||||
PROPGRIDITEM pItem;
|
||||
PropGrid_ItemInit(pItem);
|
||||
pItem.lpszCatalog=_catalog;
|
||||
pItem.lpszPropName=_name;
|
||||
pItem.lpszPropDesc=_desc;
|
||||
pItem.lpCurValue=(LPARAM)stringRep.c_str();
|
||||
pItem.iItemType=PIT_EDIT;
|
||||
return pItem;
|
||||
}
|
||||
|
||||
void Vector3Property::setProperty(LPPROPGRIDITEM &pItem){
|
||||
|
||||
std::string str = (LPTSTR)pItem->lpCurValue;
|
||||
std::vector<float> vect;
|
||||
std::stringstream ss(str);
|
||||
float i;
|
||||
while (ss >> i)
|
||||
{
|
||||
vect.push_back(i);
|
||||
if (ss.peek() == ',')
|
||||
ss.ignore();
|
||||
}
|
||||
if(vect.size() == 3)
|
||||
{
|
||||
setValue(Vector3(vect.at(0),vect.at(1),vect.at(2)));
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "strsafe.h"
|
||||
#include "Application.h"
|
||||
|
||||
std::vector<PROPGRIDITEM> prop;
|
||||
std::vector<Property*> prop;
|
||||
std::vector<Instance*> children;
|
||||
Instance * selectedInstance;
|
||||
Instance * parent = NULL;
|
||||
@@ -186,8 +186,15 @@ LRESULT CALLBACK PropProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
LPNMHDR pnm = (LPNMHDR)lParam;
|
||||
LPNMPROPGRID lpnmp = (LPNMPROPGRID)pnm;
|
||||
LPPROPGRIDITEM item = PropGrid_GetItemData(pnm->hwndFrom,lpnmp->iIndex);
|
||||
selectedInstance->PropUpdate(item);
|
||||
//propWind->UpdateSelected(selectedInstance);
|
||||
for(size_t i = 0; i < prop.size(); i++)
|
||||
{
|
||||
if(strcmp(item->lpszPropName, prop[i]->getName()) == 0)
|
||||
{
|
||||
prop[i]->setProperty(item);
|
||||
}
|
||||
}
|
||||
//selectedInstance->PropUpdate(item);
|
||||
propWind->UpdateSelected(g_dataModel->getSelectionService()->getSelection());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -342,6 +349,7 @@ void PropertyWindow::_resize()
|
||||
|
||||
void PropertyWindow::UpdateSelected(std::vector<Instance *> instances)
|
||||
{
|
||||
deleteProperties();
|
||||
if(instances.size() <= 0)
|
||||
{
|
||||
ClearProperties();
|
||||
@@ -349,13 +357,13 @@ void PropertyWindow::UpdateSelected(std::vector<Instance *> instances)
|
||||
}
|
||||
Instance * instance = instances[0];
|
||||
PropGrid_ResetContent(_propGrid);
|
||||
prop = instance->getProperties();
|
||||
prop = instance->collectProperties();
|
||||
//if (selectedInstance != instance)
|
||||
{
|
||||
selectedInstance = instance;
|
||||
for(size_t i = 0; i < prop.size(); i++)
|
||||
{
|
||||
::PROPGRIDITEM item = prop.at(i);
|
||||
::PROPGRIDITEM item = prop.at(i)->getPropGridItem();
|
||||
PropGrid_AddItem(_propGrid, &item);
|
||||
//PRGP propgp;
|
||||
//propgp.instance = instance;
|
||||
@@ -371,6 +379,16 @@ void PropertyWindow::UpdateSelected(std::vector<Instance *> instances)
|
||||
|
||||
void PropertyWindow::ClearProperties()
|
||||
{
|
||||
deleteProperties();
|
||||
clearExplorer();
|
||||
PropGrid_ResetContent(_propGrid);
|
||||
}
|
||||
|
||||
void PropertyWindow::deleteProperties()
|
||||
{
|
||||
while(prop.size() > 0) {
|
||||
Property * toDelete = prop.back();
|
||||
prop.pop_back();
|
||||
delete toDelete;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user