Fix T39563: Tiny unit-display problem in constraint panels.
[blender.git] / source / blender / blenloader / intern / versioning_270.c
index 8fadfa69facec159d9222a54df6b9841e0254119..8f95d78ce1c4448d27e62d6da96c244a304db904 100644 (file)
@@ -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);
+                                       }
+                               }
+                       }
+               }
+       }
 }