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
@@ -120,7 +120,7 @@ void DlgInspectMaterial::appendClip(QString text)
|
||||
{
|
||||
// Need to add indent
|
||||
QString indent(clipboardIndent * 4, QLatin1Char(' '));
|
||||
clipboardText += indent + text + QLatin1String("\n");
|
||||
clipboardText += indent + text + QStringLiteral("\n");
|
||||
}
|
||||
|
||||
QStandardItem* DlgInspectMaterial::clipItem(QString text)
|
||||
@@ -144,7 +144,7 @@ void DlgInspectMaterial::unindent()
|
||||
|
||||
void DlgInspectMaterial::update(std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
clipboardText = QLatin1String("");
|
||||
clipboardText = QStringLiteral("");
|
||||
clipboardIndent = 0;
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
if (doc) {
|
||||
@@ -166,7 +166,7 @@ void DlgInspectMaterial::update(std::vector<Gui::ViewProvider*>& views)
|
||||
appendClip(tr("Label: ") + QString::fromUtf8(labelProp->getValue()));
|
||||
}
|
||||
else {
|
||||
ui->editObjectLabel->setText(QLatin1String(""));
|
||||
ui->editObjectLabel->setText(QStringLiteral(""));
|
||||
}
|
||||
ui->editObjectName->setText(QLatin1String(obj->getNameInDocument()));
|
||||
appendClip(tr("Internal Name: ") + QString::fromUtf8(obj->getNameInDocument()));
|
||||
@@ -178,15 +178,15 @@ void DlgInspectMaterial::update(std::vector<Gui::ViewProvider*>& views)
|
||||
ui->editSubShape->setText(QString::fromStdString(subObject.getSubNames()[0]));
|
||||
}
|
||||
else {
|
||||
ui->editSubShape->setText(QLatin1String(""));
|
||||
ui->editSubShape->setText(QStringLiteral(""));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ui->editSubShape->setText(QLatin1String(""));
|
||||
ui->editSubShape->setText(QStringLiteral(""));
|
||||
}
|
||||
|
||||
auto subShapeType = QString::fromUtf8(obj->getTypeId().getName());
|
||||
subShapeType.remove(subShapeType.indexOf(QLatin1String("::")), subShapeType.size());
|
||||
subShapeType.remove(subShapeType.indexOf(QStringLiteral("::")), subShapeType.size());
|
||||
appendClip(tr("Type: ") + subShapeType);
|
||||
ui->editSubShapeType->setText(subShapeType);
|
||||
appendClip(tr("TypeID: ") + QString::fromUtf8(obj->getTypeId().getName()));
|
||||
@@ -248,7 +248,7 @@ void DlgInspectMaterial::addModels(QTreeView* tree,
|
||||
}
|
||||
else {
|
||||
for (const QString& uuid : *models) {
|
||||
auto model = modelManager.getModel(uuid);
|
||||
auto model = Materials::ModelManager::getManager().getModel(uuid);
|
||||
auto name = clipItem(tr("Name: ") + model->getName());
|
||||
addExpanded(tree, parent, name);
|
||||
|
||||
@@ -287,7 +287,7 @@ void DlgInspectMaterial::addModelDetails(QTreeView* tree,
|
||||
}
|
||||
else {
|
||||
for (const QString& inherited : inheritedUuids) {
|
||||
auto inheritedModel = modelManager.getModel(inherited);
|
||||
auto inheritedModel = Materials::ModelManager::getManager().getModel(inherited);
|
||||
|
||||
auto name = clipItem(tr("Name: ") + inheritedModel->getName());
|
||||
addExpanded(tree, inherits, name);
|
||||
@@ -340,10 +340,10 @@ void DlgInspectMaterial::addMaterialDetails(QTreeView* tree,
|
||||
{
|
||||
auto uuid = clipItem(tr("UUID: ") + material.getUUID());
|
||||
addExpanded(tree, parent, uuid);
|
||||
auto library = clipItem(tr("Library: ") + material.getLibrary()->getName());
|
||||
auto library =
|
||||
clipItem(tr("Library: ") + material.getLibrary()->getName());
|
||||
addExpanded(tree, parent, library);
|
||||
auto libraryPath =
|
||||
clipItem(tr("Library Directory: ") + material.getLibrary()->getDirectoryPath());
|
||||
auto libraryPath = clipItem(tr("Library Directory: ") + material.getLibrary()->getDirectoryPath());
|
||||
addExpanded(tree, parent, libraryPath);
|
||||
auto directory = clipItem(tr("Sub Directory: ") + material.getDirectory());
|
||||
addExpanded(tree, parent, directory);
|
||||
@@ -353,7 +353,7 @@ void DlgInspectMaterial::addMaterialDetails(QTreeView* tree,
|
||||
indent();
|
||||
auto parentUUID = material.getParentUUID();
|
||||
if (!parentUUID.isEmpty()) {
|
||||
auto parentMaterial = materialManager.getMaterial(material.getParentUUID());
|
||||
auto parentMaterial = Materials::MaterialManager::getManager().getMaterial(material.getParentUUID());
|
||||
addMaterial(tree, inherits, *parentMaterial);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user