Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2017-04-01 16:29:40 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2017-04-01 16:29:50 +0300
commit3bf0026bec6f839ae0f7c40bde845299ce22e8de (patch)
tree8d9280c31eb03e8f4e74a0d19ebbd2074cf42fe4 /source/blender/collada
parente1fb0807437644b2e20d3edac8d4aef92e0f5877 (diff)
fix: T50412 - collada: Replaced precision local limit function by blender's own implementation
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/collada_utils.cpp22
-rw-r--r--source/blender/collada/collada_utils.h3
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);