mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 11:08:06 +02:00
handle weird material name case
This commit is contained in:
parent
cf7230f023
commit
2b376f7881
2 changed files with 15 additions and 3 deletions
|
@ -326,6 +326,7 @@ void ModelBaker::outputBakedFST() {
|
|||
auto outputMapping = _mapping;
|
||||
outputMapping[FST_VERSION_FIELD] = FST_VERSION;
|
||||
outputMapping[FILENAME_FIELD] = _bakedModelURL.fileName();
|
||||
outputMapping.remove(TEXDIR_FIELD);
|
||||
hifi::ByteArray fstOut = FSTReader::writeMapping(outputMapping);
|
||||
|
||||
QFile fstOutputFile { outputFSTURL };
|
||||
|
|
|
@ -97,7 +97,7 @@ QString processID(const QString& id) {
|
|||
return id.mid(id.lastIndexOf(':') + 1);
|
||||
}
|
||||
|
||||
QString getName(const QVariantList& properties) {
|
||||
QString getModelName(const QVariantList& properties) {
|
||||
QString name;
|
||||
if (properties.size() == 3) {
|
||||
name = properties.at(1).toString();
|
||||
|
@ -108,6 +108,17 @@ QString getName(const QVariantList& properties) {
|
|||
return name;
|
||||
}
|
||||
|
||||
QString getMaterialName(const QVariantList& properties) {
|
||||
QString name;
|
||||
if (properties.size() == 1 || properties.at(1).toString().isEmpty()) {
|
||||
name = properties.at(0).toString();
|
||||
name = processID(name.left(name.indexOf(QChar('\0'))));
|
||||
} else {
|
||||
name = processID(properties.at(1).toString());
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
QString getID(const QVariantList& properties, int index = 0) {
|
||||
return processID(properties.at(index).toString());
|
||||
}
|
||||
|
@ -507,7 +518,7 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
|||
blendshapes.append(extracted);
|
||||
}
|
||||
} else if (object.name == "Model") {
|
||||
QString name = getName(object.properties);
|
||||
QString name = getModelName(object.properties);
|
||||
QString id = getID(object.properties);
|
||||
modelIDsToNames.insert(id, name);
|
||||
|
||||
|
@ -826,7 +837,7 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
|||
} else if (object.name == "Material") {
|
||||
HFMMaterial material;
|
||||
MaterialParam materialParam;
|
||||
material.name = (object.properties.at(1).toString());
|
||||
material.name = getMaterialName(object.properties);
|
||||
foreach (const FBXNode& subobject, object.children) {
|
||||
bool properties = false;
|
||||
|
||||
|
|
Loading…
Reference in a new issue