2014-03-06 10:13:39 +01:00
|
|
|
#ifndef OPENCS_VIEW_UNPAGEDWORLDSPACEWIDGET_H
|
|
|
|
#define OPENCS_VIEW_UNPAGEDWORLDSPACEWIDGET_H
|
|
|
|
|
2014-06-29 14:19:10 +02:00
|
|
|
#include <memory>
|
2014-03-06 13:02:21 +01:00
|
|
|
#include <string>
|
2022-10-19 19:02:00 +02:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <apps/opencs/model/world/universalid.hpp>
|
|
|
|
#include <apps/opencs/view/render/instancedragmodes.hpp>
|
|
|
|
|
|
|
|
#include <osg/Vec3d>
|
2014-03-06 13:02:21 +01:00
|
|
|
|
2014-06-29 14:19:10 +02:00
|
|
|
#include "cell.hpp"
|
2014-03-06 10:13:39 +01:00
|
|
|
#include "worldspacewidget.hpp"
|
|
|
|
|
2014-03-06 13:02:21 +01:00
|
|
|
class QModelIndex;
|
2022-10-19 19:02:00 +02:00
|
|
|
class QObject;
|
|
|
|
class QWidget;
|
|
|
|
|
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Vec3f;
|
|
|
|
template <class T>
|
|
|
|
class ref_ptr;
|
|
|
|
}
|
2014-03-06 13:02:21 +01:00
|
|
|
|
|
|
|
namespace CSMDoc
|
|
|
|
{
|
|
|
|
class Document;
|
|
|
|
}
|
|
|
|
|
2022-10-19 19:02:00 +02:00
|
|
|
namespace CSVWidget
|
|
|
|
{
|
|
|
|
class SceneToolToggle2;
|
|
|
|
}
|
|
|
|
|
2014-03-06 13:02:21 +01:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class IdTable;
|
2019-09-11 12:59:15 +03:00
|
|
|
class CellCoordinates;
|
2014-03-06 13:02:21 +01:00
|
|
|
}
|
|
|
|
|
2014-03-06 10:13:39 +01:00
|
|
|
namespace CSVRender
|
|
|
|
{
|
2022-10-19 19:02:00 +02:00
|
|
|
class TagBase;
|
|
|
|
|
2014-03-06 10:13:39 +01:00
|
|
|
class UnpagedWorldspaceWidget : public WorldspaceWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2014-03-06 13:02:21 +01:00
|
|
|
CSMDoc::Document& mDocument;
|
|
|
|
std::string mCellId;
|
|
|
|
CSMWorld::IdTable* mCellsModel;
|
2014-05-03 14:00:30 +02:00
|
|
|
CSMWorld::IdTable* mReferenceablesModel;
|
2017-04-28 17:30:26 +02:00
|
|
|
std::unique_ptr<Cell> mCell;
|
2014-03-06 13:02:21 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void update();
|
2014-05-01 18:25:28 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
UnpagedWorldspaceWidget(const std::string& cellId, CSMDoc::Document& document, QWidget* parent);
|
2014-05-01 15:09:47 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
dropRequirments getDropRequirements(DropType type) const override;
|
2015-09-29 13:48:04 +02:00
|
|
|
|
2016-05-16 17:03:00 -04:00
|
|
|
/// \return Drop handled?
|
2020-10-16 22:18:54 +04:00
|
|
|
bool handleDrop(const std::vector<CSMWorld::UniversalId>& data, DropType type) override;
|
2016-05-16 17:03:00 -04:00
|
|
|
|
2016-01-19 14:25:20 +01:00
|
|
|
/// \param elementMask Elements to be affected by the clear operation
|
2020-10-16 22:18:54 +04:00
|
|
|
void clearSelection(int elementMask) override;
|
2016-01-19 14:25:20 +01:00
|
|
|
|
2016-01-26 11:31:37 +01:00
|
|
|
/// \param elementMask Elements to be affected by the select operation
|
2020-10-16 22:18:54 +04:00
|
|
|
void invertSelection(int elementMask) override;
|
2016-01-26 11:31:37 +01:00
|
|
|
|
2021-01-09 21:35:07 +00:00
|
|
|
/// \param elementMask Elements to be affected by the select operation
|
|
|
|
void selectAll(int elementMask) override;
|
|
|
|
|
|
|
|
// Select everything that references the same ID as at least one of the elements
|
2016-01-26 11:31:37 +01:00
|
|
|
// already selected
|
2022-09-22 21:26:05 +03:00
|
|
|
//
|
2021-01-09 21:35:07 +00:00
|
|
|
/// \param elementMask Elements to be affected by the select operation
|
|
|
|
void selectAllWithSameParentId(int elementMask) override;
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void selectInsideCube(const osg::Vec3d& pointA, const osg::Vec3d& pointB, DragMode dragMode) override;
|
2016-01-10 08:56:15 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void selectWithinDistance(const osg::Vec3d& point, float distance, DragMode dragMode) override;
|
2016-05-16 17:20:07 -04:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
std::string getCellId(const osg::Vec3f& point) const override;
|
2019-09-11 12:59:15 +03:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
Cell* getCell(const osg::Vec3d& point) const override;
|
2016-01-25 14:55:02 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
Cell* getCell(const CSMWorld::CellCoordinates& coords) const override;
|
2016-02-16 16:02:29 +01:00
|
|
|
|
2022-11-04 15:04:42 -07:00
|
|
|
osg::ref_ptr<TagBase> getSnapTarget(unsigned int elementMask) const override;
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
std::vector<osg::ref_ptr<TagBase>> getSelection(unsigned int elementMask) const override;
|
2016-03-01 15:48:34 +01:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
std::vector<osg::ref_ptr<TagBase>> getEdited(unsigned int elementMask) const override;
|
2016-03-04 15:19:26 +01:00
|
|
|
|
2014-06-29 14:19:10 +02:00
|
|
|
void setSubMode(int subMode, unsigned int elementMask) override;
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
/// Erase all overrides and restore the visual representation to its true state.
|
|
|
|
void reset(unsigned int elementMask) override;
|
2014-06-29 14:19:10 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
private:
|
|
|
|
void referenceableDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) override;
|
2014-06-29 14:19:10 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void referenceableAboutToBeRemoved(const QModelIndex& parent, int start, int end) override;
|
2014-06-29 14:19:10 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void referenceableAdded(const QModelIndex& index, int start, int end) override;
|
2014-06-29 14:19:10 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void referenceDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) override;
|
2014-06-29 14:19:10 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void referenceAboutToBeRemoved(const QModelIndex& parent, int start, int end) override;
|
2014-06-29 14:19:10 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void referenceAdded(const QModelIndex& index, int start, int end) override;
|
2016-05-02 22:08:49 -04:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void pathgridDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight) override;
|
2016-05-02 22:08:49 -04:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void pathgridAboutToBeRemoved(const QModelIndex& parent, int start, int end) override;
|
2016-05-02 22:08:49 -04:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void pathgridAdded(const QModelIndex& parent, int start, int end) override;
|
2014-09-06 16:11:06 +02:00
|
|
|
|
2014-12-02 11:17:39 +01:00
|
|
|
std::string getStartupInstruction() override;
|
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
protected:
|
2020-10-16 22:18:54 +04:00
|
|
|
void addVisibilitySelectorButtons(CSVWidget::SceneToolToggle2* tool) override;
|
2014-12-02 11:17:39 +01:00
|
|
|
|
2014-03-06 13:02:21 +01:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void cellDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
|
|
|
|
|
|
|
void cellRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
|
2014-05-01 15:09:47 +02:00
|
|
|
|
2017-08-19 19:36:45 -04:00
|
|
|
void assetTablesChanged();
|
|
|
|
|
2014-05-01 15:09:47 +02:00
|
|
|
signals:
|
|
|
|
|
2014-05-03 14:00:30 +02:00
|
|
|
void cellChanged(const CSMWorld::UniversalId& id);
|
2014-03-06 10:13:39 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|