feat(editor): added sound effects toggle button and resize sound effects
This commit is contained in:
parent
f88e4e2416
commit
6bb01dda36
4 changed files with 55 additions and 13 deletions
|
@ -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<Part>(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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
|
||||
SelectedTool selectedTool;
|
||||
GridSnappingMode snappingMode;
|
||||
bool editSoundEffects = true;
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
private:
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1027</width>
|
||||
<width>935</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -118,9 +118,9 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<widget class="QToolBar" name="fileTools">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
<string>File Tools</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
|
@ -132,9 +132,9 @@
|
|||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar_2">
|
||||
<widget class="QToolBar" name="transformTools">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar_2</string>
|
||||
<string>Transform Tools</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
|
@ -148,7 +148,7 @@
|
|||
<addaction name="actionToolRotate"/>
|
||||
<addaction name="actionToggleSpace"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar_3">
|
||||
<widget class="QToolBar" name="editTools">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar_3</string>
|
||||
</property>
|
||||
|
@ -164,9 +164,9 @@
|
|||
<addaction name="actionPaste"/>
|
||||
<addaction name="actionPasteInto"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar_4">
|
||||
<widget class="QToolBar" name="snappingOptions">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar_4</string>
|
||||
<string>Snapping Options</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
|
@ -178,9 +178,9 @@
|
|||
<addaction name="actionGridSnap05"/>
|
||||
<addaction name="actionGridSnapOff"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar_5">
|
||||
<widget class="QToolBar" name="simulationControls">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar_5</string>
|
||||
<string>Simulation Controls</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
|
@ -190,9 +190,9 @@
|
|||
</attribute>
|
||||
<addaction name="actionToggleSimulation"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar_6">
|
||||
<widget class="QToolBar" name="surfaceTools">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar_6</string>
|
||||
<string>Surface Tools</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
|
@ -207,6 +207,18 @@
|
|||
<addaction name="actionToolInlets"/>
|
||||
<addaction name="actionToolUniversal"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionToggleEditSounds"/>
|
||||
</widget>
|
||||
<action name="actionAddPart">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
|
@ -646,6 +658,23 @@
|
|||
<enum>QAction::MenuRole::NoRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionToggleEditSounds">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="audio-volume-high"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Toggle Edit Sounds</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Toggles edit sound effects</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::MenuRole::NoRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Add table
Reference in a new issue