Material: Material editor enhancements

Continues the work of the material subsystem improvements.

This merge covers the continued development of the material editor. The
primary improvements are the addition of new data types, a new
appearance preview UI, and changes in the array data types.

New data types were added to support more advanced workflows, such as
the Render Workbench.The Image datatype allows the material to embed
the image in the card instead of pointing to an image in an external
file. Multi-buyte strings span multiple lines as the name implies.
It preserves formatting accross those lines. Also several list types
are now supported, with the primary difference being the editors.
List is a list of strings, FileList is a list of file path names, and
ImageList is a list of embedded images.

For the appearance preview, the UI now uses the same Coin library as
is used in the documents, meaning the preview will look exactly the
same as the material will be shown in the documents.

The array data types are now more complete. The default value wasn't
being used as originially envisioned and was tehrefore removed. For
3D arrays, the Python API was implemented.

There were a lot of code clean ups. This involved removing logging
statements used for debugging during development, reduction of lint
warnings, and code refactoring.

The editor can automatically convert from previous format files to the
current format. This has been extended to material files generated by
the Render WB. Old format files are displayed in the editor with a
warning icon. Selecting one will require saving the file in the new
format before it can be used.
This commit is contained in:
David Carter
2023-12-03 13:22:43 -05:00
committed by Chris Hennes
parent 703561f7bc
commit 3dd6a67804
72 changed files with 4248 additions and 1334 deletions

View File

@@ -43,9 +43,6 @@ LibraryBase::LibraryBase(const QString& libraryName, const QString& dir, const Q
, _iconPath(icon)
{}
LibraryBase::LibraryBase()
{}
bool LibraryBase::operator==(const LibraryBase& library) const
{
return (_name == library._name) && (_directory == library._directory);
@@ -146,39 +143,36 @@ ModelLibrary::getModelTree(ModelFilter filter) const
std::shared_ptr<std::map<QString, std::shared_ptr<ModelTreeNode>>> modelTree =
std::make_shared<std::map<QString, std::shared_ptr<ModelTreeNode>>>();
for (auto it = _modelPathMap->begin(); it != _modelPathMap->end(); it++) {
auto filename = it->first;
auto model = it->second;
for (auto& it : *_modelPathMap) {
auto filename = it.first;
auto model = it.second;
if (ModelManager::passFilter(filter, model->getType())) {
// Base::Console().Log("Relative path '%s'\n\t", filename.toStdString().c_str());
QStringList list = filename.split(QString::fromStdString("/"));
// Start at the root
std::shared_ptr<std::map<QString, std::shared_ptr<ModelTreeNode>>> node = modelTree;
for (auto itp = list.begin(); itp != list.end(); itp++) {
// Base::Console().Log("\t%s", itp->toStdString().c_str());
if (ModelManager::isModel(*itp)) {
for (auto& itp : list) {
if (ModelManager::isModel(itp)) {
std::shared_ptr<ModelTreeNode> child = std::make_shared<ModelTreeNode>();
child->setData(model);
(*node)[*itp] = child;
(*node)[itp] = child;
}
else {
// Add the folder only if it's not already there
if (node->count(*itp) == 0) {
if (node->count(itp) == 0) {
auto mapPtr =
std::make_shared<std::map<QString, std::shared_ptr<ModelTreeNode>>>();
std::shared_ptr<ModelTreeNode> child = std::make_shared<ModelTreeNode>();
child->setFolder(mapPtr);
(*node)[*itp] = child;
(*node)[itp] = child;
node = mapPtr;
}
else {
node = (*node)[*itp]->getFolder();
node = (*node)[itp]->getFolder();
}
}
}
// Base::Console().Log("\n");
}
}