asset browser: rotate camera by 45 degrees on load, fix referencing group files, allow local file loading
This commit is contained in:
@@ -2,10 +2,12 @@
|
||||
#include <ui_AssetBrowser.h>
|
||||
#include <noggit/MPQ.h>
|
||||
#include <noggit/Log.h>
|
||||
#include <noggit/Red/AssetBrowser/Ui/Model/TreeManager.hpp>
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QRegularExpression>
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
|
||||
using namespace noggit::Red::AssetBrowser::Ui;
|
||||
|
||||
@@ -62,6 +64,34 @@ AssetBrowserWidget::AssetBrowserWidget(QWidget *parent)
|
||||
|
||||
}
|
||||
|
||||
// Add WMOs and M2s from project directory recursively
|
||||
void AssetBrowserWidget::recurseDirectory(Model::TreeManager& tree_mgr, const QString& s_dir, const QString& project_dir)
|
||||
{
|
||||
QDir dir(s_dir);
|
||||
QFileInfoList list = dir.entryInfoList();
|
||||
for (int i = 0; i < list.count(); ++i)
|
||||
{
|
||||
QFileInfo info = list[i];
|
||||
|
||||
QString q_path = info.filePath();
|
||||
if (info.isDir())
|
||||
{
|
||||
if (info.fileName() != ".." && info.fileName() != ".")
|
||||
{
|
||||
recurseDirectory(tree_mgr, q_path, project_dir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!((q_path.endsWith(".wmo") && !QRegularExpression(".+_\\d{3}(_lod.+)*.wmo").match(q_path).hasMatch())
|
||||
|| q_path.endsWith(".m2")))
|
||||
continue;
|
||||
|
||||
tree_mgr.addItem(QDir(project_dir).relativeFilePath(q_path.toStdString().c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AssetBrowserWidget::updateModelData()
|
||||
{
|
||||
Model::TreeManager tree_mgr = Model::TreeManager(_model);
|
||||
@@ -69,11 +99,17 @@ void AssetBrowserWidget::updateModelData()
|
||||
{
|
||||
QString q_path = QString(path.c_str());
|
||||
|
||||
if (!(q_path.endsWith(".wmo") || q_path.endsWith(".m2")))
|
||||
if (!((q_path.endsWith(".wmo") && !QRegularExpression(".+_\\d{3}(_lod.+)*.wmo").match(q_path).hasMatch())
|
||||
|| q_path.endsWith(".m2")))
|
||||
continue;
|
||||
|
||||
tree_mgr.addItem(path.c_str());
|
||||
}
|
||||
|
||||
|
||||
QSettings settings;
|
||||
QString project_dir = settings.value("project/path").toString();
|
||||
recurseDirectory(tree_mgr, project_dir, project_dir);
|
||||
}
|
||||
|
||||
AssetBrowserWidget::~AssetBrowserWidget()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#ifndef NOGGIT_ASSETBROWSER_HPP
|
||||
#define NOGGIT_ASSETBROWSER_HPP
|
||||
|
||||
#include <QWidget>
|
||||
#include <ui_AssetBrowser.h>
|
||||
#include <noggit/Red/AssetBrowser/Ui/Model/TreeManager.hpp>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
|
||||
@@ -22,6 +23,7 @@ namespace noggit
|
||||
QStandardItemModel* _model;
|
||||
|
||||
void updateModelData();
|
||||
void recurseDirectory(Model::TreeManager& tree_mgr, const QString& s_dir, const QString& project_dir);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace noggit
|
||||
{
|
||||
position = {0.f, 0.f, 0.f};
|
||||
_roll = math::degrees(0.0f);
|
||||
_yaw = math::degrees(0.f);
|
||||
_yaw = math::degrees(45.f);
|
||||
_pitch = math::degrees(0.f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user