feat(editor): local-space/world-space toggle
This commit is contained in:
parent
3fc20fcd4e
commit
62835505f9
2 changed files with 32 additions and 2 deletions
|
@ -35,6 +35,8 @@
|
||||||
|
|
||||||
bool simulationPlaying = false;
|
bool simulationPlaying = false;
|
||||||
|
|
||||||
|
bool worldSpaceTransforms = false;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
|
@ -102,6 +104,16 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(ui->actionToggleSpace, &QAction::triggered, this, [&]() {
|
||||||
|
worldSpaceTransforms = !worldSpaceTransforms;
|
||||||
|
updateToolbars();
|
||||||
|
if (worldSpaceTransforms) {
|
||||||
|
ui->actionToggleSpace->setText("W");
|
||||||
|
} else {
|
||||||
|
ui->actionToggleSpace->setText("L");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
connect(ui->actionSave, &QAction::triggered, this, [&]() {
|
connect(ui->actionSave, &QAction::triggered, this, [&]() {
|
||||||
std::optional<std::string> path;
|
std::optional<std::string> path;
|
||||||
if (!dataModel->HasFile())
|
if (!dataModel->HasFile())
|
||||||
|
@ -305,8 +317,11 @@ void MainWindow::updateToolbars() {
|
||||||
ui->actionGridSnapOff->setChecked(snappingMode == GridSnappingMode::SNAP_OFF);
|
ui->actionGridSnapOff->setChecked(snappingMode == GridSnappingMode::SNAP_OFF);
|
||||||
|
|
||||||
// editorToolHandles->worldMode = false;
|
// editorToolHandles->worldMode = false;
|
||||||
if (selectedTool == SelectedTool::MOVE) editorToolHandles->worldMode = true;
|
if (selectedTool == SelectedTool::SCALE)
|
||||||
if (selectedTool == SelectedTool::SCALE) editorToolHandles->worldMode = false;
|
editorToolHandles->worldMode = false;
|
||||||
|
else
|
||||||
|
editorToolHandles->worldMode = worldSpaceTransforms;
|
||||||
|
|
||||||
editorToolHandles->active = selectedTool != SelectedTool::SELECT;
|
editorToolHandles->active = selectedTool != SelectedTool::SELECT;
|
||||||
editorToolHandles->handlesType =
|
editorToolHandles->handlesType =
|
||||||
selectedTool == SelectedTool::MOVE ? HandlesType::MoveHandles
|
selectedTool == SelectedTool::MOVE ? HandlesType::MoveHandles
|
||||||
|
|
|
@ -124,6 +124,7 @@
|
||||||
<addaction name="actionToolMove"/>
|
<addaction name="actionToolMove"/>
|
||||||
<addaction name="actionToolScale"/>
|
<addaction name="actionToolScale"/>
|
||||||
<addaction name="actionToolRotate"/>
|
<addaction name="actionToolRotate"/>
|
||||||
|
<addaction name="actionToggleSpace"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionDelete"/>
|
<addaction name="actionDelete"/>
|
||||||
<addaction name="actionCopy"/>
|
<addaction name="actionCopy"/>
|
||||||
|
@ -465,6 +466,20 @@
|
||||||
<enum>QAction::MenuRole::QuitRole</enum>
|
<enum>QAction::MenuRole::QuitRole</enum>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionToggleSpace">
|
||||||
|
<property name="text">
|
||||||
|
<string>L</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Switch between local and world space transformations</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+L</string>
|
||||||
|
</property>
|
||||||
|
<property name="menuRole">
|
||||||
|
<enum>QAction::MenuRole::NoRole</enum>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
Loading…
Add table
Reference in a new issue