mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
Merge pull request #4387 from ZappoMan/fbxFixes
tweaks to hacks for detecting mixamo files
This commit is contained in:
commit
174e359c50
3 changed files with 17 additions and 2 deletions
|
@ -311,8 +311,18 @@ void ModelUploader::populateBasicMapping(QVariantHash& mapping, QString filename
|
||||||
mapping.insertMulti(FREE_JOINT_FIELD, "RightForeArm");
|
mapping.insertMulti(FREE_JOINT_FIELD, "RightForeArm");
|
||||||
}
|
}
|
||||||
|
|
||||||
// mixamo blendshapes
|
// mixamo blendshapes - in the event that a mixamo file was edited by some other tool, it's likely the applicationName will
|
||||||
if (!mapping.contains(BLENDSHAPE_FIELD) && geometry.applicationName == "mixamo.com") {
|
// be rewritten, so we detect the existence of several different blendshapes which indicate we're likely a mixamo file
|
||||||
|
bool likelyMixamoFile = geometry.applicationName == "mixamo.com" ||
|
||||||
|
(geometry.blendshapeChannelNames.contains("BrowsDown_Left") &&
|
||||||
|
geometry.blendshapeChannelNames.contains("BrowsDown_Right") &&
|
||||||
|
geometry.blendshapeChannelNames.contains("MouthOpen") &&
|
||||||
|
geometry.blendshapeChannelNames.contains("TongueUp") &&
|
||||||
|
geometry.blendshapeChannelNames.contains("MouthWhistle_NarrowAdjust_Left") &&
|
||||||
|
geometry.blendshapeChannelNames.contains("NoseScrunch_Left") &&
|
||||||
|
geometry.blendshapeChannelNames.contains("Squint_Right"));
|
||||||
|
|
||||||
|
if (!mapping.contains(BLENDSHAPE_FIELD) && likelyMixamoFile) {
|
||||||
QVariantHash blendshapes;
|
QVariantHash blendshapes;
|
||||||
blendshapes.insertMulti("BrowsD_L", QVariantList() << "BrowsDown_Left" << 1.0);
|
blendshapes.insertMulti("BrowsD_L", QVariantList() << "BrowsDown_Left" << 1.0);
|
||||||
blendshapes.insertMulti("BrowsD_R", QVariantList() << "BrowsDown_Right" << 1.0);
|
blendshapes.insertMulti("BrowsD_R", QVariantList() << "BrowsDown_Right" << 1.0);
|
||||||
|
|
|
@ -1266,6 +1266,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
||||||
QVector<QString> humanIKJointIDs(humanIKJointNames.size());
|
QVector<QString> humanIKJointIDs(humanIKJointNames.size());
|
||||||
|
|
||||||
QVariantHash blendshapeMappings = mapping.value("bs").toHash();
|
QVariantHash blendshapeMappings = mapping.value("bs").toHash();
|
||||||
|
|
||||||
QMultiHash<QByteArray, WeightedIndex> blendshapeIndices;
|
QMultiHash<QByteArray, WeightedIndex> blendshapeIndices;
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
QByteArray blendshapeName = FACESHIFT_BLENDSHAPES[i];
|
QByteArray blendshapeName = FACESHIFT_BLENDSHAPES[i];
|
||||||
|
@ -1720,12 +1721,14 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping,
|
||||||
|
|
||||||
} else if (object.properties.last() == "BlendShapeChannel") {
|
} else if (object.properties.last() == "BlendShapeChannel") {
|
||||||
QByteArray name = object.properties.at(1).toByteArray();
|
QByteArray name = object.properties.at(1).toByteArray();
|
||||||
|
|
||||||
name = name.left(name.indexOf('\0'));
|
name = name.left(name.indexOf('\0'));
|
||||||
if (!blendshapeIndices.contains(name)) {
|
if (!blendshapeIndices.contains(name)) {
|
||||||
// try everything after the dot
|
// try everything after the dot
|
||||||
name = name.mid(name.lastIndexOf('.') + 1);
|
name = name.mid(name.lastIndexOf('.') + 1);
|
||||||
}
|
}
|
||||||
QString id = getID(object.properties);
|
QString id = getID(object.properties);
|
||||||
|
geometry.blendshapeChannelNames << name;
|
||||||
foreach (const WeightedIndex& index, blendshapeIndices.values(name)) {
|
foreach (const WeightedIndex& index, blendshapeIndices.values(name)) {
|
||||||
blendshapeChannelIndices.insert(id, index);
|
blendshapeChannelIndices.insert(id, index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,6 +257,8 @@ public:
|
||||||
|
|
||||||
/// given a meshIndex this will return the name of the model that mesh belongs to if known
|
/// given a meshIndex this will return the name of the model that mesh belongs to if known
|
||||||
QString getModelNameOfMesh(int meshIndex) const;
|
QString getModelNameOfMesh(int meshIndex) const;
|
||||||
|
|
||||||
|
QList<QString> blendshapeChannelNames;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(FBXGeometry)
|
Q_DECLARE_METATYPE(FBXGeometry)
|
||||||
|
|
Loading…
Reference in a new issue