Merge branch 'develop' into modnark
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity
|
||||
version="0.0.106.2"
|
||||
processorArchitecture="*"
|
||||
name="Blocks3D.Blocks3D.Blocks3D"
|
||||
type="win32"
|
||||
/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
|
||||
@@ -739,6 +739,10 @@
|
||||
RelativePath=".\src\include\ToolEnum.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\versioning.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\include\VS2005CompatShim.h"
|
||||
>
|
||||
|
||||
12
Dialogs.rc
12
Dialogs.rc
@@ -6,17 +6,7 @@
|
||||
#include <commctrl.h>
|
||||
#include <richedit.h>
|
||||
#include "src/include/resource.h"
|
||||
|
||||
#define APP_GENER 0
|
||||
#define APP_MAJOR 0
|
||||
#define APP_MINOR 106
|
||||
#define APP_PATCH 4
|
||||
#define APP_VER_STRING APP_GENER.APP_MAJOR.APP_MINOR.APP_PATCH
|
||||
|
||||
#define VER_PREFIX( N ) v##N
|
||||
#define HSTR( N ) #N
|
||||
#define STR( N ) HSTR( N )
|
||||
#define VER_STR( N ) STR( VER_PREFIX( N ) )
|
||||
#include "src/include/versioning.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ public:
|
||||
void onSelect(Mouse mouse);
|
||||
void onKeyDown(int key);
|
||||
void onKeyUp(int key);
|
||||
void roundDeg(float °ree);
|
||||
private:
|
||||
bool lctrlDown;
|
||||
bool rctrlDown;
|
||||
@@ -20,4 +21,5 @@ private:
|
||||
int mouseDownStarty;
|
||||
bool dragging;
|
||||
bool mouseDown;
|
||||
Vector3 draggingPartOffset;
|
||||
};
|
||||
|
||||
23
src/include/versioning.h
Normal file
23
src/include/versioning.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef APP_GENER
|
||||
|
||||
#define SNAPSHOT_VERSION
|
||||
|
||||
#define APP_GENER 0
|
||||
#define APP_MAJOR 0
|
||||
#define APP_MINOR 107
|
||||
#define APP_PATCH 0
|
||||
#define APP_VER_STRING APP_GENER.APP_MAJOR.APP_MINOR.APP_PATCH
|
||||
|
||||
|
||||
#ifdef SNAPSHOT_VERSION
|
||||
#define VER_PREFIX( N ) v##N-SNAPSHOT
|
||||
#else
|
||||
#define VER_PREFIX( N ) v##N
|
||||
#endif
|
||||
|
||||
|
||||
#define HSTR( N ) #N
|
||||
#define STR( N ) HSTR( N )
|
||||
#define VER_STR( N ) STR( VER_PREFIX( N ) )
|
||||
|
||||
#endif
|
||||
@@ -202,8 +202,8 @@ void PartInstance::setSize(Vector3 newSize)
|
||||
|
||||
size = Vector3(sizex, sizey, sizez);
|
||||
|
||||
|
||||
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
}
|
||||
Vector3 PartInstance::getSize()
|
||||
{
|
||||
@@ -224,6 +224,8 @@ void PartInstance::setShape(Enum::Shape::Value shape)
|
||||
this->shape = shape;
|
||||
this->setSize(this->getSize());
|
||||
}
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
@@ -231,12 +233,19 @@ void PartInstance::setPosition(Vector3 pos)
|
||||
{
|
||||
position = pos;
|
||||
setCFrame(CoordinateFrame(cFrame.rotation, pos));
|
||||
|
||||
if (anchored)
|
||||
{
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
}
|
||||
}
|
||||
|
||||
void PartInstance::setAnchored(bool anchored)
|
||||
{
|
||||
this->anchored = anchored;
|
||||
g_dataModel->getEngine()->deleteBody(this);
|
||||
g_dataModel->getEngine()->createBody(this);
|
||||
}
|
||||
|
||||
bool PartInstance::isAnchored()
|
||||
|
||||
@@ -25,7 +25,13 @@ void ArrowTool::onButton1MouseDown(Mouse mouse)
|
||||
g_dataModel->getSelectionService()->clearSelection();
|
||||
PartInstance * target = mouse.getTarget();
|
||||
if(target != NULL)
|
||||
{
|
||||
Vector3 mousePos = mouse.getPosition(g_dataModel->getSelectionService()->getSelection());
|
||||
Vector3 targetPos = target->getPosition();
|
||||
|
||||
g_dataModel->getSelectionService()->addSelected(target);
|
||||
draggingPartOffset = targetPos-mousePos;
|
||||
}
|
||||
if(g_dataModel->getSelectionService()->getSelection().size() == 0)
|
||||
g_dataModel->getSelectionService()->addSelected(g_dataModel);
|
||||
}
|
||||
@@ -51,7 +57,40 @@ void ArrowTool::onMouseMoved(Mouse mouse)
|
||||
{
|
||||
if(PartInstance * part = dynamic_cast<PartInstance *>(g_dataModel->getSelectionService()->getSelection()[i]))
|
||||
{
|
||||
part->setPosition(mouse.getPosition(g_dataModel->getSelectionService()->getSelection()));
|
||||
Vector3 mousePos = mouse.getPosition(g_dataModel->getSelectionService()->getSelection());
|
||||
Vector3 vec = mousePos + draggingPartOffset;
|
||||
|
||||
vec.x = (ceil(vec.x / 1) * 1);
|
||||
vec.y = (ceil(vec.y / 1) * 1);
|
||||
vec.z = (ceil(vec.z / 1) * 1);
|
||||
|
||||
if ( ((int)part->getSize().x)%2 == 1 )
|
||||
vec.x += 0.5;
|
||||
|
||||
vec.y = mousePos.y + part->getSize().y/2 - 0.5;
|
||||
|
||||
if ( ((int)part->getSize().z)%2 == 1 )
|
||||
vec.z += 0.5;
|
||||
|
||||
Matrix3 rot = part->getCFrame().rotation;
|
||||
Vector3 rotEulerAngles;
|
||||
|
||||
rot.toEulerAnglesXYZ(rotEulerAngles.x, rotEulerAngles.y, rotEulerAngles.z);
|
||||
|
||||
rotEulerAngles = Vector3(
|
||||
rotEulerAngles.x * 180 / M_PI,
|
||||
rotEulerAngles.y * 180 / M_PI,
|
||||
rotEulerAngles.z * 180 / M_PI
|
||||
);
|
||||
|
||||
roundDeg(rotEulerAngles.x);
|
||||
roundDeg(rotEulerAngles.y);
|
||||
roundDeg(rotEulerAngles.z);
|
||||
|
||||
rot = rot.fromEulerAnglesXYZ( rotEulerAngles.x * (M_PI / 180), rotEulerAngles.y * (M_PI / 180), rotEulerAngles.z * (M_PI / 180) );
|
||||
|
||||
part->setPosition(vec);
|
||||
part->setCFrame(CoordinateFrame(rot, vec));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -75,4 +114,20 @@ void ArrowTool::onKeyUp(int key)
|
||||
{
|
||||
if(key == VK_CONTROL)
|
||||
lctrlDown = false;
|
||||
}
|
||||
|
||||
void ArrowTool::roundDeg(float °ree)
|
||||
{
|
||||
if ( ( degree < 0 && degree > -45 ) || ( degree > 0 && degree < 45 ) )
|
||||
{
|
||||
degree = 0;
|
||||
}
|
||||
else if ( ( degree < 0 && degree > -90 ) || ( degree > 45 && degree < 90 ) )
|
||||
{
|
||||
degree = 90;
|
||||
}
|
||||
else if ( ( degree < 0 && degree > -180 ) || ( degree > 90 && degree < 180 ) )
|
||||
{
|
||||
degree = 180;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user