mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-15 23:42:20 +00:00
Feat(worldspacewidget.cpp): Implement shortcut for visibility switching
& unhiding all instances
This commit is contained in:
parent
9d155afc15
commit
94eadd436d
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#include "cameracontroller.hpp"
|
#include "cameracontroller.hpp"
|
||||||
#include "instancemode.hpp"
|
#include "instancemode.hpp"
|
||||||
|
#include "mask.hpp"
|
||||||
#include "object.hpp"
|
#include "object.hpp"
|
||||||
#include "pathgridmode.hpp"
|
#include "pathgridmode.hpp"
|
||||||
|
|
||||||
@ -135,6 +136,12 @@ CSVRender::WorldspaceWidget::WorldspaceWidget(CSMDoc::Document& document, QWidge
|
|||||||
CSMPrefs::Shortcut* abortShortcut = new CSMPrefs::Shortcut("scene-edit-abort", this);
|
CSMPrefs::Shortcut* abortShortcut = new CSMPrefs::Shortcut("scene-edit-abort", this);
|
||||||
connect(abortShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), this, &WorldspaceWidget::abortDrag);
|
connect(abortShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), this, &WorldspaceWidget::abortDrag);
|
||||||
|
|
||||||
|
connect(new CSMPrefs::Shortcut("scene-toggle-visibility", this), qOverload<>(&CSMPrefs::Shortcut::activated), this,
|
||||||
|
&WorldspaceWidget::toggleHiddenInstances);
|
||||||
|
|
||||||
|
connect(new CSMPrefs::Shortcut("scene-unhide-all", this), qOverload<>(&CSMPrefs::Shortcut::activated), this,
|
||||||
|
&WorldspaceWidget::unhideAll);
|
||||||
|
|
||||||
mInConstructor = false;
|
mInConstructor = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -740,6 +747,23 @@ void CSVRender::WorldspaceWidget::speedMode(bool activate)
|
|||||||
mSpeedMode = activate;
|
mSpeedMode = activate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::WorldspaceWidget::toggleHiddenInstances()
|
||||||
|
{
|
||||||
|
const std::vector<osg::ref_ptr<TagBase>> selection = getSelection(Mask_Reference);
|
||||||
|
|
||||||
|
if (selection.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const CSVRender::ObjectTag* firstSelection = dynamic_cast<CSVRender::ObjectTag*>(selection.begin()->get());
|
||||||
|
|
||||||
|
const CSVRender::Mask firstMask
|
||||||
|
= firstSelection->mObject->getRootNode()->getNodeMask() == Mask_Hidden ? Mask_Reference : Mask_Hidden;
|
||||||
|
|
||||||
|
for (const auto& object : selection)
|
||||||
|
if (const auto objectTag = dynamic_cast<CSVRender::ObjectTag*>(object.get()))
|
||||||
|
objectTag->mObject->getRootNode()->setNodeMask(firstMask);
|
||||||
|
}
|
||||||
|
|
||||||
void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate)
|
void CSVRender::WorldspaceWidget::handleInteraction(InteractionType type, bool activate)
|
||||||
{
|
{
|
||||||
if (activate)
|
if (activate)
|
||||||
|
@ -203,8 +203,6 @@ namespace CSVRender
|
|||||||
|
|
||||||
virtual void selectGroup(const std::vector<std::string>) const = 0;
|
virtual void selectGroup(const std::vector<std::string>) const = 0;
|
||||||
|
|
||||||
virtual void hideGroup(const std::vector<std::string>) const = 0;
|
|
||||||
|
|
||||||
virtual void unhideAll() const = 0;
|
virtual void unhideAll() const = 0;
|
||||||
|
|
||||||
virtual std::vector<osg::ref_ptr<TagBase>> getEdited(unsigned int elementMask) const = 0;
|
virtual std::vector<osg::ref_ptr<TagBase>> getEdited(unsigned int elementMask) const = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user