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