Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorChris Blackbourn <chrisbblend@gmail.com>2022-07-24 04:47:32 +0300
committerChris Blackbourn <chrisbblend@gmail.com>2022-07-24 04:48:53 +0300
commitf1f2c26223efd4ff0a99c5b7510da917fc606205 (patch)
tree4ab5c33992999dc88ceb9be3a92697ecd841f79d /source
parentc94c0d988a5640ab7c6fb815462792dcf8dd863b (diff)
Cleanup: Simplify uv sculpt tool
No functional changes.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_uv.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c
index 5c2dff7b252..dfa85e8e56d 100644
--- a/source/blender/editors/sculpt_paint/sculpt_uv.c
+++ b/source/blender/editors/sculpt_paint/sculpt_uv.c
@@ -211,7 +211,7 @@ static void HC_relaxation_iteration_uv(BMEditMesh *em,
}
}
- MEM_freeN(tmp_uvdata);
+ MEM_SAFE_FREE(tmp_uvdata);
}
static void laplacian_relaxation_iteration_uv(BMEditMesh *em,
@@ -240,7 +240,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em,
add_v2_v2(tmp_uvdata[tmpedge->uv1].sum_co, sculptdata->uv[tmpedge->uv2].uv);
}
- /* Original Lacplacian algorithm included removal of normal component of translation.
+ /* Original Laplacian algorithm included removal of normal component of translation.
* here it is not needed since we translate along the UV plane always. */
for (i = 0; i < sculptdata->totalUniqueUvs; i++) {
copy_v2_v2(tmp_uvdata[i].p, tmp_uvdata[i].sum_co);
@@ -283,7 +283,7 @@ static void laplacian_relaxation_iteration_uv(BMEditMesh *em,
}
}
- MEM_freeN(tmp_uvdata);
+ MEM_SAFE_FREE(tmp_uvdata);
}
static void uv_sculpt_stroke_apply(bContext *C,
@@ -417,20 +417,14 @@ static void uv_sculpt_stroke_exit(bContext *C, wmOperator *op)
if (data->elementMap) {
BM_uv_element_map_free(data->elementMap);
}
- if (data->uv) {
- MEM_freeN(data->uv);
- }
- if (data->uvedges) {
- MEM_freeN(data->uvedges);
- }
+ MEM_SAFE_FREE(data->uv);
+ MEM_SAFE_FREE(data->uvedges);
if (data->initial_stroke) {
- if (data->initial_stroke->initialSelection) {
- MEM_freeN(data->initial_stroke->initialSelection);
- }
- MEM_freeN(data->initial_stroke);
+ MEM_SAFE_FREE(data->initial_stroke->initialSelection);
+ MEM_SAFE_FREE(data->initial_stroke);
}
- MEM_freeN(data);
+ MEM_SAFE_FREE(data);
op->customdata = NULL;
}
@@ -489,7 +483,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
bool do_island_optimization = !(ts->uv_sculpt_settings & UV_SCULPT_ALL_ISLANDS);
int island_index = 0;
- /* Holds, for each UvElement in elementMap, a pointer to its unique UV. */
+ /* Holds, for each UvElement in elementMap, an index of its unique UV. */
int *uniqueUv;
data->tool = (RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_SMOOTH) ?
UV_SCULPT_TOOL_RELAX :
@@ -540,12 +534,8 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
/* we have at most totalUVs edges */
edges = MEM_mallocN(sizeof(*edges) * data->elementMap->totalUVs, "uv_brush_all_edges");
if (!data->uv || !uniqueUv || !edgeHash || !edges) {
- if (edges) {
- MEM_freeN(edges);
- }
- if (uniqueUv) {
- MEM_freeN(uniqueUv);
- }
+ MEM_SAFE_FREE(edges);
+ MEM_SAFE_FREE(uniqueUv);
if (edgeHash) {
BLI_ghash_free(edgeHash, NULL, NULL);
}
@@ -625,14 +615,14 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
}
}
- MEM_freeN(uniqueUv);
+ MEM_SAFE_FREE(uniqueUv);
/* Allocate connectivity data, we allocate edges once */
data->uvedges = MEM_mallocN(sizeof(*data->uvedges) * BLI_ghash_len(edgeHash),
"uv_brush_edge_connectivity_data");
if (!data->uvedges) {
BLI_ghash_free(edgeHash, NULL, NULL);
- MEM_freeN(edges);
+ MEM_SAFE_FREE(edges);
uv_sculpt_stroke_exit(C, op);
return NULL;
}
@@ -646,7 +636,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm
/* cleanup temporary stuff */
BLI_ghash_free(edgeHash, NULL, NULL);
- MEM_freeN(edges);
+ MEM_SAFE_FREE(edges);
/* transfer boundary edge property to UV's */
if (ts->uv_sculpt_settings & UV_SCULPT_LOCK_BORDERS) {