Update font and help
This commit is contained in:
Binary file not shown.
@@ -1,351 +1,354 @@
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include <noggit/ui/Help.h>
|
||||
#include <noggit/ui/font_noggit.hpp>
|
||||
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QScrollArea>
|
||||
#include <QtWidgets/QTabWidget>
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
namespace noggit
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
|
||||
help::help(QWidget* parent)
|
||||
: widget (parent)
|
||||
{
|
||||
setWindowTitle ("Help");
|
||||
setWindowIcon (QIcon (":/icon"));
|
||||
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
|
||||
|
||||
QString header_style =
|
||||
"QLabel { \n "
|
||||
" font-weight: bold; \n "
|
||||
"} \n ";
|
||||
|
||||
|
||||
auto layout (new QFormLayout (this));
|
||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
auto tabs (new QTabWidget (this));
|
||||
|
||||
auto base_widget (new QWidget (this));
|
||||
auto base_layout(new QGridLayout (base_widget));
|
||||
|
||||
|
||||
auto basic_controls_layout (new QFormLayout (this));
|
||||
base_layout->addLayout(basic_controls_layout, 0, 0);
|
||||
|
||||
base_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
auto label = new QLabel("Basic controls:");
|
||||
label->setStyleSheet(header_style);
|
||||
basic_controls_layout->addRow(label);
|
||||
|
||||
generate_hotkey_row({font_noggit::rmb_drag}, "\a - Rotate camera", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::lmb}, "\a - Select chunk or object", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::i}, "\a - Invert mouse up and down", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::q, font_noggit::e}, "\a,\a - Invert mouse up and down", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::w, font_noggit::a , font_noggit::s , font_noggit::d}, "\a\a\a\a - Move left, right, forward, backwards", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::home}, "\a - Move position to the cursor", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::c}, "\a+\a - Switch cursor type", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::alt}, "\a+\a - Toggle cursor options", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::m}, "\a - Show map", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::u}, "\a - 2D texture editor", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::f1}, "\a+\a - This help", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::j}, "\a+\a - reload an adt under the camera", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::r}, "\a+\a - Turn camera 180 degrees", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift}, "\a + 1, 2, 3, or 4 - Set a predefined camera speed", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::alt, font_noggit::f4}, "\a+\a - exit to main menu", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::l}, "\a - Change lookat (useful for assigning to graphic tablet styli buttons).", basic_controls_layout);
|
||||
generate_hotkey_row({}, "", basic_controls_layout); // padding
|
||||
|
||||
auto toggles_layout(new QFormLayout(this));
|
||||
base_layout->addLayout(toggles_layout, 0, 1);
|
||||
|
||||
auto label_toggle = new QLabel("Toggles:");
|
||||
label_toggle->setStyleSheet(header_style);
|
||||
toggles_layout->addRow(label_toggle);
|
||||
|
||||
generate_hotkey_row({font_noggit::f1}, "\a - Toggle M2s", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f2}, "\a - Toggle WMO doodads set", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f3}, "\a - Toggle ground", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f4}, "\a - Toggle water", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f6}, "\a - Toggle WMOs", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f7}, "\a - Toggle chunk (red) and ADT (green) lines", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f8}, "\a - Toggle detailed window", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f9}, "\a - Toggle map contour", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f10}, "\a - Toggle wireframe", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f11}, "\a - Toggle model animations", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f12}, "\a - Toggle fog", toggles_layout);
|
||||
generate_hotkey_row({}, "1-9 - Select the editing modes", toggles_layout);
|
||||
|
||||
auto files_layout(new QFormLayout(this));
|
||||
base_layout->addLayout(files_layout, 1, 0);
|
||||
|
||||
auto label_files = new QLabel("Files:");
|
||||
label_files->setStyleSheet(header_style);
|
||||
files_layout->addRow(label_files);
|
||||
|
||||
generate_hotkey_row({font_noggit::f5}, "\a - Save bookmark", files_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::s}, "\a+\a - Save all changed ADT tiles", files_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::shift, font_noggit::s}, "\a+\a+\a - Save ADT tile at camera position", files_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::shift, font_noggit::a}, "\a+\a+\a- Save all loaded ADT tiles", files_layout);
|
||||
generate_hotkey_row({font_noggit::g}, "\a - Save port commands to ports.txt", files_layout);
|
||||
|
||||
auto adjust_layout(new QFormLayout(this));
|
||||
base_layout->addLayout(adjust_layout, 1, 1);
|
||||
|
||||
auto label_adjust = new QLabel("Adjust:");
|
||||
label_adjust->setStyleSheet(header_style);
|
||||
adjust_layout->addRow(label_adjust);
|
||||
|
||||
generate_hotkey_row({font_noggit::o, font_noggit::p}, "\a/\a- Slower / Faster movement", adjust_layout);
|
||||
generate_hotkey_row({font_noggit::b, font_noggit::n}, "\a/\a- Slower / Faster time", adjust_layout);
|
||||
generate_hotkey_row({font_noggit::j}, "\a- Pause time", adjust_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::plus, font_noggit::minus}, "\a+\a/\a- Fog distance when no model is selected", adjust_layout);
|
||||
|
||||
auto flag_widget (new QWidget (this));
|
||||
auto flag_layout (new QFormLayout (flag_widget));
|
||||
|
||||
auto holes_label = new QLabel("Holes:");
|
||||
holes_label->setStyleSheet(header_style);
|
||||
flag_layout->addRow(holes_label);
|
||||
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::lmb}, "\a+\a- Fog distance when no model is selected", flag_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::lmb}, "\a+\a- Add hole", flag_layout);
|
||||
generate_hotkey_row({font_noggit::t}, "\a- Remove all holes on ADT", flag_layout);
|
||||
generate_hotkey_row({font_noggit::alt, font_noggit::t}, "\a+\a- Remove all ground on ADT", flag_layout);
|
||||
|
||||
auto impass_flags_label = new QLabel("Impassible Flags:");
|
||||
impass_flags_label->setStyleSheet(header_style);
|
||||
flag_layout->addRow(impass_flags_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Paint flag", flag_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Clear flag", flag_layout);
|
||||
|
||||
auto areaid_label = new QLabel("AreaID Flags:");
|
||||
areaid_label->setStyleSheet(header_style);
|
||||
flag_layout->addRow(areaid_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Pick existing AreaID", flag_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Paint selected AreaID", flag_layout);
|
||||
|
||||
|
||||
auto ground_widget (new QWidget (this));
|
||||
auto ground_layout (new QGridLayout (ground_widget));
|
||||
|
||||
auto ground_column1_layout(new QFormLayout(this));
|
||||
ground_layout->addLayout(ground_column1_layout, 0, 0);
|
||||
|
||||
auto ground_label = new QLabel("Edit ground:");
|
||||
ground_label->setStyleSheet(header_style);
|
||||
ground_column1_layout->addRow(ground_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::f1 }, "\a+\a - Toggle ground edit mode", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\a - Change brush size", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::lmb_drag }, "\a+\a - Change speed", ground_column1_layout);
|
||||
|
||||
auto raise_label = new QLabel("Terrain mode \"raise / lower\":");
|
||||
raise_label->setStyleSheet(header_style);
|
||||
ground_column1_layout->addRow(raise_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Raise terrain", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Lower terrain", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::y }, "\a - Switch to next type", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::rmb_drag }, "\a+\a - Change inner radius", ground_column1_layout);
|
||||
|
||||
auto raise_label_vm = new QLabel("Terrain mode \"raise / lower\" (vertex mode only):");
|
||||
raise_label_vm->setStyleSheet(header_style);
|
||||
ground_column1_layout->addRow(raise_label_vm);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Select vertices", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Deselect vertices", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::c }, "\a - Clear selection", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::f }, "\a+\a - Flatten vertices", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::rmb_drag }, "\a+\a - Orient vertices toward the mouse cursor", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::rmb_drag }, "\a+\a - Change vertices height", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\a - Change angle", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\a - Change orientation", ground_column1_layout);
|
||||
|
||||
auto ground_column2_layout(new QFormLayout(this));
|
||||
ground_layout->addLayout(ground_column2_layout, 0, 1);
|
||||
|
||||
auto flatten_label = new QLabel("Terrain mode \"flatten / blur\":");
|
||||
flatten_label->setStyleSheet(header_style);
|
||||
ground_column2_layout->addRow(flatten_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Flatten terrain", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Blur terrain", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\a - Toggle flatten angle", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::t }, "\a+\a - Toggle flatten type", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\a - Change angle", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\a - Change orientation", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::y }, "\a - Switch to next type", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::f }, "\a - Set relative point", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::f }, "\a+\a - Toggle flatten relative mode", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::mmb }, "\a+\a - Change height", ground_column2_layout);
|
||||
|
||||
|
||||
auto texture_widget (new QWidget (this));
|
||||
auto texture_layout (new QFormLayout (texture_widget));
|
||||
|
||||
auto common_controls_label = new QLabel("Common controls:");
|
||||
common_controls_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(common_controls_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Open texture picker for the chunk", texture_layout);
|
||||
|
||||
auto paint_label = new QLabel("Paint:");
|
||||
paint_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(paint_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::shift, font_noggit::alt, font_noggit::lmb }, "\a+\a+\a+\a - Open texture picker for the chunk", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Draw texture or fills if chunk is empty", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\a - Change radius", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::rmb_drag }, "\a+\a - Change hardness", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::lmb_drag }, "\a+\a - Change pressure", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::mmb }, "\a+\a - Change strength (gradient)", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::r }, "\a+\a - Toggle min and max strength (gradient)", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\a - Toggle spray brush", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\a - Change spray radius", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\a - Change spray pressure", texture_layout);
|
||||
|
||||
auto swapper_label = new QLabel("Swap:");
|
||||
swapper_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(swapper_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Swap texture", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\a - Change radius", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\a - Toggle brush swapper", texture_layout);
|
||||
|
||||
auto anim_label = new QLabel("Anim:");
|
||||
anim_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(anim_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Update animation", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\a - Switch between add/remove animation mode", texture_layout);
|
||||
|
||||
|
||||
auto water_widget (new QWidget (this));
|
||||
auto water_layout (new QFormLayout (water_widget));
|
||||
|
||||
auto water_label = new QLabel("Water:");
|
||||
water_label->setStyleSheet(header_style);
|
||||
water_layout->addRow(water_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Add liquid", water_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Remove liquid", water_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\a - Change brush size", water_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\a - Toggle angled mode", water_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\a - Change orientation", water_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\a - Change angle", water_layout);
|
||||
generate_hotkey_row({ font_noggit::f }, "\a - Set lock position to cursor position", water_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::f }, "\a+\a - Toggle lock mode", water_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::mmb }, "\a+\a - Change height", water_layout);
|
||||
|
||||
|
||||
auto object_widget (new QWidget (this));
|
||||
auto object_layout (new QFormLayout (object_widget));
|
||||
|
||||
auto object_label = new QLabel("Edit objects if a model is selected with left click (in object editor):");
|
||||
object_label->setStyleSheet(header_style);
|
||||
object_layout->addRow(object_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::mmb }, "\a - Move object", object_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\a - Scale M2", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::ctrl, font_noggit::alt, font_noggit::lmb }, "\a/\a/\a+\a - Rotate object", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl }, "\a+ 0-9 - Change doodadset of selected WMO", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::r }, "\a+\a - Reset rotation", object_layout);
|
||||
generate_hotkey_row({ font_noggit::h }, "\a - Toggle selected model/wmo visibility", object_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::h }, "\a+\a - Hide/Show hidden model/wmo", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::h }, "\a+\a - Clear hidden model/wmo list", object_layout);
|
||||
generate_hotkey_row({ font_noggit::page_down }, "\a - Set object to ground level", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::c, font_noggit::c }, "\a+\a or \a - Copy object to clipboard", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::v, font_noggit::v }, "\a+\a or \a - Paste object on mouse position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::b }, "\a+\a - Duplicate selected object to mouse position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::v }, "\a+\a - Import last M2 from WMV", object_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::v }, "\a+\a - Import last WMO from WMV", object_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\a - Switch between paste modes", object_layout);
|
||||
generate_hotkey_row({ font_noggit::f }, "\a - Move selection to cursor position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::minus, font_noggit::plus }, "\a/\a - Scale M2", object_layout);
|
||||
generate_hotkey_row({ font_noggit::num }, "\a 7 / 9 - Rotate object", object_layout);
|
||||
generate_hotkey_row({ font_noggit::num }, "\a 4 / 8 / 6 / 2 - Vertical position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::num }, "\a 1 / 3 - Move up/down", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift }, "Holding \a 1 / 3 - Double speed", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl }, "Holding \a 1 / 3 - Triple speed", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::ctrl }, "Holding \a and \a together - half speed", object_layout);
|
||||
|
||||
auto shader_widget (new QWidget (this));
|
||||
auto shader_layout (new QFormLayout (shader_widget));
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\a - Add shader", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\a - Remove shader", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\a - Change brush size", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::lmb_drag }, "\a+\a - Change speed", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::mmb }, "\a - Pick shader color from the ground", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::plus }, "\a - Add current color to palette", shader_layout);
|
||||
|
||||
layout->addWidget(tabs);
|
||||
tabs->addTab(base_widget, "Base");
|
||||
tabs->addTab(ground_widget, "Terrain");
|
||||
tabs->addTab(texture_widget, "Texture");
|
||||
tabs->addTab(water_widget, "Water");
|
||||
tabs->addTab(object_widget, "Objects");
|
||||
tabs->addTab(shader_widget, "Shader");
|
||||
tabs->addTab(flag_widget, "Flags/Hole/Area");
|
||||
}
|
||||
|
||||
|
||||
void help::generate_hotkey_row(std::initializer_list<font_noggit::icons>&& hotkeys, const char* description, QFormLayout* layout)
|
||||
{
|
||||
auto row_layout = new QHBoxLayout(this);
|
||||
|
||||
const char* from = nullptr;
|
||||
auto icon = hotkeys.begin();
|
||||
|
||||
while (*description)
|
||||
{
|
||||
if (*description == '\a')
|
||||
{
|
||||
if (from)
|
||||
{
|
||||
auto label = new QLabel(::std::string(from, description - from).c_str());
|
||||
row_layout->addWidget(label);
|
||||
}
|
||||
|
||||
auto label = new QLabel(this);
|
||||
QIcon hotkey_icon = font_noggit_icon(*icon++);
|
||||
label->setPixmap(hotkey_icon.pixmap(20, 20));
|
||||
row_layout->addWidget(label);
|
||||
|
||||
from = ++description;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!from)
|
||||
{
|
||||
from = description;
|
||||
}
|
||||
++description;
|
||||
}
|
||||
}
|
||||
|
||||
if (from && *from)
|
||||
{
|
||||
auto label = new QLabel(from);
|
||||
row_layout->addWidget(label);
|
||||
}
|
||||
|
||||
row_layout->setAlignment(Qt::AlignLeft);
|
||||
layout->addRow(row_layout);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include <noggit/ui/Help.h>
|
||||
#include <noggit/ui/font_noggit.hpp>
|
||||
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtWidgets/QHBoxLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QScrollArea>
|
||||
#include <QtWidgets/QTabWidget>
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
namespace noggit
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
|
||||
help::help(QWidget* parent)
|
||||
: widget (parent)
|
||||
{
|
||||
setWindowTitle ("Help");
|
||||
setWindowIcon (QIcon (":/icon"));
|
||||
setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint);
|
||||
|
||||
QString header_style =
|
||||
"QLabel { \n "
|
||||
" font-weight: bold; \n "
|
||||
" margin-top: 8px; \n "
|
||||
" margin-bottom: 4px; \n "
|
||||
" margin-left: 150px; \n "
|
||||
"} \n ";
|
||||
|
||||
|
||||
auto layout (new QFormLayout (this));
|
||||
layout->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
auto tabs (new QTabWidget (this));
|
||||
|
||||
auto base_widget (new QWidget (this));
|
||||
auto base_layout(new QGridLayout (base_widget));
|
||||
|
||||
|
||||
auto basic_controls_layout (new QFormLayout (this));
|
||||
base_layout->addLayout(basic_controls_layout, 0, 0);
|
||||
|
||||
base_widget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
auto label = new QLabel("Basic controls:");
|
||||
label->setStyleSheet(header_style);
|
||||
basic_controls_layout->addRow(label);
|
||||
|
||||
generate_hotkey_row({font_noggit::rmb_drag}, "\aRotate camera", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::lmb}, "\aSelect chunk or object", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::i}, "\aInvert mouse up and down", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::q, font_noggit::e}, "\a,\aMove up and down", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::w, font_noggit::a , font_noggit::s , font_noggit::d}, "\a\a\a\aMove left, right, forward, backwards", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::home}, "\aMove position to the cursor", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::c}, "\a+\aSwitch cursor type", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::alt}, "\a+\aToggle cursor options", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::m}, "\aShow map", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::u}, "\a2D texture editor", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::f1}, "\a+\aThis help", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::j}, "\a+\aReload an adt under the camera", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::r}, "\a+\aTurn camera 180 degrees", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::shift}, "\a+ 1, 2, 3 or 4 Set a predefined camera speed", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::alt, font_noggit::f4}, "\a+\aExit to main menu", basic_controls_layout);
|
||||
generate_hotkey_row({font_noggit::l}, "\aToggle top view (hint: it's faster to use with graphic tablet stylus buttons)", basic_controls_layout);
|
||||
generate_hotkey_row({}, "", basic_controls_layout); // padding
|
||||
|
||||
auto toggles_layout(new QFormLayout(this));
|
||||
base_layout->addLayout(toggles_layout, 0, 1);
|
||||
|
||||
auto label_toggle = new QLabel("Toggles:");
|
||||
label_toggle->setStyleSheet(header_style);
|
||||
toggles_layout->addRow(label_toggle);
|
||||
|
||||
generate_hotkey_row({font_noggit::f1}, "\aToggle M2s", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f2}, "\aToggle WMO doodads set", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f3}, "\aToggle ground", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f4}, "\aToggle water", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f6}, "\aToggle WMOs", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f7}, "\aToggle chunk (red) and ADT (green) lines", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f8}, "\aToggle detailed window", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f9}, "\aToggle map contour", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f10}, "\aToggle wireframe", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f11}, "\aToggle model animations", toggles_layout);
|
||||
generate_hotkey_row({font_noggit::f12}, "\aToggle fog", toggles_layout);
|
||||
generate_hotkey_row({}, "1 - 9 Select the editing modes", toggles_layout);
|
||||
|
||||
auto files_layout(new QFormLayout(this));
|
||||
base_layout->addLayout(files_layout, 1, 0);
|
||||
|
||||
auto label_files = new QLabel("Files:");
|
||||
label_files->setStyleSheet(header_style);
|
||||
files_layout->addRow(label_files);
|
||||
|
||||
generate_hotkey_row({font_noggit::f5}, "\aSave bookmark", files_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::s}, "\a+\a Save all changed ADT tiles", files_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::shift, font_noggit::s}, "\a+\a+\aSave ADT tile at camera position", files_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::shift, font_noggit::a}, "\a+\a+\aSave all loaded ADT tiles", files_layout);
|
||||
generate_hotkey_row({font_noggit::g}, "\aSave port commands to ports.txt", files_layout);
|
||||
|
||||
auto adjust_layout(new QFormLayout(this));
|
||||
base_layout->addLayout(adjust_layout, 1, 1);
|
||||
|
||||
auto label_adjust = new QLabel("Adjust:");
|
||||
label_adjust->setStyleSheet(header_style);
|
||||
adjust_layout->addRow(label_adjust);
|
||||
|
||||
generate_hotkey_row({font_noggit::o, font_noggit::p}, "\aor\aSlower / Faster movement", adjust_layout);
|
||||
generate_hotkey_row({font_noggit::b, font_noggit::n}, "\aor\aSlower / Faster time", adjust_layout);
|
||||
generate_hotkey_row({font_noggit::j}, "\aPause time", adjust_layout);
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::plus, font_noggit::minus}, "\a+\aor\aFog distance when no model is selected", adjust_layout);
|
||||
|
||||
auto flag_widget (new QWidget (this));
|
||||
auto flag_layout (new QFormLayout (flag_widget));
|
||||
|
||||
auto holes_label = new QLabel("Holes:");
|
||||
holes_label->setStyleSheet(header_style);
|
||||
flag_layout->addRow(holes_label);
|
||||
|
||||
generate_hotkey_row({font_noggit::shift, font_noggit::lmb}, "\a+\aFog distance when no model is selected", flag_layout);
|
||||
generate_hotkey_row({font_noggit::ctrl, font_noggit::lmb}, "\a+\aAdd hole", flag_layout);
|
||||
generate_hotkey_row({font_noggit::t}, "\aRemove all holes on ADT", flag_layout);
|
||||
generate_hotkey_row({font_noggit::alt, font_noggit::t}, "\a+\aRemove all ground on ADT", flag_layout);
|
||||
|
||||
auto impass_flags_label = new QLabel("Impassible Flags:");
|
||||
impass_flags_label->setStyleSheet(header_style);
|
||||
flag_layout->addRow(impass_flags_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aPaint flag", flag_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aClear flag", flag_layout);
|
||||
|
||||
auto areaid_label = new QLabel("AreaID Flags:");
|
||||
areaid_label->setStyleSheet(header_style);
|
||||
flag_layout->addRow(areaid_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aPick existing AreaID", flag_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aPaint selected AreaID", flag_layout);
|
||||
|
||||
|
||||
auto ground_widget (new QWidget (this));
|
||||
auto ground_layout (new QGridLayout (ground_widget));
|
||||
|
||||
auto ground_column1_layout(new QFormLayout(this));
|
||||
ground_layout->addLayout(ground_column1_layout, 0, 0);
|
||||
|
||||
auto ground_label = new QLabel("Edit ground:");
|
||||
ground_label->setStyleSheet(header_style);
|
||||
ground_column1_layout->addRow(ground_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::f1 }, "\a+\aToggle ground edit mode", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\aChange brush size", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::lmb_drag }, "\a+\aChange speed", ground_column1_layout);
|
||||
|
||||
auto raise_label = new QLabel("Raise / Lower tool:");
|
||||
raise_label->setStyleSheet(header_style);
|
||||
ground_column1_layout->addRow(raise_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aRaise terrain", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aLower terrain", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::y }, "\aSwitch to next type", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::rmb_drag }, "\a+\aChange inner radius", ground_column1_layout);
|
||||
|
||||
auto raise_label_vm = new QLabel("Raise / Lower tool (vertex mode):");
|
||||
raise_label_vm->setStyleSheet(header_style);
|
||||
ground_column1_layout->addRow(raise_label_vm);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aSelect vertices", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aDeselect vertices", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::c }, "\aClear selection", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::f }, "\a+\aFlatten vertices", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::rmb_drag }, "\a+\aOrient vertices toward the mouse cursor", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::rmb_drag }, "\a+\aChange vertices height", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\aChange angle", ground_column1_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\aChange orientation", ground_column1_layout);
|
||||
|
||||
auto ground_column2_layout(new QFormLayout(this));
|
||||
ground_layout->addLayout(ground_column2_layout, 0, 1);
|
||||
|
||||
auto flatten_label = new QLabel("Flatten / Blur tool:");
|
||||
flatten_label->setStyleSheet(header_style);
|
||||
ground_column2_layout->addRow(flatten_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aFlatten terrain", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aBlur terrain", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\aToggle flatten angle", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::t }, "\a+\aToggle flatten type", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\aChange angle", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\aChange orientation", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::y }, "\aSwitch to next type", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::f }, "\aSet relative point", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::f }, "\a+\aToggle flatten relative mode", ground_column2_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::mmb }, "\a+\aChange height", ground_column2_layout);
|
||||
|
||||
|
||||
auto texture_widget (new QWidget (this));
|
||||
auto texture_layout (new QFormLayout (texture_widget));
|
||||
|
||||
auto common_controls_label = new QLabel("Common controls:");
|
||||
common_controls_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(common_controls_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aOpen texture picker for the chunk", texture_layout);
|
||||
|
||||
auto paint_label = new QLabel("Paint:");
|
||||
paint_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(paint_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::shift, font_noggit::alt, font_noggit::lmb }, "\a+\a+\a+\aOpen texture picker for the chunk", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aDraw texture or fills if chunk is empty", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\aChange radius", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::rmb_drag }, "\a+\aChange hardness", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::lmb_drag }, "\a+\aChange pressure", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::mmb }, "\a+\aChange strength (gradient)", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::r }, "\a+\aToggle min and max strength (gradient)", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\aToggle spray brush", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\aChange spray radius", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\aChange spray pressure", texture_layout);
|
||||
|
||||
auto swapper_label = new QLabel("Swap:");
|
||||
swapper_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(swapper_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aSwap texture", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\aChange radius", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\aToggle brush swapper", texture_layout);
|
||||
|
||||
auto anim_label = new QLabel("Anim:");
|
||||
anim_label->setStyleSheet(header_style);
|
||||
texture_layout->addRow(anim_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aUpdate animation", texture_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\aSwitch between add/remove animation mode", texture_layout);
|
||||
|
||||
|
||||
auto water_widget (new QWidget (this));
|
||||
auto water_layout (new QFormLayout (water_widget));
|
||||
|
||||
auto water_label = new QLabel("Water:");
|
||||
water_label->setStyleSheet(header_style);
|
||||
water_layout->addRow(water_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aAdd liquid", water_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aRemove liquid", water_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\aChange brush size", water_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\aToggle angled mode", water_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\aChange orientation", water_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::mmb }, "\a+\aChange angle", water_layout);
|
||||
generate_hotkey_row({ font_noggit::f }, "\aSet lock position to cursor position", water_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::f }, "\a+\aToggle lock mode", water_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::mmb }, "\a+\aChange height", water_layout);
|
||||
|
||||
|
||||
auto object_widget (new QWidget (this));
|
||||
auto object_layout (new QFormLayout (object_widget));
|
||||
|
||||
auto object_label = new QLabel("Edit objects if a model is selected with left click (in object editor):");
|
||||
object_label->setStyleSheet(header_style);
|
||||
object_layout->addRow(object_label);
|
||||
|
||||
generate_hotkey_row({ font_noggit::mmb }, "\aMove object", object_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::mmb }, "\a+\aScale M2", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::ctrl, font_noggit::alt, font_noggit::lmb }, "\aor\aor\a+\aRotate object", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl }, "\a+ 0 - 9 Change doodadset of selected WMO", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::r }, "\a+\aReset rotation", object_layout);
|
||||
generate_hotkey_row({ font_noggit::h }, "\aToggle selected model/wmo visibility", object_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::h }, "\a+\a - Hide/Show hidden model/wmo", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::h }, "\a+\a - Clear hidden model/wmo list", object_layout);
|
||||
generate_hotkey_row({ font_noggit::page_down }, "\aSet object to ground level", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::c }, "\a+\aCopy object to clipboard", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::v }, "\a+\aPaste object on mouse position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::b }, "\a+\aDuplicate selected object to mouse position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::v }, "\a+\aImport last M2 from WMV", object_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::v }, "\a+\aImport last WMO from WMV", object_layout);
|
||||
generate_hotkey_row({ font_noggit::t }, "\aSwitch between paste modes", object_layout);
|
||||
generate_hotkey_row({ font_noggit::f }, "\aMove selection to cursor position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::minus, font_noggit::plus }, "\aor\aScale M2", object_layout);
|
||||
generate_hotkey_row({ font_noggit::num }, "\a 7 or 9 Rotate object", object_layout);
|
||||
generate_hotkey_row({ font_noggit::num }, "\a 4 or 8 or 6 or 2 Vertical position", object_layout);
|
||||
generate_hotkey_row({ font_noggit::num }, "\a 1 or 3 Move up/down", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift }, "Holding \a 1 / 3 Double speed", object_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl }, "Holding \a 1 / 3 Triple speed", object_layout);
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::ctrl }, "Holding \a and \a Half speed", object_layout);
|
||||
|
||||
auto shader_widget (new QWidget (this));
|
||||
auto shader_layout (new QFormLayout (shader_widget));
|
||||
|
||||
generate_hotkey_row({ font_noggit::shift, font_noggit::lmb }, "\a+\aAdd shader", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::ctrl, font_noggit::lmb }, "\a+\aRemove shader", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::alt, font_noggit::lmb_drag }, "\a+\aChange brush size", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::space, font_noggit::lmb_drag }, "\a+\aChange speed", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::mmb }, "\aPick shader color from the ground", shader_layout);
|
||||
generate_hotkey_row({ font_noggit::plus }, "\aAdd current color to palette", shader_layout);
|
||||
|
||||
layout->addWidget(tabs);
|
||||
tabs->addTab(base_widget, "Basic");
|
||||
tabs->addTab(ground_widget, "Terrain Editors");
|
||||
tabs->addTab(texture_widget, "Texture Painter");
|
||||
tabs->addTab(water_widget, "Water Editor");
|
||||
tabs->addTab(object_widget, "Object Editor");
|
||||
tabs->addTab(shader_widget, "Vertex Painter");
|
||||
tabs->addTab(flag_widget, "Impass Flag / Hole Cutter / Area ID");
|
||||
}
|
||||
|
||||
|
||||
void help::generate_hotkey_row(std::initializer_list<font_noggit::icons>&& hotkeys, const char* description, QFormLayout* layout)
|
||||
{
|
||||
auto row_layout = new QHBoxLayout(this);
|
||||
|
||||
const char* from = nullptr;
|
||||
auto icon = hotkeys.begin();
|
||||
|
||||
while (*description)
|
||||
{
|
||||
if (*description == '\a')
|
||||
{
|
||||
if (from)
|
||||
{
|
||||
auto label = new QLabel(::std::string(from, description - from).c_str());
|
||||
row_layout->addWidget(label);
|
||||
}
|
||||
|
||||
auto label = new QLabel(this);
|
||||
QIcon hotkey_icon = font_noggit_icon(*icon++);
|
||||
label->setPixmap(hotkey_icon.pixmap(22, 22));
|
||||
row_layout->addWidget(label);
|
||||
|
||||
from = ++description;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!from)
|
||||
{
|
||||
from = description;
|
||||
}
|
||||
++description;
|
||||
}
|
||||
}
|
||||
|
||||
if (from && *from)
|
||||
{
|
||||
auto label = new QLabel(from);
|
||||
row_layout->addWidget(label);
|
||||
}
|
||||
|
||||
row_layout->setAlignment(Qt::AlignLeft);
|
||||
layout->addRow(row_layout);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,345 +1,346 @@
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include <noggit/DBC.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <noggit/Misc.h>
|
||||
#include <noggit/World.h>
|
||||
#include <noggit/ui/pushbutton.hpp>
|
||||
#include <noggit/ui/Water.h>
|
||||
#include <util/qt/overload.hpp>
|
||||
|
||||
#include <QtWidgets/QButtonGroup>
|
||||
#include <QtWidgets/QCheckBox>
|
||||
#include <QtWidgets/QDoubleSpinBox>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtWidgets/QGroupBox>
|
||||
#include <QtWidgets/QComboBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QListWidget>
|
||||
#include <QtWidgets/QRadioButton>
|
||||
|
||||
namespace noggit
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
water::water ( unsigned_int_property* current_layer
|
||||
, bool_toggle_property* display_all_layers
|
||||
, QWidget* parent
|
||||
)
|
||||
: QWidget (parent)
|
||||
, _liquid_id(5)
|
||||
, _radius(10.0f)
|
||||
, _angle(10.0f)
|
||||
, _orientation(0.0f)
|
||||
, _locked(false)
|
||||
, _angled_mode(false)
|
||||
, _override_liquid_id(true)
|
||||
, _override_height(true)
|
||||
, _opacity_mode(river_opacity)
|
||||
, _custom_opacity_factor(0.0337f)
|
||||
, _lock_pos(math::vector_3d(0.0f, 0.0f, 0.0f))
|
||||
, tile(0, 0)
|
||||
{
|
||||
auto layout (new QFormLayout (this));
|
||||
|
||||
auto brush_group (new QGroupBox (this));
|
||||
auto brush_layout (new QFormLayout (brush_group));
|
||||
|
||||
_radius_spin = new QDoubleSpinBox (this);
|
||||
_radius_spin->setRange (0.f, 250.f);
|
||||
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _radius = f; }
|
||||
);
|
||||
_radius_spin->setValue(_radius);
|
||||
brush_layout->addRow ("Radius", _radius_spin);
|
||||
|
||||
waterType = new QComboBox(this);
|
||||
|
||||
for (DBCFile::Iterator i = gLiquidTypeDB.begin(); i != gLiquidTypeDB.end(); ++i)
|
||||
{
|
||||
int liquid_id = i->getInt(LiquidTypeDB::ID);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << liquid_id << "-" << LiquidTypeDB::getLiquidName(liquid_id);
|
||||
waterType->addItem (QString::fromUtf8(ss.str().c_str()), QVariant (liquid_id));
|
||||
|
||||
}
|
||||
|
||||
connect (waterType, qOverload<int> (&QComboBox::currentIndexChanged)
|
||||
, [&]
|
||||
{
|
||||
changeWaterType(waterType->currentData().toInt());
|
||||
}
|
||||
);
|
||||
|
||||
brush_layout->addRow (waterType);
|
||||
|
||||
layout->addRow (brush_group);
|
||||
|
||||
auto angle_group (new QGroupBox ("Angled mode", this));
|
||||
angle_group->setCheckable (true);
|
||||
angle_group->setChecked (_angled_mode.get());
|
||||
|
||||
|
||||
connect ( &_angled_mode, &bool_toggle_property::changed
|
||||
, angle_group, &QGroupBox::setChecked
|
||||
);
|
||||
connect ( angle_group, &QGroupBox::toggled
|
||||
, &_angled_mode, &bool_toggle_property::set
|
||||
);
|
||||
auto angle_layout (new QFormLayout (angle_group));
|
||||
|
||||
_angle_spin = new QDoubleSpinBox (this);
|
||||
_angle_spin->setRange (0.00001f, 89.f);
|
||||
_angle_spin->setSingleStep (2.0f);
|
||||
connect ( _angle_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _angle = f; }
|
||||
);
|
||||
_angle_spin->setValue(_angle);
|
||||
angle_layout->addRow ("Angle", _angle_spin);
|
||||
|
||||
_orientation_spin = new QDoubleSpinBox (this);
|
||||
_orientation_spin->setRange (0.f, 360.f);
|
||||
_orientation_spin->setWrapping (true);
|
||||
_orientation_spin->setValue(_orientation);
|
||||
_orientation_spin->setSingleStep (5.0f);
|
||||
connect ( _orientation_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _orientation = f; }
|
||||
);
|
||||
|
||||
angle_layout->addRow ("Orienation", _orientation_spin);
|
||||
|
||||
layout->addRow (angle_group);
|
||||
|
||||
auto lock_group (new QGroupBox ("Lock", this));
|
||||
lock_group->setCheckable (true);
|
||||
lock_group->setChecked (_locked.get());
|
||||
auto lock_layout (new QFormLayout (lock_group));
|
||||
|
||||
lock_layout->addRow("X:", _x_spin = new QDoubleSpinBox (this));
|
||||
lock_layout->addRow("Z:", _z_spin = new QDoubleSpinBox (this));
|
||||
lock_layout->addRow("H:", _h_spin = new QDoubleSpinBox (this));
|
||||
|
||||
_x_spin->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
|
||||
_z_spin->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
|
||||
_h_spin->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
|
||||
_x_spin->setDecimals (2);
|
||||
_z_spin->setDecimals (2);
|
||||
_h_spin->setDecimals (2);
|
||||
|
||||
connect ( _x_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _lock_pos.x = f; }
|
||||
);
|
||||
connect ( _z_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _lock_pos.z = f; }
|
||||
);
|
||||
connect ( _h_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _lock_pos.y = f; }
|
||||
);
|
||||
|
||||
connect ( &_locked, &bool_toggle_property::changed
|
||||
, lock_group, &QGroupBox::setChecked
|
||||
);
|
||||
connect ( lock_group, &QGroupBox::toggled
|
||||
, &_locked, &bool_toggle_property::set
|
||||
);
|
||||
|
||||
layout->addRow(lock_group);
|
||||
|
||||
auto override_group (new QGroupBox ("Override", this));
|
||||
auto override_layout (new QFormLayout (override_group));
|
||||
|
||||
override_layout->addWidget (new checkbox ("Liquid ID", &_override_liquid_id, this));
|
||||
override_layout->addWidget (new checkbox ("Height", &_override_height, this));
|
||||
|
||||
layout->addRow(override_group);
|
||||
|
||||
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));
|
||||
|
||||
QButtonGroup *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);
|
||||
|
||||
connect ( transparency_toggle, qOverload<int> (&QButtonGroup::buttonClicked)
|
||||
, [&] (int id) { _opacity_mode = id; }
|
||||
);
|
||||
|
||||
opacity_layout->addRow (river_button);
|
||||
opacity_layout->addRow (ocean_button);
|
||||
opacity_layout->addRow (custom_button);
|
||||
|
||||
transparency_toggle->button (river_opacity)->setChecked (true);
|
||||
|
||||
QDoubleSpinBox *opacity_spin = new QDoubleSpinBox (this);
|
||||
opacity_spin->setRange (0.f, 1.f);
|
||||
opacity_spin->setDecimals (4);
|
||||
opacity_spin->setSingleStep (0.02f);
|
||||
opacity_spin->setValue(_custom_opacity_factor);
|
||||
connect ( opacity_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _custom_opacity_factor = f; }
|
||||
);
|
||||
opacity_layout->addRow (opacity_spin);
|
||||
|
||||
layout->addRow (opacity_group);
|
||||
|
||||
layout->addRow ( new pushbutton
|
||||
( "Regen ADT opacity"
|
||||
, [this]
|
||||
{
|
||||
emit regenerate_water_opacity
|
||||
(get_opacity_factor());
|
||||
}
|
||||
)
|
||||
);
|
||||
layout->addRow ( new pushbutton
|
||||
( "Crop water"
|
||||
, [this]
|
||||
{
|
||||
emit crop_water();
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
auto layer_group (new QGroupBox ("Layers", this));
|
||||
auto layer_layout (new QFormLayout (layer_group));
|
||||
|
||||
layer_layout->addRow (new checkbox("Show all layers", display_all_layers));
|
||||
layer_layout->addRow (new QLabel("Current layer:", this));
|
||||
|
||||
waterLayer = new QSpinBox (this);
|
||||
waterLayer->setValue (current_layer->get());
|
||||
waterLayer->setRange (0, 100);
|
||||
layer_layout->addRow (waterLayer);
|
||||
|
||||
layout->addRow (layer_group);
|
||||
|
||||
connect ( waterLayer, qOverload<int> (&QSpinBox::valueChanged)
|
||||
, current_layer, &unsigned_int_property::set
|
||||
);
|
||||
connect ( current_layer, &unsigned_int_property::changed
|
||||
, waterLayer, &QSpinBox::setValue
|
||||
);
|
||||
|
||||
updateData();
|
||||
setMinimumWidth(sizeHint().width());
|
||||
}
|
||||
|
||||
void water::updatePos(tile_index const& newTile)
|
||||
{
|
||||
if (newTile == tile) return;
|
||||
|
||||
tile = newTile;
|
||||
|
||||
updateData();
|
||||
}
|
||||
|
||||
void water::updateData()
|
||||
{
|
||||
std::stringstream mt;
|
||||
mt << _liquid_id << " - " << LiquidTypeDB::getLiquidName(_liquid_id);
|
||||
waterType->setCurrentText (QString::fromStdString (mt.str()));
|
||||
}
|
||||
|
||||
void water::changeWaterType(int waterint)
|
||||
{
|
||||
_liquid_id = waterint;
|
||||
updateData();
|
||||
}
|
||||
|
||||
void water::changeRadius(float change)
|
||||
{
|
||||
_radius_spin->setValue(_radius + change);
|
||||
}
|
||||
|
||||
void water::changeOrientation(float change)
|
||||
{
|
||||
_orientation += change;
|
||||
|
||||
while (_orientation >= 360.0f)
|
||||
{
|
||||
_orientation -= 360.0f;
|
||||
}
|
||||
while (_orientation < 0.0f)
|
||||
{
|
||||
_orientation += 360.0f;
|
||||
}
|
||||
|
||||
_orientation_spin->setValue(_orientation);
|
||||
}
|
||||
|
||||
void water::changeAngle(float change)
|
||||
{
|
||||
_angle_spin->setValue(_angle + change);
|
||||
}
|
||||
|
||||
void water::change_height(float change)
|
||||
{
|
||||
_h_spin->setValue(_lock_pos.y + change);
|
||||
}
|
||||
|
||||
void water::paintLiquid (World* world, math::vector_3d const& pos, bool add)
|
||||
{
|
||||
world->paintLiquid ( pos
|
||||
, _radius
|
||||
, _liquid_id
|
||||
, add
|
||||
, math::degrees (_angled_mode.get() ? _angle : 0.0f)
|
||||
, math::degrees (_angled_mode.get() ? _orientation : 0.0f)
|
||||
, _locked.get()
|
||||
, _lock_pos
|
||||
, _override_height.get()
|
||||
, _override_liquid_id.get()
|
||||
, get_opacity_factor()
|
||||
);
|
||||
}
|
||||
|
||||
void water::lockPos(math::vector_3d const& cursor_pos)
|
||||
{
|
||||
QSignalBlocker const blocker_x(_x_spin);
|
||||
QSignalBlocker const blocker_z(_z_spin);
|
||||
QSignalBlocker const blocker_h(_h_spin);
|
||||
_lock_pos = cursor_pos;
|
||||
|
||||
_x_spin->setValue(_lock_pos.x);
|
||||
_z_spin->setValue(_lock_pos.z);
|
||||
_h_spin->setValue(_lock_pos.y);
|
||||
|
||||
if (!_locked.get())
|
||||
{
|
||||
toggle_lock();
|
||||
}
|
||||
}
|
||||
|
||||
void water::toggle_lock()
|
||||
{
|
||||
_locked.toggle();
|
||||
}
|
||||
|
||||
void water::toggle_angled_mode()
|
||||
{
|
||||
_angled_mode.toggle();
|
||||
}
|
||||
|
||||
float water::get_opacity_factor() const
|
||||
{
|
||||
switch (_opacity_mode)
|
||||
{
|
||||
default: // values found by experimenting
|
||||
case river_opacity: return 0.0337f;
|
||||
case ocean_opacity: return 0.007f;
|
||||
case custom_opacity: return _custom_opacity_factor;
|
||||
}
|
||||
}
|
||||
|
||||
QSize water::sizeHint() const
|
||||
{
|
||||
return QSize(215, height());
|
||||
}
|
||||
}
|
||||
}
|
||||
// This file is part of Noggit3, licensed under GNU General Public License (version 3).
|
||||
|
||||
#include <noggit/DBC.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <noggit/Misc.h>
|
||||
#include <noggit/World.h>
|
||||
#include <noggit/ui/pushbutton.hpp>
|
||||
#include <noggit/ui/Water.h>
|
||||
#include <util/qt/overload.hpp>
|
||||
|
||||
#include <QtWidgets/QButtonGroup>
|
||||
#include <QtWidgets/QCheckBox>
|
||||
#include <QtWidgets/QDoubleSpinBox>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtWidgets/QGroupBox>
|
||||
#include <QtWidgets/QComboBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QListWidget>
|
||||
#include <QtWidgets/QRadioButton>
|
||||
|
||||
namespace noggit
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
water::water ( unsigned_int_property* current_layer
|
||||
, bool_toggle_property* display_all_layers
|
||||
, QWidget* parent
|
||||
)
|
||||
: QWidget (parent)
|
||||
, _liquid_id(5)
|
||||
, _radius(10.0f)
|
||||
, _angle(10.0f)
|
||||
, _orientation(0.0f)
|
||||
, _locked(false)
|
||||
, _angled_mode(false)
|
||||
, _override_liquid_id(true)
|
||||
, _override_height(true)
|
||||
, _opacity_mode(river_opacity)
|
||||
, _custom_opacity_factor(0.0337f)
|
||||
, _lock_pos(math::vector_3d(0.0f, 0.0f, 0.0f))
|
||||
, tile(0, 0)
|
||||
{
|
||||
auto layout (new QFormLayout (this));
|
||||
|
||||
auto brush_group (new QGroupBox (this));
|
||||
auto brush_layout (new QFormLayout (brush_group));
|
||||
|
||||
_radius_spin = new QDoubleSpinBox (this);
|
||||
_radius_spin->setRange (0.f, 250.f);
|
||||
connect ( _radius_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _radius = f; }
|
||||
);
|
||||
_radius_spin->setValue(_radius);
|
||||
brush_layout->addRow ("Radius", _radius_spin);
|
||||
|
||||
waterType = new QComboBox(this);
|
||||
|
||||
for (DBCFile::Iterator i = gLiquidTypeDB.begin(); i != gLiquidTypeDB.end(); ++i)
|
||||
{
|
||||
int liquid_id = i->getInt(LiquidTypeDB::ID);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << liquid_id << "-" << LiquidTypeDB::getLiquidName(liquid_id);
|
||||
waterType->addItem (QString::fromUtf8(ss.str().c_str()), QVariant (liquid_id));
|
||||
|
||||
}
|
||||
|
||||
connect (waterType, qOverload<int> (&QComboBox::currentIndexChanged)
|
||||
, [&]
|
||||
{
|
||||
changeWaterType(waterType->currentData().toInt());
|
||||
}
|
||||
);
|
||||
|
||||
brush_layout->addRow (waterType);
|
||||
|
||||
layout->addRow (brush_group);
|
||||
|
||||
auto angle_group (new QGroupBox ("Angled mode", this));
|
||||
angle_group->setCheckable (true);
|
||||
angle_group->setChecked (_angled_mode.get());
|
||||
|
||||
|
||||
connect ( &_angled_mode, &bool_toggle_property::changed
|
||||
, angle_group, &QGroupBox::setChecked
|
||||
);
|
||||
connect ( angle_group, &QGroupBox::toggled
|
||||
, &_angled_mode, &bool_toggle_property::set
|
||||
);
|
||||
auto angle_layout (new QFormLayout (angle_group));
|
||||
|
||||
_angle_spin = new QDoubleSpinBox (this);
|
||||
_angle_spin->setRange (0.00001f, 89.f);
|
||||
_angle_spin->setSingleStep (2.0f);
|
||||
connect ( _angle_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _angle = f; }
|
||||
);
|
||||
_angle_spin->setValue(_angle);
|
||||
angle_layout->addRow ("Angle", _angle_spin);
|
||||
|
||||
_orientation_spin = new QDoubleSpinBox (this);
|
||||
_orientation_spin->setRange (0.f, 360.f);
|
||||
_orientation_spin->setWrapping (true);
|
||||
_orientation_spin->setValue(_orientation);
|
||||
_orientation_spin->setSingleStep (5.0f);
|
||||
connect ( _orientation_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _orientation = f; }
|
||||
);
|
||||
|
||||
angle_layout->addRow ("Orienation", _orientation_spin);
|
||||
|
||||
layout->addRow (angle_group);
|
||||
|
||||
auto lock_group (new QGroupBox ("Lock", this));
|
||||
lock_group->setCheckable (true);
|
||||
lock_group->setChecked (_locked.get());
|
||||
auto lock_layout (new QFormLayout (lock_group));
|
||||
|
||||
lock_layout->addRow("X:", _x_spin = new QDoubleSpinBox (this));
|
||||
lock_layout->addRow("Z:", _z_spin = new QDoubleSpinBox (this));
|
||||
lock_layout->addRow("H:", _h_spin = new QDoubleSpinBox (this));
|
||||
|
||||
_x_spin->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
|
||||
_z_spin->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
|
||||
_h_spin->setRange (std::numeric_limits<float>::lowest(), std::numeric_limits<float>::max());
|
||||
_x_spin->setDecimals (2);
|
||||
_z_spin->setDecimals (2);
|
||||
_h_spin->setDecimals (2);
|
||||
|
||||
connect ( _x_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _lock_pos.x = f; }
|
||||
);
|
||||
connect ( _z_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _lock_pos.z = f; }
|
||||
);
|
||||
connect ( _h_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _lock_pos.y = f; }
|
||||
);
|
||||
|
||||
connect ( &_locked, &bool_toggle_property::changed
|
||||
, lock_group, &QGroupBox::setChecked
|
||||
);
|
||||
connect ( lock_group, &QGroupBox::toggled
|
||||
, &_locked, &bool_toggle_property::set
|
||||
);
|
||||
|
||||
layout->addRow(lock_group);
|
||||
|
||||
auto override_group (new QGroupBox ("Override", this));
|
||||
auto override_layout (new QFormLayout (override_group));
|
||||
|
||||
override_layout->addWidget (new checkbox ("Liquid ID", &_override_liquid_id, this));
|
||||
override_layout->addWidget (new checkbox ("Height", &_override_height, this));
|
||||
|
||||
layout->addRow(override_group);
|
||||
|
||||
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));
|
||||
|
||||
QButtonGroup *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);
|
||||
|
||||
connect ( transparency_toggle, qOverload<int> (&QButtonGroup::buttonClicked)
|
||||
, [&] (int id) { _opacity_mode = id; }
|
||||
);
|
||||
|
||||
opacity_layout->addRow (river_button);
|
||||
opacity_layout->addRow (ocean_button);
|
||||
opacity_layout->addRow (custom_button);
|
||||
|
||||
transparency_toggle->button (river_opacity)->setChecked (true);
|
||||
|
||||
QDoubleSpinBox *opacity_spin = new QDoubleSpinBox (this);
|
||||
opacity_spin->setRange (0.f, 1.f);
|
||||
opacity_spin->setDecimals (4);
|
||||
opacity_spin->setSingleStep (0.02f);
|
||||
opacity_spin->setValue(_custom_opacity_factor);
|
||||
connect ( opacity_spin, qOverload<double> (&QDoubleSpinBox::valueChanged)
|
||||
, [&] (float f) { _custom_opacity_factor = f; }
|
||||
);
|
||||
opacity_layout->addRow (opacity_spin);
|
||||
|
||||
layout->addRow (opacity_group);
|
||||
|
||||
layout->addRow ( new pushbutton
|
||||
( "Regen ADT opacity"
|
||||
, [this]
|
||||
{
|
||||
emit regenerate_water_opacity
|
||||
(get_opacity_factor());
|
||||
}
|
||||
)
|
||||
);
|
||||
layout->addRow ( new pushbutton
|
||||
( "Crop water"
|
||||
, [this]
|
||||
{
|
||||
emit crop_water();
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
auto layer_group (new QGroupBox ("Layers", this));
|
||||
auto layer_layout (new QFormLayout (layer_group));
|
||||
|
||||
layer_layout->addRow (new checkbox("Show all layers", display_all_layers));
|
||||
layer_layout->addRow (new QLabel("Current layer:", this));
|
||||
|
||||
waterLayer = new QSpinBox (this);
|
||||
waterLayer->setValue (current_layer->get());
|
||||
waterLayer->setRange (0, 100);
|
||||
layer_layout->addRow (waterLayer);
|
||||
|
||||
layout->addRow (layer_group);
|
||||
|
||||
connect ( waterLayer, qOverload<int> (&QSpinBox::valueChanged)
|
||||
, current_layer, &unsigned_int_property::set
|
||||
);
|
||||
connect ( current_layer, &unsigned_int_property::changed
|
||||
, waterLayer, &QSpinBox::setValue
|
||||
);
|
||||
|
||||
updateData();
|
||||
setMinimumWidth(250);
|
||||
|
||||
}
|
||||
|
||||
void water::updatePos(tile_index const& newTile)
|
||||
{
|
||||
if (newTile == tile) return;
|
||||
|
||||
tile = newTile;
|
||||
|
||||
updateData();
|
||||
}
|
||||
|
||||
void water::updateData()
|
||||
{
|
||||
std::stringstream mt;
|
||||
mt << _liquid_id << " - " << LiquidTypeDB::getLiquidName(_liquid_id);
|
||||
waterType->setCurrentText (QString::fromStdString (mt.str()));
|
||||
}
|
||||
|
||||
void water::changeWaterType(int waterint)
|
||||
{
|
||||
_liquid_id = waterint;
|
||||
updateData();
|
||||
}
|
||||
|
||||
void water::changeRadius(float change)
|
||||
{
|
||||
_radius_spin->setValue(_radius + change);
|
||||
}
|
||||
|
||||
void water::changeOrientation(float change)
|
||||
{
|
||||
_orientation += change;
|
||||
|
||||
while (_orientation >= 360.0f)
|
||||
{
|
||||
_orientation -= 360.0f;
|
||||
}
|
||||
while (_orientation < 0.0f)
|
||||
{
|
||||
_orientation += 360.0f;
|
||||
}
|
||||
|
||||
_orientation_spin->setValue(_orientation);
|
||||
}
|
||||
|
||||
void water::changeAngle(float change)
|
||||
{
|
||||
_angle_spin->setValue(_angle + change);
|
||||
}
|
||||
|
||||
void water::change_height(float change)
|
||||
{
|
||||
_h_spin->setValue(_lock_pos.y + change);
|
||||
}
|
||||
|
||||
void water::paintLiquid (World* world, math::vector_3d const& pos, bool add)
|
||||
{
|
||||
world->paintLiquid ( pos
|
||||
, _radius
|
||||
, _liquid_id
|
||||
, add
|
||||
, math::degrees (_angled_mode.get() ? _angle : 0.0f)
|
||||
, math::degrees (_angled_mode.get() ? _orientation : 0.0f)
|
||||
, _locked.get()
|
||||
, _lock_pos
|
||||
, _override_height.get()
|
||||
, _override_liquid_id.get()
|
||||
, get_opacity_factor()
|
||||
);
|
||||
}
|
||||
|
||||
void water::lockPos(math::vector_3d const& cursor_pos)
|
||||
{
|
||||
QSignalBlocker const blocker_x(_x_spin);
|
||||
QSignalBlocker const blocker_z(_z_spin);
|
||||
QSignalBlocker const blocker_h(_h_spin);
|
||||
_lock_pos = cursor_pos;
|
||||
|
||||
_x_spin->setValue(_lock_pos.x);
|
||||
_z_spin->setValue(_lock_pos.z);
|
||||
_h_spin->setValue(_lock_pos.y);
|
||||
|
||||
if (!_locked.get())
|
||||
{
|
||||
toggle_lock();
|
||||
}
|
||||
}
|
||||
|
||||
void water::toggle_lock()
|
||||
{
|
||||
_locked.toggle();
|
||||
}
|
||||
|
||||
void water::toggle_angled_mode()
|
||||
{
|
||||
_angled_mode.toggle();
|
||||
}
|
||||
|
||||
float water::get_opacity_factor() const
|
||||
{
|
||||
switch (_opacity_mode)
|
||||
{
|
||||
default: // values found by experimenting
|
||||
case river_opacity: return 0.0337f;
|
||||
case ocean_opacity: return 0.007f;
|
||||
case custom_opacity: return _custom_opacity_factor;
|
||||
}
|
||||
}
|
||||
|
||||
QSize water::sizeHint() const
|
||||
{
|
||||
return QSize(215, height());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,8 @@ namespace noggit
|
||||
"} \n"
|
||||
"QSlider::vertical { \n"
|
||||
" width: 35px; \n"
|
||||
" max-height: 100px; \n"
|
||||
" min-height: 100px; \n"
|
||||
" max-height: 200px; \n"
|
||||
"} \n"
|
||||
"QSlider::add-page:vertical { \n"
|
||||
" background: transparent; \n"
|
||||
@@ -374,7 +375,6 @@ namespace noggit
|
||||
|
||||
setMinimumWidth(250);
|
||||
setMaximumWidth(250);
|
||||
setMinimumHeight(540);
|
||||
}
|
||||
|
||||
void texturing_tool::update_brush_hardness()
|
||||
|
||||
Reference in New Issue
Block a user