diff --git a/libraries/fbx/src/FBXSerializer.cpp b/libraries/fbx/src/FBXSerializer.cpp index cfa1420224..a25ef2acf5 100644 --- a/libraries/fbx/src/FBXSerializer.cpp +++ b/libraries/fbx/src/FBXSerializer.cpp @@ -977,6 +977,8 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr static const QVariant MAYA_USE_AO_MAP = QByteArray("Maya|use_ao_map"); static const QVariant MAYA_UV_SCALE = QByteArray("Maya|uv_scale"); static const QVariant MAYA_UV_OFFSET = QByteArray("Maya|uv_offset"); + static const int MAYA_UV_OFFSET_PROPERTY_LENGTH = 6; + static const int MAYA_UV_SCALE_PROPERTY_LENGTH = 6; @@ -1066,42 +1068,26 @@ HFMModel* FBXSerializer::extractHFMModel(const QVariantHash& mapping, const QStr material.useOcclusionMap = (bool)property.properties.at(index).value(); } else if (property.properties.at(0) == MAYA_UV_SCALE) { - static const int MAYA_UV_SCALE_PROPERTY_LENGTH_2D = 6; - static const int MAYA_UV_SCALE_PROPERTY_LENGTH_3D = 7; - glm::vec3 scale; - if (property.properties.size() == MAYA_UV_SCALE_PROPERTY_LENGTH_2D) { // Vector2D + if (property.properties.size() == MAYA_UV_SCALE_PROPERTY_LENGTH) { // properties: { "Maya|uv_scale", "Vector2D", "Vector2", nothing, double, double } - scale = glm::vec3(property.properties.at(4).value(), property.properties.at(5).value(), 1.0); - } else if (property.properties.size() == MAYA_UV_SCALE_PROPERTY_LENGTH_3D) { // Vector (3d) - // properties: { "Maya|uv_scale", "Vector3D", "Vector", nothing, double, double, double } - // (in principle, given how Vector3D is used for other Maya properties in the same area) - scale = glm::vec3(property.properties.at(4).value(), property.properties.at(5).value(), property.properties.at(6).value()); - } else { - scale = glm::vec3(1.0, 1.0, 1.0); + glm::vec3 scale = glm::vec3(property.properties.at(4).value(), property.properties.at(5).value(), 1.0); + 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; } - 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) { - static const int MAYA_UV_OFFSET_PROPERTY_LENGTH_2D = 6; - static const int MAYA_UV_OFFSET_PROPERTY_LENGTH_3D = 7; - glm::vec3 translation; - if (property.properties.size() == MAYA_UV_OFFSET_PROPERTY_LENGTH_2D) { // Vector2 + if (property.properties.size() == MAYA_UV_OFFSET_PROPERTY_LENGTH) { // properties: { "Maya|uv_offset", "Vector2D", "Vector2", nothing, double, double } - translation = glm::vec3(property.properties.at(4).value(), property.properties.at(5).value(), 1.0); - } else if (property.properties.size() == MAYA_UV_OFFSET_PROPERTY_LENGTH_3D) { // Vector (3d) - // 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(), property.properties.at(5).value(), property.properties.at(6).value()); + glm::vec3 translation = glm::vec3(property.properties.at(4).value(), property.properties.at(5).value(), 1.0); + materialParam.translation += translation; } - materialParam.translation += translation; } else { const QString propname = property.properties.at(0).toString(); unknowns.push_back(propname.toStdString());