mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:48:38 +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;
|
auto outputMapping = _mapping;
|
||||||
outputMapping[FST_VERSION_FIELD] = FST_VERSION;
|
outputMapping[FST_VERSION_FIELD] = FST_VERSION;
|
||||||
outputMapping[FILENAME_FIELD] = _bakedModelURL.fileName();
|
outputMapping[FILENAME_FIELD] = _bakedModelURL.fileName();
|
||||||
|
outputMapping.remove(TEXDIR_FIELD);
|
||||||
hifi::ByteArray fstOut = FSTReader::writeMapping(outputMapping);
|
hifi::ByteArray fstOut = FSTReader::writeMapping(outputMapping);
|
||||||
|
|
||||||
QFile fstOutputFile { outputFSTURL };
|
QFile fstOutputFile { outputFSTURL };
|
||||||
|
|
|
@ -97,7 +97,7 @@ QString processID(const QString& id) {
|
||||||
return id.mid(id.lastIndexOf(':') + 1);
|
return id.mid(id.lastIndexOf(':') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getName(const QVariantList& properties) {
|
QString getModelName(const QVariantList& properties) {
|
||||||
QString name;
|
QString name;
|
||||||
if (properties.size() == 3) {
|
if (properties.size() == 3) {
|
||||||
name = properties.at(1).toString();
|
name = properties.at(1).toString();
|
||||||
|
@ -108,6 +108,17 @@ QString getName(const QVariantList& properties) {
|
||||||
return name;
|
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) {
|
QString getID(const QVariantList& properties, int index = 0) {
|
||||||
return processID(properties.at(index).toString());
|
return processID(properties.at(index).toString());
|
||||||
}
|
}
|
||||||
|
@ -507,7 +518,7 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
blendshapes.append(extracted);
|
blendshapes.append(extracted);
|
||||||
}
|
}
|
||||||
} else if (object.name == "Model") {
|
} else if (object.name == "Model") {
|
||||||
QString name = getName(object.properties);
|
QString name = getModelName(object.properties);
|
||||||
QString id = getID(object.properties);
|
QString id = getID(object.properties);
|
||||||
modelIDsToNames.insert(id, name);
|
modelIDsToNames.insert(id, name);
|
||||||
|
|
||||||
|
@ -826,7 +837,7 @@ HFMModel* FBXSerializer::extractHFMModel(const hifi::VariantHash& mapping, const
|
||||||
} else if (object.name == "Material") {
|
} else if (object.name == "Material") {
|
||||||
HFMMaterial material;
|
HFMMaterial material;
|
||||||
MaterialParam materialParam;
|
MaterialParam materialParam;
|
||||||
material.name = (object.properties.at(1).toString());
|
material.name = getMaterialName(object.properties);
|
||||||
foreach (const FBXNode& subobject, object.children) {
|
foreach (const FBXNode& subobject, object.children) {
|
||||||
bool properties = false;
|
bool properties = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue