Update Gizmo selector tools
This commit is contained in:
@@ -438,40 +438,61 @@ void MapView::setupViewportOverlay()
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
connect(_viewport_overlay_ui->gizmoModeButton, &QPushButton::clicked
|
connect(_viewport_overlay_ui->gizmoModeButton, &QPushButton::clicked, [this]()
|
||||||
,[this]()
|
{
|
||||||
{
|
if (_viewport_overlay_ui->gizmoModeButton->isChecked())
|
||||||
if (_viewport_overlay_ui->gizmoVisibleButton->isChecked())
|
{
|
||||||
{
|
_gizmo_mode = ImGuizmo::MODE::WORLD;
|
||||||
_gizmo_mode = ImGuizmo::MODE::WORLD;
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
_gizmo_mode = ImGuizmo::MODE::LOCAL;
|
||||||
_gizmo_mode = ImGuizmo::MODE::LOCAL;
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
connect(_viewport_overlay_ui->gizmoTranslateButton, &QPushButton::clicked
|
connect(_viewport_overlay_ui->gizmoTranslateButton, &QPushButton::clicked, [this]() {
|
||||||
,[this]()
|
updateGizmoOverlay(ImGuizmo::OPERATION::TRANSLATE);
|
||||||
{
|
});
|
||||||
_gizmo_operation = ImGuizmo::OPERATION::TRANSLATE;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
connect(_viewport_overlay_ui->gizmoRotateButton, &QPushButton::clicked
|
connect(_viewport_overlay_ui->gizmoRotateButton, &QPushButton::clicked, [this]() {
|
||||||
,[this]()
|
updateGizmoOverlay(ImGuizmo::OPERATION::ROTATE);
|
||||||
{
|
});
|
||||||
_gizmo_operation = ImGuizmo::OPERATION::ROTATE;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
connect(_viewport_overlay_ui->gizmoScaleButton, &QPushButton::clicked
|
connect(_viewport_overlay_ui->gizmoScaleButton, &QPushButton::clicked, [this]() {
|
||||||
,[this]()
|
updateGizmoOverlay(ImGuizmo::OPERATION::SCALE);
|
||||||
{
|
});
|
||||||
_gizmo_operation = ImGuizmo::OPERATION::SCALE;
|
}
|
||||||
}
|
|
||||||
);
|
void MapView::updateGizmoOverlay(ImGuizmo::OPERATION operation)
|
||||||
|
{
|
||||||
|
if (operation == ImGuizmo::OPERATION::TRANSLATE)
|
||||||
|
{
|
||||||
|
_viewport_overlay_ui->gizmoRotateButton->setChecked(false);
|
||||||
|
_viewport_overlay_ui->gizmoScaleButton->setChecked(false);
|
||||||
|
|
||||||
|
if (!_viewport_overlay_ui->gizmoTranslateButton->isChecked())
|
||||||
|
_viewport_overlay_ui->gizmoTranslateButton->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation == ImGuizmo::OPERATION::ROTATE)
|
||||||
|
{
|
||||||
|
_viewport_overlay_ui->gizmoTranslateButton->setChecked(false);
|
||||||
|
_viewport_overlay_ui->gizmoScaleButton->setChecked(false);
|
||||||
|
|
||||||
|
if (!_viewport_overlay_ui->gizmoRotateButton->isChecked())
|
||||||
|
_viewport_overlay_ui->gizmoRotateButton->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (operation == ImGuizmo::OPERATION::SCALE)
|
||||||
|
{
|
||||||
|
_viewport_overlay_ui->gizmoTranslateButton->setChecked(false);
|
||||||
|
_viewport_overlay_ui->gizmoRotateButton->setChecked(false);
|
||||||
|
|
||||||
|
if (!_viewport_overlay_ui->gizmoScaleButton->isChecked())
|
||||||
|
_viewport_overlay_ui->gizmoScaleButton->setChecked(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
_gizmo_operation = operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::setupRaiseLowerUi()
|
void MapView::setupRaiseLowerUi()
|
||||||
@@ -4453,6 +4474,26 @@ void MapView::keyPressEvent (QKeyEvent *event)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_gizmo_on.get())
|
||||||
|
{
|
||||||
|
if (!_change_operation_mode && event->key() == Qt::Key_Space)
|
||||||
|
{
|
||||||
|
if (_gizmo_operation == ImGuizmo::OPERATION::TRANSLATE)
|
||||||
|
{
|
||||||
|
updateGizmoOverlay(ImGuizmo::OPERATION::ROTATE);
|
||||||
|
}
|
||||||
|
else if (_gizmo_operation == ImGuizmo::OPERATION::ROTATE)
|
||||||
|
{
|
||||||
|
updateGizmoOverlay(ImGuizmo::OPERATION::SCALE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
updateGizmoOverlay(ImGuizmo::OPERATION::TRANSLATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
_change_operation_mode = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::keyReleaseEvent (QKeyEvent* event)
|
void MapView::keyReleaseEvent (QKeyEvent* event)
|
||||||
@@ -4460,6 +4501,9 @@ void MapView::keyReleaseEvent (QKeyEvent* event)
|
|||||||
if (event->key() == Qt::Key_Space)
|
if (event->key() == Qt::Key_Space)
|
||||||
_mod_space_down = false;
|
_mod_space_down = false;
|
||||||
|
|
||||||
|
if (_change_operation_mode && event->key() == Qt::Key_Space)
|
||||||
|
_change_operation_mode = false;
|
||||||
|
|
||||||
checkInputsSettings();
|
checkInputsSettings();
|
||||||
|
|
||||||
// movement
|
// movement
|
||||||
|
|||||||
@@ -421,6 +421,9 @@ private:
|
|||||||
ImGuizmo::OPERATION _gizmo_operation = ImGuizmo::OPERATION::TRANSLATE;
|
ImGuizmo::OPERATION _gizmo_operation = ImGuizmo::OPERATION::TRANSLATE;
|
||||||
Noggit::BoolToggleProperty _gizmo_on = {true};
|
Noggit::BoolToggleProperty _gizmo_on = {true};
|
||||||
|
|
||||||
|
bool _change_operation_mode = false;
|
||||||
|
void updateGizmoOverlay(ImGuizmo::OPERATION operation);
|
||||||
|
|
||||||
bool _gl_initialized = false;
|
bool _gl_initialized = false;
|
||||||
bool _destroying = false;
|
bool _destroying = false;
|
||||||
bool _needs_redraw = false;
|
bool _needs_redraw = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user