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
382720b82e
commit
592406a328
@@ -1022,7 +1022,7 @@ void MaterialConfigLoader::addLegacy(const QMap<QString, QString>& fcmat,
|
||||
{
|
||||
for (auto const& legacy : fcmat.keys()) {
|
||||
auto name = legacy;
|
||||
int last = name.lastIndexOf(QLatin1String("/"));
|
||||
int last = name.lastIndexOf(QStringLiteral("/"));
|
||||
if (last > 0) {
|
||||
name = name.mid(last + 1);
|
||||
}
|
||||
@@ -1034,7 +1034,7 @@ void MaterialConfigLoader::addLegacy(const QMap<QString, QString>& fcmat,
|
||||
}
|
||||
|
||||
std::shared_ptr<Material>
|
||||
MaterialConfigLoader::getMaterialFromPath(const std::shared_ptr<MaterialLibrary>& library,
|
||||
MaterialConfigLoader::getMaterialFromPath(const std::shared_ptr<MaterialLibraryLocal>& library,
|
||||
const QString& path)
|
||||
{
|
||||
QString author = getAuthorAndLicense(path); // Place them both in the author field
|
||||
@@ -1056,7 +1056,10 @@ MaterialConfigLoader::getMaterialFromPath(const std::shared_ptr<MaterialLibrary>
|
||||
QString sourceReference = value(fcmat, "ReferenceSource", "");
|
||||
QString sourceURL = value(fcmat, "SourceURL", "");
|
||||
|
||||
std::shared_ptr<Material> finalModel = std::make_shared<Material>(library, path, uuid, name);
|
||||
auto baseLibrary =
|
||||
reinterpret_cast<const std::shared_ptr<Materials::MaterialLibrary>&>(library);
|
||||
std::shared_ptr<Material> finalModel =
|
||||
std::make_shared<Material>(baseLibrary, path, uuid, name);
|
||||
finalModel->setOldFormat(true);
|
||||
|
||||
finalModel->setAuthor(author);
|
||||
|
||||
Reference in New Issue
Block a user