From 4292cd9ab391ca32bf37fb532db32e50eb59eb15 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Wed, 15 May 2013 12:05:32 -0700 Subject: [PATCH] Moved voxel options into their own menu, switched destructive flag to check Qt action. --- interface/src/Application.cpp | 36 +++++++++++++++++------------------ interface/src/Application.h | 3 +-- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index f954c0a41f..84cc7a1b30 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -148,7 +148,6 @@ Application::Application(int& argc, char** argv) : _paintOn(false), _dominantColor(0), _perfStatsOn(false), - _destructiveAddVoxel(false), _chatEntryOn(false), _oculusTextureID(0), _oculusProgram(0), @@ -985,10 +984,6 @@ void Application::cycleFrustumRenderMode() { updateFrustumRenderModeAction(); } -void Application::setDestructivePaint(bool destructive) { - _destructiveAddVoxel = destructive; -} - void Application::setRenderWarnings(bool renderWarnings) { _voxels.setRenderPipelineWarnings(renderWarnings); } @@ -1074,11 +1069,13 @@ void Application::addVoxelInFrontOfAvatar() { detail.green = paintColor.green(); detail.blue = paintColor.blue(); - PACKET_HEADER message = (_destructiveAddVoxel ? PACKET_HEADER_SET_VOXEL_DESTRUCTIVE : PACKET_HEADER_SET_VOXEL); + PACKET_HEADER message = (_destructiveAddVoxel->isChecked() ? + PACKET_HEADER_SET_VOXEL_DESTRUCTIVE : PACKET_HEADER_SET_VOXEL); sendVoxelEditMessage(message, detail); // create the voxel locally so it appears immediately - _voxels.createVoxel(detail.x, detail.y, detail.z, detail.s, detail.red, detail.green, detail.blue, _destructiveAddVoxel); + _voxels.createVoxel(detail.x, detail.y, detail.z, detail.s, + detail.red, detail.green, detail.blue, _destructiveAddVoxel->isChecked()); } void Application::decreaseVoxelSize() { @@ -1142,27 +1139,28 @@ void Application::initMenu() { (_logOn = toolsMenu->addAction("Log"))->setCheckable(true); _logOn->setChecked(true); + QMenu* voxelMenu = menuBar->addMenu("Voxels"); _voxelModeActions = new QActionGroup(this); _voxelModeActions->setExclusive(false); // exclusivity implies one is always checked - (_addVoxelMode = toolsMenu->addAction( + (_addVoxelMode = voxelMenu->addAction( "Add Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_1))->setCheckable(true); _voxelModeActions->addAction(_addVoxelMode); - (_deleteVoxelMode = toolsMenu->addAction( + (_deleteVoxelMode = voxelMenu->addAction( "Delete Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_2))->setCheckable(true); _voxelModeActions->addAction(_deleteVoxelMode); - (_colorVoxelMode = toolsMenu->addAction( + (_colorVoxelMode = voxelMenu->addAction( "Color Voxel Mode", this, SLOT(updateVoxelModeActions()), Qt::Key_3))->setCheckable(true); _voxelModeActions->addAction(_colorVoxelMode); - toolsMenu->addAction("Place Voxel", this, SLOT(addVoxelInFrontOfAvatar()), Qt::Key_4); - toolsMenu->addAction("Decrease Voxel Size", this, SLOT(decreaseVoxelSize()), Qt::Key_5); - toolsMenu->addAction("Increase Voxel Size", this, SLOT(increaseVoxelSize()), Qt::Key_6); + voxelMenu->addAction("Place Voxel", this, SLOT(addVoxelInFrontOfAvatar()), Qt::Key_4); + voxelMenu->addAction("Decrease Voxel Size", this, SLOT(decreaseVoxelSize()), Qt::Key_5); + voxelMenu->addAction("Increase Voxel Size", this, SLOT(increaseVoxelSize()), Qt::Key_6); - _voxelPaintColor = toolsMenu->addAction("Voxel Paint Color", this, SLOT(chooseVoxelPaintColor()), Qt::Key_7); + _voxelPaintColor = voxelMenu->addAction("Voxel Paint Color", this, SLOT(chooseVoxelPaintColor()), Qt::Key_7); QColor paintColor(128, 128, 128); _voxelPaintColor->setData(paintColor); _voxelPaintColor->setIcon(createSwatchIcon(paintColor)); - toolsMenu->addAction("Create Voxel is Destructive", this, SLOT(setDestructivePaint(bool)))->setCheckable(true); + (_destructiveAddVoxel = voxelMenu->addAction("Create Voxel is Destructive"))->setCheckable(true); QMenu* frustumMenu = menuBar->addMenu("Frustum"); (_frustumOn = frustumMenu->addAction("Display Frustum"))->setCheckable(true); @@ -1373,7 +1371,8 @@ void Application::updateAvatar(float deltaTime) { _paintingVoxel.y >= 0.0 && _paintingVoxel.y <= 1.0 && _paintingVoxel.z >= 0.0 && _paintingVoxel.z <= 1.0) { - PACKET_HEADER message = (_destructiveAddVoxel ? PACKET_HEADER_SET_VOXEL_DESTRUCTIVE : PACKET_HEADER_SET_VOXEL); + PACKET_HEADER message = (_destructiveAddVoxel->isChecked() ? + PACKET_HEADER_SET_VOXEL_DESTRUCTIVE : PACKET_HEADER_SET_VOXEL); sendVoxelEditMessage(message, _paintingVoxel); } } @@ -1946,12 +1945,13 @@ void Application::shiftPaintingColor() { void Application::addVoxelUnderCursor() { if (_mouseVoxel.s != 0) { - PACKET_HEADER message = (_destructiveAddVoxel ? PACKET_HEADER_SET_VOXEL_DESTRUCTIVE : PACKET_HEADER_SET_VOXEL); + PACKET_HEADER message = (_destructiveAddVoxel->isChecked() ? + PACKET_HEADER_SET_VOXEL_DESTRUCTIVE : PACKET_HEADER_SET_VOXEL); sendVoxelEditMessage(message, _mouseVoxel); // create the voxel locally so it appears immediately _voxels.createVoxel(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z, _mouseVoxel.s, - _mouseVoxel.red, _mouseVoxel.green, _mouseVoxel.blue, _destructiveAddVoxel); + _mouseVoxel.red, _mouseVoxel.green, _mouseVoxel.blue, _destructiveAddVoxel->isChecked()); // remember the position for drag detection _lastMouseVoxelPos = glm::vec3(_mouseVoxel.x, _mouseVoxel.y, _mouseVoxel.z); diff --git a/interface/src/Application.h b/interface/src/Application.h index fde63ef88c..50341c051e 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -77,7 +77,6 @@ private slots: void setFrustumOffset(bool frustumOffset); void cycleFrustumRenderMode(); - void setDestructivePaint(bool destructive); void setRenderWarnings(bool renderWarnings); void doKillLocalVoxels(); void doRandomizeVoxelColors(); @@ -147,6 +146,7 @@ private: QAction* _deleteVoxelMode; // Whether delete voxel mode is enabled QAction* _colorVoxelMode; // Whether color voxel mode is enabled QAction* _voxelPaintColor; // The color with which to paint voxels + QAction* _destructiveAddVoxel; // when doing voxel editing do we want them to be destructive QAction* _frustumOn; // Whether or not to display the debug view frustum QAction* _viewFrustumFromOffset; // Whether or not to offset the view of the frustum QAction* _cameraFrustum; // which frustum to look at @@ -211,7 +211,6 @@ private: VoxelDetail _paintingVoxel; // The voxel we're painting if we're painting bool _perfStatsOn; // Do we want to display perfStats? - bool _destructiveAddVoxel; // when doing voxel editing do we want them to be destructive ChatEntry _chatEntry; // chat entry field bool _chatEntryOn; // Whether to show the chat entry