diff --git a/editor/mainglwidget.cpp b/editor/mainglwidget.cpp index 5f69650..c66cb49 100644 --- a/editor/mainglwidget.cpp +++ b/editor/mainglwidget.cpp @@ -216,6 +216,8 @@ void MainGLWidget::handleLinearTransform(QMouseEvent* evt) { if (snappingFactor()) diff = frame.Rotation() * (glm::round(glm::vec3(frame.Inverse().Rotation() * diff) / snappingFactor()) * snappingFactor()); // printf("Post-snap: (%f, %f, %f)\n", diff.x, diff.y, diff.z); + Data::Vector3 oldSize = part->size; + switch (mainWindow()->selectedTool) { case TOOL_MOVE: { // Add difference @@ -244,6 +246,9 @@ void MainGLWidget::handleLinearTransform(QMouseEvent* evt) { Logger::error("Invalid tool was set to be handled by handleLinearTransform\n"); } + if (mainWindow()->editSoundEffects && (oldSize != part->size) && QFile::exists("./assets/excluded/switch.wav")) + QSound::play("./assets/excluded/switch.wav"); + syncPartPhysics(std::dynamic_pointer_cast(editorToolHandles->adornee->lock())); } @@ -375,7 +380,7 @@ void MainGLWidget::mousePressEvent(QMouseEvent* evt) { default: return; } - if (QFile::exists("./assets/excluded/electronicpingshort.wav")) + if (mainWindow()->editSoundEffects && QFile::exists("./assets/excluded/electronicpingshort.wav")) QSound::play("./assets/excluded/electronicpingshort.wav"); return; diff --git a/editor/mainwindow.cpp b/editor/mainwindow.cpp index 72aa6b8..d9c5f77 100644 --- a/editor/mainwindow.cpp +++ b/editor/mainwindow.cpp @@ -129,6 +129,13 @@ MainWindow::MainWindow(QWidget *parent) ui->actionGridSnap1->setChecked(true); snappingMode = GridSnappingMode::SNAP_1_STUD; + connect(ui->actionToggleEditSounds, &QAction::triggered, this, [&](bool state) { + editSoundEffects = state; + printf("%d\n", editSoundEffects); + ui->actionToggleEditSounds->setIcon(QIcon::fromTheme(editSoundEffects ? "audio-volume-high" : "audio-volume-muted")); + }); + ui->actionToggleEditSounds->setChecked(true); + connect(ui->actionToggleSimulation, &QAction::triggered, this, [&]() { simulationPlaying = !simulationPlaying; if (simulationPlaying) { diff --git a/editor/mainwindow.h b/editor/mainwindow.h index 3d21736..94db3d7 100644 --- a/editor/mainwindow.h +++ b/editor/mainwindow.h @@ -46,6 +46,7 @@ public: SelectedTool selectedTool; GridSnappingMode snappingMode; + bool editSoundEffects = true; Ui::MainWindow *ui; private: diff --git a/editor/mainwindow.ui b/editor/mainwindow.ui index ce42c65..04b431f 100644 --- a/editor/mainwindow.ui +++ b/editor/mainwindow.ui @@ -40,7 +40,7 @@ 0 0 - 1027 + 935 30 @@ -118,9 +118,9 @@ - + - toolBar + File Tools TopToolBarArea @@ -132,9 +132,9 @@ - + - toolBar_2 + Transform Tools TopToolBarArea @@ -148,7 +148,7 @@ - + toolBar_3 @@ -164,9 +164,9 @@ - + - toolBar_4 + Snapping Options TopToolBarArea @@ -178,9 +178,9 @@ - + - toolBar_5 + Simulation Controls TopToolBarArea @@ -190,9 +190,9 @@ - + - toolBar_6 + Surface Tools TopToolBarArea @@ -207,6 +207,18 @@ + + + toolBar + + + TopToolBarArea + + + false + + + @@ -646,6 +658,23 @@ QAction::MenuRole::NoRole + + + true + + + + + + Toggle Edit Sounds + + + Toggles edit sound effects + + + QAction::MenuRole::NoRole + +