forked from mirror/openmw-tes3mp
Brush button window opens at modebutton, slider 1-50, doxygen comments
This commit is contained in:
parent
20d1d8ac89
commit
7139889566
4 changed files with 49 additions and 4 deletions
|
@ -46,10 +46,11 @@ CSVRender::BrushSizeControls::BrushSizeControls(const QString &title, QWidget *p
|
||||||
brushSizeSlider = new QSlider(Qt::Horizontal);
|
brushSizeSlider = new QSlider(Qt::Horizontal);
|
||||||
brushSizeSlider->setTickPosition(QSlider::TicksBothSides);
|
brushSizeSlider->setTickPosition(QSlider::TicksBothSides);
|
||||||
brushSizeSlider->setTickInterval(10);
|
brushSizeSlider->setTickInterval(10);
|
||||||
|
brushSizeSlider->setRange(1, 50);
|
||||||
brushSizeSlider->setSingleStep(1);
|
brushSizeSlider->setSingleStep(1);
|
||||||
|
|
||||||
brushSizeSpinBox = new QSpinBox;
|
brushSizeSpinBox = new QSpinBox;
|
||||||
brushSizeSpinBox->setRange(1, 100);
|
brushSizeSpinBox->setRange(1, 50);
|
||||||
brushSizeSpinBox->setSingleStep(1);
|
brushSizeSpinBox->setSingleStep(1);
|
||||||
|
|
||||||
layoutSliderSize = new QHBoxLayout;
|
layoutSliderSize = new QHBoxLayout;
|
||||||
|
@ -158,6 +159,7 @@ CSVRender::TerrainTextureMode::TerrainTextureMode (WorldspaceWidget *worldspaceW
|
||||||
{
|
{
|
||||||
connect(parent, SIGNAL(passEvent(QDragEnterEvent*)), this, SLOT(handleDragEnterEvent(QDragEnterEvent*)));
|
connect(parent, SIGNAL(passEvent(QDragEnterEvent*)), this, SLOT(handleDragEnterEvent(QDragEnterEvent*)));
|
||||||
connect(parent, SIGNAL(passEvent(QDropEvent*)), this, SLOT(handleDropEvent(QDropEvent*)));
|
connect(parent, SIGNAL(passEvent(QDropEvent*)), this, SLOT(handleDropEvent(QDropEvent*)));
|
||||||
|
connect(parent, SIGNAL(passEvent(QMouseEvent*)), this, SLOT(handleMouseEvent(QMouseEvent*)));
|
||||||
connect(textureBrushWindow, SIGNAL(passBrushSize(int)), this, SLOT(setBrushSize(int)));
|
connect(textureBrushWindow, SIGNAL(passBrushSize(int)), this, SLOT(setBrushSize(int)));
|
||||||
connect(textureBrushWindow, SIGNAL(passBrushShape(int)), this, SLOT(setBrushShape(int)));
|
connect(textureBrushWindow, SIGNAL(passBrushShape(int)), this, SLOT(setBrushShape(int)));
|
||||||
}
|
}
|
||||||
|
@ -191,9 +193,6 @@ void CSVRender::TerrainTextureMode::primaryEditPressed(const WorldspaceHitResult
|
||||||
|
|
||||||
void CSVRender::TerrainTextureMode::primarySelectPressed(const WorldspaceHitResult& hit)
|
void CSVRender::TerrainTextureMode::primarySelectPressed(const WorldspaceHitResult& hit)
|
||||||
{
|
{
|
||||||
QPoint position = QCursor::pos();
|
|
||||||
textureBrushWindow->move (position);
|
|
||||||
textureBrushWindow->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVRender::TerrainTextureMode::secondarySelectPressed(const WorldspaceHitResult& hit)
|
void CSVRender::TerrainTextureMode::secondarySelectPressed(const WorldspaceHitResult& hit)
|
||||||
|
@ -274,6 +273,20 @@ void CSVRender::TerrainTextureMode::handleDropEvent (QDropEvent *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVRender::TerrainTextureMode::handleMouseEvent (QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button()==Qt::MidButton)
|
||||||
|
{
|
||||||
|
QPoint position = QCursor::pos();
|
||||||
|
textureBrushWindow->move (position);
|
||||||
|
textureBrushWindow->show();
|
||||||
|
}
|
||||||
|
if (event->button()==Qt::LeftButton) PushButton::mouseReleaseEvent (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVRender::TerrainTextureMode::handlePrimarySelectOnModeButton () {
|
||||||
|
}
|
||||||
|
|
||||||
void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitResult& hit)
|
void CSVRender::TerrainTextureMode::editTerrainTextureGrid(const WorldspaceHitResult& hit)
|
||||||
{
|
{
|
||||||
mCellId = getWorldspaceWidget().getCellId (hit.worldPos);
|
mCellId = getWorldspaceWidget().getCellId (hit.worldPos);
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace CSVWidget
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/// \brief Layout-box for some brush button settings
|
||||||
class BrushSizeControls : public QGroupBox
|
class BrushSizeControls : public QGroupBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -44,6 +46,7 @@ namespace CSVRender
|
||||||
QHBoxLayout *layoutSliderSize;
|
QHBoxLayout *layoutSliderSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// \brief Brush settings window
|
||||||
class TextureBrushWindow : public QFrame
|
class TextureBrushWindow : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -82,27 +85,41 @@ namespace CSVRender
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
/// \brief Editmode for terrain texture grid
|
||||||
TerrainTextureMode(WorldspaceWidget*, QWidget* parent = nullptr);
|
TerrainTextureMode(WorldspaceWidget*, QWidget* parent = nullptr);
|
||||||
|
|
||||||
|
/// \brief Create single command for one-click texture editing
|
||||||
void primaryEditPressed (const WorldspaceHitResult& hit);
|
void primaryEditPressed (const WorldspaceHitResult& hit);
|
||||||
|
|
||||||
|
/// \brief Open brush settings window
|
||||||
void primarySelectPressed(const WorldspaceHitResult&);
|
void primarySelectPressed(const WorldspaceHitResult&);
|
||||||
|
|
||||||
void secondarySelectPressed(const WorldspaceHitResult&);
|
void secondarySelectPressed(const WorldspaceHitResult&);
|
||||||
|
|
||||||
void activate(CSVWidget::SceneToolbar*);
|
void activate(CSVWidget::SceneToolbar*);
|
||||||
void deactivate(CSVWidget::SceneToolbar*);
|
void deactivate(CSVWidget::SceneToolbar*);
|
||||||
|
|
||||||
|
/// \brief Start texture editing command macro
|
||||||
virtual bool primaryEditStartDrag (const QPoint& pos);
|
virtual bool primaryEditStartDrag (const QPoint& pos);
|
||||||
|
|
||||||
virtual bool secondaryEditStartDrag (const QPoint& pos);
|
virtual bool secondaryEditStartDrag (const QPoint& pos);
|
||||||
virtual bool primarySelectStartDrag (const QPoint& pos);
|
virtual bool primarySelectStartDrag (const QPoint& pos);
|
||||||
virtual bool secondarySelectStartDrag (const QPoint& pos);
|
virtual bool secondarySelectStartDrag (const QPoint& pos);
|
||||||
|
|
||||||
|
/// \brief Handle texture edit behavior during dragging
|
||||||
virtual void drag (const QPoint& pos, int diffX, int diffY, double speedFactor);
|
virtual void drag (const QPoint& pos, int diffX, int diffY, double speedFactor);
|
||||||
|
|
||||||
|
/// \brief End texture editing command macro
|
||||||
virtual void dragCompleted(const QPoint& pos);
|
virtual void dragCompleted(const QPoint& pos);
|
||||||
|
|
||||||
virtual void dragAborted();
|
virtual void dragAborted();
|
||||||
virtual void dragWheel (int diff, double speedFactor);
|
virtual void dragWheel (int diff, double speedFactor);
|
||||||
virtual void dragMoveEvent (QDragMoveEvent *event);
|
virtual void dragMoveEvent (QDragMoveEvent *event);
|
||||||
|
|
||||||
|
/// \brief Handle brush mechanics, maths regarding worldspace hit etc.
|
||||||
void editTerrainTextureGrid (const WorldspaceHitResult& hit);
|
void editTerrainTextureGrid (const WorldspaceHitResult& hit);
|
||||||
|
|
||||||
|
/// \brief Push texture edits to command macro
|
||||||
void pushEditToCommand (CSMWorld::LandTexturesColumn::DataType& newLandGrid, CSMDoc::Document& document,
|
void pushEditToCommand (CSMWorld::LandTexturesColumn::DataType& newLandGrid, CSMDoc::Document& document,
|
||||||
CSMWorld::IdTable& landTable, std::string cellId);
|
CSMWorld::IdTable& landTable, std::string cellId);
|
||||||
|
|
||||||
|
@ -123,6 +140,8 @@ namespace CSVRender
|
||||||
public slots:
|
public slots:
|
||||||
void handleDragEnterEvent (QDragEnterEvent *event);
|
void handleDragEnterEvent (QDragEnterEvent *event);
|
||||||
void handleDropEvent(QDropEvent *event);
|
void handleDropEvent(QDropEvent *event);
|
||||||
|
void handleMouseEvent (QMouseEvent *event);
|
||||||
|
void handlePrimarySelectOnModeButton();
|
||||||
void setBrushSize(int brushSize);
|
void setBrushSize(int brushSize);
|
||||||
void setBrushShape(int brushShape);
|
void setBrushShape(int brushShape);
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,16 @@ void CSVWidget::SceneToolMode::setButton (const std::string& id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CSVWidget::SceneToolMode::mouseReleaseEvent (QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button()==Qt::MidButton && getCurrentId() == "terrain-texture") emit passEvent(event);
|
||||||
|
if (getType()==Type_TopAction && event->button()==Qt::RightButton)
|
||||||
|
showPanel (parentWidget()->mapToGlobal (pos()));
|
||||||
|
else
|
||||||
|
PushButton::mouseReleaseEvent (event);
|
||||||
|
}
|
||||||
|
|
||||||
bool CSVWidget::SceneToolMode::event(QEvent* event)
|
bool CSVWidget::SceneToolMode::event(QEvent* event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::ToolTip)
|
if (event->type() == QEvent::ToolTip)
|
||||||
|
|
|
@ -44,6 +44,8 @@ namespace CSVWidget
|
||||||
|
|
||||||
void setButton (std::map<ModeButton *, std::string>::iterator iter);
|
void setButton (std::map<ModeButton *, std::string>::iterator iter);
|
||||||
|
|
||||||
|
void mouseReleaseEvent (QMouseEvent *event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
bool event(QEvent* event);
|
bool event(QEvent* event);
|
||||||
|
@ -74,6 +76,7 @@ namespace CSVWidget
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void modeChanged (const std::string& id);
|
void modeChanged (const std::string& id);
|
||||||
|
void passEvent (QMouseEvent *event);
|
||||||
void passEvent (QDragEnterEvent *event);
|
void passEvent (QDragEnterEvent *event);
|
||||||
void passEvent (QDropEvent *event);
|
void passEvent (QDropEvent *event);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue