fix: limit precision also for animation matrixes if the limit option is set (gives nicer output for inspection)

This commit is contained in:
2018-02-16 16:53:16 +01:00
parent 7fdf720fb1
commit e1a686e444
3 changed files with 11 additions and 0 deletions

View File

@@ -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++;

View File

@@ -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

View File

@@ -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);