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
path: root/source
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2018-02-16 18:53:16 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2018-02-16 18:55:20 +0300
commite1a686e44448e8345d45041631fda84d4ee0d2fa (patch)
tree21620c55a009266b71cd8c104d5ff26d3c714b05 /source
parent7fdf720fb164e448703c7d9f6103a3b59178189d (diff)
fix: limit precision also for animation matrixes if the limit option is set (gives nicer output for inspection)
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/AnimationExporter.cpp3
-rw-r--r--source/blender/collada/collada_utils.cpp7
-rw-r--r--source/blender/collada/collada_utils.h1
3 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index d4f434d56fd..bd5cb05a1fa 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -988,6 +988,9 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames, Obj
double outmat[4][4];
converter.mat4_to_dae_double(outmat, mat);
+ if (this->export_settings->limit_precision)
+ bc_sanitize_mat(outmat, 6);
+
source.appendValues(outmat);
j++;
diff --git a/source/blender/collada/collada_utils.cpp b/source/blender/collada/collada_utils.cpp
index c13757fa2a4..35bc643d3c7 100644
--- a/source/blender/collada/collada_utils.cpp
+++ b/source/blender/collada/collada_utils.cpp
@@ -864,6 +864,13 @@ void bc_sanitize_mat(float mat[4][4], int precision)
mat[i][j] = double_round(mat[i][j], precision);
}
+void bc_sanitize_mat(double mat[4][4], int precision)
+{
+ for (int i = 0; i < 4; i++)
+ for (int j = 0; j < 4; j++)
+ mat[i][j] = double_round(mat[i][j], precision);
+}
+
/*
* Returns name of Active UV Layer or empty String if no active UV Layer defined.
* Assuming the Object is of type MESH
diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h
index ad274777e8d..e9066d7db46 100644
--- a/source/blender/collada/collada_utils.h
+++ b/source/blender/collada/collada_utils.h
@@ -100,6 +100,7 @@ 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 void bc_sanitize_mat(float mat[4][4], int precision);
+extern void bc_sanitize_mat(double 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);