Materials: External Modules Part 1
Refactored code to support local and external material sources This is the first PR in a series to support external modules. External modules allow materials to be stored in external data sources such as databases or web services. No new functionality is introduced in this PR, rather it is a refactoring of code that will allow for changes to be introduced in future PRs. Minor performance improvements have also been made in the model and material managers. The Python API has been enhanced for many data types to allow for modification within Python.
This commit is contained in:
committed by
Chris Hennes
parent
3c4977a2d4
commit
00c57a9d08
@@ -32,68 +32,28 @@
|
||||
|
||||
#include <Mod/Material/MaterialGlobal.h>
|
||||
|
||||
#include "Library.h"
|
||||
#include "MaterialValue.h"
|
||||
#include "Model.h"
|
||||
namespace Materials
|
||||
{
|
||||
|
||||
// class Model;
|
||||
|
||||
class MaterialsExport LibraryBase: public Base::BaseClass
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
public:
|
||||
LibraryBase() = default;
|
||||
LibraryBase(const QString& libraryName, const QString& dir, const QString& icon);
|
||||
~LibraryBase() override = default;
|
||||
|
||||
const QString getName() const
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
const QString getDirectory() const
|
||||
{
|
||||
return _directory;
|
||||
}
|
||||
const QString getDirectoryPath() const
|
||||
{
|
||||
return QDir(_directory).absolutePath();
|
||||
}
|
||||
const QString getIconPath() const
|
||||
{
|
||||
return _iconPath;
|
||||
}
|
||||
bool operator==(const LibraryBase& library) const;
|
||||
bool operator!=(const LibraryBase& library) const
|
||||
{
|
||||
return !operator==(library);
|
||||
}
|
||||
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 Library,
|
||||
public std::enable_shared_from_this<ModelLibrary>
|
||||
{
|
||||
TYPESYSTEM_HEADER_WITH_OVERRIDE();
|
||||
|
||||
public:
|
||||
ModelLibrary();
|
||||
ModelLibrary(const QString& libraryName, const QString& dir, const QString& icon);
|
||||
ModelLibrary(const QString& libraryName,
|
||||
const QString& dir,
|
||||
const QString& icon,
|
||||
bool readOnly = true);
|
||||
~ModelLibrary() override = default;
|
||||
|
||||
bool operator==(const ModelLibrary& library) const
|
||||
{
|
||||
return LibraryBase::operator==(library);
|
||||
return Library::operator==(library);
|
||||
}
|
||||
bool operator!=(const ModelLibrary& library) const
|
||||
{
|
||||
@@ -119,4 +79,6 @@ private:
|
||||
|
||||
} // namespace Materials
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<Materials::ModelLibrary>)
|
||||
|
||||
#endif // MATERIAL_MODELLIBRARY_H
|
||||
|
||||
Reference in New Issue
Block a user