Page MenuHome
Paste P1117

(An Untitled Masterwork)
ActivePublic

Authored by Jeroen Bakker (jbakker) on Sep 25 2019, 9:28 AM.
diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c
index 8eb85a87acb..5fc436165cd 100644
--- a/source/blender/editors/object/object_remesh.c
+++ b/source/blender/editors/object/object_remesh.c
@@ -173,6 +173,11 @@ enum {
/****************** quadriflow remesh operator *********************/
#define QUADRIFLOW_MIRROR_BISECT_TOLERANCE 0.005f
+typedef enum eSymmetryAxes {
+ SYMMETRY_AXES_X = (1 << 0),
+ SYMMETRY_AXES_Y = (1 << 1),
+ SYMMETRY_AXES_Z = (1 << 2),
+} eSymmetryAxes;
typedef struct QuadriFlowJob {
/* from wmJob */
@@ -184,7 +189,7 @@ typedef struct QuadriFlowJob {
int target_faces;
int seed;
bool use_paint_symmetry;
- char symm;
+ eSymmetryAxes symmetry_axes;
:...skipping...
diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c
index 8eb85a87acb..5fc436165cd 100644
--- a/source/blender/editors/object/object_remesh.c
+++ b/source/blender/editors/object/object_remesh.c
@@ -173,6 +173,11 @@ enum {
/****************** quadriflow remesh operator *********************/
#define QUADRIFLOW_MIRROR_BISECT_TOLERANCE 0.005f
+typedef enum eSymmetryAxes {
+ SYMMETRY_AXES_X = (1 << 0),
+ SYMMETRY_AXES_Y = (1 << 1),
+ SYMMETRY_AXES_Z = (1 << 2),
+} eSymmetryAxes;
typedef struct QuadriFlowJob {
/* from wmJob */
@@ -184,7 +189,7 @@ typedef struct QuadriFlowJob {
int target_faces;
int seed;
bool use_paint_symmetry;
- char symm;
+ eSymmetryAxes symmetry_axes;
bool use_preserve_sharp;
bool use_preserve_boundary;
@@ -236,7 +241,7 @@ static void quadriflow_update_job(void *customdata, float progress, int *cancel)
*(qj->progress) = progress;
}
-static Mesh *remesh_symmetry_bisect(Main *bmain, Mesh *mesh, char symm)
+static Mesh *remesh_symmetry_bisect(Main *bmain, Mesh *mesh, eSymmetryAxes symmetry_axes)
{
MirrorModifierData mmd = {0};
mmd.tolerance = QUADRIFLOW_MIRROR_BISECT_TOLERANCE;
@@ -249,8 +254,8 @@ static Mesh *remesh_symmetry_bisect(Main *bmain, Mesh *mesh, char symm)
zero_v3(plane_co);
for (char i = 0; i < 3; i++) {
- char symm_it = 1 << i;
- if (symm & symm_it) {
+ eSymmetryAxes symm_it = (eSymmetryAxes)(1 << i);
+ if (symmetry_axes & symm_it) {
axis = i;
mmd.flag = 0;
mmd.flag &= MOD_MIR_BISECT_AXIS_X << i;
@@ -317,7 +322,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
bisect_mesh = BKE_mesh_copy(qj->bmain, mesh);
/* Bisect the input mesh using the paint symmetry settings */
- bisect_mesh = remesh_symmetry_bisect(qj->bmain, bisect_mesh, qj->symm);
+ bisect_mesh = remesh_symmetry_bisect(qj->bmain, bisect_mesh, qj->symmetry_axes);
new_mesh = BKE_mesh_remesh_quadriflow_to_mesh_nomain(bisect_mesh,
qj->target_faces,
@@ -343,7 +348,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
/* Mirror the Quadriflow result to build the final mesh */
if (new_mesh) {
- new_mesh = remesh_symmetry_mirror(qj->owner, new_mesh, qj->symm);
+ new_mesh = remesh_symmetry_mirror(qj->owner, new_mesh, qj->symmetry_axes);
}
if (ob->mode == OB_MODE_SCULPT) {
@@ -426,17 +431,17 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator *op)
/* Update the target face count if symmetry is enabled */
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
if (sd && job->use_paint_symmetry) {
- job->symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL;
+ job->symmetry_axes = (eSymmetryAxes)(sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL);
for (char i = 0; i < 3; i++) {
- char symm_it = 1 << i;
- if (job->symm & symm_it) {
+ eSymmetryAxes symm_it = (eSymmetryAxes)(1 << i);
+ if (job->symmetry_axes & symm_it) {
job->target_faces = job->target_faces / 2;
}
}
}
else {
job->use_paint_symmetry = false;
- job->symm = 0;
+ job->symmetry_axes = 0;
}
wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C),