diff --git a/src/noggit/MapView.cpp b/src/noggit/MapView.cpp
index 091146d7..bcddecfc 100755
--- a/src/noggit/MapView.cpp
+++ b/src/noggit/MapView.cpp
@@ -225,18 +225,20 @@ void MapView::set_editing_mode(editing_mode mode)
_viewport_overlay_ui->gizmoBar->hide();
}
+ _left_sec_toolbar->setCurrentMode(this, mode);
+
if (context() && context()->isValid())
{
_world->renderer()->getTerrainParamsUniformBlock()->draw_areaid_overlay = false;
_world->renderer()->getTerrainParamsUniformBlock()->draw_impass_overlay = false;
- _world->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = false;
+ _world->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = _left_sec_toolbar->showUnpaintableChunk();
_world->renderer()->getTerrainParamsUniformBlock()->draw_selection_overlay = false;
_minimap->use_selection(nullptr);
switch (mode)
{
case editing_mode::ground:
- if (terrainTool->_edit_type != eTerrainType_Vertex || terrainTool->_edit_type != eTerrainType_Script && terrainTool->getImageMaskSelector()->isEnabled())
+ if (terrainTool->_edit_type != eTerrainType_Vertex || (terrainTool->_edit_type != eTerrainType_Script && terrainTool->getImageMaskSelector()->isEnabled()))
{
terrainTool->updateMaskImage();
}
@@ -246,10 +248,6 @@ void MapView::set_editing_mode(editing_mode mode)
{
texturingTool->updateMaskImage();
}
- if (texturingTool->show_unpaintable_chunks())
- {
- _world->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = true;
- }
break;
case editing_mode::mccv:
if (shaderTool->getImageMaskSelector()->isEnabled())
@@ -1048,13 +1046,20 @@ void MapView::setupToolbars()
auto right_toolbar_layout = new QVBoxLayout(_viewport_overlay_ui->leftToolbarHolder);
right_toolbar_layout->addWidget( _toolbar);
right_toolbar_layout->setDirection(QBoxLayout::LeftToRight);
- right_toolbar_layout->setContentsMargins(0, 5, 0,5);
+ right_toolbar_layout->setContentsMargins(0, 5, 0, 5);
connect (this, &QObject::destroyed, _toolbar, &QObject::deleteLater);
+ auto left_sec_toolbar_layout = new QVBoxLayout(_viewport_overlay_ui->leftSecondaryToolbarHolder);
+ left_sec_toolbar_layout->setContentsMargins(5, 0, 5, 0);
+
+ _left_sec_toolbar = new Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar(this, terrainMode);
+ connect(this, &QObject::destroyed, _left_sec_toolbar, &QObject::deleteLater);
+ left_sec_toolbar_layout->addWidget( _left_sec_toolbar);
+
auto top_toolbar_layout = new QVBoxLayout(_viewport_overlay_ui->upperToolbarHolder);
top_toolbar_layout->setContentsMargins(5, 0, 5, 0);
auto sec_toolbar_layout = new QVBoxLayout(_viewport_overlay_ui->secondaryToolbarHolder);
- sec_toolbar_layout->setContentsMargins(0, 0, 0, 0);
+ sec_toolbar_layout->setContentsMargins(5, 0, 5, 0);
_viewport_overlay_ui->secondaryToolbarHolder->hide();
_secondary_toolbar = new Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar(this);
@@ -4301,7 +4306,7 @@ void MapView::draw_map()
, terrainMode == editing_mode::mccv ? shaderTool->shaderColor() : cursor_color
, _cursorType
, radius
- , texturingTool->show_unpaintable_chunks()
+ , _left_sec_toolbar->showUnpaintableChunk()
, inner_radius
, ref_pos
, angle
@@ -5256,6 +5261,11 @@ QWidget* MapView::getSecondaryToolBar()
return _viewport_overlay_ui->secondaryToolbarHolder;
}
+QWidget* MapView::getLeftSecondaryToolbar()
+{
+ return _viewport_overlay_ui->leftSecondaryToolbarHolder;
+}
+
QWidget* MapView::getActiveStampModeItem()
{
auto item = stampTool->getActiveBrushItem();
diff --git a/src/noggit/MapView.h b/src/noggit/MapView.h
index 7459c1b1..8232752c 100755
--- a/src/noggit/MapView.h
+++ b/src/noggit/MapView.h
@@ -227,6 +227,7 @@ private:
Noggit::Ui::toolbar* _toolbar;
Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _view_toolbar;
Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _secondary_toolbar;
+ Noggit::Ui::Tools::ViewToolbar::Ui::ViewToolbar* _left_sec_toolbar;
void save(save_mode mode);
@@ -277,6 +278,9 @@ public:
[[nodiscard]]
QWidget *getSecondaryToolBar();
+ [[nodiscard]]
+ QWidget *getLeftSecondaryToolbar();
+
[[nodiscard]]
QWidget* getActiveStampModeItem();
diff --git a/src/noggit/rendering/WorldRender.cpp b/src/noggit/rendering/WorldRender.cpp
index 373c2789..236accef 100755
--- a/src/noggit/rendering/WorldRender.cpp
+++ b/src/noggit/rendering/WorldRender.cpp
@@ -861,7 +861,7 @@ void WorldRender::draw (glm::mat4x4 const& model_view
if (angled_mode && terrainMode == editing_mode::flatten_blur)
{
- if (angle > 57.2958f) // 1 radian
+ if (angle > 49.0f) // 0.855 radian
{
color.x = 1.f;
color.y = 0.f;
diff --git a/src/noggit/ui/MapViewOverlay.ui b/src/noggit/ui/MapViewOverlay.ui
index 5f38f2cc..5de98bb5 100755
--- a/src/noggit/ui/MapViewOverlay.ui
+++ b/src/noggit/ui/MapViewOverlay.ui
@@ -6,8 +6,8 @@
0
0
- 924
- 141
+ 967
+ 520
@@ -63,6 +63,9 @@
-
+
+ 5
+
-
-
@@ -89,7 +92,43 @@
0
- 20
+ 0
+
+
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 0
+ 0
@@ -115,8 +154,8 @@
- 40
- 20
+ 0
+ 0
diff --git a/src/noggit/ui/texturing_tool.cpp b/src/noggit/ui/texturing_tool.cpp
index e144b66f..41cdd7ea 100755
--- a/src/noggit/ui/texturing_tool.cpp
+++ b/src/noggit/ui/texturing_tool.cpp
@@ -31,7 +31,6 @@ namespace Noggit
)
: QWidget(parent)
, _brush_level(255)
- , _show_unpaintable_chunks(false)
, _spray_size(1.0f)
, _spray_pressure(2.0f)
, _anim_prop(true)
@@ -107,16 +106,6 @@ namespace Noggit
_brush_level_spin->setSingleStep(5);
slider_layout_right->addWidget(_brush_level_spin);
- _show_unpaintable_chunks_cb = new QCheckBox("Show unpaintable chunks", tool_widget);
- _show_unpaintable_chunks_cb->setChecked(false);
- tool_layout->addWidget(_show_unpaintable_chunks_cb);
-
- connect(_show_unpaintable_chunks_cb, &QCheckBox::toggled, [=](bool checked)
- {
- _map_view->getWorld()->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = checked;
- _map_view->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
- });
-
// spray
_spray_mode_group = new QGroupBox("Spray", tool_widget);
_spray_mode_group->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
@@ -246,13 +235,6 @@ namespace Noggit
}
);
- connect ( _show_unpaintable_chunks_cb, &QCheckBox::stateChanged
- , [&] (int state)
- {
- _show_unpaintable_chunks = state;
- }
- );
-
connect ( _spray_size_spin, qOverload (&QDoubleSpinBox::valueChanged)
, [&] (double v)
{
@@ -492,11 +474,6 @@ namespace Noggit
}
}
- bool texturing_tool::show_unpaintable_chunks() const
- {
- return _show_unpaintable_chunks && _texturing_mode == texturing_mode::paint;
- }
-
void texturing_tool::paint (World* world, glm::vec3 const& pos, float dt, scoped_blp_texture_reference texture)
{
if (TabletManager::instance()->isActive())
@@ -602,7 +579,6 @@ namespace Noggit
json["radius"] = _radius_slider->rawValue();
json["brush_level"] = _brush_level_spin->value();
json["texturing_mode"] = static_cast(_texturing_mode);
- json["show_unpaintable_chunks"] = _show_unpaintable_chunks_cb->isChecked();
json["anim"] = _anim_prop.get();
json["anim_speed"] = static_cast(_anim_speed_prop.get());
@@ -637,7 +613,6 @@ namespace Noggit
_brush_level_spin->setValue(json["brush_level"].toInt());
tabs->setCurrentIndex(json["texturing_mode"].toInt());
- _show_unpaintable_chunks_cb->setChecked(json["show_unpaintable_chunks"].toBool());
_anim_prop.set(json["anim"].toBool());
_anim_speed_prop.set(json["anim_speed"].toInt());
diff --git a/src/noggit/ui/texturing_tool.hpp b/src/noggit/ui/texturing_tool.hpp
index ae71eb7f..77230807 100755
--- a/src/noggit/ui/texturing_tool.hpp
+++ b/src/noggit/ui/texturing_tool.hpp
@@ -45,7 +45,6 @@ namespace Noggit
float brush_radius() const;
float hardness() const;
- bool show_unpaintable_chunks() const;
void set_brush_level (float level);
@@ -106,7 +105,6 @@ namespace Noggit
Brush _spray_brush;
int _brush_level;
- bool _show_unpaintable_chunks;
float _spray_size;
float _spray_pressure;
@@ -125,8 +123,6 @@ namespace Noggit
Noggit::Ui::Tools::UiCommon::ExtendedSlider* _pressure_slider;
QSpinBox* _brush_level_spin;
- QCheckBox* _show_unpaintable_chunks_cb;
-
QGroupBox* _spray_mode_group;
QWidget* _spray_content;
QCheckBox* _inner_radius_cb;
diff --git a/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp b/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp
index 1bb0d1ac..e1d6e760 100755
--- a/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp
+++ b/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.cpp
@@ -19,17 +19,17 @@ ViewToolbar::ViewToolbar(MapView* mapView)
CheckBoxAction* climb_use_output_color_angle = new CheckBoxAction(tr("Display all angle color"));
climb_use_output_color_angle->checkbox()->setChecked(false);
- connect(climb_use_output_color_angle->checkbox(), &QCheckBox::stateChanged, [mapView, climb_use_output_color_angle]()
+ connect(climb_use_output_color_angle->checkbox(), &QCheckBox::toggled, [mapView](bool checked)
{
- mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_use_output_angle = climb_use_output_color_angle->checkbox()->isChecked();
+ mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_use_output_angle = checked;
mapView->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
});
CheckBoxAction* climb_use_smooth_interpolation = new CheckBoxAction(tr("Smooth"));
climb_use_smooth_interpolation->setChecked(false);
- connect(climb_use_smooth_interpolation->checkbox(), &QCheckBox::stateChanged, [mapView, climb_use_smooth_interpolation]()
+ connect(climb_use_smooth_interpolation->checkbox(), &QCheckBox::toggled, [mapView](bool checked)
{
- mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_use_smooth_interpolation = climb_use_smooth_interpolation->checkbox()->isChecked();
+ mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->climb_use_smooth_interpolation = checked;
mapView->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
});
@@ -44,7 +44,7 @@ ViewToolbar::ViewToolbar(MapView* mapView)
PushButtonAction* climb_reset_slider = new PushButtonAction(tr("Reset"));
connect(climb_reset_slider->pushbutton(), &QPushButton::clicked, [climb_value]()
{
- climb_value->slider()->setValue(1000);
+ climb_value->slider()->setValue(855);
});
_climb_secondary_tool.push_back(climb_icon);
@@ -54,44 +54,9 @@ ViewToolbar::ViewToolbar(MapView* mapView)
_climb_secondary_tool.push_back(climb_reset_slider);
}
-void ViewToolbar::add_tool_icon(MapView* mapView,
- Noggit::BoolToggleProperty* view_state,
- const QString& name,
- const FontNoggit::Icons& icon,
- ViewToolbar* sec_tool_bar,
- QVector sec_action_bar)
-{
- auto action = addAction(FontNoggitIcon{icon}, name);
- connect (action, &QAction::triggered, [action, view_state] () {
- action->setChecked(!view_state->get());
- view_state->set(!view_state->get());
- });
-
- connect (action, &QAction::hovered, [mapView, sec_tool_bar, sec_action_bar] () {
- sec_tool_bar->clear();
- mapView->getSecondaryToolBar()->hide();
-
- if (sec_action_bar.size() > 0)
- {
- sec_tool_bar->setupWidget(sec_action_bar);
- mapView->getSecondaryToolBar()->show();
- }
- });
-
- connect (view_state, &Noggit::BoolToggleProperty::changed, [action, view_state] () {
- action->setChecked(view_state->get());
- });
-
- action->setCheckable(true);
- action->setChecked(view_state->get());
-}
-
-
ViewToolbar::ViewToolbar(MapView *mapView, ViewToolbar *tb)
: _tool_group(this)
{
- Q_UNUSED(tb);
-
setContextMenuPolicy(Qt::PreventContextMenu);
setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
@@ -165,6 +130,90 @@ ViewToolbar::ViewToolbar(MapView *mapView, ViewToolbar *tb)
});
}
+ViewToolbar::ViewToolbar(MapView* mapView, editing_mode mode)
+ : _tool_group(this)
+ , current_mode(mode)
+{
+ setContextMenuPolicy(Qt::PreventContextMenu);
+ setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
+ setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
+ mapView->getLeftSecondaryToolbar()->hide();
+
+ {
+ /*
+ * TEXTURE PAINTER SECONDARY TOOL
+ */
+
+ IconAction* _icon = new IconAction(FontNoggitIcon{FontNoggit::TOOL_TEXTURE_PAINT});
+
+ CheckBoxAction* _unpaintable_chunk = new CheckBoxAction(tr("Unpaintable chunk"));
+ _unpaintable_chunk->setChecked(false);
+ connect(_unpaintable_chunk->checkbox(), &QCheckBox::toggled, [mapView](bool checked)
+ {
+ mapView->getWorld()->renderer()->getTerrainParamsUniformBlock()->draw_paintability_overlay = checked;
+ mapView->getWorld()->renderer()->markTerrainParamsUniformBlockDirty();
+ });
+
+ _texture_secondary_tool.push_back(_icon);
+ _texture_secondary_tool.push_back(_unpaintable_chunk); unpaintable_chunk_index = 1;
+ }
+}
+
+void ViewToolbar::setCurrentMode(MapView* mapView, editing_mode mode)
+{
+ mapView->getLeftSecondaryToolbar()->hide();
+ current_mode = mode;
+
+ switch (current_mode)
+ {
+ case editing_mode::ground:
+ break;
+ case editing_mode::flatten_blur:
+ break;
+ case editing_mode::paint:
+ if (_texture_secondary_tool.size() > 0)
+ {
+ setupWidget(_texture_secondary_tool);
+ mapView->getLeftSecondaryToolbar()->show();
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void ViewToolbar::add_tool_icon(MapView* mapView,
+ Noggit::BoolToggleProperty* view_state,
+ const QString& name,
+ const FontNoggit::Icons& icon,
+ ViewToolbar* sec_tool_bar,
+ QVector sec_action_bar)
+{
+ auto action = addAction(FontNoggitIcon{icon}, name);
+ connect (action, &QAction::triggered, [action, view_state] () {
+ action->setChecked(!view_state->get());
+ view_state->set(!view_state->get());
+ });
+
+ connect (action, &QAction::hovered, [mapView, sec_tool_bar, sec_action_bar] () {
+ sec_tool_bar->clear();
+ mapView->getSecondaryToolBar()->hide();
+
+ if (sec_action_bar.size() > 0)
+ {
+ sec_tool_bar->setupWidget(sec_action_bar);
+ mapView->getSecondaryToolBar()->show();
+ }
+ });
+
+ connect (view_state, &Noggit::BoolToggleProperty::changed, [action, view_state] () {
+ action->setChecked(view_state->get());
+ });
+
+ action->setCheckable(true);
+ action->setChecked(view_state->get());
+}
+
void ViewToolbar::setupWidget(QVector _to_setup)
{
clear();
@@ -174,3 +223,13 @@ void ViewToolbar::setupWidget(QVector _to_setup)
(i == _to_setup.size() - 1) ? NULL : addSeparator();
}
}
+
+bool ViewToolbar::showUnpaintableChunk()
+{
+ if ((unpaintable_chunk_index >= _texture_secondary_tool.size()) ||
+ (unpaintable_chunk_index < 0) ||
+ (current_mode != editing_mode::paint))
+ return false;
+
+ return _texture_secondary_tool[unpaintable_chunk_index];
+}
diff --git a/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.hpp b/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.hpp
index 50387eeb..c6736cf8 100755
--- a/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.hpp
+++ b/src/noggit/ui/tools/ViewToolbar/Ui/ViewToolbar.hpp
@@ -21,12 +21,24 @@ namespace Noggit
public:
ViewToolbar(MapView* mapView);
ViewToolbar(MapView* mapView, ViewToolbar* tb);
+ ViewToolbar(MapView* mapView, editing_mode mode);
+ void setCurrentMode(MapView* mapView, editing_mode mode);
void setupWidget(QVector _to_setup);
+
+ /*secondary top tool*/
QVector _climb_secondary_tool;
+ /*secondary left tool*/
+ bool showUnpaintableChunk();
+ QVector _texture_secondary_tool;
+
private:
QActionGroup _tool_group;
+ editing_mode current_mode;
+
+ int unpaintable_chunk_index = -1;
+
void add_tool_icon(MapView* mapView,
Noggit::BoolToggleProperty* view_state,
const QString& name,
@@ -45,13 +57,13 @@ namespace Noggit
QWidget* _widget = new QWidget(NULL);
QHBoxLayout* _layout = new QHBoxLayout();
QLabel* _label = new QLabel(title);
- QLabel* _display = new QLabel(tr("57 degrees"));
+ QLabel* _display = new QLabel(tr("49 degrees"));
_slider = new QSlider(NULL);
_slider->setOrientation(Qt::Horizontal);
_slider->setMinimum(0);
_slider->setMaximum(1570);
- _slider->setValue(1000);
+ _slider->setValue(855);
connect(_slider, &QSlider::valueChanged, [_display](int value)
{