diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-07 14:10:37 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-04-07 14:17:01 +0400 |
commit | 8714ae09f89426242ecd0c65f3291de1a2b51fc4 (patch) | |
tree | 9bb7eae32b739ff7972670909271e81fa10fa186 /source/blender/blenloader | |
parent | f3db0389c02bf9fec7a195fa5c2767e81337e3b2 (diff) |
Fix T39563: Tiny unit-display problem in constraint panels.
There is no good solution here, since RNA props can only have one type/unit.
Tried to find the less worse one - have different RNA props for same DNA value
(a bit like the angle/length for camera lens).
Also fixed two other issues with Transform conctraint:
* Angle were still in degrees (yes, another backward-compatibility breacking).
* Scale was absolute, unlike loc/rot.
Also cleaned up a bit the code, replaced some magic numbers by proper enums, ...
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_270.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 8fadfa69fac..8f95d78ce1c 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -34,6 +34,7 @@ /* allow readfile to use deprecated functionality */ #define DNA_DEPRECATED_ALLOW +#include "DNA_constraint_types.h" #include "DNA_curve_types.h" #include "DNA_sdna_types.h" #include "DNA_space_types.h" @@ -48,6 +49,8 @@ #include "BKE_main.h" #include "BKE_node.h" +#include "BLI_math.h" + #include "BLO_readfile.h" #include "readfile.h" @@ -110,4 +113,29 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) } } } + + if (!MAIN_VERSION_ATLEAST(main, 270, 1)) { + Object *ob; + + /* 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); + } + + 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); + } + } + } + } + } } |