Be more descriptive about Maya uv scale/translation property, and better guess for 3d vector case

This commit is contained in:
sabrina-shanman 2019-01-15 11:09:16 -08:00
parent c875492d50
commit f02d6433e3

View file

@ -1066,34 +1066,42 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr
material.useOcclusionMap = (bool)property.properties.at(index).value<double>(); material.useOcclusionMap = (bool)property.properties.at(index).value<double>();
} else if (property.properties.at(0) == MAYA_UV_SCALE) { } else if (property.properties.at(0) == MAYA_UV_SCALE) {
if (property.properties.size() == 6) { static const int MAYA_UV_SCALE_PROPERTY_LENGTH_2D = 6;
glm::vec3 scale; static const int MAYA_UV_SCALE_PROPERTY_LENGTH_3D = 7;
if (property.properties.at(2).value<QString>() == "Vector2") { glm::vec3 scale;
scale = glm::vec3(property.properties.at(4).value<double>(), property.properties.at(5).value<double>(), 1.0); if (property.properties.size() == MAYA_UV_SCALE_PROPERTY_LENGTH_2D) { // Vector2D
} else { // Vector (3d) // properties: { "Maya|uv_scale", "Vector2D", "Vector2", nothing, double, double }
scale = glm::vec3(property.properties.at(3).value<double>(), property.properties.at(4).value<double>(), property.properties.at(5).value<double>()); scale = glm::vec3(property.properties.at(4).value<double>(), property.properties.at(5).value<double>(), 1.0);
} } else if (property.properties.size() == MAYA_UV_SCALE_PROPERTY_LENGTH_3D) { // Vector (3d)
if (scale.x == 0.0f) { // properties: { "Maya|uv_scale", "Vector3D", "Vector", nothing, double, double, double }
scale.x = 1.0f; // (in principle, given how Vector3D is used for other Maya properties in the same area)
} scale = glm::vec3(property.properties.at(4).value<double>(), property.properties.at(5).value<double>(), property.properties.at(6).value<double>());
if (scale.y == 0.0f) { } else {
scale.y = 1.0f; scale = glm::vec3(1.0, 1.0, 1.0);
}
if (scale.z == 0.0f) {
scale.z = 1.0f;
}
materialParam.scaling *= scale;
} }
if (scale.x == 0.0f) {
scale.x = 1.0f;
}
if (scale.y == 0.0f) {
scale.y = 1.0f;
}
if (scale.z == 0.0f) {
scale.z = 1.0f;
}
materialParam.scaling *= scale;
} else if (property.properties.at(0) == MAYA_UV_OFFSET) { } else if (property.properties.at(0) == MAYA_UV_OFFSET) {
if (property.properties.size() == 6) { static const int MAYA_UV_OFFSET_PROPERTY_LENGTH_2D = 6;
glm::vec3 translation; static const int MAYA_UV_OFFSET_PROPERTY_LENGTH_3D = 7;
if (property.properties.at(2).value<QString>() == "Vector2") { glm::vec3 translation;
translation = glm::vec3(property.properties.at(4).value<double>(), property.properties.at(5).value<double>(), 1.0); if (property.properties.size() == MAYA_UV_OFFSET_PROPERTY_LENGTH_2D) { // Vector2
} else { // Vector (3d) // properties: { "Maya|uv_offset", "Vector2D", "Vector2", nothing, double, double }
translation = glm::vec3(property.properties.at(3).value<double>(), property.properties.at(4).value<double>(), property.properties.at(5).value<double>()); translation = glm::vec3(property.properties.at(4).value<double>(), property.properties.at(5).value<double>(), 1.0);
} } else if (property.properties.size() == MAYA_UV_OFFSET_PROPERTY_LENGTH_3D) { // Vector (3d)
materialParam.translation += translation; // properties: { "Maya|uv_offset", "Vector3D", "Vector", nothing, double, double, double }
// (in principle, given how Vector3D is used for other Maya properties in the same area)
translation = glm::vec3(property.properties.at(4).value<double>(), property.properties.at(5).value<double>(), property.properties.at(6).value<double>());
} }
materialParam.translation += translation;
} else { } else {
const QString propname = property.properties.at(0).toString(); const QString propname = property.properties.at(0).toString();
unknowns.push_back(propname.toStdString()); unknowns.push_back(propname.toStdString());