Skip to content

Commit

Permalink
Added grid snapping for object rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Borf committed Sep 15, 2017
1 parent 9f36e15 commit 68f792c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions browedit/ObjectEdit.cpp
Expand Up @@ -224,6 +224,8 @@ void BrowEdit::objectEditUpdate()
o->position.y = center.y + newPos.x;
o->position.z = center.z + newPos.y;
o->rotation.x += mouseState.position.x - lastMouseState.position.x;
if (keyState.isPressed(blib::Key::SHIFT))
o->rotation.x = glm::round(o->rotation.x / 45) * 45; //TODO: position properly too
}
if (objectRotateDirection == RotatorTool::Axis::Y)
{
Expand All @@ -232,6 +234,10 @@ void BrowEdit::objectEditUpdate()
o->position.x = center.x + newPos.x;
o->position.z = center.z + newPos.y;
o->rotation.y -= mouseState.position.x - lastMouseState.position.x;

if (keyState.isPressed(blib::Key::SHIFT))
o->rotation.y = glm::round(o->rotation.y / 45) * 45; //TODO: position properly too

}
if (objectRotateDirection == RotatorTool::Axis::Z)
{
Expand All @@ -240,6 +246,8 @@ void BrowEdit::objectEditUpdate()
o->position.x = center.x + newPos.x;
o->position.y = center.y + newPos.y;
o->rotation.z += mouseState.position.x - lastMouseState.position.x;
if (keyState.isPressed(blib::Key::SHIFT))
o->rotation.z = glm::round(o->rotation.z / 45) * 45; //TODO: position properly too
}
}
if (objectScaleDirection != ScaleTool::Axis::NONE)
Expand Down
2 changes: 2 additions & 0 deletions browedit_pause.bat
@@ -0,0 +1,2 @@
browedit.exe
pause
1 change: 1 addition & 0 deletions buildpackage.bat
Expand Up @@ -3,6 +3,7 @@ del package
mkdir package
copy vs2015\release\browedit.exe package
copy vs2015\release\BugTrap.dll package
copy browedit_pause.bat package
xcopy readme.txt package\
xcopy /s assets\*.* package\assets\
xcopy /s blib\assets\*.* package\assets\
Expand Down
Binary file modified vs2015/Release/Browedit.exe
Binary file not shown.

0 comments on commit 68f792c

Please sign in to comment.