mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 12:39:43 +00:00
Implement context-select functionality.
This commit is contained in:
parent
b83f522ecd
commit
83c86cd1be
1 changed files with 19 additions and 3 deletions
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
#include <components/sceneutil/pathgridutil.hpp>
|
#include <components/sceneutil/pathgridutil.hpp>
|
||||||
|
|
||||||
|
#include "../../model/prefs/state.hpp"
|
||||||
|
|
||||||
#include "../../model/world/commands.hpp"
|
#include "../../model/world/commands.hpp"
|
||||||
#include "../../model/world/commandmacro.hpp"
|
#include "../../model/world/commandmacro.hpp"
|
||||||
#include "../../model/world/idtable.hpp"
|
#include "../../model/world/idtable.hpp"
|
||||||
|
@ -53,9 +55,12 @@ namespace CSVRender
|
||||||
|
|
||||||
void PathgridMode::primaryEditPressed(const WorldspaceHitResult& hitResult)
|
void PathgridMode::primaryEditPressed(const WorldspaceHitResult& hitResult)
|
||||||
{
|
{
|
||||||
// Get pathgrid cell
|
if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue() &&
|
||||||
Cell* cell = getWorldspaceWidget().getCell (hitResult.worldPos);
|
dynamic_cast<PathgridTag*>(hitResult.tag.get()))
|
||||||
if (cell)
|
{
|
||||||
|
primarySelectPressed(hitResult);
|
||||||
|
}
|
||||||
|
else if (Cell* cell = getWorldspaceWidget().getCell (hitResult.worldPos))
|
||||||
{
|
{
|
||||||
// Add node
|
// Add node
|
||||||
QUndoStack& undoStack = getWorldspaceWidget().getDocument().getUndoStack();
|
QUndoStack& undoStack = getWorldspaceWidget().getDocument().getUndoStack();
|
||||||
|
@ -127,6 +132,17 @@ namespace CSVRender
|
||||||
{
|
{
|
||||||
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
std::vector<osg::ref_ptr<TagBase> > selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
||||||
|
|
||||||
|
if (CSMPrefs::get()["3D Scene Input"]["context-select"].isTrue())
|
||||||
|
{
|
||||||
|
WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask());
|
||||||
|
|
||||||
|
if (dynamic_cast<PathgridTag*>(hit.tag.get()))
|
||||||
|
{
|
||||||
|
primarySelectPressed(hit);
|
||||||
|
selection = getWorldspaceWidget().getSelection (Mask_Pathgrid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!selection.empty())
|
if (!selection.empty())
|
||||||
{
|
{
|
||||||
mDragMode = DragMode_Move;
|
mDragMode = DragMode_Move;
|
||||||
|
|
Loading…
Reference in a new issue