Materials: Add import for unimplemented fields
Adds import/export support for unimplemented material fields. This includes reference source and URLs, and tag fields. Tag support remains unimplemented in the editor, but is supported by a number of materials in the FCMat files. They can be accessed in both C++ and Python.
This commit is contained in:
@@ -699,6 +699,19 @@ void Material::removeUUID(QSet<QString>& uuidList, const QString& uuid)
|
||||
uuidList.remove(uuid);
|
||||
}
|
||||
|
||||
void Material::addTag(const QString& tag)
|
||||
{
|
||||
auto trimmed = tag.trimmed();
|
||||
if (!trimmed.isEmpty()) {
|
||||
_tags.insert(trimmed);
|
||||
}
|
||||
}
|
||||
|
||||
void Material::removeTag(const QString& tag)
|
||||
{
|
||||
_tags.remove(tag);
|
||||
}
|
||||
|
||||
void Material::addPhysical(const QString& uuid)
|
||||
{
|
||||
if (hasPhysicalModel(uuid)) {
|
||||
@@ -1327,6 +1340,12 @@ void Material::saveGeneral(QTextStream& stream) const
|
||||
if (!_reference.isEmpty()) {
|
||||
stream << " ReferenceSource: \"" << MaterialValue::escapeString(_reference) << "\"\n";
|
||||
}
|
||||
if (!_tags.isEmpty()) {
|
||||
stream << " Tags:\n";
|
||||
for (auto tag : _tags) {
|
||||
stream << " - \"" << tag << "\"\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Material::saveInherits(QTextStream& stream) const
|
||||
|
||||
Reference in New Issue
Block a user