Material: Material editor enhancements
Continues the work of the material subsystem improvements. This merge covers the continued development of the material editor. The primary improvements are in the handling of 2D and 3D array properties. These properties are now fully editable, and can be saved and restored. The cards now separate the author and license. These were previously saved as a single item. Future support will be provided for standard open source licenses. Saving operations validate the cards to ensure UUIDs of materials are considered. Warnings are given when a save could potentially impact the models, such as saving over a material instead of creating a new instance. The editor is still not complete. There are a number of functional elements, such as drag/drop operations, folder creation, and deletion operations that need to be added to the main tree. State needs to be saved and restored to improve the user experience. The appearance preview also needs significant work. This will be handled in a future PR.
This commit is contained in:
@@ -22,27 +22,30 @@
|
||||
#ifndef MATERIAL_MODELLIBRARY_H
|
||||
#define MATERIAL_MODELLIBRARY_H
|
||||
|
||||
#include <Mod/Material/MaterialGlobal.h>
|
||||
#include <memory>
|
||||
|
||||
#include <Base/BaseClass.h>
|
||||
#include <Base/Quantity.h>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
|
||||
#include "MaterialValue.h"
|
||||
#include <Base/BaseClass.h>
|
||||
#include <Base/Quantity.h>
|
||||
|
||||
#include <Mod/Material/MaterialGlobal.h>
|
||||
|
||||
#include "MaterialValue.h"
|
||||
#include "Model.h"
|
||||
namespace Materials
|
||||
{
|
||||
|
||||
class Model;
|
||||
// class Model;
|
||||
|
||||
class MaterialsExport LibraryBase: public Base::BaseClass
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
LibraryBase();
|
||||
explicit LibraryBase(const QString& libraryName, const QString& dir, const QString& icon);
|
||||
LibraryBase(const QString& libraryName, const QString& dir, const QString& icon);
|
||||
~LibraryBase() override = default;
|
||||
|
||||
const QString getName() const
|
||||
@@ -68,20 +71,24 @@ public:
|
||||
}
|
||||
QString getLocalPath(const QString& path) const;
|
||||
QString getRelativePath(const QString& path) const;
|
||||
bool isRoot(const QString& path) const;
|
||||
|
||||
private:
|
||||
LibraryBase(const LibraryBase&);
|
||||
|
||||
QString _name;
|
||||
QString _directory;
|
||||
QString _iconPath;
|
||||
};
|
||||
|
||||
class MaterialsExport ModelLibrary: public LibraryBase
|
||||
class MaterialsExport ModelLibrary: public LibraryBase,
|
||||
public std::enable_shared_from_this<ModelLibrary>
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
TYPESYSTEM_HEADER();
|
||||
|
||||
public:
|
||||
ModelLibrary();
|
||||
explicit ModelLibrary(const QString& libraryName, const QString& dir, const QString& icon);
|
||||
ModelLibrary(const QString& libraryName, const QString& dir, const QString& icon);
|
||||
~ModelLibrary() override = default;
|
||||
|
||||
bool operator==(const ModelLibrary& library) const
|
||||
@@ -92,8 +99,22 @@ public:
|
||||
{
|
||||
return !operator==(library);
|
||||
}
|
||||
std::shared_ptr<Model> getModelByPath(const QString& path) const;
|
||||
|
||||
Model* addModel(const Model& model, const QString& path);
|
||||
std::shared_ptr<Model> addModel(const Model& model, const QString& path);
|
||||
|
||||
// Use this to get a shared_ptr for *this
|
||||
std::shared_ptr<ModelLibrary> getptr()
|
||||
{
|
||||
return shared_from_this();
|
||||
}
|
||||
std::shared_ptr<std::map<QString, std::shared_ptr<ModelTreeNode>>>
|
||||
getModelTree(ModelFilter filter) const;
|
||||
|
||||
private:
|
||||
ModelLibrary(const ModelLibrary&);
|
||||
|
||||
std::unique_ptr<std::map<QString, std::shared_ptr<Model>>> _modelPathMap;
|
||||
};
|
||||
|
||||
} // namespace Materials
|
||||
|
||||
Reference in New Issue
Block a user