[Bf-blender-cvs] [44c3bb729be] master: Cleanup: use a common prefix in static functions

Germano Cavalcante noreply at git.blender.org
Mon Oct 18 18:44:23 CEST 2021


Commit: 44c3bb729be42d6d67eaf8918d7cbcb2ff0b315d
Author: Germano Cavalcante
Date:   Mon Oct 18 13:42:06 2021 -0300
Branches: master
https://developer.blender.org/rB44c3bb729be42d6d67eaf8918d7cbcb2ff0b315d

Cleanup: use a common prefix in static functions

This helps identify where the function came from.

===================================================================

M	source/blender/editors/space_view3d/view3d_cursor_snap.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_cursor_snap.c b/source/blender/editors/space_view3d/view3d_cursor_snap.c
index 712e68501c5..5a7d8113528 100644
--- a/source/blender/editors/space_view3d/view3d_cursor_snap.c
+++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c
@@ -86,9 +86,9 @@ typedef struct SnapCursorDataIntern {
 /**
  * Calculate a 3x3 orientation matrix from the surface under the cursor.
  */
-static void cursor_poject_surface_normal(const float normal[3],
-                                         const float obmat[4][4],
-                                         float r_mat[3][3])
+static void v3d_cursor_poject_surface_normal(const float normal[3],
+                                             const float obmat[4][4],
+                                             float r_mat[3][3])
 {
   float mat[3][3];
   copy_m3_m4(mat, obmat);
@@ -121,7 +121,7 @@ static void cursor_poject_surface_normal(const float normal[3],
  *
  * \note This could be moved to a public function.
  */
-static bool cursor_snap_calc_incremental(
+static bool v3d_cursor_snap_calc_incremental(
     Scene *scene, View3D *v3d, ARegion *region, const float co_relative[3], float co[3])
 {
   const float grid_size = ED_view3d_grid_view_scale(scene, v3d, region, NULL);
@@ -179,12 +179,12 @@ static bool mat3_align_axis_to_v3(float mat[3][3], const int axis_align, const f
 /** \name Drawings
  * \{ */
 
-static void cursor_plane_draw_grid(const int resolution,
-                                   const float scale,
-                                   const float scale_fade,
-                                   const float matrix[4][4],
-                                   const int plane_axis,
-                                   const float color[4])
+static void v3d_cursor_plane_draw_grid(const int resolution,
+                                       const float scale,
+                                       const float scale_fade,
+                                       const float matrix[4][4],
+                                       const int plane_axis,
+                                       const float color[4])
 {
   BLI_assert(scale_fade <= scale);
   const int resolution_min = resolution - 1;
@@ -274,9 +274,9 @@ static void cursor_plane_draw_grid(const int resolution,
   GPU_blend(GPU_BLEND_NONE);
 }
 
-static void cursor_plane_draw(const RegionView3D *rv3d,
-                              const int plane_axis,
-                              const float matrix[4][4])
+static void v3d_cursor_plane_draw(const RegionView3D *rv3d,
+                                  const int plane_axis,
+                                  const float matrix[4][4])
 {
   /* Draw */
   float pixel_size;
@@ -326,7 +326,7 @@ static void cursor_plane_draw(const RegionView3D *rv3d,
     float color[4] = {1, 1, 1, color_alpha};
     color[3] *= square_f(1.0f - fac);
     if (color[3] > 0.0f) {
-      cursor_plane_draw_grid(
+      v3d_cursor_plane_draw_grid(
           lines * lines_subdiv, final_scale, final_scale_fade, matrix, plane_axis, color);
     }
 
@@ -336,7 +336,7 @@ static void cursor_plane_draw(const RegionView3D *rv3d,
       lines = 1;
       final_scale = final_scale_fade;
     }
-    cursor_plane_draw_grid(lines, final_scale, final_scale_fade, matrix, plane_axis, color);
+    v3d_cursor_plane_draw_grid(lines, final_scale, final_scale_fade, matrix, plane_axis, color);
   }
 }
 
@@ -437,10 +437,10 @@ void ED_view3d_cursor_snap_draw_util(RegionView3D *rv3d,
  * \{ */
 
 /* Checks if the current event is different from the one captured in the last update. */
-static bool eventstate_has_changed(SnapCursorDataIntern *sdata_intern,
-                                   const wmWindowManager *wm,
-                                   const int x,
-                                   const int y)
+static bool v3d_cursor_eventstate_has_changed(SnapCursorDataIntern *sdata_intern,
+                                              const wmWindowManager *wm,
+                                              const int x,
+                                              const int y)
 {
   V3DSnapCursorData *snap_data = (V3DSnapCursorData *)sdata_intern;
   if (wm && wm->winactive) {
@@ -463,14 +463,17 @@ static bool eventstate_has_changed(SnapCursorDataIntern *sdata_intern,
 }
 
 /* Copies the current eventstate. */
-static void eventstate_save_xy(SnapCursorDataIntern *cursor_snap, const int x, const int y)
+static void v3d_cursor_eventstate_save_xy(SnapCursorDataIntern *cursor_snap,
+                                          const int x,
+                                          const int y)
 {
   cursor_snap->last_eventstate.x = x;
   cursor_snap->last_eventstate.y = y;
 }
 
 #ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK
-static bool invert_snap(SnapCursorDataIntern *sdata_intern, const wmWindowManager *wm)
+static bool v3d_cursor_is_snap_invert(SnapCursorDataIntern *sdata_intern,
+                                      const wmWindowManager *wm)
 {
   if (!wm || !wm->winactive) {
     return false;
@@ -518,7 +521,7 @@ static bool invert_snap(SnapCursorDataIntern *sdata_intern, const wmWindowManage
 /** \name Update
  * \{ */
 
-static short cursor_snap_elements(V3DSnapCursorData *cursor_snap, Scene *scene)
+static short v3d_cursor_snap_elements(V3DSnapCursorData *cursor_snap, Scene *scene)
 {
   short snap_elements = cursor_snap->snap_elem_force;
   if (!snap_elements) {
@@ -527,24 +530,24 @@ static short cursor_snap_elements(V3DSnapCursorData *cursor_snap, Scene *scene)
   return snap_elements;
 }
 
-static void wm_paint_cursor_snap_context_ensure(SnapCursorDataIntern *sdata_intern, Scene *scene)
+static void v3d_cursor_snap_context_ensure(SnapCursorDataIntern *sdata_intern, Scene *scene)
 {
   if (sdata_intern->snap_context_v3d == NULL) {
     sdata_intern->snap_context_v3d = ED_transform_snap_object_context_create(scene, 0);
   }
 }
 
-static void cursor_snap_update(const bContext *C,
-                               wmWindowManager *wm,
-                               Depsgraph *depsgraph,
-                               Scene *scene,
-                               ARegion *region,
-                               View3D *v3d,
-                               int x,
-                               int y,
-                               SnapCursorDataIntern *sdata_intern)
+static void v3d_cursor_snap_update(const bContext *C,
+                                   wmWindowManager *wm,
+                                   Depsgraph *depsgraph,
+                                   Scene *scene,
+                                   ARegion *region,
+                                   View3D *v3d,
+                                   int x,
+                                   int y,
+                                   SnapCursorDataIntern *sdata_intern)
 {
-  wm_paint_cursor_snap_context_ensure(sdata_intern, scene);
+  v3d_cursor_snap_context_ensure(sdata_intern, scene);
   V3DSnapCursorData *snap_data = (V3DSnapCursorData *)sdata_intern;
 
   float co[3], no[3], face_nor[3], obmat[4][4], omat[3][3];
@@ -557,7 +560,7 @@ static void cursor_snap_update(const bContext *C,
   zero_v3(face_nor);
   unit_m3(omat);
 
-  ushort snap_elements = cursor_snap_elements(snap_data, scene);
+  ushort snap_elements = v3d_cursor_snap_elements(snap_data, scene);
   sdata_intern->snap_elem_hidden = 0;
   const bool draw_plane = sdata_intern->draw_plane;
   if (draw_plane && !(snap_elements & SCE_SNAP_MODE_FACE)) {
@@ -568,7 +571,7 @@ static void cursor_snap_update(const bContext *C,
   snap_data->is_enabled = true;
 #ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK
   if (!(snap_data->flag & V3D_SNAPCURSOR_TOGGLE_ALWAYS_TRUE)) {
-    snap_data->is_snap_invert = invert_snap(sdata_intern, wm);
+    snap_data->is_snap_invert = v3d_cursor_is_snap_invert(sdata_intern, wm);
 
     const ToolSettings *ts = scene->toolsettings;
     if (snap_data->is_snap_invert != !(ts->snap_flag & SCE_SNAP)) {
@@ -659,7 +662,7 @@ static void cursor_snap_update(const bContext *C,
     orthogonalize_m3(omat, snap_data->plane_axis);
 
     if (orient_surface) {
-      cursor_poject_surface_normal(face_nor, obmat, omat);
+      v3d_cursor_poject_surface_normal(face_nor, obmat, omat);
     }
   }
 
@@ -678,7 +681,7 @@ static void cursor_snap_update(const bContext *C,
     }
 
     if (snap_data->is_enabled && (snap_elements & SCE_SNAP_MODE_INCREMENT)) {
-      cursor_snap_calc_incremental(scene, v3d, region, snap_data->prevpoint, co);
+      v3d_cursor_snap_calc_incremental(scene, v3d, region, snap_data->prevpoint, co);
     }
   }
   else if (snap_elem == SCE_SNAP_MODE_VERTEX) {
@@ -701,7 +704,7 @@ static void cursor_snap_update(const bContext *C,
 
   copy_m3_m3(snap_data->plane_omat, omat);
 
-  eventstate_save_xy(sdata_intern, x, y);
+  v3d_cursor_eventstate_save_xy(sdata_intern, x, y);
 }
 
 /** \} */
@@ -710,7 +713,7 @@ static void cursor_snap_update(const bContext *C,
 /** \name Callbacks
  * \{ */
 
-static bool cursor_snap_pool_fn(bContext *C)
+static bool v3d_cursor_snap_pool_fn(bContext *C)
 {
   if (G.moving) {
     return false;
@@ -735,7 +738,7 @@ static bool cursor_snap_pool_fn(bContext *C)
   return true;
 }
 
-static void cursor_snap_draw_fn(bContext *C, int x, int y, void *customdata)
+static void v3d_cursor_snap_draw_fn(bContext *C, int x, int y, void *customdata)
 {
   V3DSnapCursorData *snap_data = customdata;
   SnapCursorDataIntern *sdata_intern = customdata;
@@ -744,11 +747,11 @@ static void cursor_snap_draw_fn(bContext *C, int x, int y, void *customdata)
   ARegion *region = CTX_wm_region(C);
   x -= region->winrct.xmin;
   y -= region->winrct.ymin;
-  if (eventstate_has_changed(sdata_intern, wm, x, y)) {
+  if (v3d_cursor_eventstate_has_changed(sdata_intern, wm, x, y)) {
     Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
     Scene *scene = DEG_get_input_scene(depsgraph);
     View3D *v3d = CTX_wm_view3d(C);
-    cursor_snap_update(C, wm, depsgraph, scene, region, v3d, x, y, sdata_intern);
+    v3d_cursor_snap_update(C, wm, depsgraph, scene, region, v3d, x, y, sdata_intern);
   }
 
   const bool draw_plane = sdata_intern->draw_plane;
@@ -771,7 +774,7 @@ static void cursor_snap_draw_fn(bContext *C, int x, int y,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list