auto adjust opacity mode when changing liquid type

This commit is contained in:
T1ti
2024-07-27 22:47:58 +02:00
parent 83925a927d
commit e6b43ef8fe
2 changed files with 26 additions and 4 deletions

View File

@@ -76,6 +76,23 @@ namespace Noggit
, [&]
{
changeWaterType(waterType->currentData().toInt());
// change auto opacity based on liquid type
if (_opacity_mode == custom_opacity)
return;
int liquid_type = LiquidTypeDB::getLiquidType(_liquid_id);
if (liquid_type == 1) // ocean
{
ocean_button->setChecked(true);
_opacity_mode = ocean_opacity;
}
else
{
river_button->setChecked(true);
_opacity_mode = river_opacity;
}
}
);
@@ -164,11 +181,11 @@ namespace Noggit
auto opacity_group (new QGroupBox ("Auto opacity", this));
auto opacity_layout (new QFormLayout (opacity_group));
auto river_button (new QRadioButton ("River", this));
auto ocean_button (new QRadioButton ("Ocean", this));
auto custom_button (new QRadioButton ("Custom factor:", this));
river_button = new QRadioButton ("River", this);
ocean_button = new QRadioButton ("Ocean", this);
custom_button = new QRadioButton ("Custom factor:", this);
QButtonGroup *transparency_toggle = new QButtonGroup (this);
transparency_toggle = new QButtonGroup (this);
transparency_toggle->addButton (river_button, river_opacity);
transparency_toggle->addButton (ocean_button, ocean_opacity);
transparency_toggle->addButton (custom_button, custom_opacity);

View File

@@ -87,6 +87,11 @@ namespace Noggit
QDoubleSpinBox* _z_spin;
QDoubleSpinBox* _h_spin;
QRadioButton* river_button;
QRadioButton* ocean_button;
QRadioButton* custom_button;
QButtonGroup* transparency_toggle;
QComboBox* waterType;
QSpinBox* waterLayer;