Cleanup: correct argument type mismatch
authorCampbell Barton <ideasman42@gmail.com>
Mon, 28 Oct 2019 13:45:05 +0000 (00:45 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 28 Oct 2019 13:45:05 +0000 (00:45 +1100)
Add transform_snap.h header which includes DNA enum.

source/blender/editors/include/ED_transform.h
source/blender/editors/transform/CMakeLists.txt
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_constraints.c
source/blender/editors/transform/transform_convert_mesh.c
source/blender/editors/transform/transform_convert_node.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_gizmo_3d.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/transform/transform_snap.h [new file with mode: 0644]

index 446dbccb4c5257e1bc6af1380abb57b9e2bec4c7..0771f39f905eec244ce08f6e9d6ac3903d803966 100644 (file)
@@ -173,46 +173,8 @@ void ED_widgetgroup_gizmo2d_setup(const struct bContext *C, struct wmGizmoGroup
 void ED_widgetgroup_gizmo2d_refresh(const struct bContext *C, struct wmGizmoGroup *gzgroup);
 void ED_widgetgroup_gizmo2d_draw_prepare(const struct bContext *C, struct wmGizmoGroup *gzgroup);
 
-/* Snapping */
-
-#define SNAP_MIN_DISTANCE 30
 #define SNAP_INCREMENTAL_ANGLE DEG2RAD(5.0)
 
-bool peelObjectsTransform(struct TransInfo *t,
-                          const float mval[2],
-                          const bool use_peel_object,
-                          /* return args */
-                          float r_loc[3],
-                          float r_no[3],
-                          float *r_thickness);
-bool peelObjectsSnapContext(struct SnapObjectContext *sctx,
-                            const float mval[2],
-                            const struct SnapObjectParams *params,
-                            const bool use_peel_object,
-                            /* return args */
-                            float r_loc[3],
-                            float r_no[3],
-                            float *r_thickness);
-
-short snapObjectsTransform(struct TransInfo *t,
-                           const float mval[2],
-                           float *dist_px,
-                           /* return args */
-                           float r_loc[3],
-                           float r_no[3]);
-bool snapNodesTransform(struct TransInfo *t,
-                        const int mval[2],
-                        /* return args */
-                        float r_loc[2],
-                        float *r_dist_px,
-                        char *r_node_border);
-void snapFrameTransform(struct TransInfo *t,
-                        const short autosnap,
-                        const bool is_frame_value,
-                        const float delta,
-                        /* return args */
-                        float *r_val);
-
 void ED_transform_calc_orientation_from_type(const struct bContext *C, float r_mat[3][3]);
 void ED_transform_calc_orientation_from_type_ex(const struct bContext *C,
                                                 float r_mat[3][3],
index e3ff8b92081be707d447129ae09d712ebc3fa94c..5853574dcedaba9f298914a703076f4c459dc9f1 100644 (file)
@@ -71,6 +71,7 @@ set(SRC
 
   transform.h
   transform_convert.h
+  transform_snap.h
 )
 
 set(LIB
index 07193bfb1e42531d38839c53b21afc15ad6f8ab4..9f53c38c40333f021a6cb24e3bdf0d124afdc486 100644 (file)
@@ -95,6 +95,7 @@
 
 #include "transform.h"
 #include "transform_convert.h"
+#include "transform_snap.h"
 
 /* Disabling, since when you type you know what you are doing,
  * and being able to set it to zero is handy. */
@@ -8959,9 +8960,7 @@ static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR])
     outputNumInput(&(t->num), tvec, &t->scene->unit);
   }
   else {
-    const Scene *scene = t->scene;
     const short autosnap = getAnimEdit_SnapMode(t);
-    const double secf = FPS;
     float val = t->values_final[0];
 
     float snap_val;
index ff2afbc0cd76e856e05e8b5956b91adbe87ef658..c437714956aab6245da55d0f9028db09bead0cfe 100644 (file)
@@ -935,40 +935,6 @@ void postSelectConstraint(TransInfo *t);
 
 void setNearestAxis(TransInfo *t);
 
-/*********************** Snapping ********************************/
-
-typedef enum {
-  NO_GEARS = 0,
-  BIG_GEARS = 1,
-  SMALL_GEARS = 2,
-} GearsType;
-
-bool transformModeUseSnap(const TransInfo *t);
-
-void snapGridIncrement(TransInfo *t, float *val);
-void snapGridIncrementAction(TransInfo *t, float *val, GearsType action);
-
-void snapSequenceBounds(TransInfo *t, const int mval[2]);
-
-bool activeSnap(const TransInfo *t);
-bool validSnap(const TransInfo *t);
-
-void initSnapping(struct TransInfo *t, struct wmOperator *op);
-void freeSnapping(struct TransInfo *t);
-void applyProject(TransInfo *t);
-void applyGridAbsolute(TransInfo *t);
-void applySnapping(TransInfo *t, float *vec);
-void resetSnapping(TransInfo *t);
-eRedrawFlag handleSnapping(TransInfo *t, const struct wmEvent *event);
-void drawSnapping(const struct bContext *C, TransInfo *t);
-bool usingSnappingNormal(const TransInfo *t);
-bool validSnappingNormal(const TransInfo *t);
-
-void getSnapPoint(const TransInfo *t, float vec[3]);
-void addSnapPoint(TransInfo *t);
-eRedrawFlag updateSelectedSnapPoint(TransInfo *t);
-void removeSnapPoint(TransInfo *t);
-
 /********************** Mouse Input ******************************/
 
 typedef enum {
index 6a6d3b78d38abdff29d856279baea920811aa41a..b43e1fec98836a81bc88c42bd66a9623bc879a01 100644 (file)
@@ -53,6 +53,7 @@
 #include "UI_resources.h"
 
 #include "transform.h"
+#include "transform_snap.h"
 
 static void drawObjectConstraint(TransInfo *t);
 
index f192843349165f3c0d78d9620daf89915f4e6a06..b9d69cafd0c508852b8c9a9b822175a7bec35dac 100644 (file)
@@ -52,6 +52,8 @@
 
 #include "transform.h"
 #include "transform_convert.h"
+#include "transform_snap.h"
+
 #include "bmesh.h"
 
 /* Used for both mirror epsilon and TD_MIRROR_EDGE_ */
index 41e3a79e4c9a932e328df0a572a65237ea284a9b..ee4aa053444b879a45abea6e29653f4109fb686c 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "transform.h"
 #include "transform_convert.h"
+#include "transform_snap.h"
 
 /* -------------------------------------------------------------------- */
 /** \name Node Transform Creation
index 2e4f4344481db6e439100f6a33e5f7cd171cfb54..afaca361372b9a7cb671992e0de940c72c652506 100644 (file)
 
 #include "transform.h"
 #include "transform_convert.h"
+#include "transform_snap.h"
 
 /* ************************** Functions *************************** */
 
index a2bdeadeaae49ce65a0e348d4c12b683d57d81ca..237bf50be7cdb4d2576ba89b357754c8eceeadd3 100644 (file)
@@ -84,6 +84,7 @@
 /* local module include */
 #include "transform.h"
 #include "transform_convert.h"
+#include "transform_snap.h"
 
 #include "MEM_guardedalloc.h"
 
index 4f6c26a63911f4e1df4ad4dc5532f28ec4beb94e..a66e76abc58450e052b8d2934fc350ff8b1c92c5 100644 (file)
@@ -71,6 +71,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "transform.h"
+#include "transform_snap.h"
 
 /* this should be passed as an arg for use in snap functions */
 #undef BASACT
@@ -1627,6 +1628,9 @@ void snapFrameTransform(TransInfo *t,
       }
       break;
     }
+    case SACTSNAP_OFF: {
+      break;
+    }
   }
   *r_val = (float)val;
 }
diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h
new file mode 100644 (file)
index 0000000..f9f6a51
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup editors
+ */
+
+#ifndef __TRANSFORM_SNAP_H__
+#define __TRANSFORM_SNAP_H__
+
+#define SNAP_MIN_DISTANCE 30
+
+/* For enum. */
+#include "DNA_space_types.h"
+
+bool peelObjectsTransform(struct TransInfo *t,
+                          const float mval[2],
+                          const bool use_peel_object,
+                          /* return args */
+                          float r_loc[3],
+                          float r_no[3],
+                          float *r_thickness);
+bool peelObjectsSnapContext(struct SnapObjectContext *sctx,
+                            const float mval[2],
+                            const struct SnapObjectParams *params,
+                            const bool use_peel_object,
+                            /* return args */
+                            float r_loc[3],
+                            float r_no[3],
+                            float *r_thickness);
+
+short snapObjectsTransform(struct TransInfo *t,
+                           const float mval[2],
+                           float *dist_px,
+                           /* return args */
+                           float r_loc[3],
+                           float r_no[3]);
+bool snapNodesTransform(struct TransInfo *t,
+                        const int mval[2],
+                        /* return args */
+                        float r_loc[2],
+                        float *r_dist_px,
+                        char *r_node_border);
+void snapFrameTransform(struct TransInfo *t,
+                        const eAnimEdit_AutoSnap autosnap,
+                        const bool is_frame_value,
+                        const float delta,
+                        /* return args */
+                        float *r_val);
+
+typedef enum {
+  NO_GEARS = 0,
+  BIG_GEARS = 1,
+  SMALL_GEARS = 2,
+} GearsType;
+
+bool transformModeUseSnap(const TransInfo *t);
+
+void snapGridIncrement(TransInfo *t, float *val);
+void snapGridIncrementAction(TransInfo *t, float *val, GearsType action);
+
+void snapSequenceBounds(TransInfo *t, const int mval[2]);
+
+bool activeSnap(const TransInfo *t);
+bool validSnap(const TransInfo *t);
+
+void initSnapping(struct TransInfo *t, struct wmOperator *op);
+void freeSnapping(struct TransInfo *t);
+void applyProject(TransInfo *t);
+void applyGridAbsolute(TransInfo *t);
+void applySnapping(TransInfo *t, float *vec);
+void resetSnapping(TransInfo *t);
+eRedrawFlag handleSnapping(TransInfo *t, const struct wmEvent *event);
+void drawSnapping(const struct bContext *C, TransInfo *t);
+bool usingSnappingNormal(const TransInfo *t);
+bool validSnappingNormal(const TransInfo *t);
+
+void getSnapPoint(const TransInfo *t, float vec[3]);
+void addSnapPoint(TransInfo *t);
+eRedrawFlag updateSelectedSnapPoint(TransInfo *t);
+void removeSnapPoint(TransInfo *t);
+
+#endif /* __TRANSFORM_SNAP_H__ */