[Bf-blender-cvs] [e1a686e4444] master: fix: limit precision also for animation matrixes if the limit option is set (gives nicer output for inspection)
Gaia Clary
noreply at git.blender.org
Fri Feb 16 16:58:46 CET 2018
Commit: e1a686e44448e8345d45041631fda84d4ee0d2fa
Author: Gaia Clary
Date: Fri Feb 16 16:53:16 2018 +0100
Branches: master
https://developer.blender.org/rBe1a686e44448e8345d45041631fda84d4ee0d2fa
fix: limit precision also for animation matrixes if the limit option is set (gives nicer output for inspection)
===================================================================
M source/blender/collada/AnimationExporter.cpp
M source/blender/collada/collada_utils.cpp
M source/blender/collada/collada_utils.h
===================================================================
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);
More information about the Bf-blender-cvs
mailing list