new asset browser filter UI settings
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <noggit/Misc.h>
|
||||
#include <blizzard-archive-library/include/ClientData.hpp>
|
||||
#include <string>
|
||||
#include <Exception.hpp>
|
||||
|
||||
AreaDB gAreaDB;
|
||||
MapDB gMapDB;
|
||||
|
||||
@@ -2328,7 +2328,7 @@ void MapView::setupHelpMenu()
|
||||
{
|
||||
ShellExecute ( nullptr
|
||||
, "open"
|
||||
, "https://gitlab.com/prophecy-rp/noggit-red/-/tree/noggit-shadowlands?ref_type=heads"
|
||||
, "https://gitlab.com/prophecy-rp/noggit-red/"
|
||||
, nullptr
|
||||
, nullptr
|
||||
, SW_SHOWNORMAL
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <noggit/DBC.h>
|
||||
#include "noggit/ActionManager.hpp"
|
||||
#include "noggit/Action.hpp"
|
||||
#include <noggit/ui/FontAwesome.hpp>
|
||||
|
||||
#include <QFormLayout>
|
||||
#include <QGridLayout>
|
||||
@@ -100,8 +101,10 @@ namespace Noggit
|
||||
layout->addWidget(drag_selection_depth_group);*/
|
||||
|
||||
QPushButton* asset_browser_btn = new QPushButton("Asset browser", this);
|
||||
asset_browser_btn->setIcon(Noggit::Ui::FontAwesomeIcon(Noggit::Ui::FontAwesome::file));
|
||||
layout->addWidget(asset_browser_btn);
|
||||
QPushButton* object_palette_btn = new QPushButton("Object palette", this);
|
||||
object_palette_btn->setIcon(Noggit::Ui::FontAwesomeIcon(Noggit::Ui::FontAwesome::palette));
|
||||
layout->addWidget(object_palette_btn);
|
||||
|
||||
_wmo_group = new QGroupBox("Selected WMO Options");
|
||||
@@ -115,6 +118,7 @@ namespace Noggit
|
||||
wmo_layout->addRow("Name Set:", _nameSetSelector);
|
||||
|
||||
auto clipboard_box = new QGroupBox("Clipboard");
|
||||
// clipboard_box->setWindowIcon(Noggit::Ui::FontAwesomeIcon(Noggit::Ui::FontAwesome::clipboard));
|
||||
auto clipboard_layout = new QVBoxLayout(clipboard_box);
|
||||
|
||||
_filename = new QLabel(this);
|
||||
|
||||
@@ -35,6 +35,37 @@ AssetBrowserWidget::AssetBrowserWidget(MapView* map_view, QWidget *parent)
|
||||
|
||||
setWindowFlags(windowFlags() | Qt::Tool | Qt::WindowStaysOnTopHint);
|
||||
|
||||
ui->checkBox_M2s->setChecked(true);
|
||||
ui->checkBox_WMOs->setChecked(true);
|
||||
connect(ui->checkBox_M2s, &QCheckBox::stateChanged, [&](int state)
|
||||
{
|
||||
updateModelData();
|
||||
});
|
||||
|
||||
connect(ui->checkBox_WMOs, &QCheckBox::stateChanged, [&](int state)
|
||||
{
|
||||
updateModelData();
|
||||
});
|
||||
|
||||
ui->comboBox_BrowseMode->addItems(brosweModeLabels.keys());
|
||||
|
||||
// set combobox browse mode to World
|
||||
for (auto it = brosweModeLabels.constBegin(); it != brosweModeLabels.constEnd(); ++it) {
|
||||
if (it.value() == asset_browse_mode::world) {
|
||||
ui->comboBox_BrowseMode->setCurrentText(it.key());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
connect(ui->comboBox_BrowseMode, qOverload<int>(&QComboBox::currentIndexChanged)
|
||||
, [this](int index)
|
||||
{
|
||||
asset_browse_mode mode = brosweModeLabels[ui->comboBox_BrowseMode->currentText()];
|
||||
|
||||
set_browse_mode(mode);
|
||||
}
|
||||
);
|
||||
|
||||
_model = new QStandardItemModel(this);
|
||||
// _sort_model = new QSortFilterProxyModel(this);
|
||||
_sort_model = new NoggitExpendableFilterProxyModel;
|
||||
@@ -274,8 +305,14 @@ void AssetBrowserWidget::setupConnectsCommon()
|
||||
[this](bool state) {ui->viewport->_draw_grid.set(state);});
|
||||
}
|
||||
|
||||
bool AssetBrowserWidget::validateBrowseMode(QString wow_file_path)
|
||||
bool AssetBrowserWidget::validateBrowseMode(const QString& wow_file_path)
|
||||
{
|
||||
// if (_browse_mode == asset_browse_mode::detail_doodads)
|
||||
// {
|
||||
// _sort_model->setFilterFixedString("world/nodxt/detail");
|
||||
// }
|
||||
|
||||
|
||||
// TODO : do it in sort model instead?
|
||||
switch (_browse_mode)
|
||||
{
|
||||
@@ -391,8 +428,9 @@ void AssetBrowserWidget::updateModelData()
|
||||
|
||||
QString q_path = QString(filename.c_str());
|
||||
|
||||
if (!((q_path.endsWith(".wmo") && !_wmo_group_and_lod_regex.match(q_path).hasMatch())
|
||||
|| q_path.endsWith(".m2")))
|
||||
if (!( (ui->checkBox_WMOs->isChecked() && q_path.endsWith(".wmo") && !_wmo_group_and_lod_regex.match(q_path).hasMatch())
|
||||
|| (ui->checkBox_M2s->isChecked() && q_path.endsWith(".m2"))
|
||||
))
|
||||
continue;
|
||||
|
||||
if (!validateBrowseMode(q_path))
|
||||
@@ -409,10 +447,21 @@ void AssetBrowserWidget::updateModelData()
|
||||
_sort_model->setSortRole(Qt::UserRole);
|
||||
_sort_model->sort(0, Qt::AscendingOrder);
|
||||
|
||||
// TODO : set default layout for the modes
|
||||
// TODO : set default layout(base folder) for the modes
|
||||
if (_browse_mode != asset_browse_mode::ALL)
|
||||
{
|
||||
// expend base directories
|
||||
// ui->listfileTree->expand();
|
||||
}
|
||||
|
||||
// those modes don't have subfolders, can auto expend without it becoming a mess
|
||||
if (_browse_mode == asset_browse_mode::detail_doodads
|
||||
|| _browse_mode == asset_browse_mode::spells
|
||||
|| _browse_mode == asset_browse_mode::skybox
|
||||
|| _browse_mode == asset_browse_mode::cameras
|
||||
|| _browse_mode == asset_browse_mode::particles)
|
||||
{
|
||||
ui->listfileTree->expandAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,17 +472,28 @@ AssetBrowserWidget::~AssetBrowserWidget()
|
||||
}
|
||||
|
||||
void AssetBrowserWidget::set_browse_mode(asset_browse_mode browse_mode)
|
||||
{
|
||||
{
|
||||
if (_browse_mode == browse_mode)
|
||||
return;
|
||||
|
||||
{
|
||||
QSignalBlocker const combobox_blocker(ui->comboBox_BrowseMode);
|
||||
|
||||
QString key_text = "";
|
||||
|
||||
for (auto it = brosweModeLabels.constBegin(); it != brosweModeLabels.constEnd(); ++it) {
|
||||
if (it.value() == browse_mode) {
|
||||
key_text = it.key();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (key_text.isEmpty())
|
||||
|
||||
ui->comboBox_BrowseMode->setCurrentText(key_text);
|
||||
}
|
||||
|
||||
_browse_mode = browse_mode;
|
||||
updateModelData();
|
||||
// if (_browse_mode == asset_browse_mode::detail_doodads)
|
||||
// {
|
||||
// _sort_model->setFilterFixedString("world/nodxt/detail");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
void AssetBrowserWidget::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QRegularExpression>
|
||||
#include <QMainWindow>
|
||||
#include <QMap>
|
||||
|
||||
class MapView;
|
||||
|
||||
@@ -54,7 +55,6 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
namespace Noggit::Ui::Tools::AssetBrowser
|
||||
{
|
||||
enum class asset_browse_mode
|
||||
@@ -72,11 +72,12 @@ namespace Noggit::Ui::Tools::AssetBrowser
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
namespace Noggit
|
||||
{
|
||||
namespace Ui::Tools::AssetBrowser::Ui
|
||||
{
|
||||
|
||||
|
||||
class AssetBrowserWidget : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -103,7 +104,21 @@ namespace Noggit
|
||||
|
||||
void updateModelData();
|
||||
void recurseDirectory(Model::TreeManager& tree_mgr, const QString& s_dir, const QString& project_dir);
|
||||
bool validateBrowseMode(QString wow_file_path);
|
||||
inline bool validateBrowseMode(const QString& wow_file_path);
|
||||
|
||||
// commented objects that shouldn't be placed on the map, still accessible through Show all
|
||||
const QMap<QString, asset_browse_mode> brosweModeLabels = {
|
||||
{ "World Objects", asset_browse_mode::world },
|
||||
// { "Detail Doodads", asset_browse_mode::detail_doodads },
|
||||
// { "Skybox", asset_browse_mode::skybox },
|
||||
// { "Creatures", asset_browse_mode::creatures },
|
||||
// { "Characters", asset_browse_mode::characters },
|
||||
// {"Particles", asset_browse_mode::particles },
|
||||
// {"Cameras", asset_browse_mode::cameras },
|
||||
{ "Items", asset_browse_mode::items },
|
||||
{ "Spells", asset_browse_mode::spells },
|
||||
{ "Show All", asset_browse_mode::ALL },
|
||||
};
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>960</width>
|
||||
<height>324</height>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
@@ -110,7 +110,7 @@
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@@ -231,6 +231,103 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Browse Mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_BrowseMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="horizontalWidget" native="true">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_WMOs">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>WMOs (*.wmo)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRepeat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_M2s">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Models (*.m2)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <noggit/ui/windows/projectSelection/widgets/ProjectListItem.hpp>
|
||||
#include <noggit/ui/FontAwesome.hpp>
|
||||
|
||||
namespace Noggit::Ui::Widget
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user