diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-07 21:43:21 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-07 21:44:27 +0400 |
commit | 833029ba02f81fecb3fa34ee89879a69e6c458e5 (patch) | |
tree | 0e664aeca573865bed8c0418e4edde647bf7fe49 /source | |
parent | 708b8d871642d2e624bd5f43bec89e57d7151059 (diff) |
Fix own rB8714ae09f894: Forgot to handle bone constraints in versionning code!
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 8f95d78ce1c..82458e17001 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -56,6 +56,29 @@ #include "readfile.h" +static void do_version_constraints_radians_degrees_270_1(ListBase *lb) +{ + bConstraint *con; + + for (con = lb->first; con; con = con->next) { + if (con->type == CONSTRAINT_TYPE_TRANSFORM) { + bTransformConstraint *data = (bTransformConstraint *)con->data; + const float deg_to_rad_f = DEG2RADF(1.0f); + + if (data->from == TRANS_ROTATION) { + mul_v3_fl(data->from_min, deg_to_rad_f); + mul_v3_fl(data->from_max, deg_to_rad_f); + } + + if (data->to == TRANS_ROTATION) { + mul_v3_fl(data->to_min, deg_to_rad_f); + mul_v3_fl(data->to_max, deg_to_rad_f); + } + } + } +} + + void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) { if (!MAIN_VERSION_ATLEAST(main, 270, 0)) { @@ -119,21 +142,13 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) /* Update Transform constraint (another deg -> rad stuff). */ for (ob = main->object.first; ob; ob = ob->id.next) { - bConstraint *con; - for (con = ob->constraints.first; con; con = con->next) { - if (con->type == CONSTRAINT_TYPE_TRANSFORM) { - bTransformConstraint *data = (bTransformConstraint *)con->data; - const float deg_to_rad_f = DEG2RADF(1.0f); - - if (data->from == TRANS_ROTATION) { - mul_v3_fl(data->from_min, deg_to_rad_f); - mul_v3_fl(data->from_max, deg_to_rad_f); - } + do_version_constraints_radians_degrees_270_1(&ob->constraints); - if (data->to == TRANS_ROTATION) { - mul_v3_fl(data->to_min, deg_to_rad_f); - mul_v3_fl(data->to_max, deg_to_rad_f); - } + if (ob->pose) { + /* Bones constraints! */ + bPoseChannel *pchan; + for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { + do_version_constraints_radians_degrees_270_1(&pchan->constraints); } } } |