diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-23 08:17:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-23 08:17:29 +0300 |
commit | 2f472ccd60f37ad9adcd388575e88bcf78336074 (patch) | |
tree | 4a10ed79ac6b96b2456e61025fa6cde2f50ce618 | |
parent | 0a7fecac8f967150d736e3b99d469179b7290f45 (diff) |
add back 2.4x mesh vertex sort/randomize operators, were called xsort and hash in 2.4x.
available from vertex menu.
-rw-r--r-- | release/scripts/ui/space_view3d.py | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 48 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 4 |
4 files changed, 56 insertions, 0 deletions
diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index e6d546dda22..69dfb7c99a9 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -1507,6 +1507,8 @@ class VIEW3D_MT_edit_mesh_vertices(bpy.types.Menu): layout.operator("mesh.vertices_smooth") layout.operator("mesh.remove_doubles") + layout.operator("mesh.vertices_sort") + layout.operator("mesh.vertices_randomize") layout.operator("mesh.select_vertex_path") diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 24c4e887ecc..4a0b1cb9e5e 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -563,6 +563,29 @@ static void xsortvert_flag(bContext *C, int flag) } +static int mesh_vertices_sort_exec(bContext *C, wmOperator *UNUSED(op)) +{ + xsortvert_flag(C, SELECT); + return OPERATOR_FINISHED; +} + +void MESH_OT_vertices_sort(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Vertex Sort"; + ot->description= "Sort vertex order"; + ot->idname= "MESH_OT_vertices_sort"; + + /* api callbacks */ + ot->exec= mesh_vertices_sort_exec; + + ot->poll= EM_view3d_poll; /* uses view relative X axis to sort verts */ + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + + /* called from buttons */ static void hashvert_flag(EditMesh *em, int flag) { @@ -621,6 +644,31 @@ static void hashvert_flag(EditMesh *em, int flag) } +static int mesh_vertices_randomize_exec(bContext *C, wmOperator *UNUSED(op)) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + hashvert_flag(em, SELECT); + return OPERATOR_FINISHED; +} + +void MESH_OT_vertices_randomize(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Vertex Randomize"; + ot->description= "Randomize vertex order"; + ot->idname= "MESH_OT_vertices_randomize"; + + /* api callbacks */ + ot->exec= mesh_vertices_randomize_exec; + + ot->poll= ED_operator_editmesh; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + + /* generic extern called extruder */ static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short type) { diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 1a9fdcea992..9fea30fab98 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -205,6 +205,8 @@ int EdgeSlide(EditMesh *em, struct wmOperator *op, short immediate, float imperc void MESH_OT_merge(struct wmOperatorType *ot); void MESH_OT_subdivide(struct wmOperatorType *ot); void MESH_OT_remove_doubles(struct wmOperatorType *ot); +void MESH_OT_vertices_randomize(struct wmOperatorType *ot); +void MESH_OT_vertices_sort(struct wmOperatorType *ot); void MESH_OT_extrude(struct wmOperatorType *ot); void MESH_OT_spin(struct wmOperatorType *ot); void MESH_OT_screw(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index f144ae60518..639fdd7c119 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -86,6 +86,8 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_fgon_make); WM_operatortype_append(MESH_OT_duplicate); WM_operatortype_append(MESH_OT_remove_doubles); + WM_operatortype_append(MESH_OT_vertices_sort); + WM_operatortype_append(MESH_OT_vertices_randomize); WM_operatortype_append(MESH_OT_extrude); WM_operatortype_append(MESH_OT_spin); WM_operatortype_append(MESH_OT_screw); @@ -146,6 +148,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_select_nth); } +#if 0 /* UNUSED, remove? */ static int ED_operator_editmesh_face_select(bContext *C) { Object *obedit= CTX_data_edit_object(C); @@ -157,6 +160,7 @@ static int ED_operator_editmesh_face_select(bContext *C) } return 0; } +#endif void ED_operatormacros_mesh(void) { |