mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 20:49:56 +00:00
added select all of same ID item to selection mode button menu
This commit is contained in:
parent
d5ef40aeb7
commit
1d0ef97bf6
9 changed files with 70 additions and 1 deletions
|
@ -263,6 +263,28 @@ void CSVRender::Cell::setSelection (int elementMask, Selection mode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::Cell::selectAllWithSameParentId (int elementMask)
|
||||||
|
{
|
||||||
|
std::set<std::string> ids;
|
||||||
|
|
||||||
|
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
|
||||||
|
iter!=mObjects.end(); ++iter)
|
||||||
|
{
|
||||||
|
if (iter->second->getSelected())
|
||||||
|
ids.insert (iter->second->getReferenceableId());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
|
||||||
|
iter!=mObjects.end(); ++iter)
|
||||||
|
{
|
||||||
|
if (!iter->second->getSelected() &&
|
||||||
|
ids.find (iter->second->getReferenceableId())!=ids.end())
|
||||||
|
{
|
||||||
|
iter->second->setSelected (true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSVRender::Cell::setCellArrows (int mask)
|
void CSVRender::Cell::setCellArrows (int mask)
|
||||||
{
|
{
|
||||||
for (int i=0; i<4; ++i)
|
for (int i=0; i<4; ++i)
|
||||||
|
|
|
@ -99,6 +99,10 @@ namespace CSVRender
|
||||||
|
|
||||||
void setSelection (int elementMask, Selection mode);
|
void setSelection (int elementMask, Selection mode);
|
||||||
|
|
||||||
|
// Select everything that references the same ID as at least one of the elements
|
||||||
|
// already selected
|
||||||
|
void selectAllWithSameParentId (int elementMask);
|
||||||
|
|
||||||
void setCellArrows (int mask);
|
void setCellArrows (int mask);
|
||||||
|
|
||||||
/// Returns 0, 0 in case of an unpaged cell.
|
/// Returns 0, 0 in case of an unpaged cell.
|
||||||
|
|
|
@ -16,6 +16,7 @@ bool CSVRender::InstanceSelectionMode::createContextMenu (QMenu *menu)
|
||||||
{
|
{
|
||||||
menu->addAction (mSelectAll);
|
menu->addAction (mSelectAll);
|
||||||
menu->addAction (mDeselectAll);
|
menu->addAction (mDeselectAll);
|
||||||
|
menu->addAction (mSelectSame);
|
||||||
menu->addAction (mDeleteSelection);
|
menu->addAction (mDeleteSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,10 +51,11 @@ CSVRender::InstanceSelectionMode::InstanceSelectionMode (CSVWidget::SceneToolbar
|
||||||
mSelectAll = new QAction ("Select all instances", this);
|
mSelectAll = new QAction ("Select all instances", this);
|
||||||
mDeselectAll = new QAction ("Clear selection", this);
|
mDeselectAll = new QAction ("Clear selection", this);
|
||||||
mDeleteSelection = new QAction ("Delete selected instances", this);
|
mDeleteSelection = new QAction ("Delete selected instances", this);
|
||||||
|
mSelectSame = new QAction ("Extend selection to instances with same object ID", this);
|
||||||
connect (mSelectAll, SIGNAL (triggered ()), this, SLOT (selectAll()));
|
connect (mSelectAll, SIGNAL (triggered ()), this, SLOT (selectAll()));
|
||||||
connect (mDeselectAll, SIGNAL (triggered ()), this, SLOT (clearSelection()));
|
connect (mDeselectAll, SIGNAL (triggered ()), this, SLOT (clearSelection()));
|
||||||
connect (mDeleteSelection, SIGNAL (triggered ()), this, SLOT (deleteSelection()));
|
connect (mDeleteSelection, SIGNAL (triggered ()), this, SLOT (deleteSelection()));
|
||||||
|
connect (mSelectSame, SIGNAL (triggered ()), this, SLOT (selectSame()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::InstanceSelectionMode::selectAll()
|
void CSVRender::InstanceSelectionMode::selectAll()
|
||||||
|
@ -84,3 +86,8 @@ void CSVRender::InstanceSelectionMode::deleteSelection()
|
||||||
mWorldspaceWidget.getDocument().getUndoStack().push (command);
|
mWorldspaceWidget.getDocument().getUndoStack().push (command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::InstanceSelectionMode::selectSame()
|
||||||
|
{
|
||||||
|
mWorldspaceWidget.selectAllWithSameParentId (Mask_Reference);
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace CSVRender
|
||||||
QAction *mSelectAll;
|
QAction *mSelectAll;
|
||||||
QAction *mDeselectAll;
|
QAction *mDeselectAll;
|
||||||
QAction *mDeleteSelection;
|
QAction *mDeleteSelection;
|
||||||
|
QAction *mSelectSame;
|
||||||
|
|
||||||
/// Add context menu items to \a menu.
|
/// Add context menu items to \a menu.
|
||||||
///
|
///
|
||||||
|
@ -37,6 +38,8 @@ namespace CSVRender
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
|
|
||||||
void deleteSelection();
|
void deleteSelection();
|
||||||
|
|
||||||
|
void selectSame();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -518,6 +518,15 @@ void CSVRender::PagedWorldspaceWidget::selectAll (int elementMask)
|
||||||
flagAsModified();
|
flagAsModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::PagedWorldspaceWidget::selectAllWithSameParentId (int elementMask)
|
||||||
|
{
|
||||||
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter = mCells.begin();
|
||||||
|
iter!=mCells.end(); ++iter)
|
||||||
|
iter->second->selectAllWithSameParentId (elementMask);
|
||||||
|
|
||||||
|
flagAsModified();
|
||||||
|
}
|
||||||
|
|
||||||
std::string CSVRender::PagedWorldspaceWidget::getCellId (const osg::Vec3f& point) const
|
std::string CSVRender::PagedWorldspaceWidget::getCellId (const osg::Vec3f& point) const
|
||||||
{
|
{
|
||||||
const int cellSize = 8192;
|
const int cellSize = 8192;
|
||||||
|
|
|
@ -101,6 +101,12 @@ namespace CSVRender
|
||||||
/// \param elementMask Elements to be affected by the select operation
|
/// \param elementMask Elements to be affected by the select operation
|
||||||
virtual void selectAll (int elementMask);
|
virtual void selectAll (int elementMask);
|
||||||
|
|
||||||
|
// Select everything that references the same ID as at least one of the elements
|
||||||
|
// already selected
|
||||||
|
//
|
||||||
|
/// \param elementMask Elements to be affected by the select operation
|
||||||
|
virtual void selectAllWithSameParentId (int elementMask);
|
||||||
|
|
||||||
virtual std::string getCellId (const osg::Vec3f& point) const;
|
virtual std::string getCellId (const osg::Vec3f& point) const;
|
||||||
|
|
||||||
virtual std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask)
|
virtual std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask)
|
||||||
|
|
|
@ -114,6 +114,12 @@ void CSVRender::UnpagedWorldspaceWidget::selectAll (int elementMask)
|
||||||
flagAsModified();
|
flagAsModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::UnpagedWorldspaceWidget::selectAllWithSameParentId (int elementMask)
|
||||||
|
{
|
||||||
|
mCell->selectAllWithSameParentId (elementMask);
|
||||||
|
flagAsModified();
|
||||||
|
}
|
||||||
|
|
||||||
std::string CSVRender::UnpagedWorldspaceWidget::getCellId (const osg::Vec3f& point) const
|
std::string CSVRender::UnpagedWorldspaceWidget::getCellId (const osg::Vec3f& point) const
|
||||||
{
|
{
|
||||||
return mCellId;
|
return mCellId;
|
||||||
|
|
|
@ -49,6 +49,12 @@ namespace CSVRender
|
||||||
/// \param elementMask Elements to be affected by the select operation
|
/// \param elementMask Elements to be affected by the select operation
|
||||||
virtual void selectAll (int elementMask);
|
virtual void selectAll (int elementMask);
|
||||||
|
|
||||||
|
// Select everything that references the same ID as at least one of the elements
|
||||||
|
// already selected
|
||||||
|
//
|
||||||
|
/// \param elementMask Elements to be affected by the select operation
|
||||||
|
virtual void selectAllWithSameParentId (int elementMask);
|
||||||
|
|
||||||
virtual std::string getCellId (const osg::Vec3f& point) const;
|
virtual std::string getCellId (const osg::Vec3f& point) const;
|
||||||
|
|
||||||
virtual std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask)
|
virtual std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask)
|
||||||
|
|
|
@ -130,6 +130,12 @@ namespace CSVRender
|
||||||
/// \param elementMask Elements to be affected by the select operation
|
/// \param elementMask Elements to be affected by the select operation
|
||||||
virtual void selectAll (int elementMask) = 0;
|
virtual void selectAll (int elementMask) = 0;
|
||||||
|
|
||||||
|
// Select everything that references the same ID as at least one of the elements
|
||||||
|
// already selected
|
||||||
|
//
|
||||||
|
/// \param elementMask Elements to be affected by the select operation
|
||||||
|
virtual void selectAllWithSameParentId (int elementMask) = 0;
|
||||||
|
|
||||||
/// Return the next intersection point with scene elements matched by
|
/// Return the next intersection point with scene elements matched by
|
||||||
/// \a interactionMask based on \a localPos and the camera vector.
|
/// \a interactionMask based on \a localPos and the camera vector.
|
||||||
/// If there is no such point, instead a point "in front" of \a localPos will be
|
/// If there is no such point, instead a point "in front" of \a localPos will be
|
||||||
|
|
Loading…
Reference in a new issue