diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/uvedit/CMakeLists.txt | 2 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_islands.cc (renamed from source/blender/editors/uvedit/uvedit_islands.c) | 33 |
2 files changed, 20 insertions, 15 deletions
diff --git a/source/blender/editors/uvedit/CMakeLists.txt b/source/blender/editors/uvedit/CMakeLists.txt index fd3f7c49dc4..4574c745d93 100644 --- a/source/blender/editors/uvedit/CMakeLists.txt +++ b/source/blender/editors/uvedit/CMakeLists.txt @@ -22,7 +22,7 @@ set(INC set(SRC uvedit_buttons.c uvedit_draw.c - uvedit_islands.c + uvedit_islands.cc uvedit_ops.c uvedit_path.c uvedit_rip.c diff --git a/source/blender/editors/uvedit/uvedit_islands.c b/source/blender/editors/uvedit/uvedit_islands.cc index 68c00b18b09..836d997f6e4 100644 --- a/source/blender/editors/uvedit/uvedit_islands.c +++ b/source/blender/editors/uvedit/uvedit_islands.cc @@ -46,7 +46,7 @@ static void bm_face_uv_scale_y(BMFace *f, const float scale_y, const int cd_loop BMLoop *l_first; l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { - MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); + MLoopUV *luv = static_cast<MLoopUV *>(BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset)); luv->uv[1] *= scale_y; } while ((l_iter = l_iter->next) != l_first); } @@ -61,7 +61,7 @@ static void bm_face_uv_translate_and_scale_around_pivot(BMFace *f, BMLoop *l_first; l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { - MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); + MLoopUV *luv = static_cast<MLoopUV *>(BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset)); for (int i = 0; i < 2; i++) { luv->uv[i] = offset[i] + (((luv->uv[i] - pivot[i]) * scale[i]) + pivot[i]); } @@ -111,7 +111,8 @@ static float (*bm_face_array_calc_unique_uv_coords( coords_len_alloc += f->len; } - float(*coords)[2] = MEM_mallocN(sizeof(*coords) * coords_len_alloc, __func__); + float(*coords)[2] = static_cast<float(*)[2]>( + MEM_mallocN(sizeof(*coords) * coords_len_alloc, __func__)); int coords_len = 0; for (int i = 0; i < faces_len; i++) { @@ -125,7 +126,8 @@ static float (*bm_face_array_calc_unique_uv_coords( } BM_elem_flag_disable(l_iter, BM_ELEM_TAG); - const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); + const MLoopUV *luv = static_cast<const MLoopUV *>( + BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset)); copy_v2_v2(coords[coords_len++], luv->uv); /* Un tag all connected so we don't add them twice. @@ -140,7 +142,8 @@ static float (*bm_face_array_calc_unique_uv_coords( do { if (l_radial->v == l_iter->v) { if (BM_elem_flag_test(l_radial, BM_ELEM_TAG)) { - const MLoopUV *luv_radial = BM_ELEM_CD_GET_VOID_P(l_radial, cd_loop_uv_offset); + const MLoopUV *luv_radial = static_cast<const MLoopUV *>( + BM_ELEM_CD_GET_VOID_P(l_radial, cd_loop_uv_offset)); if (equals_v2v2(luv->uv, luv_radial->uv)) { /* Don't add this UV when met in another face in `faces`. */ BM_elem_flag_disable(l_iter, BM_ELEM_TAG); @@ -152,7 +155,6 @@ static float (*bm_face_array_calc_unique_uv_coords( } while ((e = BM_DISK_EDGE_NEXT(e, v_pivot)) != e_first); } while ((l_iter = l_iter->next) != l_first); } - coords = MEM_reallocN(coords, sizeof(*coords) * coords_len); *r_coords_len = coords_len; return coords; } @@ -319,7 +321,7 @@ struct SharedUVLoopData { static bool bm_loop_uv_shared_edge_check(const BMLoop *l_a, const BMLoop *l_b, void *user_data) { - const struct SharedUVLoopData *data = user_data; + const struct SharedUVLoopData *data = static_cast<const struct SharedUVLoopData *>(user_data); if (data->use_seams) { if (BM_elem_flag_test(l_a->e, BM_ELEM_SEAM)) { @@ -351,7 +353,8 @@ int bm_mesh_calc_uv_islands(const Scene *scene, .use_seams = use_seams, }; - int *groups_array = MEM_mallocN(sizeof(*groups_array) * (size_t)bm->totface, __func__); + int *groups_array = static_cast<int *>( + MEM_mallocN(sizeof(*groups_array) * (size_t)bm->totface, __func__)); int(*group_index)[2]; @@ -388,7 +391,7 @@ int bm_mesh_calc_uv_islands(const Scene *scene, for (int i = 0; i < group_len; i++) { const int faces_start = group_index[i][0]; const int faces_len = group_index[i][1]; - BMFace **faces = MEM_mallocN(sizeof(*faces) * faces_len, __func__); + BMFace **faces = static_cast<BMFace **>(MEM_mallocN(sizeof(*faces) * faces_len, __func__)); float bounds_min[2], bounds_max[2]; INIT_MINMAX2(bounds_min, bounds_max); @@ -397,7 +400,8 @@ int bm_mesh_calc_uv_islands(const Scene *scene, faces[j] = BM_face_at_index(bm, groups_array[faces_start + j]); } - struct FaceIsland *island = MEM_callocN(sizeof(*island), __func__); + struct FaceIsland *island = static_cast<struct FaceIsland *>( + MEM_callocN(sizeof(*island), __func__)); island->faces = faces; island->faces_len = faces_len; island->cd_loop_uv_offset = cd_loop_uv_offset; @@ -466,9 +470,10 @@ void ED_uvedit_pack_islands_multi(const Scene *scene, float margin = scene->toolsettings->uvcalc_margin; double area = 0.0f; - struct FaceIsland **island_array = MEM_mallocN(sizeof(*island_array) * island_list_len, - __func__); - BoxPack *boxarray = MEM_mallocN(sizeof(*boxarray) * island_list_len, __func__); + struct FaceIsland **island_array = static_cast<struct FaceIsland **>( + MEM_mallocN(sizeof(*island_array) * island_list_len, __func__)); + BoxPack *boxarray = static_cast<BoxPack *>( + MEM_mallocN(sizeof(*boxarray) * island_list_len, __func__)); int index; /* Coordinates of bounding box containing all selected UVs. */ @@ -620,7 +625,7 @@ void ED_uvedit_pack_islands_multi(const Scene *scene, for (uint ob_index = 0; ob_index < objects_len; ob_index++) { Object *obedit = objects[ob_index]; - DEG_id_tag_update(obedit->data, ID_RECALC_GEOMETRY); + DEG_id_tag_update(static_cast<ID *>(obedit->data), ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, obedit->data); } |