diff options
author | Gaia Clary <gaia.clary@machinimatrix.org> | 2017-04-01 16:29:40 +0300 |
---|---|---|
committer | Gaia Clary <gaia.clary@machinimatrix.org> | 2017-04-01 16:29:50 +0300 |
commit | 3bf0026bec6f839ae0f7c40bde845299ce22e8de (patch) | |
tree | 8d9280c31eb03e8f4e74a0d19ebbd2074cf42fe4 /source/blender | |
parent | e1fb0807437644b2e20d3edac8d4aef92e0f5877 (diff) |
fix: T50412 - collada: Replaced precision local limit function by blender's own implementation
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/collada/collada_utils.cpp | 22 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.h | 3 |
2 files changed, 6 insertions, 19 deletions
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp index 407f0799014..ac4395e1430 100644 --- a/source/blender/collada/collada_utils.cpp +++ b/source/blender/collada/collada_utils.cpp @@ -32,9 +32,6 @@ #include "COLLADAFWMeshPrimitive.h" #include "COLLADAFWMeshVertexData.h" -#include "collada_utils.h" -#include "ExportSettings.h" - extern "C" { #include "DNA_modifier_types.h" #include "DNA_customdata_types.h" @@ -64,6 +61,9 @@ extern "C" { #include "bmesh_tools.h" } +#include "collada_utils.h" +#include "ExportSettings.h" + float bc_get_float_value(const COLLADAFW::FloatOrDoubleArray& array, unsigned int index) { if (index >= array.getValuesCount()) @@ -824,23 +824,11 @@ void bc_create_restpose_mat(const ExportSettings *export_settings, Bone *bone, f } /* - To get rid of those lengthy float values which make the numbers unreadable. -*/ -float bc_sanitize_float(float value, float precision) -{ - float result = floor((value * pow(10, precision) + 0.5)) / pow(10, precision); - if (abs(result) < 1 / pow(10, precision)) { - result = 0; - } - return result; -} - -/* Make 4*4 matrices better readable */ -void bc_sanitize_mat(float mat[4][4], float precision) +void bc_sanitize_mat(float mat[4][4], int precision) { for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) - mat[i][j] = bc_sanitize_float(mat[i][j], precision); + mat[i][j] = double_round(mat[i][j], precision); }
\ No newline at end of file diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index b98f8bfb188..38c0bd5096a 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -97,8 +97,7 @@ extern bool bc_is_leaf_bone(Bone *bone); extern EditBone *bc_get_edit_bone(bArmature * armature, char *name); extern int bc_set_layer(int bitfield, int layer, bool enable); extern int bc_set_layer(int bitfield, int layer); -extern float bc_sanitize_float(float value, float precision); -extern void bc_sanitize_mat(float mat[4][4], float precision); +extern void bc_sanitize_mat(float mat[4][4], int precision); extern IDProperty *bc_get_IDProperty(Bone *bone, std::string key); extern void bc_set_IDProperty(EditBone *ebone, const char *key, float value); |