remove BMO_OP_FLAG_RATIONALIZE_NORMALS option which wasnt used anywhere.
This commit is contained in:
parent
90d215535e
commit
d9fcbe2f59
@ -198,8 +198,6 @@ typedef struct BMesh {
|
||||
ListBase errorstack;
|
||||
|
||||
void *py_handle;
|
||||
|
||||
int opflag; /* current operator flag */
|
||||
} BMesh;
|
||||
|
||||
/* BMHeader->htype (char) */
|
||||
|
@ -290,47 +290,6 @@ void BM_mesh_normals_update(BMesh *bm, const short skip_hidden)
|
||||
MEM_freeN(edgevec);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function ensures correct normals for the mesh, but
|
||||
* sets the flag BM_ELEM_TAG in flipped faces, to allow restoration
|
||||
* of original normals.
|
||||
*
|
||||
* if undo is 0: calculate right normals
|
||||
* if undo is 1: restore original normals
|
||||
*/
|
||||
|
||||
//keep in sycn with utils.c!
|
||||
#define FACE_FLIP 8
|
||||
static void bm_rationalize_normals(BMesh *bm, int undo)
|
||||
{
|
||||
BMOperator bmop;
|
||||
BMFace *f;
|
||||
BMIter iter;
|
||||
|
||||
if (undo) {
|
||||
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
|
||||
if (BM_elem_flag_test(f, BM_ELEM_TAG)) {
|
||||
BM_face_normal_flip(bm, f);
|
||||
}
|
||||
BM_elem_flag_disable(f, BM_ELEM_TAG);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
BMO_op_initf(bm, &bmop, BMO_FLAG_DEFAULTS, "recalc_face_normals faces=%af do_flip=%b", FALSE);
|
||||
|
||||
BMO_push(bm, &bmop);
|
||||
bmo_recalc_face_normals_exec(bm, &bmop);
|
||||
|
||||
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
|
||||
BM_elem_flag_set(f, BM_ELEM_TAG, BMO_elem_flag_test(bm, f, FACE_FLIP));
|
||||
}
|
||||
|
||||
BMO_pop(bm);
|
||||
BMO_op_finish(bm, &bmop);
|
||||
}
|
||||
|
||||
static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from, int to)
|
||||
{
|
||||
/* switch multires data out of tangent space */
|
||||
@ -390,10 +349,8 @@ static void UNUSED_FUNCTION(bm_mdisps_space_set)(Object *ob, BMesh *bm, int from
|
||||
* the editing operations are done. These are called by the tools/operator
|
||||
* API for each time a tool is executed.
|
||||
*/
|
||||
void bmesh_edit_begin(BMesh *bm, int flag)
|
||||
void bmesh_edit_begin(BMesh *UNUSED(bm), int UNUSED(type_flag))
|
||||
{
|
||||
bm->opflag = flag;
|
||||
|
||||
/* Most operators seem to be using BMO_OP_FLAG_UNTAN_MULTIRES to change the MDisps to
|
||||
* absolute space during mesh edits. With this enabled, changes to the topology
|
||||
* (loop cuts, edge subdivides, etc) are not reflected in the higher levels of
|
||||
@ -401,27 +358,20 @@ void bmesh_edit_begin(BMesh *bm, int flag)
|
||||
* until this is shown to be better for certain types of mesh edits. */
|
||||
#if BMOP_UNTAN_MULTIRES_ENABLED
|
||||
/* switch multires data out of tangent space */
|
||||
if ((flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
|
||||
if ((type_flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
|
||||
bmesh_mdisps_space_set(bm, MULTIRES_SPACE_TANGENT, MULTIRES_SPACE_ABSOLUTE);
|
||||
|
||||
/* ensure correct normals, if possible */
|
||||
bmesh_rationalize_normals(bm, 0);
|
||||
BM_mesh_normals_update(bm);
|
||||
}
|
||||
else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
|
||||
bmesh_rationalize_normals(bm, 0);
|
||||
}
|
||||
#else
|
||||
if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
|
||||
bm_rationalize_normals(bm, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief BMesh End Edit
|
||||
*/
|
||||
void bmesh_edit_end(BMesh *bm, int flag)
|
||||
void bmesh_edit_end(BMesh *bm, int UNUSED(flag))
|
||||
{
|
||||
/* BMO_OP_FLAG_UNTAN_MULTIRES disabled for now, see comment above in bmesh_edit_begin. */
|
||||
#if BMOP_UNTAN_MULTIRES_ENABLED
|
||||
@ -434,14 +384,8 @@ void bmesh_edit_end(BMesh *bm, int flag)
|
||||
else if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
|
||||
bmesh_rationalize_normals(bm, 1);
|
||||
}
|
||||
#else
|
||||
if (flag & BMO_OP_FLAG_RATIONALIZE_NORMALS) {
|
||||
bm_rationalize_normals(bm, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
bm->opflag = 0;
|
||||
|
||||
/* compute normals, clear temp flags and flush selections */
|
||||
BM_mesh_normals_update(bm, TRUE);
|
||||
BM_mesh_select_mode_flush(bm);
|
||||
|
@ -37,8 +37,8 @@ void BM_mesh_clear(BMesh *bm);
|
||||
|
||||
void BM_mesh_normals_update(BMesh *bm, const short skip_hidden);
|
||||
|
||||
void bmesh_edit_begin(BMesh *bm, int flag);
|
||||
void bmesh_edit_end(BMesh *bm, int flag);
|
||||
void bmesh_edit_begin(BMesh *bm, int type_flag);
|
||||
void bmesh_edit_end(BMesh *bm, int type_flag);
|
||||
|
||||
void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag);
|
||||
void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *func,
|
||||
|
@ -162,14 +162,10 @@ typedef struct BMOpDefine {
|
||||
int type_flag;
|
||||
} BMOpDefine;
|
||||
|
||||
/* BMOpDefine->flag */
|
||||
#define BMO_OP_FLAG_UNTAN_MULTIRES 1 /*switch from multires tangent space to absolute coordinates*/
|
||||
|
||||
/* ensures consistent normals before operator execution,
|
||||
* restoring the original ones windings/normals afterwards.
|
||||
* keep in mind, this won't work if the input mesh isn't
|
||||
* manifold.*/
|
||||
#define BMO_OP_FLAG_RATIONALIZE_NORMALS 2
|
||||
/* BMOpDefine->type_flag */
|
||||
enum {
|
||||
BMO_OP_FLAG_UNTAN_MULTIRES = 1 /*switch from multires tangent space to absolute coordinates*/
|
||||
};
|
||||
|
||||
/*------------- Operator API --------------*/
|
||||
|
||||
|
@ -174,11 +174,11 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
|
||||
BMO_push(bm, op);
|
||||
|
||||
if (bm->stackdepth == 2)
|
||||
bmesh_edit_begin(bm, op->flag);
|
||||
bmesh_edit_begin(bm, op->type_flag);
|
||||
op->exec(bm, op);
|
||||
|
||||
if (bm->stackdepth == 2)
|
||||
bmesh_edit_end(bm, op->flag);
|
||||
bmesh_edit_end(bm, op->type_flag);
|
||||
|
||||
BMO_pop(bm);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user