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:
authorCampbell Barton <ideasman42@gmail.com>2013-04-14 10:22:34 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-04-14 10:22:34 +0400
commitda5e0ea8fe1cb85c5d0ba3b974a0520a8917ac30 (patch)
treed807b3d44fd7851ed68988e7608d988ea82ef12d /source
parentba283d6c9be1d678210e08233916268f48ef4ee1 (diff)
bmesh operators: use operator type-flag to specify which operations require normal-calculations and which operations require selection flushing.
eg, no need to flush selection after 'Smooth' tool, no need to recalculate normals after 'Select Similar'.
Diffstat (limited to 'source')
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c21
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_opdefines.c148
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api.h17
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c4
-rw-r--r--source/blender/editors/transform/transform.c4
6 files changed, 103 insertions, 95 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index f36ac361550..e06250f1256 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -415,16 +415,16 @@ 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 *UNUSED(bm), int UNUSED(type_flag))
+void bmesh_edit_begin(BMesh *UNUSED(bm), BMOpTypeFlag UNUSED(type_flag))
{
- /* Most operators seem to be using BMO_OP_FLAG_UNTAN_MULTIRES to change the MDisps to
+ /* Most operators seem to be using BMO_OPTYPE_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
* the mesh at all, which doesn't seem right. Turning off completely for now,
* until this is shown to be better for certain types of mesh edits. */
#ifdef BMOP_UNTAN_MULTIRES_ENABLED
/* switch multires data out of tangent space */
- if ((type_flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
+ if ((type_flag & BMO_OPTYPE_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 */
@@ -437,12 +437,12 @@ void bmesh_edit_begin(BMesh *UNUSED(bm), int UNUSED(type_flag))
/**
* \brief BMesh End Edit
*/
-void bmesh_edit_end(BMesh *bm, int UNUSED(flag))
+void bmesh_edit_end(BMesh *bm, BMOpTypeFlag type_flag)
{
- /* BMO_OP_FLAG_UNTAN_MULTIRES disabled for now, see comment above in bmesh_edit_begin. */
+ /* BMO_OPTYPE_FLAG_UNTAN_MULTIRES disabled for now, see comment above in bmesh_edit_begin. */
#ifdef BMOP_UNTAN_MULTIRES_ENABLED
/* switch multires data into tangent space */
- if ((flag & BMO_OP_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
+ if ((flag & BMO_OPTYPE_FLAG_UNTAN_MULTIRES) && CustomData_has_layer(&bm->ldata, CD_MDISPS)) {
/* set normals to their previous winding */
bmesh_rationalize_normals(bm, 1);
bmesh_mdisps_space_set(bm, MULTIRES_SPACE_ABSOLUTE, MULTIRES_SPACE_TANGENT);
@@ -453,8 +453,13 @@ void bmesh_edit_end(BMesh *bm, int UNUSED(flag))
#endif
/* compute normals, clear temp flags and flush selections */
- BM_mesh_normals_update(bm, true);
- BM_mesh_select_mode_flush(bm);
+ if (type_flag & BMO_OPTYPE_FLAG_NORMALS_CALC) {
+ BM_mesh_normals_update(bm, true);
+ }
+
+ if (type_flag & BMO_OPTYPE_FLAG_SELECT_FLUSH) {
+ BM_mesh_select_mode_flush(bm);
+ }
}
void BM_mesh_elem_index_ensure(BMesh *bm, const char hflag)
diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h
index 35ce1859c2b..c3fddf9cc90 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.h
+++ b/source/blender/bmesh/intern/bmesh_mesh.h
@@ -39,8 +39,8 @@ void BM_mesh_clear(BMesh *bm);
void BM_mesh_normals_update(BMesh *bm, const bool skip_hidden);
-void bmesh_edit_begin(BMesh *bm, int type_flag);
-void bmesh_edit_end(BMesh *bm, int type_flag);
+void bmesh_edit_begin(BMesh *bm, const BMOpTypeFlag type_flag);
+void bmesh_edit_end(BMesh *bm, const BMOpTypeFlag 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,
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c
index 9006f3893a2..e68bdd2cc8c 100644
--- a/source/blender/bmesh/intern/bmesh_opdefines.c
+++ b/source/blender/bmesh/intern/bmesh_opdefines.c
@@ -115,7 +115,7 @@ static BMOpDefine bmo_smooth_vert_def = {
},
{{{'\0'}}}, /* no output */
bmo_smooth_vert_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
@@ -138,7 +138,7 @@ static BMOpDefine bmo_smooth_laplacian_vert_def = {
},
{{{'\0'}}}, /* no output */
bmo_smooth_laplacian_vert_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
@@ -155,7 +155,7 @@ static BMOpDefine bmo_recalc_face_normals_def = {
},
{{{'\0'}}}, /* no output */
bmo_recalc_face_normals_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
@@ -181,7 +181,7 @@ static BMOpDefine bmo_region_extend_def = {
{{'\0'}},
},
bmo_region_extend_exec,
- 0
+ BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -202,7 +202,7 @@ static BMOpDefine bmo_rotate_edges_def = {
{{'\0'}},
},
bmo_rotate_edges_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -219,7 +219,7 @@ static BMOpDefine bmo_reverse_faces_def = {
},
{{{'\0'}}}, /* no output */
bmo_reverse_faces_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
@@ -240,7 +240,7 @@ static BMOpDefine bmo_bisect_edges_def = {
{{'\0'}},
},
bmo_bisect_edges_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -266,7 +266,7 @@ static BMOpDefine bmo_mirror_def = {
{{'\0'}},
},
bmo_mirror_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -291,7 +291,7 @@ static BMOpDefine bmo_find_doubles_def = {
{{'\0'}},
},
bmo_find_doubles_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -309,7 +309,7 @@ static BMOpDefine bmo_remove_doubles_def = {
},
{{{'\0'}}}, /* no output */
bmo_remove_doubles_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -328,7 +328,7 @@ static BMOpDefine bmo_automerge_def = {
},
{{{'\0'}}}, /* no output */
bmo_automerge_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -344,7 +344,7 @@ static BMOpDefine bmo_collapse_def = {
},
{{{'\0'}}}, /* no output */
bmo_collapse_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -361,7 +361,7 @@ static BMOpDefine bmo_pointmerge_facedata_def = {
},
{{{'\0'}}}, /* no output */
bmo_pointmerge_facedata_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -379,7 +379,7 @@ static BMOpDefine bmo_average_vert_facedata_def = {
},
{{{'\0'}}}, /* no output */
bmo_average_vert_facedata_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -396,7 +396,7 @@ static BMOpDefine bmo_pointmerge_def = {
},
{{{'\0'}}}, /* no output */
bmo_pointmerge_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -412,7 +412,7 @@ static BMOpDefine bmo_collapse_uvs_def = {
},
{{{'\0'}}}, /* no output */
bmo_collapse_uvs_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -431,7 +431,7 @@ static BMOpDefine bmo_weld_verts_def = {
},
{{{'\0'}}}, /* no output */
bmo_weld_verts_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -451,7 +451,7 @@ static BMOpDefine bmo_create_vert_def = {
{{'\0'}},
},
bmo_create_vert_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -476,7 +476,7 @@ static BMOpDefine bmo_join_triangles_def = {
{{'\0'}},
},
bmo_join_triangles_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -504,7 +504,7 @@ static BMOpDefine bmo_contextual_create_def = {
{{'\0'}},
},
bmo_contextual_create_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -523,7 +523,7 @@ static BMOpDefine bmo_bridge_loops_def = {
{{'\0'}},
},
bmo_bridge_loops_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -546,7 +546,7 @@ static BMOpDefine bmo_edgeloop_fill_def = {
{{'\0'}},
},
bmo_edgeloop_fill_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
@@ -575,7 +575,7 @@ static BMOpDefine bmo_edgenet_fill_def = {
{{'\0'}},
},
bmo_edgenet_fill_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -599,7 +599,7 @@ static BMOpDefine bmo_edgenet_prepare_def = {
{{'\0'}},
},
bmo_edgenet_prepare_exec,
- 0,
+ BMO_OPTYPE_FLAG_NOP,
};
/*
@@ -617,7 +617,7 @@ static BMOpDefine bmo_rotate_def = {
},
{{{'\0'}}}, /* no output */
bmo_rotate_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
@@ -634,7 +634,7 @@ static BMOpDefine bmo_translate_def = {
},
{{{'\0'}}}, /* no output */
bmo_translate_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
@@ -651,7 +651,7 @@ static BMOpDefine bmo_scale_def = {
},
{{{'\0'}}}, /* no output */
bmo_scale_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC,
};
@@ -670,7 +670,7 @@ static BMOpDefine bmo_transform_def = {
},
{{{'\0'}}}, /* no output */
bmo_transform_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC,
};
/*
@@ -688,7 +688,7 @@ static BMOpDefine bmo_object_load_bmesh_def = {
},
{{{'\0'}}}, /* no output */
bmo_object_load_bmesh_exec,
- 0,
+ BMO_OPTYPE_FLAG_NOP,
};
@@ -710,7 +710,7 @@ static BMOpDefine bmo_bmesh_to_mesh_def = {
},
{{{'\0'}}}, /* no output */
bmo_bmesh_to_mesh_exec,
- 0,
+ BMO_OPTYPE_FLAG_NOP,
};
/*
@@ -732,7 +732,7 @@ static BMOpDefine bmo_mesh_to_bmesh_def = {
},
{{{'\0'}}}, /* no output */
bmo_mesh_to_bmesh_exec,
- 0
+ BMO_OPTYPE_FLAG_NOP,
};
/*
@@ -751,7 +751,7 @@ static BMOpDefine bmo_extrude_discrete_faces_def = {
{{'\0'}},
},
bmo_extrude_discrete_faces_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -771,7 +771,7 @@ static BMOpDefine bmo_extrude_edge_only_def = {
{{'\0'}},
},
bmo_extrude_edge_only_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -791,7 +791,7 @@ static BMOpDefine bmo_extrude_vert_indiv_def = {
{{'\0'}},
},
bmo_extrude_vert_indiv_exec,
- 0
+ BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -810,7 +810,7 @@ static BMOpDefine bmo_connect_verts_def = {
{{'\0'}},
},
bmo_connect_verts_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -831,7 +831,7 @@ static BMOpDefine bmo_extrude_face_region_def = {
{{'\0'}},
},
bmo_extrude_face_region_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -845,7 +845,7 @@ static BMOpDefine bmo_dissolve_verts_def = {
},
{{{'\0'}}}, /* no output */
bmo_dissolve_verts_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -863,7 +863,7 @@ static BMOpDefine bmo_dissolve_edges_def = {
{{'\0'}},
},
bmo_dissolve_edges_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -880,7 +880,7 @@ static BMOpDefine bmo_dissolve_edge_loop_def = {
{{'\0'}},
},
bmo_dissolve_edgeloop_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -898,7 +898,7 @@ static BMOpDefine bmo_dissolve_faces_def = {
{{'\0'}},
},
bmo_dissolve_faces_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -917,7 +917,7 @@ static BMOpDefine bmo_dissolve_limit_def = {
},
{{{'\0'}}}, /* no output */
bmo_dissolve_limit_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -937,7 +937,7 @@ static BMOpDefine bmo_triangulate_def = {
{{'\0'}},
},
bmo_triangulate_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -954,7 +954,7 @@ static BMOpDefine bmo_unsubdivide_def = {
},
{{{'\0'}}}, /* no output */
bmo_unsubdivide_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -990,7 +990,7 @@ static BMOpDefine bmo_subdivide_edges_def = {
{{'\0'}},
},
bmo_subdivide_edges_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1007,7 +1007,7 @@ static BMOpDefine bmo_delete_def = {
},
{{{'\0'}}}, /* no output */
bmo_delete_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1035,7 +1035,7 @@ static BMOpDefine bmo_duplicate_def = {
{{'\0'}},
},
bmo_duplicate_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1060,7 +1060,7 @@ static BMOpDefine bmo_split_def = {
{{'\0'}},
},
bmo_split_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1086,7 +1086,7 @@ static BMOpDefine bmo_spin_def = {
{{'\0'}},
},
bmo_spin_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
@@ -1109,7 +1109,7 @@ static BMOpDefine bmo_similar_faces_def = {
{{'\0'}},
},
bmo_similar_faces_exec,
- 0
+ BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1131,7 +1131,7 @@ static BMOpDefine bmo_similar_edges_def = {
{{'\0'}},
},
bmo_similar_edges_exec,
- 0
+ BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1153,7 +1153,7 @@ static BMOpDefine bmo_similar_verts_def = {
{{'\0'}},
},
bmo_similar_verts_exec,
- 0
+ BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1171,7 +1171,7 @@ static BMOpDefine bmo_rotate_uvs_def = {
/* slots_out */
{{{'\0'}}}, /* no output */
bmo_rotate_uvs_exec,
- 0
+ BMO_OPTYPE_FLAG_NOP,
};
/*
@@ -1187,7 +1187,7 @@ static BMOpDefine bmo_reverse_uvs_def = {
},
{{{'\0'}}}, /* no output */
bmo_reverse_uvs_exec,
- 0
+ BMO_OPTYPE_FLAG_NOP,
};
/*
@@ -1204,7 +1204,7 @@ static BMOpDefine bmo_rotate_colors_def = {
},
{{{'\0'}}}, /* no output */
bmo_rotate_colors_exec,
- 0
+ BMO_OPTYPE_FLAG_NOP,
};
/*
@@ -1220,7 +1220,7 @@ static BMOpDefine bmo_reverse_colors_def = {
},
{{{'\0'}}}, /* no output */
bmo_reverse_colors_exec,
- 0
+ BMO_OPTYPE_FLAG_NOP,
};
/*
@@ -1241,7 +1241,7 @@ static BMOpDefine bmo_shortest_path_def = {
{{'\0'}},
},
bmo_shortest_path_exec,
- 0
+ BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1263,7 +1263,7 @@ static BMOpDefine bmo_split_edges_def = {
{{'\0'}},
},
bmo_split_edges_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1285,7 +1285,7 @@ static BMOpDefine bmo_create_grid_def = {
{{'\0'}},
},
bmo_create_grid_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1307,7 +1307,7 @@ static BMOpDefine bmo_create_uvsphere_def = {
{{'\0'}},
},
bmo_create_uvsphere_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1328,7 +1328,7 @@ static BMOpDefine bmo_create_icosphere_def = {
{{'\0'}},
},
bmo_create_icosphere_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1347,7 +1347,7 @@ static BMOpDefine bmo_create_monkey_def = {
{{'\0'}},
},
bmo_create_monkey_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1372,7 +1372,7 @@ static BMOpDefine bmo_create_cone_def = {
{{'\0'}},
},
bmo_create_cone_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1393,7 +1393,7 @@ static BMOpDefine bmo_create_circle_def = {
{{'\0'}},
},
bmo_create_circle_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1413,7 +1413,7 @@ static BMOpDefine bmo_create_cube_def = {
{{'\0'}},
},
bmo_create_cube_exec,
- 0,
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1436,7 +1436,7 @@ static BMOpDefine bmo_bevel_def = {
},
bmo_bevel_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1456,7 +1456,7 @@ static BMOpDefine bmo_beautify_fill_def = {
{{'\0'}},
},
bmo_beautify_fill_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1476,7 +1476,7 @@ static BMOpDefine bmo_triangle_fill_def = {
{{'\0'}},
},
bmo_triangle_fill_exec,
- BMO_OP_FLAG_UNTAN_MULTIRES
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1496,7 +1496,7 @@ static BMOpDefine bmo_solidify_def = {
{{'\0'}},
},
bmo_solidify_face_region_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1519,7 +1519,7 @@ static BMOpDefine bmo_inset_individual_def = {
{{'\0'}},
},
bmo_inset_individual_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1545,7 +1545,7 @@ static BMOpDefine bmo_inset_region_def = {
{{'\0'}},
},
bmo_inset_region_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1570,7 +1570,7 @@ static BMOpDefine bmo_wireframe_def = {
{{'\0'}},
},
bmo_wireframe_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
/*
@@ -1593,7 +1593,7 @@ static BMOpDefine bmo_poke_def = {
{{'\0'}},
},
bmo_poke_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
#ifdef WITH_BULLET
@@ -1627,7 +1627,7 @@ static BMOpDefine bmo_convex_hull_def = {
{{'\0'}},
},
bmo_convex_hull_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
#endif
@@ -1653,7 +1653,7 @@ static BMOpDefine bmo_symmetrize_def = {
{{'\0'}},
},
bmo_symmetrize_exec,
- 0
+ BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH,
};
const BMOpDefine *bmo_opdefines[] = {
diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h
index c72accbc605..ccc90172d7a 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api.h
@@ -178,13 +178,21 @@ typedef struct BMOpSlot {
/* way more than probably needed, compiler complains if limit hit */
#define BMO_OP_MAX_SLOTS 16
+/* BMOpDefine->type_flag */
+typedef enum {
+ BMO_OPTYPE_FLAG_NOP = 0,
+ BMO_OPTYPE_FLAG_UNTAN_MULTIRES = (1 << 0), /* switch from multires tangent space to absolute coordinates */
+ BMO_OPTYPE_FLAG_NORMALS_CALC = (1 << 1), /*switch from multires tangent space to absolute coordinates*/
+ BMO_OPTYPE_FLAG_SELECT_FLUSH = (1 << 2) /*switch from multires tangent space to absolute coordinates*/
+} BMOpTypeFlag;
+
typedef struct BMOperator {
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS];
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS];
void (*exec)(BMesh *bm, struct BMOperator *op);
struct MemArena *arena;
int type;
- int type_flag;
+ BMOpTypeFlag type_flag;
int flag; /* runtime options */
} BMOperator;
@@ -207,14 +215,9 @@ typedef struct BMOpDefine {
BMOSlotType slot_types_in[BMO_OP_MAX_SLOTS];
BMOSlotType slot_types_out[BMO_OP_MAX_SLOTS];
void (*exec)(BMesh *bm, BMOperator *op);
- int type_flag;
+ BMOpTypeFlag type_flag;
} BMOpDefine;
-/* BMOpDefine->type_flag */
-enum {
- BMO_OP_FLAG_UNTAN_MULTIRES = 1 /*switch from multires tangent space to absolute coordinates*/
-};
-
/*------------- Operator API --------------*/
/* data types that use pointers (arrays, etc) should never
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 063ad46b996..69deafabc42 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1969,7 +1969,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
int i, j, k = 0, totface = bm->totface;
BMO_push(bm, NULL);
- bmesh_edit_begin(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
+ bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH);
/* BMESH_TODO this should be valid now, leaving here until we can ensure this - campbell */
i = 0;
@@ -2204,7 +2204,7 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
BMO_error_clear(bm); /* remerge_faces sometimes raises errors, so make sure to clear them */
- bmesh_edit_end(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
+ bmesh_edit_end(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES | BMO_OPTYPE_FLAG_NORMALS_CALC | BMO_OPTYPE_FLAG_SELECT_FLUSH);
BMO_pop(bm);
}
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index bf4baf9ea22..a0e2b16218d 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -5449,7 +5449,7 @@ static int createEdgeSlideVerts(TransInfo *t)
}
}
- bmesh_edit_begin(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
+ bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
/*create copies of faces for customdata projection*/
sv_array = sld->sv;
@@ -5725,7 +5725,7 @@ void freeEdgeSlideVerts(TransInfo *t)
freeEdgeSlideTempFaces(sld);
- bmesh_edit_end(sld->em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
+ bmesh_edit_end(sld->em->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
BLI_smallhash_release(&sld->vhash);