diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-08 20:17:47 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-08 20:17:47 +0400 |
commit | eacb31dbb2f9a181f01d2b1138754cdea386c80f (patch) | |
tree | 78f27d4fbd1f2a5a4a4e419360f6e980cb3d52b4 /source/blender/editors/mesh | |
parent | 5e749af4295ba3120cd882f6e35b49a80292915e (diff) |
2.5: code consistency
* Rename BIF_transform/retopo.h to ED_transform/retopo.h
for consistency.
* Move MESH_OT_duplicate_add to editmesh_add.c.
* Remove some code from BIF_gl.h which is not needed there
anymore.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 53 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 45 |
5 files changed, 60 insertions, 52 deletions
diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index 3ac6a1778db..e2ccd0976d2 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -74,12 +74,12 @@ #include "LBM_fluidsim.h" -#include "BIF_retopo.h" #include "ED_mesh.h" #include "ED_object.h" -#include "ED_util.h" +#include "ED_retopo.h" #include "ED_screen.h" +#include "ED_util.h" #include "ED_view3d.h" #include "RNA_access.h" diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index abbbb5aea3d..942ad657992 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -61,15 +61,15 @@ #include "BKE_utildefines.h" #include "BKE_report.h" -#include "BIF_retopo.h" - #include "WM_api.h" #include "WM_types.h" #include "ED_mesh.h" +#include "ED_retopo.h" +#include "ED_screen.h" +#include "ED_transform.h" #include "ED_util.h" #include "ED_view3d.h" -#include "ED_screen.h" #include "mesh_intern.h" @@ -1659,3 +1659,50 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) RNA_def_float(ot->srna, "size", 1.0f, 0.0f, FLT_MAX, "Size", "", 0.001f, 100.00); } +/****************** add duplicate operator ***************/ + +static int mesh_add_duplicate_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh(ob->data); + + adduplicateflag(em, SELECT); + + BKE_mesh_end_editmesh(ob->data, em); + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob); + + return OPERATOR_FINISHED; +} + +static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + WM_cursor_wait(1); + mesh_add_duplicate_exec(C, op); + WM_cursor_wait(0); + + RNA_int_set(op->ptr, "mode", TFM_TRANSLATION); + WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr); + + return OPERATOR_FINISHED; +} + +void MESH_OT_duplicate_add(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name= "Add Duplicate"; + ot->idname= "MESH_OT_duplicate_add"; + + /* api callbacks */ + ot->invoke= mesh_add_duplicate_invoke; + ot->exec= mesh_add_duplicate_exec; + + ot->poll= ED_operator_editmesh; + + /* to give to transform */ + RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX); +} + diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 2c3007d00ad..00cd187a23c 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -83,10 +83,10 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise #include "WM_types.h" #include "ED_mesh.h" -#include "ED_view3d.h" -#include "ED_util.h" #include "ED_screen.h" -#include "BIF_transform.h" +#include "ED_transform.h" +#include "ED_util.h" +#include "ED_view3d.h" #include "UI_interface.h" diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index ff07d03313b..4d71ddbd647 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -82,8 +82,10 @@ void MESH_OT_primitive_grid_add(struct wmOperatorType *ot); void MESH_OT_primitive_monkey_add(struct wmOperatorType *ot); void MESH_OT_primitive_uv_sphere_add(struct wmOperatorType *ot); void MESH_OT_primitive_ico_sphere_add(struct wmOperatorType *ot); -void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot); + void MESH_OT_edge_face_add(struct wmOperatorType *ot); +void MESH_OT_dupli_extrude_cursor(struct wmOperatorType *ot); +void MESH_OT_duplicate_add(struct wmOperatorType *ot); void MESH_OT_fgon_make(struct wmOperatorType *ot); void MESH_OT_fgon_clear(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 7e59cd684ba..64fcfb681ed 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -54,55 +54,14 @@ #include "WM_api.h" #include "WM_types.h" -#include "ED_screen.h" #include "ED_mesh.h" +#include "ED_screen.h" +#include "ED_transform.h" #include "ED_view3d.h" -#include "BIF_transform.h" - #include "mesh_intern.h" -static int mesh_add_duplicate_exec(bContext *C, wmOperator *op) -{ - Object *ob= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh(ob->data); - - adduplicateflag(em, SELECT); - - BKE_mesh_end_editmesh(ob->data, em); - return OPERATOR_FINISHED; -} - -static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - WM_cursor_wait(1); - mesh_add_duplicate_exec(C, op); - WM_cursor_wait(0); - - RNA_int_set(op->ptr, "mode", TFM_TRANSLATION); - WM_operator_name_call(C, "TFM_OT_transform", WM_OP_INVOKE_REGION_WIN, op->ptr); - - return OPERATOR_FINISHED; -} - -static void MESH_OT_duplicate_add(wmOperatorType *ot) -{ - - /* identifiers */ - ot->name= "Add Duplicate"; - ot->idname= "MESH_OT_duplicate_add"; - - /* api callbacks */ - ot->invoke= mesh_add_duplicate_invoke; - ot->exec= mesh_add_duplicate_exec; - - ot->poll= ED_operator_editmesh; - - /* to give to transform */ - RNA_def_int(ot->srna, "mode", TFM_TRANSLATION, 0, INT_MAX, "Mode", "", 0, INT_MAX); -} - /* ************************** registration **********************************/ |