Merge pull request #103 from Vulpovile/bugfix-property-grid
Various Bugfixes
This commit is contained in:
@@ -56,11 +56,13 @@ public:
|
|||||||
void setAnchored(bool anchored);
|
void setAnchored(bool anchored);
|
||||||
bool isAnchored();
|
bool isAnchored();
|
||||||
float getMass();
|
float getMass();
|
||||||
|
bool isDragging();
|
||||||
|
void setDragging(bool value);
|
||||||
|
|
||||||
//Collision
|
//Collision
|
||||||
bool collides(PartInstance * part);
|
bool collides(PartInstance * part);
|
||||||
bool collides(Box);
|
bool collides(Box);
|
||||||
|
|
||||||
//Properties
|
//Properties
|
||||||
virtual std::vector<PROPGRIDITEM> getProperties();
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
@@ -71,6 +73,7 @@ private:
|
|||||||
Vector3 velocity;
|
Vector3 velocity;
|
||||||
Vector3 rotVelocity;
|
Vector3 rotVelocity;
|
||||||
bool changed;
|
bool changed;
|
||||||
|
bool dragging;
|
||||||
Box itemBox;
|
Box itemBox;
|
||||||
GLuint glList;
|
GLuint glList;
|
||||||
};
|
};
|
||||||
@@ -16,4 +16,5 @@ public:
|
|||||||
void createBody(PartInstance* partInstance);
|
void createBody(PartInstance* partInstance);
|
||||||
void deleteBody(PartInstance* partInstance);
|
void deleteBody(PartInstance* partInstance);
|
||||||
void updateBody(PartInstance* partInstance);
|
void updateBody(PartInstance* partInstance);
|
||||||
|
void resetBody(PartInstance* partInstance);
|
||||||
};
|
};
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#define APP_GENER 0
|
#define APP_GENER 0
|
||||||
#define APP_MAJOR 0
|
#define APP_MAJOR 0
|
||||||
#define APP_MINOR 107
|
#define APP_MINOR 107
|
||||||
#define APP_PATCH 0
|
#define APP_PATCH 1
|
||||||
#define APP_VER_STRING APP_GENER.APP_MAJOR.APP_MINOR.APP_PATCH
|
#define APP_VER_STRING APP_GENER.APP_MAJOR.APP_MINOR.APP_PATCH
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ PartInstance::PartInstance(void)
|
|||||||
className = "Part";
|
className = "Part";
|
||||||
canCollide = true;
|
canCollide = true;
|
||||||
anchored = false;
|
anchored = false;
|
||||||
|
dragging = false;
|
||||||
size = Vector3(2,1,4);
|
size = Vector3(2,1,4);
|
||||||
setCFrame(CoordinateFrame(Vector3(0,0,0)));
|
setCFrame(CoordinateFrame(Vector3(0,0,0)));
|
||||||
color = Color3::gray();
|
color = Color3::gray();
|
||||||
@@ -28,6 +29,20 @@ PartInstance::PartInstance(void)
|
|||||||
shape = Enum::Shape::Block;
|
shape = Enum::Shape::Block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PartInstance::isDragging()
|
||||||
|
{
|
||||||
|
return dragging;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PartInstance::setDragging(bool value)
|
||||||
|
{
|
||||||
|
if (dragging != value)
|
||||||
|
{
|
||||||
|
dragging = value;
|
||||||
|
g_dataModel->getEngine()->resetBody(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float PartInstance::getMass()
|
float PartInstance::getMass()
|
||||||
{
|
{
|
||||||
if(shape == Enum::Shape::Block)
|
if(shape == Enum::Shape::Block)
|
||||||
@@ -206,10 +221,7 @@ void PartInstance::setSize(Vector3 newSize)
|
|||||||
size = Vector3(sizex, sizey, sizez);
|
size = Vector3(sizex, sizey, sizez);
|
||||||
|
|
||||||
if(this->physBody != NULL)
|
if(this->physBody != NULL)
|
||||||
{
|
g_dataModel->getEngine()->resetBody(this);
|
||||||
g_dataModel->getEngine()->deleteBody(this);
|
|
||||||
g_dataModel->getEngine()->createBody(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Vector3 PartInstance::getSize()
|
Vector3 PartInstance::getSize()
|
||||||
{
|
{
|
||||||
@@ -231,10 +243,8 @@ void PartInstance::setShape(Enum::Shape::Value shape)
|
|||||||
this->setSize(this->getSize());
|
this->setSize(this->getSize());
|
||||||
}
|
}
|
||||||
if(this->physBody != NULL)
|
if(this->physBody != NULL)
|
||||||
{
|
g_dataModel->getEngine()->resetBody(this);
|
||||||
g_dataModel->getEngine()->deleteBody(this);
|
|
||||||
g_dataModel->getEngine()->createBody(this);
|
|
||||||
}
|
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,20 +254,14 @@ void PartInstance::setPosition(Vector3 pos)
|
|||||||
setCFrame(CoordinateFrame(cFrame.rotation, pos));
|
setCFrame(CoordinateFrame(cFrame.rotation, pos));
|
||||||
|
|
||||||
if (anchored)
|
if (anchored)
|
||||||
{
|
g_dataModel->getEngine()->resetBody(this);
|
||||||
g_dataModel->getEngine()->deleteBody(this);
|
|
||||||
g_dataModel->getEngine()->createBody(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PartInstance::setAnchored(bool anchored)
|
void PartInstance::setAnchored(bool anchored)
|
||||||
{
|
{
|
||||||
this->anchored = anchored;
|
this->anchored = anchored;
|
||||||
if(this->physBody != NULL)
|
if(this->physBody != NULL)
|
||||||
{
|
g_dataModel->getEngine()->resetBody(this);
|
||||||
g_dataModel->getEngine()->deleteBody(this);
|
|
||||||
g_dataModel->getEngine()->createBody(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PartInstance::isAnchored()
|
bool PartInstance::isAnchored()
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ void ArrowTool::onButton1MouseUp(Mouse mouse)
|
|||||||
{
|
{
|
||||||
mouseDown = false;
|
mouseDown = false;
|
||||||
dragging = false;
|
dragging = false;
|
||||||
|
|
||||||
|
for(size_t i = 0; i < g_dataModel->getSelectionService()->getSelection().size(); i++) //This will later decide primary and move all parts according to primary
|
||||||
|
{
|
||||||
|
if(PartInstance * part = dynamic_cast<PartInstance *>(g_dataModel->getSelectionService()->getSelection()[i]))
|
||||||
|
{
|
||||||
|
part->setDragging(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArrowTool::onMouseMoved(Mouse mouse)
|
void ArrowTool::onMouseMoved(Mouse mouse)
|
||||||
@@ -88,7 +96,8 @@ void ArrowTool::onMouseMoved(Mouse mouse)
|
|||||||
roundDeg(rotEulerAngles.z);
|
roundDeg(rotEulerAngles.z);
|
||||||
|
|
||||||
rot = rot.fromEulerAnglesXYZ( rotEulerAngles.x * (M_PI / 180), rotEulerAngles.y * (M_PI / 180), rotEulerAngles.z * (M_PI / 180) );
|
rot = rot.fromEulerAnglesXYZ( rotEulerAngles.x * (M_PI / 180), rotEulerAngles.y * (M_PI / 180), rotEulerAngles.z * (M_PI / 180) );
|
||||||
|
|
||||||
|
part->setDragging(true);
|
||||||
part->setPosition(vec);
|
part->setPosition(vec);
|
||||||
part->setCFrame(CoordinateFrame(rot, vec));
|
part->setCFrame(CoordinateFrame(rot, vec));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ XplicitNgine::~XplicitNgine()
|
|||||||
dCloseODE();
|
dCloseODE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void XplicitNgine::resetBody(PartInstance* partInstance)
|
||||||
|
{
|
||||||
|
deleteBody(partInstance);
|
||||||
|
createBody(partInstance);
|
||||||
|
}
|
||||||
|
|
||||||
void collisionCallback(void *data, dGeomID o1, dGeomID o2)
|
void collisionCallback(void *data, dGeomID o1, dGeomID o2)
|
||||||
{
|
{
|
||||||
int i,n;
|
int i,n;
|
||||||
@@ -78,7 +84,7 @@ void XplicitNgine::deleteBody(PartInstance* partInstance)
|
|||||||
{
|
{
|
||||||
dBodyEnable(partInstance->physBody);
|
dBodyEnable(partInstance->physBody);
|
||||||
dGeomEnable(partInstance->physGeom[0]);
|
dGeomEnable(partInstance->physGeom[0]);
|
||||||
if(partInstance->isAnchored())
|
if(partInstance->isAnchored() || partInstance->isDragging())
|
||||||
{
|
{
|
||||||
dGeomSetBody(partInstance->physGeom[0], partInstance->physBody);
|
dGeomSetBody(partInstance->physGeom[0], partInstance->physBody);
|
||||||
dGeomEnable(partInstance->physGeom[0]);
|
dGeomEnable(partInstance->physGeom[0]);
|
||||||
@@ -183,11 +189,11 @@ void XplicitNgine::createBody(PartInstance* partInstance)
|
|||||||
|
|
||||||
//printf("[XplicitNgine] Created Body for PartInstance\n");
|
//printf("[XplicitNgine] Created Body for PartInstance\n");
|
||||||
|
|
||||||
if(!partInstance->isAnchored())
|
if(!partInstance->isAnchored() && !partInstance->isDragging())
|
||||||
dGeomSetBody(partInstance->physGeom[0], partInstance->physBody);
|
dGeomSetBody(partInstance->physGeom[0], partInstance->physBody);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(!partInstance->isAnchored())
|
if(!partInstance->isAnchored() && !partInstance->isDragging())
|
||||||
{
|
{
|
||||||
const dReal* velocity = dBodyGetLinearVel(partInstance->physBody);
|
const dReal* velocity = dBodyGetLinearVel(partInstance->physBody);
|
||||||
const dReal* rotVelocity = dBodyGetAngularVel(partInstance->physBody);
|
const dReal* rotVelocity = dBodyGetAngularVel(partInstance->physBody);
|
||||||
|
|||||||
@@ -3917,7 +3917,7 @@ static BOOL Grid_OnGetSel(INT iItem)
|
|||||||
static VOID Grid_OnResetContent(VOID)
|
static VOID Grid_OnResetContent(VOID)
|
||||||
{
|
{
|
||||||
ListBox_ResetContent(g_lpInst->hwndListMap);
|
ListBox_ResetContent(g_lpInst->hwndListMap);
|
||||||
|
g_lpInst->lpCurrent = NULL;
|
||||||
if (NULL != g_lpInst->hwndCtl1)
|
if (NULL != g_lpInst->hwndCtl1)
|
||||||
{
|
{
|
||||||
DestroyWindow(g_lpInst->hwndCtl1);
|
DestroyWindow(g_lpInst->hwndCtl1);
|
||||||
|
|||||||
Reference in New Issue
Block a user