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
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_mesh_remesh_voxel.h4
-rw-r--r--source/blender/blenkernel/BKE_shrinkwrap.h2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt2
-rw-r--r--source/blender/blenkernel/intern/mesh_remesh_voxel.cc (renamed from source/blender/blenkernel/intern/mesh_remesh_voxel.c)130
-rw-r--r--source/blender/editors/object/CMakeLists.txt2
-rw-r--r--source/blender/editors/object/object_intern.h2
-rw-r--r--source/blender/editors/object/object_remesh.cc (renamed from source/blender/editors/object/object_remesh.c)92
7 files changed, 115 insertions, 119 deletions
diff --git a/source/blender/blenkernel/BKE_mesh_remesh_voxel.h b/source/blender/blenkernel/BKE_mesh_remesh_voxel.h
index 2265fa6e105..3ada2eb6c6c 100644
--- a/source/blender/blenkernel/BKE_mesh_remesh_voxel.h
+++ b/source/blender/blenkernel/BKE_mesh_remesh_voxel.h
@@ -54,7 +54,9 @@ struct Mesh *BKE_mesh_remesh_quadriflow_to_mesh_nomain(struct Mesh *mesh,
bool preserve_sharp,
bool preserve_boundary,
bool adaptive_scale,
- void *update_cb,
+ void (*update_cb)(void *,
+ float progress,
+ int *cancel),
void *update_cb_data);
/* Data reprojection functions */
diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h
index bcf702ea797..70aeb37d995 100644
--- a/source/blender/blenkernel/BKE_shrinkwrap.h
+++ b/source/blender/blenkernel/BKE_shrinkwrap.h
@@ -118,7 +118,7 @@ void BKE_shrinkwrap_mesh_nearest_surface_deform(struct bContext *C,
struct Object *ob_source,
struct Object *ob_target);
-/* Used in object_remesh.c to preserve the details and volume in the voxel remesher */
+/* Used in object_remesh.cc to preserve the details and volume in the voxel remesher */
void BKE_shrinkwrap_remesh_target_project(struct Mesh *src_me,
struct Mesh *target_me,
struct Object *ob_target);
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index e8f31ae72c0..78bfe8c9afb 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -194,7 +194,7 @@ set(SRC
intern/mesh_mirror.c
intern/mesh_normals.cc
intern/mesh_remap.c
- intern/mesh_remesh_voxel.c
+ intern/mesh_remesh_voxel.cc
intern/mesh_runtime.c
intern/mesh_sample.cc
intern/mesh_tangent.c
diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.c b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 5a90d1f6ea5..bdb5a343644 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.c
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -21,12 +21,12 @@
* \ingroup bke
*/
-#include <ctype.h>
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
+#include <cctype>
+#include <cfloat>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
#include "MEM_guardedalloc.h"
@@ -62,8 +62,8 @@ struct OpenVDBLevelSet *BKE_mesh_remesh_voxel_ovdb_mesh_to_level_set_create(
{
BKE_mesh_runtime_looptri_recalc(mesh);
const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(mesh);
- MVertTri *verttri = MEM_callocN(sizeof(*verttri) * BKE_mesh_runtime_looptri_len(mesh),
- "remesh_looptri");
+ MVertTri *verttri = (MVertTri *)MEM_callocN(
+ sizeof(*verttri) * BKE_mesh_runtime_looptri_len(mesh), "remesh_looptri");
BKE_mesh_runtime_verttri_from_looptri(
verttri, mesh->mloop, looptri, BKE_mesh_runtime_looptri_len(mesh));
@@ -86,7 +86,7 @@ struct OpenVDBLevelSet *BKE_mesh_remesh_voxel_ovdb_mesh_to_level_set_create(
faces[i * 3 + 2] = vt->tri[2];
}
- struct OpenVDBLevelSet *level_set = OpenVDBLevelSet_create(false, NULL);
+ struct OpenVDBLevelSet *level_set = OpenVDBLevelSet_create(false, nullptr);
OpenVDBLevelSet_mesh_to_level_set(level_set, verts, faces, totverts, totfaces, transform);
MEM_freeN(verts);
@@ -157,7 +157,7 @@ static Mesh *BKE_mesh_remesh_quadriflow(Mesh *input_mesh,
bool preserve_sharp,
bool preserve_boundary,
bool adaptive_scale,
- void *update_cb,
+ void (*update_cb)(void *, float progress, int *cancel),
void *update_cb_data)
{
/* Ensure that the triangulated mesh data is up to data */
@@ -165,8 +165,8 @@ static Mesh *BKE_mesh_remesh_quadriflow(Mesh *input_mesh,
const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(input_mesh);
/* Gather the required data for export to the internal quadiflow mesh format */
- MVertTri *verttri = MEM_callocN(sizeof(*verttri) * BKE_mesh_runtime_looptri_len(input_mesh),
- "remesh_looptri");
+ MVertTri *verttri = (MVertTri *)MEM_callocN(
+ sizeof(*verttri) * BKE_mesh_runtime_looptri_len(input_mesh), "remesh_looptri");
BKE_mesh_runtime_verttri_from_looptri(
verttri, input_mesh->mloop, looptri, BKE_mesh_runtime_looptri_len(input_mesh));
@@ -201,11 +201,11 @@ static Mesh *BKE_mesh_remesh_quadriflow(Mesh *input_mesh,
qrd.preserve_sharp = preserve_sharp;
qrd.preserve_boundary = preserve_boundary;
qrd.adaptive_scale = adaptive_scale;
- qrd.minimum_cost_flow = 0;
- qrd.aggresive_sat = 0;
+ qrd.minimum_cost_flow = false;
+ qrd.aggresive_sat = false;
qrd.rng_seed = seed;
- qrd.out_faces = NULL;
+ qrd.out_faces = nullptr;
/* Run the remesher */
QFLOW_quadriflow_remesh(&qrd, update_cb, update_cb_data);
@@ -214,16 +214,16 @@ static Mesh *BKE_mesh_remesh_quadriflow(Mesh *input_mesh,
MEM_freeN(faces);
MEM_freeN(verttri);
- if (qrd.out_faces == NULL) {
+ if (qrd.out_faces == nullptr) {
/* The remeshing was canceled */
- return NULL;
+ return nullptr;
}
if (qrd.out_totfaces == 0) {
/* Meshing failed */
MEM_freeN(qrd.out_faces);
MEM_freeN(qrd.out_verts);
- return NULL;
+ return nullptr;
}
/* Construct the new output mesh */
@@ -262,10 +262,12 @@ Mesh *BKE_mesh_remesh_quadriflow_to_mesh_nomain(Mesh *mesh,
bool preserve_sharp,
bool preserve_boundary,
bool adaptive_scale,
- void *update_cb,
+ void (*update_cb)(void *,
+ float progress,
+ int *cancel),
void *update_cb_data)
{
- Mesh *new_mesh = NULL;
+ Mesh *new_mesh = nullptr;
#ifdef WITH_QUADRIFLOW
if (target_faces <= 0) {
target_faces = -1;
@@ -296,7 +298,7 @@ Mesh *BKE_mesh_remesh_voxel_to_mesh_nomain(Mesh *mesh,
float adaptivity,
float isovalue)
{
- Mesh *new_mesh = NULL;
+ Mesh *new_mesh = nullptr;
#ifdef WITH_OPENVDB
struct OpenVDBLevelSet *level_set;
struct OpenVDBTransform *xform = OpenVDBTransform_create();
@@ -314,28 +316,26 @@ Mesh *BKE_mesh_remesh_voxel_to_mesh_nomain(Mesh *mesh,
void BKE_mesh_remesh_reproject_paint_mask(Mesh *target, Mesh *source)
{
- BVHTreeFromMesh bvhtree = {
- .nearest_callback = NULL,
- };
+ BVHTreeFromMesh bvhtree = {{nullptr}};
BKE_bvhtree_from_mesh_get(&bvhtree, source, BVHTREE_FROM_VERTS, 2);
- MVert *target_verts = CustomData_get_layer(&target->vdata, CD_MVERT);
+ MVert *target_verts = (MVert *)CustomData_get_layer(&target->vdata, CD_MVERT);
float *target_mask;
if (CustomData_has_layer(&target->vdata, CD_PAINT_MASK)) {
- target_mask = CustomData_get_layer(&target->vdata, CD_PAINT_MASK);
+ target_mask = (float *)CustomData_get_layer(&target->vdata, CD_PAINT_MASK);
}
else {
- target_mask = CustomData_add_layer(
- &target->vdata, CD_PAINT_MASK, CD_CALLOC, NULL, target->totvert);
+ target_mask = (float *)CustomData_add_layer(
+ &target->vdata, CD_PAINT_MASK, CD_CALLOC, nullptr, target->totvert);
}
float *source_mask;
if (CustomData_has_layer(&source->vdata, CD_PAINT_MASK)) {
- source_mask = CustomData_get_layer(&source->vdata, CD_PAINT_MASK);
+ source_mask = (float *)CustomData_get_layer(&source->vdata, CD_PAINT_MASK);
}
else {
- source_mask = CustomData_add_layer(
- &source->vdata, CD_PAINT_MASK, CD_CALLOC, NULL, source->totvert);
+ source_mask = (float *)CustomData_add_layer(
+ &source->vdata, CD_PAINT_MASK, CD_CALLOC, nullptr, source->totvert);
}
for (int i = 0; i < target->totvert; i++) {
@@ -354,30 +354,28 @@ void BKE_mesh_remesh_reproject_paint_mask(Mesh *target, Mesh *source)
void BKE_remesh_reproject_sculpt_face_sets(Mesh *target, Mesh *source)
{
- BVHTreeFromMesh bvhtree = {
- .nearest_callback = NULL,
- };
+ BVHTreeFromMesh bvhtree = {{nullptr}};
- const MPoly *target_polys = CustomData_get_layer(&target->pdata, CD_MPOLY);
- const MVert *target_verts = CustomData_get_layer(&target->vdata, CD_MVERT);
- const MLoop *target_loops = CustomData_get_layer(&target->ldata, CD_MLOOP);
+ const MPoly *target_polys = (const MPoly *)CustomData_get_layer(&target->pdata, CD_MPOLY);
+ const MVert *target_verts = (const MVert *)CustomData_get_layer(&target->vdata, CD_MVERT);
+ const MLoop *target_loops = (const MLoop *)CustomData_get_layer(&target->ldata, CD_MLOOP);
int *target_face_sets;
if (CustomData_has_layer(&target->pdata, CD_SCULPT_FACE_SETS)) {
- target_face_sets = CustomData_get_layer(&target->pdata, CD_SCULPT_FACE_SETS);
+ target_face_sets = (int *)CustomData_get_layer(&target->pdata, CD_SCULPT_FACE_SETS);
}
else {
- target_face_sets = CustomData_add_layer(
- &target->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, NULL, target->totpoly);
+ target_face_sets = (int *)CustomData_add_layer(
+ &target->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, nullptr, target->totpoly);
}
int *source_face_sets;
if (CustomData_has_layer(&source->pdata, CD_SCULPT_FACE_SETS)) {
- source_face_sets = CustomData_get_layer(&source->pdata, CD_SCULPT_FACE_SETS);
+ source_face_sets = (int *)CustomData_get_layer(&source->pdata, CD_SCULPT_FACE_SETS);
}
else {
- source_face_sets = CustomData_add_layer(
- &source->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, NULL, source->totpoly);
+ source_face_sets = (int *)CustomData_add_layer(
+ &source->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, nullptr, source->totpoly);
}
const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(source);
@@ -403,9 +401,7 @@ void BKE_remesh_reproject_sculpt_face_sets(Mesh *target, Mesh *source)
void BKE_remesh_reproject_vertex_paint(Mesh *target, Mesh *source)
{
- BVHTreeFromMesh bvhtree = {
- .nearest_callback = NULL,
- };
+ BVHTreeFromMesh bvhtree = {{nullptr}};
BKE_bvhtree_from_mesh_get(&bvhtree, source, BVHTREE_FROM_VERTS, 2);
int tot_color_layer = CustomData_number_of_layers(&source->vdata, CD_PROP_COLOR);
@@ -413,11 +409,13 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, Mesh *source)
for (int layer_n = 0; layer_n < tot_color_layer; layer_n++) {
const char *layer_name = CustomData_get_layer_name(&source->vdata, CD_PROP_COLOR, layer_n);
CustomData_add_layer_named(
- &target->vdata, CD_PROP_COLOR, CD_CALLOC, NULL, target->totvert, layer_name);
+ &target->vdata, CD_PROP_COLOR, CD_CALLOC, nullptr, target->totvert, layer_name);
- MPropCol *target_color = CustomData_get_layer_n(&target->vdata, CD_PROP_COLOR, layer_n);
- MVert *target_verts = CustomData_get_layer(&target->vdata, CD_MVERT);
- MPropCol *source_color = CustomData_get_layer_n(&source->vdata, CD_PROP_COLOR, layer_n);
+ MPropCol *target_color = (MPropCol *)CustomData_get_layer_n(
+ &target->vdata, CD_PROP_COLOR, layer_n);
+ MVert *target_verts = (MVert *)CustomData_get_layer(&target->vdata, CD_MVERT);
+ MPropCol *source_color = (MPropCol *)CustomData_get_layer_n(
+ &source->vdata, CD_PROP_COLOR, layer_n);
for (int i = 0; i < target->totvert; i++) {
BVHTreeNearest nearest;
nearest.index = -1;
@@ -436,16 +434,14 @@ struct Mesh *BKE_mesh_remesh_voxel_fix_poles(struct Mesh *mesh)
{
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(mesh);
BMesh *bm;
- bm = BM_mesh_create(&allocsize,
- &((struct BMeshCreateParams){
- .use_toolflags = true,
- }));
- BM_mesh_bm_from_me(bm,
- mesh,
- (&(struct BMeshFromMeshParams){
- .calc_face_normal = true,
- }));
+ BMeshCreateParams bmesh_create_params;
+ bmesh_create_params.use_toolflags = true;
+ bm = BM_mesh_create(&allocsize, &bmesh_create_params);
+
+ BMeshFromMeshParams bmesh_from_mesh_params;
+ bmesh_from_mesh_params.calc_face_normal = true;
+ BM_mesh_bm_from_me(bm, mesh, &bmesh_from_mesh_params);
BMVert *v;
BMEdge *ed, *ed_next;
@@ -456,8 +452,8 @@ struct Mesh *BKE_mesh_remesh_voxel_fix_poles(struct Mesh *mesh)
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
BM_ITER_MESH_MUTABLE (f, f_next, &iter_a, bm, BM_FACES_OF_MESH) {
BMVert *v1, *v2;
- v1 = NULL;
- v2 = NULL;
+ v1 = nullptr;
+ v2 = nullptr;
BM_ITER_ELEM (v, &iter_b, f, BM_VERTS_OF_FACE) {
if (BM_vert_edge_count(v) == 3) {
if (v1) {
@@ -470,7 +466,7 @@ struct Mesh *BKE_mesh_remesh_voxel_fix_poles(struct Mesh *mesh)
}
if (v1 && v2 && (v1 != v2) && !BM_edge_exists(v1, v2)) {
BM_face_kill(bm, f);
- BMEdge *e = BM_edge_create(bm, v1, v2, NULL, BM_CREATE_NOP);
+ BMEdge *e = BM_edge_create(bm, v1, v2, nullptr, BM_CREATE_NOP);
BM_elem_flag_set(e, BM_ELEM_TAG, true);
}
}
@@ -532,13 +528,11 @@ struct Mesh *BKE_mesh_remesh_voxel_fix_poles(struct Mesh *mesh)
BM_ELEM_TAG);
BM_mesh_elem_hflag_disable_all(bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_TAG, false);
- Mesh *result = BKE_mesh_from_bmesh_nomain(bm,
- (&(struct BMeshToMeshParams){
- .calc_object_remap = false,
- }),
- mesh);
+ BMeshToMeshParams bmesh_to_mesh_params;
+ bmesh_to_mesh_params.calc_object_remap = false;
+ Mesh *result = BKE_mesh_from_bmesh_nomain(bm, &bmesh_to_mesh_params, mesh);
- BKE_id_free(NULL, mesh);
+ BKE_id_free(nullptr, mesh);
BM_mesh_free(bm);
return result;
}
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 4338b043fc9..18f2b58eb65 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -56,7 +56,7 @@ set(SRC
object_ops.c
object_random.c
object_relations.c
- object_remesh.c
+ object_remesh.cc
object_select.c
object_shader_fx.c
object_shapekey.c
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 5a3a28b5a3f..6299fdcc7f7 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -303,7 +303,7 @@ void OBJECT_OT_bake(wmOperatorType *ot);
/* object_random.c */
void TRANSFORM_OT_vertex_random(struct wmOperatorType *ot);
-/* object_remesh.c */
+/* object_remesh.cc */
void OBJECT_OT_voxel_remesh(struct wmOperatorType *ot);
void OBJECT_OT_voxel_size_edit(struct wmOperatorType *ot);
void OBJECT_OT_quadriflow_remesh(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.cc
index 05f9980e0ab..6bee04e2b4f 100644
--- a/source/blender/editors/object/object_remesh.c
+++ b/source/blender/editors/object/object_remesh.cc
@@ -21,11 +21,11 @@
* \ingroup edobj
*/
-#include <ctype.h>
-#include <float.h>
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cfloat>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
#include "MEM_guardedalloc.h"
@@ -99,7 +99,7 @@ static bool object_remesh_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
- if (ob == NULL || ob->data == NULL) {
+ if (ob == nullptr || ob->data == nullptr) {
return false;
}
@@ -131,7 +131,7 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
- Mesh *mesh = ob->data;
+ Mesh *mesh = static_cast<Mesh *>(ob->data);
Mesh *new_mesh;
if (mesh->remesh_voxel_size <= 0.0f) {
@@ -193,7 +193,7 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op)
BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, &CD_MASK_MESH, true);
if (smooth_normals) {
- BKE_mesh_smooth_flag_set(ob->data, true);
+ BKE_mesh_smooth_flag_set(static_cast<Mesh *>(ob->data), true);
}
if (ob->mode == OB_MODE_SCULPT) {
@@ -201,7 +201,7 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op)
ED_sculpt_undo_geometry_end(ob);
}
- BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
+ BKE_mesh_batch_cache_dirty_tag(static_cast<Mesh *>(ob->data), BKE_MESH_BATCH_DIRTY_ALL);
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
@@ -233,7 +233,7 @@ void OBJECT_OT_voxel_remesh(wmOperatorType *ot)
#define VOXEL_SIZE_EDIT_MAX_GRIDS_LINES 500
#define VOXEL_SIZE_EDIT_MAX_STR_LEN 20
-typedef struct VoxelSizeEditCustomData {
+struct VoxelSizeEditCustomData {
void *draw_handle;
Object *active_object;
@@ -249,7 +249,7 @@ typedef struct VoxelSizeEditCustomData {
float preview_plane[4][3];
float text_mat[4][4];
-} VoxelSizeEditCustomData;
+};
static void voxel_size_parallel_lines_draw(uint pos3d,
const float initial_co[3],
@@ -300,7 +300,7 @@ static void voxel_size_parallel_lines_draw(uint pos3d,
static void voxel_size_edit_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
{
- VoxelSizeEditCustomData *cd = arg;
+ VoxelSizeEditCustomData *cd = static_cast<VoxelSizeEditCustomData *>(arg);
GPU_blend(GPU_BLEND_ALPHA);
GPU_line_smooth(true);
@@ -378,19 +378,19 @@ static void voxel_size_edit_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar),
static void voxel_size_edit_cancel(bContext *C, wmOperator *op)
{
ARegion *region = CTX_wm_region(C);
- VoxelSizeEditCustomData *cd = op->customdata;
+ VoxelSizeEditCustomData *cd = static_cast<VoxelSizeEditCustomData *>(op->customdata);
ED_region_draw_cb_exit(region->type, cd->draw_handle);
MEM_freeN(op->customdata);
- ED_workspace_status_text(C, NULL);
+ ED_workspace_status_text(C, nullptr);
}
static int voxel_size_edit_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- VoxelSizeEditCustomData *cd = op->customdata;
+ VoxelSizeEditCustomData *cd = static_cast<VoxelSizeEditCustomData *>(op->customdata);
Object *active_object = cd->active_object;
Mesh *mesh = (Mesh *)active_object->data;
@@ -410,11 +410,11 @@ static int voxel_size_edit_modal(bContext *C, wmOperator *op, const wmEvent *eve
mesh->remesh_voxel_size = cd->voxel_size;
MEM_freeN(op->customdata);
ED_region_tag_redraw(region);
- ED_workspace_status_text(C, NULL);
+ ED_workspace_status_text(C, nullptr);
return OPERATOR_FINISHED;
}
- const float mval[2] = {event->mval[0], event->mval[1]};
+ const float mval[2] = {float(event->mval[0]), float(event->mval[1])};
float d = cd->init_mval[0] - mval[0];
@@ -461,8 +461,8 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
Object *active_object = CTX_data_active_object(C);
Mesh *mesh = (Mesh *)active_object->data;
- VoxelSizeEditCustomData *cd = MEM_callocN(sizeof(VoxelSizeEditCustomData),
- "Voxel Size Edit OP Custom Data");
+ VoxelSizeEditCustomData *cd = (VoxelSizeEditCustomData *)MEM_callocN(
+ sizeof(VoxelSizeEditCustomData), "Voxel Size Edit OP Custom Data");
/* Initial operator Custom Data setup. */
cd->draw_handle = ED_region_draw_cb_activate(
@@ -641,13 +641,13 @@ enum {
QUADRIFLOW_REMESH_FACES,
};
-typedef enum eSymmetryAxes {
+enum eSymmetryAxes {
SYMMETRY_AXES_X = (1 << 0),
SYMMETRY_AXES_Y = (1 << 1),
SYMMETRY_AXES_Z = (1 << 2),
-} eSymmetryAxes;
+};
-typedef struct QuadriFlowJob {
+struct QuadriFlowJob {
/* from wmJob */
struct Object *owner;
short *stop, *do_update;
@@ -668,7 +668,7 @@ typedef struct QuadriFlowJob {
int success;
bool is_nonblocking_job;
-} QuadriFlowJob;
+};
static bool mesh_is_manifold_consistent(Mesh *mesh)
{
@@ -723,7 +723,7 @@ static bool mesh_is_manifold_consistent(Mesh *mesh)
static void quadriflow_free_job(void *customdata)
{
- QuadriFlowJob *qj = customdata;
+ QuadriFlowJob *qj = static_cast<QuadriFlowJob *>(customdata);
MEM_freeN(qj);
}
@@ -748,7 +748,7 @@ static int quadriflow_break_job(void *customdata)
/** Called by ocean-bake, #wmJob sends notifier. */
static void quadriflow_update_job(void *customdata, float progress, int *cancel)
{
- QuadriFlowJob *qj = customdata;
+ QuadriFlowJob *qj = static_cast<QuadriFlowJob *>(customdata);
if (quadriflow_break_job(qj)) {
*cancel = 1;
@@ -763,7 +763,7 @@ static void quadriflow_update_job(void *customdata, float progress, int *cancel)
static Mesh *remesh_symmetry_bisect(Mesh *mesh, eSymmetryAxes symmetry_axes)
{
- MirrorModifierData mmd = {{0}};
+ MirrorModifierData mmd = {{nullptr}};
mmd.tolerance = QUADRIFLOW_MIRROR_BISECT_TOLERANCE;
Mesh *mesh_bisect, *mesh_bisect_temp;
@@ -785,19 +785,19 @@ static Mesh *remesh_symmetry_bisect(Mesh *mesh, eSymmetryAxes symmetry_axes)
mesh_bisect = BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(
&mmd, mesh_bisect, axis, plane_co, plane_no);
if (mesh_bisect_temp != mesh_bisect) {
- BKE_id_free(NULL, mesh_bisect_temp);
+ BKE_id_free(nullptr, mesh_bisect_temp);
}
}
}
- BKE_id_free(NULL, mesh);
+ BKE_id_free(nullptr, mesh);
return mesh_bisect;
}
static Mesh *remesh_symmetry_mirror(Object *ob, Mesh *mesh, eSymmetryAxes symmetry_axes)
{
- MirrorModifierData mmd = {{0}};
+ MirrorModifierData mmd = {{nullptr}};
mmd.tolerance = QUADRIFLOW_MIRROR_BISECT_TOLERANCE;
Mesh *mesh_mirror, *mesh_mirror_temp;
@@ -814,7 +814,7 @@ static Mesh *remesh_symmetry_mirror(Object *ob, Mesh *mesh, eSymmetryAxes symmet
mesh_mirror_temp = mesh_mirror;
mesh_mirror = BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(&mmd, ob, mesh_mirror, axis);
if (mesh_mirror_temp != mesh_mirror) {
- BKE_id_free(NULL, mesh_mirror_temp);
+ BKE_id_free(nullptr, mesh_mirror_temp);
}
}
}
@@ -824,7 +824,7 @@ static Mesh *remesh_symmetry_mirror(Object *ob, Mesh *mesh, eSymmetryAxes symmet
static void quadriflow_start_job(void *customdata, short *stop, short *do_update, float *progress)
{
- QuadriFlowJob *qj = customdata;
+ QuadriFlowJob *qj = static_cast<QuadriFlowJob *>(customdata);
qj->stop = stop;
qj->do_update = do_update;
@@ -836,7 +836,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
}
Object *ob = qj->owner;
- Mesh *mesh = ob->data;
+ Mesh *mesh = static_cast<Mesh *>(ob->data);
Mesh *new_mesh;
Mesh *bisect_mesh;
@@ -867,9 +867,9 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
quadriflow_update_job,
(void *)qj);
- BKE_id_free(NULL, bisect_mesh);
+ BKE_id_free(nullptr, bisect_mesh);
- if (new_mesh == NULL) {
+ if (new_mesh == nullptr) {
*do_update = true;
*stop = 0;
if (qj->success == 1) {
@@ -895,9 +895,9 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
if (qj->smooth_normals) {
if (qj->use_mesh_symmetry) {
- BKE_mesh_calc_normals(ob->data);
+ BKE_mesh_calc_normals(static_cast<Mesh *>(ob->data));
}
- BKE_mesh_smooth_flag_set(ob->data, true);
+ BKE_mesh_smooth_flag_set(static_cast<Mesh *>(ob->data), true);
}
if (ob->mode == OB_MODE_SCULPT) {
@@ -905,7 +905,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
ED_sculpt_undo_geometry_end(ob);
}
- BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
+ BKE_mesh_batch_cache_dirty_tag(static_cast<Mesh *>(ob->data), BKE_MESH_BATCH_DIRTY_ALL);
*do_update = true;
*stop = 0;
@@ -913,12 +913,12 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
static void quadriflow_end_job(void *customdata)
{
- QuadriFlowJob *qj = customdata;
+ QuadriFlowJob *qj = (QuadriFlowJob *)customdata;
Object *ob = qj->owner;
if (qj->is_nonblocking_job) {
- WM_set_locked_interface(G_MAIN->wm.first, false);
+ WM_set_locked_interface(static_cast<wmWindowManager *>(G_MAIN->wm.first), false);
}
switch (qj->success) {
@@ -942,7 +942,7 @@ static void quadriflow_end_job(void *customdata)
static int quadriflow_remesh_exec(bContext *C, wmOperator *op)
{
- QuadriFlowJob *job = MEM_mallocN(sizeof(QuadriFlowJob), "QuadriFlowJob");
+ QuadriFlowJob *job = (QuadriFlowJob *)MEM_mallocN(sizeof(QuadriFlowJob), "QuadriFlowJob");
job->owner = CTX_data_active_object(C);
job->scene = CTX_data_scene(C);
@@ -976,7 +976,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator *op)
}
else {
job->use_mesh_symmetry = false;
- job->symmetry_axes = 0;
+ job->symmetry_axes = (eSymmetryAxes)0;
}
if (op->flag == 0) {
@@ -1001,7 +1001,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator *op)
WM_jobs_customdata_set(wm_job, job, quadriflow_free_job);
WM_jobs_timer(wm_job, 0.1, NC_GEOM | ND_DATA, NC_GEOM | ND_DATA);
- WM_jobs_callbacks(wm_job, quadriflow_start_job, NULL, NULL, quadriflow_end_job);
+ WM_jobs_callbacks(wm_job, quadriflow_start_job, nullptr, nullptr, quadriflow_end_job);
WM_set_locked_interface(CTX_wm_manager(C), true);
@@ -1018,7 +1018,7 @@ static bool quadriflow_check(bContext *C, wmOperator *op)
float area = RNA_float_get(op->ptr, "mesh_area");
if (area < 0.0f) {
Object *ob = CTX_data_active_object(C);
- area = BKE_mesh_calc_area(ob->data);
+ area = BKE_mesh_calc_area(static_cast<const Mesh *>(ob->data));
RNA_float_set(op->ptr, "mesh_area", area);
}
int num_faces;
@@ -1029,7 +1029,7 @@ static bool quadriflow_check(bContext *C, wmOperator *op)
}
else if (mode == QUADRIFLOW_REMESH_RATIO) {
Object *ob = CTX_data_active_object(C);
- Mesh *mesh = ob->data;
+ Mesh *mesh = static_cast<Mesh *>(ob->data);
int num_faces;
float ratio = RNA_float_get(op->ptr, "target_ratio");
@@ -1091,7 +1091,7 @@ static const EnumPropertyItem mode_type_items[] = {
"Edge Length",
"Input target edge length in the new mesh"},
{QUADRIFLOW_REMESH_FACES, "FACES", 0, "Faces", "Input target number of faces in the new mesh"},
- {0, NULL, 0, NULL, NULL},
+ {0, nullptr, 0, nullptr, nullptr},
};
void OBJECT_OT_quadriflow_remesh(wmOperatorType *ot)
@@ -1198,7 +1198,7 @@ void OBJECT_OT_quadriflow_remesh(wmOperatorType *ot)
"This property is only used to cache the object area for later calculations",
0.0f,
FLT_MAX);
- RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+ RNA_def_property_flag(prop, static_cast<PropertyFlag>(PROP_HIDDEN | PROP_SKIP_SAVE));
RNA_def_int(ot->srna,
"seed",