Minor bugfix, added reflection notify
This commit is contained in:
@@ -29,8 +29,6 @@ class Application { // : public GApp {
|
||||
void clearInstances();
|
||||
void navigateToolbox(std::string);
|
||||
PartInstance* makePart();
|
||||
void drawButtons(RenderDevice* rd);
|
||||
void drawOutline(Vector3 from, Vector3 to, RenderDevice* rd, LightingParameters lighting, Vector3 size, Vector3 pos, CoordinateFrame c);
|
||||
void deleteInstance();
|
||||
void run();
|
||||
void QuitApp();
|
||||
|
||||
@@ -22,7 +22,10 @@ namespace B3D
|
||||
virtual void renderName(RenderDevice*);
|
||||
virtual void update();
|
||||
virtual void setParent(Instance*);
|
||||
|
||||
//TODO implement
|
||||
virtual Instance* clone() const { return new Instance(*this); }
|
||||
virtual void reflectionNotify(ReflectionProperty<void*>* property);
|
||||
|
||||
//Functions
|
||||
std::vector<Instance*> children; // All children.
|
||||
|
||||
@@ -62,7 +62,8 @@ namespace B3D
|
||||
void setShape(Enum::Shape::Value shape);
|
||||
void setChanged();
|
||||
void setSurface(int face, Enum::SurfaceType::Value surface);
|
||||
void setAnchored(bool anchored);
|
||||
void setAnchored(bool anchored);
|
||||
void reflectionNotify(ReflectionProperty<void*>* property);
|
||||
bool isAnchored();
|
||||
float getMass();
|
||||
bool isDragging();
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace B3D{
|
||||
std::string ReflectionDataTable::getClassName(void);
|
||||
|
||||
void mapProperty(std::string key, ReflectionProperty<void*>* prop);
|
||||
void notify(ReflectionProperty<void*>* prop);
|
||||
private:
|
||||
//Perhaps not stored here?
|
||||
std::string className;
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace B3D{
|
||||
T* getValuePtr();
|
||||
|
||||
void setValue(T);
|
||||
void setValueNotify(T);
|
||||
|
||||
void dispose();
|
||||
|
||||
|
||||
@@ -46,7 +46,8 @@ void ReflectionProperty<T>::dispose()
|
||||
//value = NULL;
|
||||
if(extData)
|
||||
{
|
||||
delete extData;
|
||||
//TODO why???
|
||||
//delete extData;
|
||||
extData = NULL;
|
||||
}
|
||||
}
|
||||
@@ -72,4 +73,10 @@ T* ReflectionProperty<T>::getValuePtr()
|
||||
template<class T>
|
||||
void ReflectionProperty<T>::setValue(T value){
|
||||
value=T(value);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void ReflectionProperty<T>::setValueNotify(T value){
|
||||
value=T(value);
|
||||
containerTable->notify((ReflectionProperty<void*>*)this);
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "DataModelV3/DataModelInstance.h"
|
||||
//TODO should this be here?
|
||||
#include "DataModelV3/Gui/ToggleImageButtonInstance.h"
|
||||
using namespace B3D;
|
||||
|
||||
DataModelInstance::DataModelInstance(void) : Instance("DataModel")
|
||||
@@ -34,8 +36,6 @@ DataModelInstance::DataModelInstance(void) : Instance("DataModel")
|
||||
resetEngine();
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
|
||||
void DataModelInstance::resetEngine()
|
||||
{
|
||||
if(xplicitNgine != NULL)
|
||||
@@ -77,8 +77,7 @@ DataModelInstance::~DataModelInstance(void)
|
||||
void DataModelInstance::clearLevel()
|
||||
{
|
||||
running = false;
|
||||
//TODO implement
|
||||
/*Instance * goButton = this->getGuiRoot()->findFirstChild("go");
|
||||
Instance * goButton = this->getGuiRoot()->findFirstChild("go");
|
||||
if(goButton != NULL){
|
||||
if(ToggleImageButtonInstance* goButtonReal = dynamic_cast<ToggleImageButtonInstance*>(goButton))
|
||||
{
|
||||
@@ -87,7 +86,7 @@ void DataModelInstance::clearLevel()
|
||||
}
|
||||
selectionService->clearSelection();
|
||||
selectionService->addSelected(this);
|
||||
workspace->clearChildren();*/
|
||||
workspace->clearChildren();
|
||||
}
|
||||
|
||||
//TODO move elsewhere
|
||||
@@ -305,7 +304,6 @@ WorkspaceInstance* DataModelInstance::getWorkspace()
|
||||
return workspace;
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
GuiRootInstance* DataModelInstance::getGuiRoot()
|
||||
{
|
||||
return guiRoot;
|
||||
@@ -333,7 +331,6 @@ SoundService* DataModelInstance::getSoundService()
|
||||
return soundService;
|
||||
}
|
||||
|
||||
//TODO implement
|
||||
LightingInstance* DataModelInstance::getLighting()
|
||||
{
|
||||
return lightingInstance;
|
||||
|
||||
@@ -10,7 +10,7 @@ void BaseButtonInstance::render(RenderDevice* rd)
|
||||
{
|
||||
//TODO make mouse a member of datamodel
|
||||
//Vector2 pos = Vector2(g_usableApp->mouse.x,g_usableApp->mouse.y);
|
||||
//drawObj(rd, pos, g_usableApp->mouse.isMouseDown());
|
||||
drawObj(rd, Vector2(0, 0), false);//g_usableApp->mouse.isMouseDown());
|
||||
Instance::render(rd);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ Instance::Instance(void)
|
||||
canDelete = true;
|
||||
}
|
||||
|
||||
|
||||
Instance::~Instance(void)
|
||||
{
|
||||
for(size_t i = 0; i < children.size(); i++)
|
||||
@@ -36,6 +37,10 @@ Instance::Instance(const Instance &oinst)
|
||||
//CLONE WITH REFLECTION!!!
|
||||
}
|
||||
|
||||
|
||||
void Instance::reflectionNotify(ReflectionProperty<void*> * property){
|
||||
}
|
||||
|
||||
//Perhaps should be separated
|
||||
void Instance::render(RenderDevice* rd)
|
||||
{
|
||||
|
||||
@@ -85,8 +85,7 @@ void LightingInstance::update(RenderDevice* rd)
|
||||
rd->setObjectToWorldMatrix(forDraw);
|
||||
rd->afterPrimitive();
|
||||
|
||||
// TODO implement
|
||||
//parentDataModel->getSelectionService()->render(rd);
|
||||
parentDataModel->getSelectionService()->render(rd);
|
||||
|
||||
// TODO Mouse and tool will be handled by datamodel
|
||||
//g_usableApp->tool->render(rd, g_usableApp->mouse);
|
||||
|
||||
@@ -62,8 +62,7 @@ void PartInstance::setDragging(bool value)
|
||||
if (dragging != value && getParentDataModel() != NULL)
|
||||
{
|
||||
dragging = value;
|
||||
//TODO implement engine
|
||||
//getParentDataModel()->getEngine()->resetBody(this);
|
||||
getParentDataModel()->getEngine()->resetBody(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,23 +188,20 @@ void PartInstance::setParent(Instance* prnt)
|
||||
{
|
||||
if(this->physBody != NULL && getParentDataModel() != NULL)
|
||||
{
|
||||
//TODO implement engine
|
||||
//getParentDataModel()->getEngine()->deleteBody(this);
|
||||
getParentDataModel()->getEngine()->deleteBody(this);
|
||||
}
|
||||
Instance * cparent = getParent();
|
||||
//TODO implement workspace
|
||||
/*while(cparent != NULL)
|
||||
while(cparent != NULL)
|
||||
{
|
||||
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
|
||||
{
|
||||
workspace->partObjects.erase(std::remove(workspace->partObjects.begin(), workspace->partObjects.end(), this), workspace->partObjects.end());
|
||||
}
|
||||
cparent = cparent->getParent();
|
||||
}*/
|
||||
}
|
||||
Instance::setParent(prnt);
|
||||
cparent = getParent();
|
||||
//TODO implement workspace
|
||||
/*
|
||||
|
||||
while(cparent != NULL)
|
||||
{
|
||||
if(WorkspaceInstance* workspace = dynamic_cast<WorkspaceInstance*>(cparent))
|
||||
@@ -214,8 +210,7 @@ void PartInstance::setParent(Instance* prnt)
|
||||
break;
|
||||
}
|
||||
cparent = cparent->getParent();
|
||||
}*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void PartInstance::setSize(Vector3 newSize)
|
||||
@@ -305,7 +300,7 @@ bool PartInstance::isAnchored()
|
||||
|
||||
CoordinateFrame PartInstance::getCFrame()
|
||||
{
|
||||
return cFrame.value.rotation;
|
||||
return cFrame.value;
|
||||
}
|
||||
void PartInstance::setCFrame(CoordinateFrame coordinateFrame)
|
||||
{
|
||||
@@ -338,6 +333,12 @@ bool PartInstance::collides(PartInstance * part)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PartInstance::reflectionNotify(ReflectionProperty<void*>* property){
|
||||
//TODO actually implement correctly
|
||||
changed = true;
|
||||
}
|
||||
|
||||
Box PartInstance::getBox()
|
||||
{
|
||||
Box box = Box(Vector3(size.value.x/2, size.value.y/2, size.value.z/2) ,Vector3(-size.value.x/2,-size.value.y/2,-size.value.z/2));
|
||||
@@ -422,11 +423,9 @@ void PartInstance::onTouch()
|
||||
break;
|
||||
}
|
||||
|
||||
//TODO implement SoundService
|
||||
/*
|
||||
SoundService* sndService = getParentDataModel()->getSoundService();
|
||||
|
||||
switch(OnTouchSound)
|
||||
switch(OnTouchSound.getValue())
|
||||
{
|
||||
case Enum::Sound::NoSound:
|
||||
break;
|
||||
@@ -469,5 +468,5 @@ void PartInstance::onTouch()
|
||||
case Enum::Sound::StepOn:
|
||||
sndService->playSound(sndService->findFirstChild("StepOn"));
|
||||
break;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Reflection/ReflectionDataTable.h"
|
||||
#include "DataModelV3/Instance.h"
|
||||
|
||||
using namespace B3D::Reflection;
|
||||
|
||||
@@ -26,6 +27,11 @@ std::string ReflectionDataTable::getClassName(void)
|
||||
return className;
|
||||
}
|
||||
|
||||
void ReflectionDataTable::notify(ReflectionProperty<void*>* prop)
|
||||
{
|
||||
parentInstance->reflectionNotify(prop);
|
||||
}
|
||||
|
||||
void ReflectionDataTable::mapProperty(std::string key, ReflectionProperty<void*>* prop)
|
||||
{
|
||||
if(propertyTable.find(key) != propertyTable.end())
|
||||
|
||||
@@ -37,10 +37,10 @@ std::vector<G3D::Box> getSurfaces(PartInstance * part)
|
||||
|
||||
void SurfaceTool::onButton1MouseDown(Mouse mouse)
|
||||
{
|
||||
AudioPlayer::playSound(dingSound);
|
||||
PartInstance * target = mouse.getTarget();
|
||||
if(target != NULL)
|
||||
{
|
||||
AudioPlayer::playSound(dingSound);
|
||||
G3D::Ray ray = mouse.getLastRay();
|
||||
std::vector<G3D::Box> surfacesHit = getSurfaces(target);
|
||||
int closest;
|
||||
|
||||
Reference in New Issue
Block a user