[Bf-blender-cvs] [fdb1a7b5e15] master: Cleanup: `struct PHandle` merged with alias `typedef void ParamHandle`

Chris Blackbourn noreply at git.blender.org
Thu May 26 12:05:59 CEST 2022


Commit: fdb1a7b5e1542d10d88fd7292ee86bc23ce3afa7
Author: Chris Blackbourn
Date:   Thu May 26 20:03:08 2022 +1000
Branches: master
https://developer.blender.org/rBfdb1a7b5e1542d10d88fd7292ee86bc23ce3afa7

Cleanup: `struct PHandle` merged with alias `typedef void ParamHandle`

Reviewed By: brecht

Ref D15021

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

M	source/blender/editors/uvedit/uvedit_unwrap_ops.c
M	source/blender/geometry/GEO_uv_parametrizer.h
M	source/blender/geometry/intern/uv_parametrizer.c

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

diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index 945c2fc616e..84dca352c9f 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -339,7 +339,6 @@ static ParamHandle *construct_param_handle(const Scene *scene,
                                            const UnwrapOptions *options,
                                            UnwrapResultInfo *result_info)
 {
-  ParamHandle *handle;
   BMFace *efa;
   BMLoop *l;
   BMEdge *eed;
@@ -348,7 +347,7 @@ static ParamHandle *construct_param_handle(const Scene *scene,
 
   const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
 
-  handle = GEO_uv_parametrizer_construct_begin();
+  ParamHandle *handle = GEO_uv_parametrizer_construct_begin();
 
   if (options->correct_aspect) {
     float aspx, aspy;
@@ -417,14 +416,13 @@ static ParamHandle *construct_param_handle_multi(const Scene *scene,
                                                  const UnwrapOptions *options,
                                                  int *count_fail)
 {
-  ParamHandle *handle;
   BMFace *efa;
   BMLoop *l;
   BMEdge *eed;
   BMIter iter, liter;
   int i;
 
-  handle = GEO_uv_parametrizer_construct_begin();
+  ParamHandle *handle = GEO_uv_parametrizer_construct_begin();
 
   if (options->correct_aspect) {
     Object *ob = objects[0];
@@ -539,7 +537,6 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene,
                                                      const UnwrapOptions *options,
                                                      UnwrapResultInfo *result_info)
 {
-  ParamHandle *handle;
   /* index pointers */
   MPoly *mpoly;
   MLoop *mloop;
@@ -571,7 +568,7 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene,
 
   const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
 
-  handle = GEO_uv_parametrizer_construct_begin();
+  ParamHandle *handle = GEO_uv_parametrizer_construct_begin();
 
   if (options->correct_aspect) {
     float aspx, aspy;
@@ -1023,8 +1020,7 @@ static void uvedit_pack_islands(const Scene *scene, Object *ob, BMesh *bm)
   bool rotate = true;
   bool ignore_pinned = false;
 
-  ParamHandle *handle;
-  handle = construct_param_handle(scene, ob, bm, &options, NULL);
+  ParamHandle *handle = construct_param_handle(scene, ob, bm, &options, NULL);
   GEO_uv_parametrizer_pack(handle, scene->toolsettings->uvcalc_margin, rotate, ignore_pinned);
   GEO_uv_parametrizer_flush(handle);
   GEO_uv_parametrizer_delete(handle);
@@ -1043,8 +1039,7 @@ static void uvedit_pack_islands_multi(const Scene *scene,
                                       bool rotate,
                                       bool ignore_pinned)
 {
-  ParamHandle *handle;
-  handle = construct_param_handle_multi(scene, objects, objects_len, options, NULL);
+  ParamHandle *handle = construct_param_handle_multi(scene, objects, objects_len, options, NULL);
   GEO_uv_parametrizer_pack(handle, scene->toolsettings->uvcalc_margin, rotate, ignore_pinned);
   GEO_uv_parametrizer_flush(handle);
   GEO_uv_parametrizer_delete(handle);
diff --git a/source/blender/geometry/GEO_uv_parametrizer.h b/source/blender/geometry/GEO_uv_parametrizer.h
index a5194883cf2..624b0695aa3 100644
--- a/source/blender/geometry/GEO_uv_parametrizer.h
+++ b/source/blender/geometry/GEO_uv_parametrizer.h
@@ -12,8 +12,8 @@
 extern "C" {
 #endif
 
-typedef void ParamHandle;  /* handle to a set of charts */
-typedef intptr_t ParamKey; /* (hash) key for identifying verts and faces */
+typedef struct ParamHandle ParamHandle; /* Handle to an array of charts. */
+typedef intptr_t ParamKey;              /* Key (hash) for identifying verts and faces. */
 typedef enum ParamBool {
   PARAM_TRUE = 1,
   PARAM_FALSE = 0,
diff --git a/source/blender/geometry/intern/uv_parametrizer.c b/source/blender/geometry/intern/uv_parametrizer.c
index e25fff0d6b8..ad4b051a6c2 100644
--- a/source/blender/geometry/intern/uv_parametrizer.c
+++ b/source/blender/geometry/intern/uv_parametrizer.c
@@ -59,7 +59,6 @@ typedef struct PHash {
 struct PChart;
 struct PEdge;
 struct PFace;
-struct PHandle;
 struct PVert;
 
 /* Simplices */
@@ -171,7 +170,7 @@ typedef struct PChart {
   } u;
 
   uchar flag;
-  struct PHandle *handle;
+  ParamHandle *handle;
 } PChart;
 
 enum PChartFlag {
@@ -185,7 +184,7 @@ enum PHandleState {
   PHANDLE_STATE_STRETCH,
 };
 
-typedef struct PHandle {
+typedef struct ParamHandle {
   enum PHandleState state;
   MemArena *arena;
   MemArena *polyfill_arena;
@@ -204,7 +203,7 @@ typedef struct PHandle {
   RNG *rng;
   float blend;
   bool do_aspect;
-} PHandle;
+} ParamHandle;
 
 /* PHash
  * - special purpose hash that keeps all its elements in a single linked list.
@@ -637,7 +636,7 @@ static void p_chart_topological_sanity_check(PChart *chart)
 
 /* Loading / Flushing */
 
-static void p_vert_load_pin_select_uvs(PHandle *handle, PVert *v)
+static void p_vert_load_pin_select_uvs(ParamHandle *handle, PVert *v)
 {
   PEdge *e;
   int nedges = 0, npins = 0;
@@ -679,7 +678,7 @@ static void p_vert_load_pin_select_uvs(PHandle *handle, PVert *v)
   }
 }
 
-static void p_flush_uvs(PHandle *handle, PChart *chart)
+static void p_flush_uvs(ParamHandle *handle, PChart *chart)
 {
   PEdge *e;
 
@@ -691,7 +690,7 @@ static void p_flush_uvs(PHandle *handle, PChart *chart)
   }
 }
 
-static void p_flush_uvs_blend(PHandle *handle, PChart *chart, float blend)
+static void p_flush_uvs_blend(ParamHandle *handle, PChart *chart, float blend)
 {
   PEdge *e;
   float invblend = 1.0f - blend;
@@ -742,7 +741,7 @@ static void p_face_restore_uvs(PFace *f)
 
 /* Construction (use only during construction, relies on u.key being set */
 
-static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], PEdge *e)
+static PVert *p_vert_add(ParamHandle *handle, PHashKey key, const float co[3], PEdge *e)
 {
   PVert *v = (PVert *)BLI_memarena_alloc(handle->arena, sizeof(*v));
   copy_v3_v3(v->co, co);
@@ -765,7 +764,7 @@ static PVert *p_vert_add(PHandle *handle, PHashKey key, const float co[3], PEdge
   return v;
 }
 
-static PVert *p_vert_lookup(PHandle *handle, PHashKey key, const float co[3], PEdge *e)
+static PVert *p_vert_lookup(ParamHandle *handle, PHashKey key, const float co[3], PEdge *e)
 {
   PVert *v = (PVert *)phash_lookup(handle->hash_verts, key);
 
@@ -789,7 +788,7 @@ static PVert *p_vert_copy(PChart *chart, PVert *v)
   return nv;
 }
 
-static PEdge *p_edge_lookup(PHandle *handle, const PHashKey *vkeys)
+static PEdge *p_edge_lookup(ParamHandle *handle, const PHashKey *vkeys)
 {
   PHashKey key = PHASH_edge(vkeys[0], vkeys[1]);
   PEdge *e = (PEdge *)phash_lookup(handle->hash_edges, key);
@@ -808,9 +807,8 @@ static PEdge *p_edge_lookup(PHandle *handle, const PHashKey *vkeys)
   return NULL;
 }
 
-static int p_face_exists(ParamHandle *phandle, ParamKey *pvkeys, int i1, int i2, int i3)
+static int p_face_exists(ParamHandle *handle, ParamKey *pvkeys, int i1, int i2, int i3)
 {
-  PHandle *handle = (PHandle *)phandle;
   PHashKey *vkeys = (PHashKey *)pvkeys;
   PHashKey key = PHASH_edge(vkeys[i1], vkeys[i2]);
   PEdge *e = (PEdge *)phash_lookup(handle->hash_edges, key);
@@ -833,7 +831,7 @@ static int p_face_exists(ParamHandle *phandle, ParamKey *pvkeys, int i1, int i2,
   return P_FALSE;
 }
 
-static PChart *p_chart_new(PHandle *handle)
+static PChart *p_chart_new(ParamHandle *handle)
 {
   PChart *chart = (PChart *)MEM_callocN(sizeof(*chart), "PChart");
   chart->handle = handle;
@@ -881,7 +879,10 @@ static PBool p_edge_implicit_seam(PEdge *e, PEdge *ep)
   return P_FALSE;
 }
 
-static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PBool topology_from_uvs, PEdge **r_pair)
+static PBool p_edge_has_pair(ParamHandle *handle,
+                             PEdge *e,
+                             PBool topology_from_uvs,
+                             PEdge **r_pair)
 {
   PHashKey key;
   PEdge *pe;
@@ -930,7 +931,7 @@ static PBool p_edge_has_pair(PHandle *handle, PEdge *e, PBool topology_from_uvs,
   return (*r_pair != NULL);
 }
 
-static PBool p_edge_connect_pair(PHandle *handle,
+static PBool p_edge_connect_pair(ParamHandle *handle,
                                  PEdge *e,
                                  PBool topology_from_uvs,
                                  PEdge ***stack)
@@ -954,7 +955,7 @@ static PBool p_edge_connect_pair(PHandle *handle,
   return (e->pair != NULL);
 }
 
-static int p_connect_pairs(PHandle *handle, PBool topology_from_uvs)
+static int p_connect_pairs(ParamHandle *handle, PBool topology_from_uvs)
 {
   PEdge **stackbase = MEM_mallocN(sizeof(*stackbase) * phash_size(handle->hash_faces),
                                   "Pstackbase");
@@ -1061,7 +1062,7 @@ static void p_split_vert(PChart *chart, PEdge *e)
   }
 }
 
-static PChart **p_split_charts(PHandle *handle, PChart *chart, int ncharts)
+static PChart **p_split_charts(ParamHandle *handle, PChart *chart, int ncharts)
 {
   PChart **charts = MEM_mallocN(sizeof(*charts) * ncharts, "PCharts"), *nchart;
   PFace *f, *nextf;
@@ -1100,7 +1101,7 @@ static PChart **p_split_charts(PHandle *handle, PChart *chart, int ncharts)
   return charts;
 }
 
-static PFace *p_face_add(PHandle *handle)
+static PFace *p_face_add(ParamHandle *handle)
 {
   PFace *f;
   PEdge *e1, *e2, *e3;
@@ -1132,7 +1133,7 @@ static PFace *p_face_add(PHandle *handle)
   return f;
 }
 
-static PFace *p_face_add_construct(PHandle *handle,
+static PFace *p_face_add_construct(ParamHandle *handle,
                                    ParamKey key,
                                    const ParamKey *vkeys,
                                    float *co[4],
@@ -1219,7 +1220,7 @@ static PFace *p_face_add_fill(PChart *chart, PVert *v1, PVert *v2, PVert *v3)
   return f;
 }
 
-static PBool p_quad_split_direction(PHandle *handle, float **co, PHashKey *vkeys)
+static PBool p_quad_split_direction(ParamHandle *handle, float **co, PHashKey *vkeys)
 {
   /* Slight bias to prefer one edge over the other in case they are equal, so
    * that in symmetric models we choose the same split direction instead of
@@ -3212,7 +3213,7 @@ static void p_chart_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list