| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef MATERIAL_MATERIALMANAGEREXTERNAl_H |
| | #define MATERIAL_MATERIALMANAGEREXTERNAl_H |
| |
|
| | #include <memory> |
| | #include <lru/lru.hpp> |
| |
|
| | #include <Mod/Material/MaterialGlobal.h> |
| |
|
| | #include <QMutex> |
| |
|
| | #include "FolderTree.h" |
| | #include "Materials.h" |
| |
|
| | class QMutex; |
| |
|
| | namespace App |
| | { |
| | class Material; |
| | } |
| |
|
| | namespace Materials |
| | { |
| |
|
| | class LibraryObject; |
| | class MaterialLibrary; |
| | class MaterialLibraryExternal; |
| | class MaterialFilter; |
| | class MaterialFilterOptions; |
| |
|
| | class MaterialsExport MaterialManagerExternal: public Base::BaseClass |
| | { |
| | TYPESYSTEM_HEADER_WITH_OVERRIDE(); |
| |
|
| | public: |
| | MaterialManagerExternal(); |
| | ~MaterialManagerExternal() override = default; |
| |
|
| | static void cleanup(); |
| | void refresh(); |
| |
|
| | static const int DEFAULT_CACHE_SIZE = 100; |
| |
|
| | |
| | std::shared_ptr<std::list<std::shared_ptr<MaterialLibrary>>> getLibraries(); |
| | std::shared_ptr<std::list<std::shared_ptr<MaterialLibrary>>> getMaterialLibraries(); |
| | std::shared_ptr<MaterialLibrary> getLibrary(const QString& name) const; |
| | void createLibrary(const QString& libraryName, |
| | const QByteArray& icon, |
| | bool readOnly = true); |
| | void renameLibrary(const QString& libraryName, const QString& newName); |
| | void changeIcon(const QString& libraryName, const QByteArray& icon); |
| | void removeLibrary(const QString& libraryName); |
| | std::shared_ptr<std::vector<LibraryObject>> |
| | libraryMaterials(const QString& libraryName); |
| | std::shared_ptr<std::vector<LibraryObject>> |
| | libraryMaterials(const QString& libraryName, |
| | const MaterialFilter& filter, |
| | const MaterialFilterOptions& options); |
| |
|
| | |
| | void createFolder(const MaterialLibrary& library, const QString& path); |
| | void |
| | renameFolder(const MaterialLibrary& library, const QString& oldPath, const QString& newPath); |
| | void deleteRecursive(const MaterialLibrary& library, const QString& path); |
| |
|
| | |
| | std::shared_ptr<Material> getMaterial(const QString& uuid) const; |
| | void addMaterial(const QString& libraryName, |
| | const QString& path, |
| | const Material& material); |
| | void migrateMaterial(const QString& libraryName, |
| | const QString& path, |
| | const Material& material); |
| |
|
| | |
| | void resetCache(); |
| | double materialHitRate(); |
| |
|
| | private: |
| | static void initCache(); |
| | std::shared_ptr<Material> materialNotFound(const QString& uuid) const; |
| |
|
| | static QMutex _mutex; |
| |
|
| | |
| | |
| | static LRU::Cache<std::string, std::shared_ptr<Material>> _cache; |
| | }; |
| |
|
| | } |
| |
|
| | #endif |