mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 19:55:07 +02:00
Read the unit scale factor and include it in the offset scale.
This commit is contained in:
parent
1940fe67a0
commit
c979ace924
2 changed files with 14 additions and 2 deletions
|
@ -157,7 +157,7 @@ bool ModelUploader::zip() {
|
|||
|
||||
// mixamo/autodesk defaults
|
||||
if (!mapping.contains(SCALE_FIELD)) {
|
||||
mapping.insert(SCALE_FIELD, geometry.author == "www.makehuman.org" ? 150.0 : 15.0);
|
||||
mapping.insert(SCALE_FIELD, 15.0);
|
||||
}
|
||||
QVariantHash joints = mapping.value(JOINT_FIELD).toHash();
|
||||
if (!joints.contains("jointEyeLeft")) {
|
||||
|
|
|
@ -1073,6 +1073,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
QMultiHash<QString, WeightedIndex> blendshapeChannelIndices;
|
||||
|
||||
FBXGeometry geometry;
|
||||
float unitScaleFactor = 1.0f;
|
||||
foreach (const FBXNode& child, node.children) {
|
||||
if (child.name == "FBXHeaderExtension") {
|
||||
foreach (const FBXNode& object, child.children) {
|
||||
|
@ -1095,6 +1096,17 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (child.name == "GlobalSettings") {
|
||||
foreach (const FBXNode& object, child.children) {
|
||||
if (object.name == "Properties70") {
|
||||
foreach (const FBXNode& subobject, object.children) {
|
||||
if (subobject.name == "P" && subobject.properties.size() >= 5 &&
|
||||
subobject.properties.at(0) == "UnitScaleFactor") {
|
||||
unitScaleFactor = subobject.properties.at(4).toFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (child.name == "Objects") {
|
||||
foreach (const FBXNode& object, child.children) {
|
||||
if (object.name == "Geometry") {
|
||||
|
@ -1412,7 +1424,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping)
|
|||
}
|
||||
|
||||
// get offset transform from mapping
|
||||
float offsetScale = mapping.value("scale", 1.0f).toFloat();
|
||||
float offsetScale = mapping.value("scale", 1.0f).toFloat() * unitScaleFactor;
|
||||
glm::quat offsetRotation = glm::quat(glm::radians(glm::vec3(mapping.value("rx").toFloat(),
|
||||
mapping.value("ry").toFloat(), mapping.value("rz").toFloat())));
|
||||
geometry.offset = glm::translate(glm::vec3(mapping.value("tx").toFloat(), mapping.value("ty").toFloat(),
|
||||
|
|
Loading…
Reference in a new issue