mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 01:10:10 +00:00
Feat(worldspacewidget.cpp): store the camera mode tool & implement the
shortcut to cycle camera modes
This commit is contained in:
parent
2e581c4d70
commit
98750a122d
@ -75,6 +75,7 @@ CSVRender::WorldspaceWidget::WorldspaceWidget(CSMDoc::Document& document, QWidge
|
||||
, mShowToolTips(false)
|
||||
, mToolTipDelay(0)
|
||||
, mInConstructor(true)
|
||||
, mSelectedNavigationMode(0)
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
|
||||
@ -146,6 +147,10 @@ CSVRender::WorldspaceWidget::WorldspaceWidget(CSMDoc::Document& document, QWidge
|
||||
connect(new CSMPrefs::Shortcut("scene-clear-selection", this), qOverload<>(&CSMPrefs::Shortcut::activated), this,
|
||||
[this] { this->clearSelection(Mask_Reference); });
|
||||
|
||||
CSMPrefs::Shortcut* switchPerspectiveShortcut = new CSMPrefs::Shortcut("scene-cam-cycle", this);
|
||||
connect(switchPerspectiveShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), this,
|
||||
&WorldspaceWidget::cycleNavigationMode);
|
||||
|
||||
mInConstructor = false;
|
||||
}
|
||||
|
||||
@ -235,9 +240,11 @@ CSVWidget::SceneToolMode* CSVRender::WorldspaceWidget::makeNavigationSelector(CS
|
||||
tool),
|
||||
"orbit");
|
||||
|
||||
connect(tool, &CSVWidget::SceneToolMode::modeChanged, this, &WorldspaceWidget::selectNavigationMode);
|
||||
mCameraMode = tool;
|
||||
|
||||
return tool;
|
||||
connect(mCameraMode, &CSVWidget::SceneToolMode::modeChanged, this, &WorldspaceWidget::selectNavigationMode);
|
||||
|
||||
return mCameraMode;
|
||||
}
|
||||
|
||||
CSVWidget::SceneToolToggle2* CSVRender::WorldspaceWidget::makeSceneVisibilitySelector(CSVWidget::SceneToolbar* parent)
|
||||
@ -769,6 +776,26 @@ void CSVRender::WorldspaceWidget::toggleHiddenInstances()
|
||||
objectTag->mObject->getRootNode()->setNodeMask(firstMask);
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::cycleNavigationMode()
|
||||
{
|
||||
switch (++mSelectedNavigationMode)
|
||||
{
|
||||
case (CameraMode::FirstPerson):
|
||||
mCameraMode->setButton("1st");
|
||||
break;
|
||||
case (CameraMode::Orbit):
|
||||
mCameraMode->setButton("orbit");
|
||||
break;
|
||||
case (CameraMode::Free):
|
||||
mCameraMode->setButton("free");
|
||||
break;
|
||||
default:
|
||||
mCameraMode->setButton("1st");
|
||||
mSelectedNavigationMode = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate)
|
||||
{
|
||||
if (activate)
|
||||
|
@ -75,6 +75,7 @@ namespace CSVRender
|
||||
CSMDoc::Document& mDocument;
|
||||
unsigned int mInteractionMask;
|
||||
CSVWidget::SceneToolMode* mEditMode;
|
||||
CSVWidget::SceneToolMode* mCameraMode;
|
||||
bool mLocked;
|
||||
int mDragMode;
|
||||
bool mDragging;
|
||||
@ -89,6 +90,7 @@ namespace CSVRender
|
||||
bool mShowToolTips;
|
||||
int mToolTipDelay;
|
||||
bool mInConstructor;
|
||||
int mSelectedNavigationMode;
|
||||
|
||||
public:
|
||||
enum DropType
|
||||
@ -225,6 +227,13 @@ namespace CSVRender
|
||||
Button_Terrain = 0x8
|
||||
};
|
||||
|
||||
enum CameraMode
|
||||
{
|
||||
FirstPerson,
|
||||
Orbit,
|
||||
Free
|
||||
};
|
||||
|
||||
virtual void addVisibilitySelectorButtons(CSVWidget::SceneToolToggle2* tool);
|
||||
|
||||
virtual void addEditModeSelectorButtons(CSVWidget::SceneToolMode* tool);
|
||||
@ -240,6 +249,8 @@ namespace CSVRender
|
||||
|
||||
bool getSpeedMode();
|
||||
|
||||
void cycleNavigationMode();
|
||||
|
||||
private:
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user