diff options
author | Chris Blackbourn <chrisbblend@gmail.com> | 2022-05-20 04:39:25 +0300 |
---|---|---|
committer | Chris Blackbourn <chrisbblend@gmail.com> | 2022-05-20 04:42:14 +0300 |
commit | 45a24d5eeedb6e720b5a794f18ac84106a14038a (patch) | |
tree | d82a625b24e5b481a3280ae07c6b115303af6ff9 | |
parent | 930e526cae6204658e70fe7f19c61cf3291949f4 (diff) |
Cleanup: Deprecate ParamHandle -> PHandletemp-deprecate_paramhandle
Improves callstacks when debugging UV solver.
-rw-r--r-- | source/blender/editors/uvedit/uvedit_unwrap_ops.c | 66 | ||||
-rw-r--r-- | source/blender/geometry/GEO_uv_parametrizer.h | 46 | ||||
-rw-r--r-- | source/blender/geometry/intern/uv_parametrizer.c | 113 |
3 files changed, 92 insertions, 133 deletions
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index c0ea753ed51..82e6ef2e21b 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -298,11 +298,8 @@ void ED_uvedit_get_aspect(Object *ob, float *r_aspx, float *r_aspy) ED_uvedit_get_aspect_from_material(ob, efa->mat_nr, r_aspx, r_aspy); } -static void construct_param_handle_face_add(ParamHandle *handle, - const Scene *scene, - BMFace *efa, - int face_index, - const int cd_loop_uv_offset) +static void construct_param_handle_face_add( + PHandle *handle, const Scene *scene, BMFace *efa, int face_index, const int cd_loop_uv_offset) { ParamKey key; ParamKey *vkeys = BLI_array_alloca(vkeys, efa->len); @@ -333,13 +330,12 @@ static void construct_param_handle_face_add(ParamHandle *handle, } /* See: construct_param_handle_multi to handle multiple objects at once. */ -static ParamHandle *construct_param_handle(const Scene *scene, - Object *ob, - BMesh *bm, - const UnwrapOptions *options, - UnwrapResultInfo *result_info) +static PHandle *construct_param_handle(const Scene *scene, + Object *ob, + BMesh *bm, + const UnwrapOptions *options, + UnwrapResultInfo *result_info) { - ParamHandle *handle; BMFace *efa; BMLoop *l; BMEdge *eed; @@ -348,7 +344,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(); + PHandle *handle = GEO_uv_parametrizer_construct_begin(); if (options->correct_aspect) { float aspx, aspy; @@ -411,20 +407,19 @@ static ParamHandle *construct_param_handle(const Scene *scene, /** * Version of #construct_param_handle_single that handles multiple objects. */ -static ParamHandle *construct_param_handle_multi(const Scene *scene, - Object **objects, - const uint objects_len, - const UnwrapOptions *options, - int *count_fail) +static PHandle *construct_param_handle_multi(const Scene *scene, + Object **objects, + const uint objects_len, + 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(); + PHandle *handle = GEO_uv_parametrizer_construct_begin(); if (options->correct_aspect) { Object *ob = objects[0]; @@ -533,13 +528,12 @@ static void texface_from_original_index(const Scene *scene, * The many modifications required to make the original function(see above) * work justified the existence of a new function. */ -static ParamHandle *construct_param_handle_subsurfed(const Scene *scene, - Object *ob, - BMEditMesh *em, - const UnwrapOptions *options, - UnwrapResultInfo *result_info) +static PHandle *construct_param_handle_subsurfed(const Scene *scene, + Object *ob, + BMEditMesh *em, + const UnwrapOptions *options, + UnwrapResultInfo *result_info) { - ParamHandle *handle; /* index pointers */ MPoly *mpoly; MLoop *mloop; @@ -571,7 +565,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(); + PHandle *handle = GEO_uv_parametrizer_construct_begin(); if (options->correct_aspect) { float aspx, aspy; @@ -736,7 +730,7 @@ typedef struct MinStretch { const Scene *scene; Object **objects_edit; uint objects_len; - ParamHandle *handle; + PHandle *handle; float blend; double lasttime; int i, iterations; @@ -1023,8 +1017,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); + PHandle *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 +1036,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); + PHandle *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); @@ -1177,7 +1169,7 @@ static int average_islands_scale_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } - ParamHandle *handle = construct_param_handle_multi(scene, objects, objects_len, &options, NULL); + PHandle *handle = construct_param_handle_multi(scene, objects, objects_len, &options, NULL); GEO_uv_parametrizer_average(handle, false); GEO_uv_parametrizer_flush(handle); GEO_uv_parametrizer_delete(handle); @@ -1218,13 +1210,13 @@ void UV_OT_average_islands_scale(wmOperatorType *ot) * \{ */ static struct { - ParamHandle **handles; + PHandle **handles; uint len, len_alloc; } g_live_unwrap = {NULL}; void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) { - ParamHandle *handle = NULL; + PHandle *handle = NULL; BMEditMesh *em = BKE_editmesh_from_object(obedit); const bool abf = (scene->toolsettings->unwrapper == 0); bool use_subsurf; @@ -1255,14 +1247,14 @@ void ED_uvedit_live_unwrap_begin(Scene *scene, Object *obedit) /* Create or increase size of g_live_unwrap.handles array */ if (g_live_unwrap.handles == NULL) { g_live_unwrap.len_alloc = 32; - g_live_unwrap.handles = MEM_mallocN(sizeof(ParamHandle *) * g_live_unwrap.len_alloc, + g_live_unwrap.handles = MEM_mallocN(sizeof(PHandle *) * g_live_unwrap.len_alloc, "uvedit_live_unwrap_liveHandles"); g_live_unwrap.len = 0; } if (g_live_unwrap.len >= g_live_unwrap.len_alloc) { g_live_unwrap.len_alloc *= 2; g_live_unwrap.handles = MEM_reallocN(g_live_unwrap.handles, - sizeof(ParamHandle *) * g_live_unwrap.len_alloc); + sizeof(PHandle *) * g_live_unwrap.len_alloc); } g_live_unwrap.handles[g_live_unwrap.len] = handle; g_live_unwrap.len++; @@ -1793,7 +1785,7 @@ static void uvedit_unwrap(const Scene *scene, bool use_subsurf; modifier_unwrap_state(obedit, scene, &use_subsurf); - ParamHandle *handle; + PHandle *handle; if (use_subsurf) { handle = construct_param_handle_subsurfed(scene, obedit, em, options, result_info); } diff --git a/source/blender/geometry/GEO_uv_parametrizer.h b/source/blender/geometry/GEO_uv_parametrizer.h index a5194883cf2..427b40db952 100644 --- a/source/blender/geometry/GEO_uv_parametrizer.h +++ b/source/blender/geometry/GEO_uv_parametrizer.h @@ -12,8 +12,9 @@ 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 PHandle ParamHandle; /* Deprecated, use PHandle instead. */ +typedef struct PHandle PHandle; /* 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, @@ -34,11 +35,11 @@ typedef enum ParamBool { * * \{ */ -ParamHandle *GEO_uv_parametrizer_construct_begin(void); +PHandle *GEO_uv_parametrizer_construct_begin(void); -void GEO_uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspx, float aspy); +void GEO_uv_parametrizer_aspect_ratio(PHandle *handle, float aspx, float aspy); -void GEO_uv_parametrizer_face_add(ParamHandle *handle, +void GEO_uv_parametrizer_face_add(PHandle *handle, ParamKey key, int nverts, ParamKey *vkeys, @@ -47,13 +48,13 @@ void GEO_uv_parametrizer_face_add(ParamHandle *handle, ParamBool *pin, ParamBool *select); -void GEO_uv_parametrizer_edge_set_seam(ParamHandle *handle, ParamKey *vkeys); +void GEO_uv_parametrizer_edge_set_seam(PHandle *handle, ParamKey *vkeys); -void GEO_uv_parametrizer_construct_end(ParamHandle *handle, +void GEO_uv_parametrizer_construct_end(PHandle *handle, ParamBool fill, ParamBool topology_from_uvs, int *count_fail); -void GEO_uv_parametrizer_delete(ParamHandle *handle); +void GEO_uv_parametrizer_delete(PHandle *handle); /** \} */ @@ -70,9 +71,9 @@ void GEO_uv_parametrizer_delete(ParamHandle *handle); * * \{ */ -void GEO_uv_parametrizer_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf); -void GEO_uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed); -void GEO_uv_parametrizer_lscm_end(ParamHandle *handle); +void GEO_uv_parametrizer_lscm_begin(PHandle *handle, ParamBool live, ParamBool abf); +void GEO_uv_parametrizer_lscm_solve(PHandle *handle, int *count_changed, int *count_failed); +void GEO_uv_parametrizer_lscm_end(PHandle *handle); /** \} */ @@ -80,10 +81,10 @@ void GEO_uv_parametrizer_lscm_end(ParamHandle *handle); /** \name Stretch * \{ */ -void GEO_uv_parametrizer_stretch_begin(ParamHandle *handle); -void GEO_uv_parametrizer_stretch_blend(ParamHandle *handle, float blend); -void GEO_uv_parametrizer_stretch_iter(ParamHandle *handle); -void GEO_uv_parametrizer_stretch_end(ParamHandle *handle); +void GEO_uv_parametrizer_stretch_begin(PHandle *handle); +void GEO_uv_parametrizer_stretch_blend(PHandle *handle, float blend); +void GEO_uv_parametrizer_stretch_iter(PHandle *handle); +void GEO_uv_parametrizer_stretch_end(PHandle *handle); /** \} */ @@ -91,7 +92,7 @@ void GEO_uv_parametrizer_stretch_end(ParamHandle *handle); /** \name Area Smooth * \{ */ -void GEO_uv_parametrizer_smooth_area(ParamHandle *handle); +void GEO_uv_parametrizer_smooth_area(PHandle *handle); /** \} */ @@ -99,10 +100,7 @@ void GEO_uv_parametrizer_smooth_area(ParamHandle *handle); /** \name Packing * \{ */ -void GEO_uv_parametrizer_pack(ParamHandle *handle, - float margin, - bool do_rotate, - bool ignore_pinned); +void GEO_uv_parametrizer_pack(PHandle *handle, float margin, bool do_rotate, bool ignore_pinned); /** \} */ @@ -110,7 +108,7 @@ void GEO_uv_parametrizer_pack(ParamHandle *handle, /** \name Average area for all charts * \{ */ -void GEO_uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned); +void GEO_uv_parametrizer_average(PHandle *handle, bool ignore_pinned); /** \} */ @@ -118,7 +116,7 @@ void GEO_uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned); /** \name Simple x,y scale * \{ */ -void GEO_uv_parametrizer_scale(ParamHandle *handle, float x, float y); +void GEO_uv_parametrizer_scale(PHandle *handle, float x, float y); /** \} */ @@ -126,8 +124,8 @@ void GEO_uv_parametrizer_scale(ParamHandle *handle, float x, float y); /** \name Flushing * \{ */ -void GEO_uv_parametrizer_flush(ParamHandle *handle); -void GEO_uv_parametrizer_flush_restore(ParamHandle *handle); +void GEO_uv_parametrizer_flush(PHandle *handle); +void GEO_uv_parametrizer_flush_restore(PHandle *handle); /** \} */ diff --git a/source/blender/geometry/intern/uv_parametrizer.c b/source/blender/geometry/intern/uv_parametrizer.c index e25fff0d6b8..ccb0dd54610 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; + PHandle *handle; } PChart; enum PChartFlag { @@ -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(PHandle *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); @@ -4359,7 +4357,7 @@ static void p_smooth(PChart *chart) /* Exported */ -ParamHandle *GEO_uv_parametrizer_construct_begin(void) +PHandle *GEO_uv_parametrizer_construct_begin(void) { PHandle *handle = MEM_callocN(sizeof(*handle), "PHandle"); handle->construction_chart = p_chart_new(handle); @@ -4375,21 +4373,18 @@ ParamHandle *GEO_uv_parametrizer_construct_begin(void) handle->hash_edges = phash_new((PHashLink **)&handle->construction_chart->edges, 1); handle->hash_faces = phash_new((PHashLink **)&handle->construction_chart->faces, 1); - return (ParamHandle *)handle; + return handle; } -void GEO_uv_parametrizer_aspect_ratio(ParamHandle *handle, float aspx, float aspy) +void GEO_uv_parametrizer_aspect_ratio(PHandle *phandle, float aspx, float aspy) { - PHandle *phandle = (PHandle *)handle; - phandle->aspx = aspx; phandle->aspy = aspy; phandle->do_aspect = true; } -void GEO_uv_parametrizer_delete(ParamHandle *handle) +void GEO_uv_parametrizer_delete(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; int i; param_assert(ELEM(phandle->state, PHANDLE_STATE_ALLOCATED, PHANDLE_STATE_CONSTRUCTED)); @@ -4416,7 +4411,7 @@ void GEO_uv_parametrizer_delete(ParamHandle *handle) MEM_freeN(phandle); } -static void p_add_ngon(ParamHandle *handle, +static void p_add_ngon(PHandle *handle, ParamKey key, int nverts, ParamKey *vkeys, @@ -4426,9 +4421,8 @@ static void p_add_ngon(ParamHandle *handle, ParamBool *select) { /* Allocate memory for polyfill. */ - PHandle *phandle = (PHandle *)handle; - MemArena *arena = phandle->polyfill_arena; - Heap *heap = phandle->polyfill_heap; + MemArena *arena = handle->polyfill_arena; + Heap *heap = handle->polyfill_heap; uint nfilltri = nverts - 2; uint(*tris)[3] = BLI_memarena_alloc(arena, sizeof(*tris) * (size_t)nfilltri); float(*projverts)[2] = BLI_memarena_alloc(arena, sizeof(*projverts) * (size_t)nverts); @@ -4478,7 +4472,7 @@ static void p_add_ngon(ParamHandle *handle, BLI_memarena_clear(arena); } -void GEO_uv_parametrizer_face_add(ParamHandle *handle, +void GEO_uv_parametrizer_face_add(PHandle *phandle, ParamKey key, int nverts, ParamKey *vkeys, @@ -4487,15 +4481,13 @@ void GEO_uv_parametrizer_face_add(ParamHandle *handle, ParamBool *pin, ParamBool *select) { - PHandle *phandle = (PHandle *)handle; - param_assert(phash_lookup(phandle->hash_faces, key) == NULL); param_assert(phandle->state == PHANDLE_STATE_ALLOCATED); param_assert(ELEM(nverts, 3, 4)); if (nverts > 4) { /* ngon */ - p_add_ngon(handle, key, nverts, vkeys, co, uv, pin, select); + p_add_ngon(phandle, key, nverts, vkeys, co, uv, pin, select); } else if (nverts == 4) { /* quad */ @@ -4514,9 +4506,8 @@ void GEO_uv_parametrizer_face_add(ParamHandle *handle, } } -void GEO_uv_parametrizer_edge_set_seam(ParamHandle *handle, ParamKey *vkeys) +void GEO_uv_parametrizer_edge_set_seam(PHandle *phandle, ParamKey *vkeys) { - PHandle *phandle = (PHandle *)handle; PEdge *e; param_assert(phandle->state == PHANDLE_STATE_ALLOCATED); @@ -4527,12 +4518,11 @@ void GEO_uv_parametrizer_edge_set_seam(ParamHandle *handle, ParamKey *vkeys) } } -void GEO_uv_parametrizer_construct_end(ParamHandle *handle, +void GEO_uv_parametrizer_construct_end(PHandle *phandle, ParamBool fill, ParamBool topology_from_uvs, int *count_fail) { - PHandle *phandle = (PHandle *)handle; PChart *chart = phandle->construction_chart; int i, j, nboundaries = 0; PEdge *outer; @@ -4572,7 +4562,7 @@ void GEO_uv_parametrizer_construct_end(ParamHandle *handle, } for (v = chart->verts; v; v = v->nextlink) { - p_vert_load_pin_select_uvs(handle, v); + p_vert_load_pin_select_uvs(phandle, v); } } @@ -4581,9 +4571,8 @@ void GEO_uv_parametrizer_construct_end(ParamHandle *handle, phandle->state = PHANDLE_STATE_CONSTRUCTED; } -void GEO_uv_parametrizer_lscm_begin(ParamHandle *handle, ParamBool live, ParamBool abf) +void GEO_uv_parametrizer_lscm_begin(PHandle *phandle, ParamBool live, ParamBool abf) { - PHandle *phandle = (PHandle *)handle; PFace *f; int i; @@ -4598,9 +4587,8 @@ void GEO_uv_parametrizer_lscm_begin(ParamHandle *handle, ParamBool live, ParamBo } } -void GEO_uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int *count_failed) +void GEO_uv_parametrizer_lscm_solve(PHandle *phandle, int *count_changed, int *count_failed) { - PHandle *phandle = (PHandle *)handle; PChart *chart; int i; @@ -4638,9 +4626,8 @@ void GEO_uv_parametrizer_lscm_solve(ParamHandle *handle, int *count_changed, int } } -void GEO_uv_parametrizer_lscm_end(ParamHandle *handle) +void GEO_uv_parametrizer_lscm_end(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; int i; param_assert(phandle->state == PHANDLE_STATE_LSCM); @@ -4655,9 +4642,8 @@ void GEO_uv_parametrizer_lscm_end(ParamHandle *handle) phandle->state = PHANDLE_STATE_CONSTRUCTED; } -void GEO_uv_parametrizer_stretch_begin(ParamHandle *handle) +void GEO_uv_parametrizer_stretch_begin(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; PChart *chart; PVert *v; PFace *f; @@ -4685,17 +4671,14 @@ void GEO_uv_parametrizer_stretch_begin(ParamHandle *handle) } } -void GEO_uv_parametrizer_stretch_blend(ParamHandle *handle, float blend) +void GEO_uv_parametrizer_stretch_blend(PHandle *phandle, float blend) { - PHandle *phandle = (PHandle *)handle; - param_assert(phandle->state == PHANDLE_STATE_STRETCH); phandle->blend = blend; } -void GEO_uv_parametrizer_stretch_iter(ParamHandle *handle) +void GEO_uv_parametrizer_stretch_iter(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; PChart *chart; int i; @@ -4707,10 +4690,8 @@ void GEO_uv_parametrizer_stretch_iter(ParamHandle *handle) } } -void GEO_uv_parametrizer_stretch_end(ParamHandle *handle) +void GEO_uv_parametrizer_stretch_end(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; - param_assert(phandle->state == PHANDLE_STATE_STRETCH); phandle->state = PHANDLE_STATE_CONSTRUCTED; @@ -4718,9 +4699,8 @@ void GEO_uv_parametrizer_stretch_end(ParamHandle *handle) phandle->rng = NULL; } -void GEO_uv_parametrizer_smooth_area(ParamHandle *handle) +void GEO_uv_parametrizer_smooth_area(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; int i; param_assert(phandle->state == PHANDLE_STATE_CONSTRUCTED); @@ -4738,13 +4718,11 @@ void GEO_uv_parametrizer_smooth_area(ParamHandle *handle) } /* don't pack, just rotate (used for better packing) */ -static void GEO_uv_parametrizer_pack_rotate(ParamHandle *handle, bool ignore_pinned) +static void GEO_uv_parametrizer_pack_rotate(PHandle *phandle, bool ignore_pinned) { PChart *chart; int i; - PHandle *phandle = (PHandle *)handle; - for (i = 0; i < phandle->ncharts; i++) { chart = phandle->charts[i]; @@ -4756,10 +4734,7 @@ static void GEO_uv_parametrizer_pack_rotate(ParamHandle *handle, bool ignore_pin } } -void GEO_uv_parametrizer_pack(ParamHandle *handle, - float margin, - bool do_rotate, - bool ignore_pinned) +void GEO_uv_parametrizer_pack(PHandle *handle, float margin, bool do_rotate, bool ignore_pinned) { /* box packing variables */ BoxPack *boxarray, *box; @@ -4770,9 +4745,7 @@ void GEO_uv_parametrizer_pack(ParamHandle *handle, float trans[2]; double area = 0.0; - PHandle *phandle = (PHandle *)handle; - - if (phandle->ncharts == 0) { + if (handle->ncharts == 0) { return; } @@ -4781,15 +4754,15 @@ void GEO_uv_parametrizer_pack(ParamHandle *handle, GEO_uv_parametrizer_pack_rotate(handle, ignore_pinned); } - if (phandle->aspx != phandle->aspy) { - GEO_uv_parametrizer_scale(handle, 1.0f / phandle->aspx, 1.0f / phandle->aspy); + if (handle->aspx != handle->aspy) { + GEO_uv_parametrizer_scale(handle, 1.0f / handle->aspx, 1.0f / handle->aspy); } /* we may not use all these boxes */ - boxarray = MEM_mallocN(phandle->ncharts * sizeof(BoxPack), "BoxPack box"); + boxarray = MEM_mallocN(handle->ncharts * sizeof(BoxPack), "BoxPack box"); - for (i = 0; i < phandle->ncharts; i++) { - chart = phandle->charts[i]; + for (i = 0; i < handle->ncharts; i++) { + chart = handle->charts[i]; if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) { unpacked++; @@ -4821,8 +4794,8 @@ void GEO_uv_parametrizer_pack(ParamHandle *handle, * 0.0 to 1.0 but not give a massive margin */ margin = (margin * (float)area) * 0.1f; unpacked = 0; - for (i = 0; i < phandle->ncharts; i++) { - chart = phandle->charts[i]; + for (i = 0; i < handle->ncharts; i++) { + chart = handle->charts[i]; if (ignore_pinned && (chart->flag & PCHART_HAS_PINS)) { unpacked++; @@ -4838,7 +4811,7 @@ void GEO_uv_parametrizer_pack(ParamHandle *handle, } } - BLI_box_pack_2d(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height); + BLI_box_pack_2d(boxarray, handle->ncharts - unpacked, &tot_width, &tot_height); if (tot_height > tot_width) { scale = tot_height != 0.0f ? (1.0f / tot_height) : 1.0f; @@ -4847,30 +4820,29 @@ void GEO_uv_parametrizer_pack(ParamHandle *handle, scale = tot_width != 0.0f ? (1.0f / tot_width) : 1.0f; } - for (i = 0; i < phandle->ncharts - unpacked; i++) { + for (i = 0; i < handle->ncharts - unpacked; i++) { box = boxarray + i; trans[0] = box->x; trans[1] = box->y; - chart = phandle->charts[box->index]; + chart = handle->charts[box->index]; p_chart_uv_translate(chart, trans); p_chart_uv_scale(chart, scale); } MEM_freeN(boxarray); - if (phandle->aspx != phandle->aspy) { - GEO_uv_parametrizer_scale(handle, phandle->aspx, phandle->aspy); + if (handle->aspx != handle->aspy) { + GEO_uv_parametrizer_scale(handle, handle->aspx, handle->aspy); } } -void GEO_uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned) +void GEO_uv_parametrizer_average(PHandle *phandle, bool ignore_pinned) { PChart *chart; int i; float tot_uvarea = 0.0f, tot_facearea = 0.0f; float tot_fac, fac; float minv[2], maxv[2], trans[2]; - PHandle *phandle = (PHandle *)handle; if (phandle->ncharts == 0) { return; @@ -4930,9 +4902,8 @@ void GEO_uv_parametrizer_average(ParamHandle *handle, bool ignore_pinned) } } -void GEO_uv_parametrizer_scale(ParamHandle *handle, float x, float y) +void GEO_uv_parametrizer_scale(PHandle *phandle, float x, float y) { - PHandle *phandle = (PHandle *)handle; PChart *chart; int i; @@ -4942,9 +4913,8 @@ void GEO_uv_parametrizer_scale(ParamHandle *handle, float x, float y) } } -void GEO_uv_parametrizer_flush(ParamHandle *handle) +void GEO_uv_parametrizer_flush(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; PChart *chart; int i; @@ -4964,9 +4934,8 @@ void GEO_uv_parametrizer_flush(ParamHandle *handle) } } -void GEO_uv_parametrizer_flush_restore(ParamHandle *handle) +void GEO_uv_parametrizer_flush_restore(PHandle *phandle) { - PHandle *phandle = (PHandle *)handle; PChart *chart; PFace *f; int i; |