Material: Material editor enhancements (#11764)
Continues the work of the material subsystem improvements. Add support for embedded SVG files. These are not the same as image files so need to be handled differently. Add the ability to filter materials in the editor when called from code. This allows programs to select objects supporting specific models, complete models, older models, etc. Updated tests, and refactored code. New models and materials supporting patterns such as used by the TechDraw workbench. fixes #11686 - checks for the presense of a model property before assinging a value. This can happen when a required model definition is not available. --------- Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
@@ -40,6 +40,7 @@ namespace Materials
|
||||
|
||||
class Material;
|
||||
class MaterialManager;
|
||||
class MaterialFilter;
|
||||
|
||||
class MaterialsExport MaterialLibrary: public LibraryBase,
|
||||
public std::enable_shared_from_this<MaterialLibrary>
|
||||
@@ -77,7 +78,8 @@ public:
|
||||
bool fileExists(const QString& path) const;
|
||||
std::shared_ptr<Material> addMaterial(const std::shared_ptr<Material>& material,
|
||||
const QString& path);
|
||||
std::shared_ptr<std::map<QString, std::shared_ptr<MaterialTreeNode>>> getMaterialTree() const;
|
||||
std::shared_ptr<std::map<QString, std::shared_ptr<MaterialTreeNode>>>
|
||||
getMaterialTree(const MaterialFilter* filter = nullptr) const;
|
||||
|
||||
bool isReadOnly() const
|
||||
{
|
||||
@@ -96,6 +98,8 @@ protected:
|
||||
|
||||
void updatePaths(const QString& oldPath, const QString& newPath);
|
||||
QString getUUIDFromPath(const QString& path) const;
|
||||
bool materialInTree(const std::shared_ptr<Material>& material,
|
||||
const MaterialFilter* filter) const;
|
||||
|
||||
bool _readOnly;
|
||||
std::unique_ptr<std::map<QString, std::shared_ptr<Material>>> _materialPathMap;
|
||||
@@ -111,7 +115,7 @@ public:
|
||||
const QString& dir,
|
||||
const QString& icon,
|
||||
bool readOnly = true);
|
||||
~MaterialExternalLibrary() = default;
|
||||
~MaterialExternalLibrary() override = default;
|
||||
};
|
||||
|
||||
} // namespace Materials
|
||||
|
||||
Reference in New Issue
Block a user