Materials: Model Manager External Interface (#20825)
* Materials: Model Manager External Interface Implement the ModelManagerExternal class for the external Materials interface. This is part of the ongoing merges of code to support external material interfaces. In this PR the ModelManagerExternal class is implemented, along with changes to supporting classes required for this class. * Apply reviewer feedback
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include "Library.h"
|
||||
#include "MaterialValue.h"
|
||||
#include "Model.h"
|
||||
|
||||
namespace Materials
|
||||
{
|
||||
|
||||
@@ -45,12 +46,44 @@ class MaterialsExport ModelLibrary: public Library,
|
||||
|
||||
public:
|
||||
ModelLibrary();
|
||||
ModelLibrary(const Library& other);
|
||||
ModelLibrary(const QString& libraryName,
|
||||
const QString& dir,
|
||||
const QString& icon,
|
||||
bool readOnly = true);
|
||||
ModelLibrary(const ModelLibrary& other) = delete;
|
||||
~ModelLibrary() override = default;
|
||||
|
||||
bool isLocal() const;
|
||||
void setLocal(bool local);
|
||||
|
||||
std::shared_ptr<std::map<QString, std::shared_ptr<ModelTreeNode>>>
|
||||
getModelTree(ModelFilter filter) const;
|
||||
|
||||
// Use this to get a shared_ptr for *this
|
||||
std::shared_ptr<ModelLibrary> getptr()
|
||||
{
|
||||
return shared_from_this();
|
||||
}
|
||||
|
||||
private:
|
||||
bool _local;
|
||||
};
|
||||
|
||||
class MaterialsExport ModelLibraryLocal: public ModelLibrary
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
public:
|
||||
ModelLibraryLocal();
|
||||
ModelLibraryLocal(const Library& other);
|
||||
ModelLibraryLocal(const QString& libraryName,
|
||||
const QString& dir,
|
||||
const QString& icon,
|
||||
bool readOnly = true);
|
||||
ModelLibraryLocal(const ModelLibraryLocal& other) = delete;
|
||||
~ModelLibraryLocal() override = default;
|
||||
|
||||
bool operator==(const ModelLibrary& library) const
|
||||
{
|
||||
return Library::operator==(library);
|
||||
@@ -63,16 +96,7 @@ public:
|
||||
|
||||
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;
|
||||
};
|
||||
@@ -80,5 +104,6 @@ private:
|
||||
} // namespace Materials
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<Materials::ModelLibrary>)
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<Materials::ModelLibraryLocal>)
|
||||
|
||||
#endif // MATERIAL_MODELLIBRARY_H
|
||||
|
||||
Reference in New Issue
Block a user