mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +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)
|
, mShowToolTips(false)
|
||||||
, mToolTipDelay(0)
|
, mToolTipDelay(0)
|
||||||
, mInConstructor(true)
|
, mInConstructor(true)
|
||||||
|
, mSelectedNavigationMode(0)
|
||||||
{
|
{
|
||||||
setAcceptDrops(true);
|
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,
|
connect(new CSMPrefs::Shortcut("scene-clear-selection", this), qOverload<>(&CSMPrefs::Shortcut::activated), this,
|
||||||
[this] { this->clearSelection(Mask_Reference); });
|
[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;
|
mInConstructor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,9 +240,11 @@ CSVWidget::SceneToolMode* CSVRender::WorldspaceWidget::makeNavigationSelector(CS
|
|||||||
tool),
|
tool),
|
||||||
"orbit");
|
"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)
|
CSVWidget::SceneToolToggle2* CSVRender::WorldspaceWidget::makeSceneVisibilitySelector(CSVWidget::SceneToolbar* parent)
|
||||||
@ -769,6 +776,26 @@ void CSVRender::WorldspaceWidget::toggleHiddenInstances()
|
|||||||
objectTag->mObject->getRootNode()->setNodeMask(firstMask);
|
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)
|
void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate)
|
||||||
{
|
{
|
||||||
if (activate)
|
if (activate)
|
||||||
|
@ -75,6 +75,7 @@ namespace CSVRender
|
|||||||
CSMDoc::Document& mDocument;
|
CSMDoc::Document& mDocument;
|
||||||
unsigned int mInteractionMask;
|
unsigned int mInteractionMask;
|
||||||
CSVWidget::SceneToolMode* mEditMode;
|
CSVWidget::SceneToolMode* mEditMode;
|
||||||
|
CSVWidget::SceneToolMode* mCameraMode;
|
||||||
bool mLocked;
|
bool mLocked;
|
||||||
int mDragMode;
|
int mDragMode;
|
||||||
bool mDragging;
|
bool mDragging;
|
||||||
@ -89,6 +90,7 @@ namespace CSVRender
|
|||||||
bool mShowToolTips;
|
bool mShowToolTips;
|
||||||
int mToolTipDelay;
|
int mToolTipDelay;
|
||||||
bool mInConstructor;
|
bool mInConstructor;
|
||||||
|
int mSelectedNavigationMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum DropType
|
enum DropType
|
||||||
@ -225,6 +227,13 @@ namespace CSVRender
|
|||||||
Button_Terrain = 0x8
|
Button_Terrain = 0x8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum CameraMode
|
||||||
|
{
|
||||||
|
FirstPerson,
|
||||||
|
Orbit,
|
||||||
|
Free
|
||||||
|
};
|
||||||
|
|
||||||
virtual void addVisibilitySelectorButtons(CSVWidget::SceneToolToggle2* tool);
|
virtual void addVisibilitySelectorButtons(CSVWidget::SceneToolToggle2* tool);
|
||||||
|
|
||||||
virtual void addEditModeSelectorButtons(CSVWidget::SceneToolMode* tool);
|
virtual void addEditModeSelectorButtons(CSVWidget::SceneToolMode* tool);
|
||||||
@ -240,6 +249,8 @@ namespace CSVRender
|
|||||||
|
|
||||||
bool getSpeedMode();
|
bool getSpeedMode();
|
||||||
|
|
||||||
|
void cycleNavigationMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user