diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-09 01:31:28 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-09 01:31:28 +0400 |
commit | 51ae88aa3b84565d79ab8819807f90aa3844479a (patch) | |
tree | 355d3ef7ac873c259321c574e6fcea82b4585087 | |
parent | 288bfeea1ed8435cfa22938346afbabb7e91bdbb (diff) |
2.5: Mesh and Various Fixes
* 3D view Mesh menu works again, but incomplete.
* Add Properties and Toolbar to 3D View menu.
* Added "specials" menus back, vertex/edge/face and general.
* Various fixes in existing mesh operators, some were not working.
* Add MESH_OT_merge.
* Merge all subdivide ops into MESH_OT_subdivide, subdivide code
changes to make smooth + multi give good results.
* Rename all select inverse ops to *_OT_select_inverse.
* Fix "search for unknown operator" prints at startup, and some
warnings in py code.
* Don't run .pyc files on startup.
* Remove unused image window header C code.
36 files changed, 745 insertions, 1804 deletions
diff --git a/release/ui/space_image.py b/release/ui/space_image.py index 53563e76154..ce8257203dc 100644 --- a/release/ui/space_image.py +++ b/release/ui/space_image.py @@ -13,7 +13,7 @@ class IMAGE_MT_view(bpy.types.Menu): show_uvedit = sima.show_uvedit - layout.itemO("IMAGE_OT_properties") # icon + layout.itemO("IMAGE_OT_properties", icon="ICON_MENU_PANEL") layout.itemS() @@ -55,7 +55,7 @@ class IMAGE_MT_select(bpy.types.Menu): layout.itemS() layout.itemO("UV_OT_select_all_toggle") - layout.itemO("UV_OT_select_invert") + layout.itemO("UV_OT_select_inverse") layout.itemO("UV_OT_unlink_selection") layout.itemS() diff --git a/release/ui/space_sequencer.py b/release/ui/space_sequencer.py index 99366a9099f..4f37ce6be45 100644 --- a/release/ui/space_sequencer.py +++ b/release/ui/space_sequencer.py @@ -119,7 +119,7 @@ class SEQUENCER_MT_select(bpy.types.Menu): layout.itemS() layout.itemO("SEQUENCER_OT_select_linked") layout.itemO("SEQUENCER_OT_select_all_toggle") - layout.itemO("SEQUENCER_OT_select_invert") + layout.itemO("SEQUENCER_OT_select_inverse") class SEQUENCER_MT_marker(bpy.types.Menu): __space_type__ = "SEQUENCE_EDITOR" diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 19204710116..d5ad63ca21b 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -42,7 +42,7 @@ void ARMATURE_OT_subdivide_multi(struct wmOperatorType *ot); void ARMATURE_OT_parent_set(struct wmOperatorType *ot); void ARMATURE_OT_parent_clear(struct wmOperatorType *ot); void ARMATURE_OT_select_all_toggle(struct wmOperatorType *ot); -void ARMATURE_OT_select_invert(struct wmOperatorType *ot); +void ARMATURE_OT_select_inverse(struct wmOperatorType *ot); void ARMATURE_OT_select_hierarchy(struct wmOperatorType *ot); void ARMATURE_OT_select_linked(struct wmOperatorType *ot); void ARMATURE_OT_delete(struct wmOperatorType *ot); @@ -56,7 +56,7 @@ void POSE_OT_rot_clear(struct wmOperatorType *ot); void POSE_OT_loc_clear(struct wmOperatorType *ot); void POSE_OT_scale_clear(struct wmOperatorType *ot); void POSE_OT_select_all_toggle(struct wmOperatorType *ot); -void POSE_OT_select_invert(struct wmOperatorType *ot); +void POSE_OT_select_inverse(struct wmOperatorType *ot); void POSE_OT_select_parent(struct wmOperatorType *ot); void POSE_OT_select_hierarchy(struct wmOperatorType *ot); void POSE_OT_select_linked(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index adbfb500eb0..df32f452a38 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -121,7 +121,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(ARMATURE_OT_parent_clear); WM_operatortype_append(ARMATURE_OT_select_all_toggle); - WM_operatortype_append(ARMATURE_OT_select_invert); + WM_operatortype_append(ARMATURE_OT_select_inverse); WM_operatortype_append(ARMATURE_OT_select_hierarchy); WM_operatortype_append(ARMATURE_OT_select_linked); @@ -148,7 +148,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(POSE_OT_scale_clear); WM_operatortype_append(POSE_OT_select_all_toggle); - WM_operatortype_append(POSE_OT_select_invert); + WM_operatortype_append(POSE_OT_select_inverse); WM_operatortype_append(POSE_OT_select_parent); WM_operatortype_append(POSE_OT_select_hierarchy); @@ -189,7 +189,7 @@ void ED_keymap_armature(wmWindowManager *wm) WM_keymap_add_item(keymap, "ARMATURE_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "ARMATURE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "ARMATURE_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ARMATURE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "ARMATURE_OT_test", TKEY, KM_PRESS, 0, 0); // XXX temp test for context iterators... to be removed @@ -233,7 +233,7 @@ void ED_keymap_armature(wmWindowManager *wm) WM_keymap_add_item(keymap, "POSE_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "POSE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "POSE_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "POSE_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "POSE_OT_select_parent", PKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index d7e3f84f0d6..4312838cba5 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -3839,7 +3839,7 @@ void ARMATURE_OT_parent_clear(wmOperatorType *ot) /* **************** Selections ******************/ -static int armature_select_invert_exec(bContext *C, wmOperator *op) +static int armature_select_inverse_exec(bContext *C, wmOperator *op) { /* Set the flags */ CTX_DATA_BEGIN(C, EditBone *, ebone, visible_bones) { @@ -3854,15 +3854,15 @@ static int armature_select_invert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void ARMATURE_OT_select_invert(wmOperatorType *ot) +void ARMATURE_OT_select_inverse(wmOperatorType *ot) { /* identifiers */ - ot->name= "Invert Selection"; - ot->idname= "ARMATURE_OT_select_invert"; + ot->name= "Select Inverse"; + ot->idname= "ARMATURE_OT_select_inverse"; /* api callbacks */ - ot->exec= armature_select_invert_exec; + ot->exec= armature_select_inverse_exec; ot->poll= ED_operator_editarmature; /* flags */ @@ -4823,7 +4823,7 @@ void POSE_OT_rot_clear(wmOperatorType *ot) /* ***************** selections ********************** */ -static int pose_select_invert_exec(bContext *C, wmOperator *op) +static int pose_select_inverse_exec(bContext *C, wmOperator *op) { /* Set the flags */ @@ -4838,15 +4838,15 @@ static int pose_select_invert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void POSE_OT_select_invert(wmOperatorType *ot) +void POSE_OT_select_inverse(wmOperatorType *ot) { /* identifiers */ - ot->name= "Invert Selection"; - ot->idname= "POSE_OT_select_invert"; + ot->name= "Select Inverse"; + ot->idname= "POSE_OT_select_inverse"; /* api callbacks */ - ot->exec= pose_select_invert_exec; + ot->exec= pose_select_inverse_exec; ot->poll= ED_operator_posemode; /* flags */ diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 2146855a75e..34e81b60a16 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -84,7 +84,7 @@ void CURVE_OT_smooth_radius(struct wmOperatorType *ot); void CURVE_OT_de_select_first(struct wmOperatorType *ot); void CURVE_OT_de_select_last(struct wmOperatorType *ot); void CURVE_OT_select_all_toggle(struct wmOperatorType *ot); -void CURVE_OT_select_invert(struct wmOperatorType *ot); +void CURVE_OT_select_inverse(struct wmOperatorType *ot); void CURVE_OT_select_linked(struct wmOperatorType *ot); void CURVE_OT_select_row(struct wmOperatorType *ot); void CURVE_OT_select_next(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index ed53f8e0194..45dc76d5488 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -139,7 +139,7 @@ void ED_operatortypes_curve(void) WM_operatortype_append(CURVE_OT_de_select_first); WM_operatortype_append(CURVE_OT_de_select_last); WM_operatortype_append(CURVE_OT_select_all_toggle); - WM_operatortype_append(CURVE_OT_select_invert); + WM_operatortype_append(CURVE_OT_select_inverse); WM_operatortype_append(CURVE_OT_select_linked); WM_operatortype_append(CURVE_OT_select_row); WM_operatortype_append(CURVE_OT_select_next); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 6ae79109445..c437f35c484 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1736,7 +1736,7 @@ void CURVE_OT_reveal(wmOperatorType *ot) /********************** select invert operator *********************/ -static int select_invert_exec(bContext *C, wmOperator *op) +static int select_inverse_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -1775,14 +1775,14 @@ static int select_invert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void CURVE_OT_select_invert(wmOperatorType *ot) +void CURVE_OT_select_inverse(wmOperatorType *ot) { /* identifiers */ - ot->name= "Select Invert"; - ot->idname= "CURVE_OT_select_invert"; + ot->name= "Select Inverse"; + ot->idname= "CURVE_OT_select_inverse"; /* api callbacks */ - ot->exec= select_invert_exec; + ot->exec= select_inverse_exec; ot->poll= ED_operator_editsurfcurve; /* flags */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 8952305d6ab..c4fde48c631 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -49,26 +49,25 @@ struct UvVertMap; struct UvMapVert; struct CustomData; -// edge and face flag both -#define EM_FGON 2 -// face flag -#define EM_FGON_DRAW 1 +#define EM_FGON_DRAW 1 // face flag +#define EM_FGON 2 // edge and face flag both /* editbutflag */ -#define B_CLOCKWISE 1 -#define B_KEEPORIG 2 -#define B_BEAUTY 4 -#define B_SMOOTH 8 -#define B_BEAUTY_SHORT 16 -#define B_AUTOFGON 32 -#define B_KNIFE 0x80 +#define B_CLOCKWISE 1 +#define B_KEEPORIG 2 +#define B_BEAUTY 4 +#define B_SMOOTH 8 +#define B_BEAUTY_SHORT 0x10 +#define B_AUTOFGON 0x20 +#define B_KNIFE 0x80 #define B_PERCENTSUBD 0x40 #define B_MESH_X_MIRROR 0x100 #define B_JOINTRIA_UV 0x200 #define B_JOINTRIA_VCOL 0X400 #define B_JOINTRIA_SHARP 0X800 #define B_JOINTRIA_MAT 0X1000 - +#define B_FRACTAL 0x2000 +#define B_SPHERE 0x4000 /* meshtools.c */ diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 59726c6d5fd..8bafc5ce1e8 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1093,9 +1093,11 @@ void uiItemM(uiLayout *layout, bContext *C, char *name, int icon, char *menuname if(layout->root->type == UI_LAYOUT_MENU && !icon) icon= ICON_BLANK1; ui_item_menu(layout, name, icon, ui_item_menutype_func, mt, NULL); - break; + return; } } + + printf("uiItemM: not found %s\n", menuname); } /* label item */ diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index e2ccd0976d2..a680fb5d07a 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1625,7 +1625,7 @@ static int mesh_separate_exec(bContext *C, wmOperator *op) void MESH_OT_separate(wmOperatorType *ot) { /* identifiers */ - ot->name= "Mesh Separate"; + ot->name= "Separate"; ot->idname= "MESH_OT_separate"; /* api callbacks */ diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index 942ad657992..c24670aa856 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1104,7 +1104,7 @@ static void make_prim(Object *obedit, int type, float mat[4][4], int tot, int se } dia*=200; - for(a=1; a<subdiv; a++) esubdivideflag(obedit, em, 2, dia, 0,1,0); + for(a=1; a<subdiv; a++) esubdivideflag(obedit, em, 2, dia, 0, B_SPHERE,1,0); /* and now do imat */ eve= em->verts.first; while(eve) { @@ -1661,7 +1661,7 @@ void MESH_OT_primitive_ico_sphere_add(wmOperatorType *ot) /****************** add duplicate operator ***************/ -static int mesh_add_duplicate_exec(bContext *C, wmOperator *op) +static int mesh_duplicate_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_edit_object(C); @@ -1677,10 +1677,10 @@ static int mesh_add_duplicate_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int mesh_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event) { WM_cursor_wait(1); - mesh_add_duplicate_exec(C, op); + mesh_duplicate_exec(C, op); WM_cursor_wait(0); RNA_int_set(op->ptr, "mode", TFM_TRANSLATION); @@ -1689,16 +1689,15 @@ static int mesh_add_duplicate_invoke(bContext *C, wmOperator *op, wmEvent *event return OPERATOR_FINISHED; } -void MESH_OT_duplicate_add(wmOperatorType *ot) +void MESH_OT_duplicate(wmOperatorType *ot) { - /* identifiers */ - ot->name= "Add Duplicate"; - ot->idname= "MESH_OT_duplicate_add"; + ot->name= "Duplicate"; + ot->idname= "MESH_OT_duplicate"; /* api callbacks */ - ot->invoke= mesh_add_duplicate_invoke; - ot->exec= mesh_add_duplicate_exec; + ot->invoke= mesh_duplicate_invoke; + ot->exec= mesh_duplicate_exec; ot->poll= ED_operator_editmesh; diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 9f804ee8553..7fc3753eefb 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -369,9 +369,9 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts) fac= 1.0f; // XXX if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return; fac= 0.292f*fac; - esubdivideflag(obedit, em, SELECT,fac,B_SMOOTH,numcuts,SUBDIV_SELECT_LOOPCUT); + esubdivideflag(obedit, em, SELECT,fac,0,B_SMOOTH,numcuts,SUBDIV_SELECT_LOOPCUT); } else { - esubdivideflag(obedit, em, SELECT,0,0,numcuts,SUBDIV_SELECT_LOOPCUT); + esubdivideflag(obedit, em, SELECT,0,0,0,numcuts,SUBDIV_SELECT_LOOPCUT); } /* if this was a single cut, enter edgeslide mode */ if(numcuts == 1 && hasHidden == 0){ @@ -690,9 +690,9 @@ static int knife_cut_exec(bContext *C, wmOperator *op) eed= eed->next; } - if (mode==KNIFE_MIDPOINT) esubdivideflag(obedit, em, SELECT, 0, B_KNIFE, 1, SUBDIV_SELECT_ORIG); - else if (mode==KNIFE_MULTICUT) esubdivideflag(obedit, em, SELECT, 0, B_KNIFE, numcuts, SUBDIV_SELECT_ORIG); - else esubdivideflag(obedit, em, SELECT, 0, B_KNIFE|B_PERCENTSUBD, 1, SUBDIV_SELECT_ORIG); + if (mode==KNIFE_MIDPOINT) esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE, 1, SUBDIV_SELECT_ORIG); + else if (mode==KNIFE_MULTICUT) esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE, numcuts, SUBDIV_SELECT_ORIG); + else esubdivideflag(obedit, em, SELECT, 0, 0, B_KNIFE|B_PERCENTSUBD, 1, SUBDIV_SELECT_ORIG); eed=em->edges.first; while(eed){ diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 67886ee8df5..ca0f73ece68 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -1412,7 +1412,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) break; case 2: /* copy image */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1433,7 +1433,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) case 3: /* copy UV's */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1446,7 +1446,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) break; case 4: /* mode's */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1459,7 +1459,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) break; case 5: /* copy transp's */ if (!tf_act) { - BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); return; } for(efa=em->faces.first; efa; efa=efa->next) { @@ -1473,7 +1473,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) case 6: /* copy vcols's */ if (!mcol_act) { - BKE_report(op->reports, RPT_ERROR, "mesh has no color layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers."); return; } else { /* guess the 4th color if needs be */ @@ -3207,7 +3207,7 @@ void EM_select_swap(EditMesh *em) /* exported for UV */ } -static int select_invert_mesh_exec(bContext *C, wmOperator *op) +static int select_inverse_mesh_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); @@ -3220,14 +3220,14 @@ static int select_invert_mesh_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void MESH_OT_select_invert(wmOperatorType *ot) +void MESH_OT_select_inverse(wmOperatorType *ot) { /* identifiers */ - ot->name= "Select Invert"; - ot->idname= "MESH_OT_select_invert"; + ot->name= "Select Inverse"; + ot->idname= "MESH_OT_select_inverse"; /* api callbacks */ - ot->exec= select_invert_mesh_exec; + ot->exec= select_inverse_mesh_exec; ot->poll= ED_operator_editmesh; /* flags */ @@ -3641,7 +3641,7 @@ static int editmesh_mark_seam(bContext *C, wmOperator *op) void MESH_OT_mark_seam(wmOperatorType *ot) { /* identifiers */ - ot->name= "Mark seam"; + ot->name= "Mark Seam"; ot->idname= "MESH_OT_mark_seam"; /* api callbacks */ @@ -3660,15 +3660,15 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); Mesh *me= ((Mesh *)obedit->data); - int set = RNA_boolean_get(op->ptr, "set"); + int clear = RNA_boolean_get(op->ptr, "clear"); EditEdge *eed; /* auto-enable sharp edge drawing */ - if(set) { + if(clear == 0) { me->drawflag |= ME_DRAWSHARP; } - if(set) { + if(!clear) { eed= em->edges.first; while(eed) { if(!eed->h && (eed->f & SELECT)) eed->sharp = 1; @@ -3693,7 +3693,7 @@ static int editmesh_mark_sharp(bContext *C, wmOperator *op) void MESH_OT_mark_sharp(wmOperatorType *ot) { /* identifiers */ - ot->name= "Mark sharp"; + ot->name= "Mark Sharp"; ot->idname= "MESH_OT_mark_sharp"; /* api callbacks */ @@ -3703,167 +3703,9 @@ void MESH_OT_mark_sharp(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "set", 0, "Set", ""); -} - -void BME_Menu() { - short ret; - ret= pupmenu("BME modeller%t|Select Edges of Vert%x1"); - - switch(ret) - { - case 1: - //BME_edges_of_vert(); - break; - } -} - - - -void Vertex_Menu(EditMesh *em) -{ - short ret; - ret= pupmenu("Vertex Specials%t|Remove Doubles%x1|Merge%x2|Smooth %x3|Select Vertex Path%x4|Blend From Shape%x5|Propagate To All Shapes%x6"); - - switch(ret) - { - case 1: -// XXX notice("Removed %d Vertices", removedoublesflag(1, 0, scene->toolsettings->doublimit)); - break; - case 2: -// XXX mergemenu(em); - break; - case 3: -// XXX vertexsmooth(em); - break; - case 4: -// XXX pathselect(em); - break; - case 5: -// XXX shape_copy_select_from(em); - break; - case 6: -// XXX shape_propagate(em); - break; - } - /* some items crashed because this is in the original W menu but not here. should really manage this better */ -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); -} - - -void Edge_Menu(EditMesh *em) -{ - short ret; - - ret= pupmenu("Edge Specials%t|Mark Seam %x1|Clear Seam %x2|Rotate Edge CW%x3|Rotate Edge CCW%x4|Loopcut%x6|Edge Slide%x5|Edge Loop Select%x7|Edge Ring Select%x8|Loop to Region%x9|Region to Loop%x10|Mark Sharp%x11|Clear Sharp%x12"); - - switch(ret) - { - case 1: - //editmesh_mark_seam(em, 0); - break; - case 2: - //editmesh_mark_seam(em, 1); - break; - case 3: -// edge_rotate_selected(em, 2); - break; - case 4: -// edge_rotate_selected(em, 1); - break; - case 5: -// EdgeSlide(em, 0,0.0); - break; - case 6: -// CutEdgeloop(em, 1); - break; - case 7: -// loop_multiselect(em, 0); - break; - case 8: -// loop_multiselect(em, 1); - break; - case 9: -// loop_to_region(em); - break; - case 10: -// region_to_loop(em); - break; - case 11: -// editmesh_mark_sharp(em, 1); -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; - case 12: -// editmesh_mark_sharp(em, 0); -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; - } - /* some items crashed because this is in the original W menu but not here. should really manage this better */ -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); -} - -void Face_Menu(EditMesh *em) -{ - short ret; - ret= pupmenu( - "Face Specials%t|Flip Normals%x1|Bevel%x2|Shade Smooth%x3|Shade Flat%x4|" - "Triangulate (Ctrl T)%x5|Quads from Triangles (Alt J)%x6|Flip Triangle Edges (Ctrl Shift F)%x7|%l|" - "Face Mode Set%x8|Face Mode Clear%x9|%l|" - "UV Rotate (Shift - CCW)%x10|UV Mirror (Shift - Switch Axis)%x11|" - "Color Rotate (Shift - CCW)%x12|Color Mirror (Shift - Switch Axis)%x13"); - - switch(ret) - { - case 1: -// flip_editnormals(em); -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; - case 2: -// bevel_menu(em); - break; - case 3: -// mesh_set_smooth_faces(em, 1); - break; - case 4: -// mesh_set_smooth_faces(em, 0); - break; - - case 5: /* Quads to Tris */ -// convert_to_triface(em, 0); -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; - case 6: /* Tris to Quads */ -// join_triangles(em); - break; - case 7: /* Flip triangle edges */ -// edge_flip(em); - break; - case 8: -// mesh_set_face_flags(em, 1); - break; - case 9: -// mesh_set_face_flags(em, 0); - break; - - /* uv texface options */ - case 10: -// mesh_rotate_uvs(em); - break; - case 11: -// mesh_mirror_uvs(em); - break; - case 12: -// mesh_rotate_colors(em); - break; - case 13: -// mesh_mirror_colors(em); - break; - } - /* some items crashed because this is in the original W menu but not here. should really manage this better */ -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + RNA_def_boolean(ot->srna, "clear", 0, "Clear", ""); } - /* **************** NORMALS ************** */ /* XXX value of select is messed up, it means two things */ @@ -4293,20 +4135,13 @@ static int smooth_vertex(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); - Mesh *me= obedit->data; - EditMesh *em= (EditMesh *)me; - + EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); EditVert *eve, *eve_mir = NULL; EditEdge *eed; float *adror, *adr, fac; float fvec[3]; int teller=0; - ModifierData *md= obedit->modifiers.first; - - if(em==NULL) { - BKE_mesh_end_editmesh(obedit->data, em); - return OPERATOR_CANCELLED; - } + ModifierData *md; /* count */ eve= em->verts.first; @@ -4334,8 +4169,8 @@ static int smooth_vertex(bContext *C, wmOperator *op) /* if there is a mirror modifier with clipping, flag the verts that * are within tolerance of the plane(s) of reflection */ - for (; md; md=md->next) { - if (md->type==eModifierType_Mirror) { + for(md=obedit->modifiers.first; md; md=md->next) { + if(md->type==eModifierType_Mirror) { MirrorModifierData *mmd = (MirrorModifierData*) md; if(mmd->flag & MOD_MIR_CLIPPING) { @@ -4604,7 +4439,7 @@ void flipface(EditMesh *em, EditFace *efa) } -static int flip_editnormals(bContext *C, wmOperator *op) +static int flip_normals(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); @@ -4630,14 +4465,14 @@ static int flip_editnormals(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void MESH_OT_flip_editnormals(wmOperatorType *ot) +void MESH_OT_flip_normals(wmOperatorType *ot) { /* identifiers */ ot->name= "Flip Normals"; - ot->idname= "MESH_OT_flip_editnormals"; + ot->idname= "MESH_OT_flip_normals"; /* api callbacks */ - ot->exec= flip_editnormals; + ot->exec= flip_normals; ot->poll= ED_operator_editmesh; /* flags */ diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 00cd187a23c..4377f459081 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -736,7 +736,7 @@ static int mesh_extrude_exec(bContext *C, wmOperator *op) void MESH_OT_extrude(wmOperatorType *ot) { /* identifiers */ - ot->name= "Extrude Mesh"; + ot->name= "Extrude"; ot->idname= "MESH_OT_extrude"; /* api callbacks */ @@ -777,7 +777,7 @@ static int split_mesh(bContext *C, wmOperator *op) void MESH_OT_split(wmOperatorType *ot) { /* identifiers */ - ot->name= "Split Mesh"; + ot->name= "Split"; ot->idname= "MESH_OT_split"; /* api callbacks */ @@ -1341,7 +1341,7 @@ void MESH_OT_delete(wmOperatorType *ot) #define DOUBLEOPFILL 16 /* calculates offset for co, based on fractal, sphere or smooth settings */ -static void alter_co(float *co, EditEdge *edge, float rad, int beauty, float perc) +static void alter_co(float *co, EditEdge *edge, float smooth, float fractal, int beauty, float perc) { float vec1[3], fac; @@ -1368,37 +1368,38 @@ static void alter_co(float *co, EditEdge *edge, float rad, int beauty, float per vec1[0]+= fac*nor2[0]; vec1[1]+= fac*nor2[1]; vec1[2]+= fac*nor2[2]; + + /* falloff for multi subdivide */ + smooth *= sqrt(fabs(1.0f - 2.0f*fabs(0.5f-perc))); - vec1[0]*= rad*len; - vec1[1]*= rad*len; - vec1[2]*= rad*len; + vec1[0]*= smooth*len; + vec1[1]*= smooth*len; + vec1[2]*= smooth*len; co[0] += vec1[0]; co[1] += vec1[1]; co[2] += vec1[2]; } - else { - if(rad > 0.0) { /* subdivide sphere */ - Normalize(co); - co[0]*= rad; - co[1]*= rad; - co[2]*= rad; - } - else if(rad< 0.0) { /* fractal subdivide */ - fac= rad* VecLenf(edge->v1->co, edge->v2->co); - vec1[0]= fac*(float)(0.5-BLI_drand()); - vec1[1]= fac*(float)(0.5-BLI_drand()); - vec1[2]= fac*(float)(0.5-BLI_drand()); - VecAddf(co, co, vec1); - } + else if(beauty & B_SPHERE) { /* subdivide sphere */ + Normalize(co); + co[0]*= smooth; + co[1]*= smooth; + co[2]*= smooth; + } + if(beauty & B_FRACTAL) { + fac= fractal*VecLenf(edge->v1->co, edge->v2->co); + vec1[0]= fac*(float)(0.5-BLI_drand()); + vec1[1]= fac*(float)(0.5-BLI_drand()); + vec1[2]= fac*(float)(0.5-BLI_drand()); + VecAddf(co, co, vec1); } } /* assumes in the edge is the correct interpolated vertices already */ -/* percent defines the interpolation, rad and beauty are for special options */ +/* percent defines the interpolation, smooth, fractal and beauty are for special options */ /* results in new vertex with correct coordinate, vertex normal and weight group info */ -static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float rad, int beauty, float percent) +static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float smooth, float fractal, int beauty, float percent) { EditVert *ev; float co[3]; @@ -1408,7 +1409,7 @@ static EditVert *subdivide_edge_addvert(EditMesh *em, EditEdge *edge, float rad, co[2] = (edge->v2->co[2]-edge->v1->co[2])*percent + edge->v1->co[2]; /* offset for smooth or sphere or fractal */ - alter_co(co, edge, rad, beauty, percent); + alter_co(co, edge, smooth, fractal, beauty, percent); /* clip if needed by mirror modifier */ if (edge->v1->f2) { @@ -2176,7 +2177,7 @@ static void fill_quad_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int //EM_fgon_flags(em); } -static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float rad, int beauty) +static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty) { EditVert **verts[4], ***innerverts; EditFace *hold; @@ -2246,7 +2247,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i for(j=1;j<=numcuts;j++) { float percent= (float)j/(float)(numcuts+1); - innerverts[i][(numcuts+1)-j]= subdivide_edge_addvert(em, &temp, rad, beauty, percent); + innerverts[i][(numcuts+1)-j]= subdivide_edge_addvert(em, &temp, smooth, fractal, beauty, percent); } } // Fill with faces @@ -2273,7 +2274,7 @@ static void fill_quad_quadruple(EditMesh *em, EditFace *efa, struct GHash *gh, i MEM_freeN(innerverts); } -static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float rad, int beauty) +static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int numcuts, float smooth, float fractal, int beauty) { EditVert **verts[3], ***innerverts; short vertsize, i, j; @@ -2344,7 +2345,7 @@ static void fill_tri_triple(EditMesh *em, EditFace *efa, struct GHash *gh, int n for(j=1;j<(numcuts+1)-i;j++) { float percent= (float)j/(float)((numcuts+1)-i); - innerverts[i][((numcuts+1)-i)-j]= subdivide_edge_addvert(em, &temp, rad, beauty, 1-percent); + innerverts[i][((numcuts+1)-i)-j]= subdivide_edge_addvert(em, &temp, smooth, fractal, beauty, 1-percent); } } @@ -2522,7 +2523,7 @@ static void fill_quad_singlevert(EditMesh *em, EditFace *efa, struct GHash *gh) // This function takes an example edge, the current point to create and // the total # of points to create, then creates the point and return the // editvert pointer to it. -static EditVert *subdivideedgenum(EditMesh *em, EditEdge *edge, int curpoint, int totpoint, float rad, int beauty) +static EditVert *subdivideedgenum(EditMesh *em, EditEdge *edge, int curpoint, int totpoint, float smooth, float fractal, int beauty) { EditVert *ev; float percent; @@ -2533,13 +2534,13 @@ static EditVert *subdivideedgenum(EditMesh *em, EditEdge *edge, int curpoint, in else percent= (float)curpoint/(float)(totpoint+1); - ev= subdivide_edge_addvert(em, edge, rad, beauty, percent); + ev= subdivide_edge_addvert(em, edge, smooth, fractal, beauty, percent); ev->f = edge->v1->f; return ev; } -void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beauty, int numcuts, int seltype) +void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float fractal, int beauty, int numcuts, int seltype) { EditFace *ef; EditEdge *eed, *cedge, *sort[4]; @@ -2692,7 +2693,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut for(i=0;i<numcuts;i++) { // This function creates the new vert and returns it back // to the array - templist[i+1] = subdivideedgenum(em, eed, i+1, numcuts, rad, beauty); + templist[i+1] = subdivideedgenum(em, eed, i+1, numcuts, smooth, fractal, beauty); //while we are here, we can copy edge info from the original edge cedge = addedgelist(em, templist[i],templist[i+1],eed); // Also set the edge f2 to EDGENEW so that we can use this info later @@ -2795,7 +2796,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut fill_quad_triple(em, ef, gh, numcuts); break; case 4: ef->f1 = SELECT; - fill_quad_quadruple(em, ef, gh, numcuts, rad, beauty); + fill_quad_quadruple(em, ef, gh, numcuts, smooth, fractal, beauty); break; } } else { @@ -2808,7 +2809,7 @@ void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beaut fill_tri_double(em, ef, gh, numcuts); break; case 3: ef->f1 = SELECT; - fill_tri_triple(em, ef, gh, numcuts, rad, beauty); + fill_tri_triple(em, ef, gh, numcuts, smooth, fractal, beauty); break; } } @@ -3487,7 +3488,23 @@ void edge_flip(EditMesh *em) MEM_freeN(efaar); } -static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir) +#define DIRECTION_CW 1 +#define DIRECTION_CCW 2 + +static const EnumPropertyItem direction_items[]= { + {DIRECTION_CW, "CW", 0, "Clockwise", ""}, + {DIRECTION_CCW, "CCW", 0, "Counter Clockwise", ""}, + {0, NULL, 0, NULL, NULL}}; + +#define AXIS_X 1 +#define AXIS_Y 2 + +static const EnumPropertyItem axis_items[]= { + {AXIS_X, "X", 0, "X", ""}, + {AXIS_Y, "Y", 0, "Y", ""}, + {0, NULL, 0, NULL, NULL}}; + +static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed, int dir) { EditVert **verts[2]; EditFace *face[2], *efa, *newFace[2]; @@ -3585,10 +3602,10 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir) newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); } else if(fac1 == 4 && fac2 == 3) { - if(dir == 1) { + if(dir == DIRECTION_CW) { newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], -1); - } else if (dir == 2) { + } else if (dir == DIRECTION_CCW) { newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], 4+p[1][1], p[0][0], p[0][1]); newFace[1]= EM_face_from_faces(em, face[1], face[0], 4+p[0][2], p[1][0], p[1][1], -1); @@ -3597,10 +3614,10 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir) } } else if(fac1 == 3 && fac2 == 4) { - if(dir == 1) { + if(dir == DIRECTION_CW) { newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], 4+p[1][1], -1); newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); - } else if (dir == 2) { + } else if (dir == DIRECTION_CCW) { newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][0], p[0][1], 4+p[1][2], -1); newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], 4+p[0][1], 4+p[0][2]); @@ -3610,10 +3627,10 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir) } else if(fac1 == 4 && fac2 == 4) { - if(dir == 1) { + if(dir == DIRECTION_CW) { newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][1], p[0][2], p[0][3], 4+p[1][1]); newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][1], p[1][2], p[1][3], 4+p[0][1]); - } else if (dir == 2) { + } else if (dir == DIRECTION_CCW) { newFace[0]= EM_face_from_faces(em, face[0], face[1], p[0][2], p[0][3], 4+p[1][1], 4+p[1][2]); newFace[1]= EM_face_from_faces(em, face[1], face[0], p[1][2], p[1][3], 4+p[0][1], 4+p[0][2]); @@ -3624,7 +3641,7 @@ static void edge_rotate(EditMesh *em, wmOperator *op, EditEdge *eed,int dir) else return; /* This should never happen */ - if(dir == 1 || (fac1 == 3 && fac2 == 3)) { + if(dir == DIRECTION_CW || (fac1 == 3 && fac2 == 3)) { verts[0][p[0][1]]->f |= SELECT; verts[1][p[1][1]]->f |= SELECT; } @@ -3668,10 +3685,9 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - int dir = RNA_int_get(op->ptr,"dir"); // dir == 2 when clockwise and ==1 for counter CW. EditEdge *eed; EditFace *efa; + int dir = RNA_int_get(op->ptr, "direction"); // dir == 2 when clockwise and ==1 for counter CW. short edgeCount = 0; /*clear new flag for new edges, count selected edges */ @@ -3719,23 +3735,21 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) } } } - else - { + else { BKE_report(op->reports, RPT_ERROR, "Select one edge or two adjacent faces"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } - /* flush selected vertices (again) to edges/faces */ EM_select_flush(em); + BKE_mesh_end_editmesh(obedit->data, em); + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); - BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_FINISHED; - } void MESH_OT_edge_rotate(wmOperatorType *ot) @@ -3752,7 +3766,7 @@ void MESH_OT_edge_rotate(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* props */ - RNA_def_int(ot->srna, "dir", 1, 1, 2, "Direction", "Clockwise and Counter Clockwise", 1, 2); + RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "direction", "direction to rotate edge around."); } @@ -4726,23 +4740,7 @@ void mesh_set_face_flags(EditMesh *em, short mode) } #endif -void mesh_set_smooth_faces(EditMesh *em, short event) -{ - EditFace *efa; - - if(em==NULL) return; - - efa= em->faces.first; - while(efa) { - if(efa->f & SELECT) { - if(event==1) efa->flag |= ME_SMOOTH; - else if(event==0) efa->flag &= ~ME_SMOOTH; - } - efa= efa->next; - } -} - -/* ********************** mesh rip ********************** */ +/********************** Rip Operator *************************/ /* helper to find edge for edge_rip */ static float mesh_rip_edgedist(ARegion *ar, float mat[][4], float *co1, float *co2, short *mval) @@ -5014,7 +5012,7 @@ void MESH_OT_rip(wmOperatorType *ot) } -/* ************************************** */ +/************************ Shape Operators *************************/ void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op) { @@ -5205,6 +5203,8 @@ void shape_copy_select_from(Object *obedit, EditMesh *em, wmOperator *op) return; } +/************************ Merge Operator *************************/ + /* Collection Routines|Currently used by the improved merge code*/ /* buildEdge_collection() creates a list of lists*/ /* these lists are filled with edges that are topologically connected.*/ @@ -5695,10 +5695,6 @@ int collapseEdges(EditMesh *em) } freecollections(&allcollections); removedoublesflag(em, 1, 0, MERGELIMIT); - /*get rid of this!*/ -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - -// if (EM_texFaceCheck()) return mergecount; } @@ -5741,6 +5737,7 @@ int merge_target(EditMesh *em, int target, int uvmerge) { EditVert *eve; + // XXX not working if(target) snap_sel_to_curs(); else snap_to_center(); @@ -5751,21 +5748,113 @@ int merge_target(EditMesh *em, int target, int uvmerge) } collapseuvs(em, NULL); } - -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); return removedoublesflag(em, 1, 0, MERGELIMIT); - } #undef MERGELIMIT -typedef struct PathNode{ +static int merge_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + int count= 0, uvs= RNA_boolean_get(op->ptr, "uvs"); + + switch(RNA_enum_get(op->ptr, "type")) { + case 3: + count = merge_target(em, 0, uvs); + break; + case 4: + count = merge_target(em, 1, uvs); + break; + case 1: + count = merge_firstlast(em, 0, uvs); + break; + case 6: + count = merge_firstlast(em, 1, uvs); + break; + case 2: + count = collapseEdges(em); + break; + } + + if(!count) + return OPERATOR_CANCELLED; + + BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices.", count); + + BKE_mesh_end_editmesh(obedit->data, em); + + DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + + return OPERATOR_FINISHED; +} + +static EnumPropertyItem merge_type_items[]= { + {6, "FIRST", 0, "At First", ""}, + {1, "LAST", 0, "At Last", ""}, + {3, "CENTER", 0, "At Center", ""}, + {4, "CURSOR", 0, "At Cursor", ""}, + {5, "COLLAPSE", 0, "Collapse", ""}, + {0, NULL, 0, NULL, NULL}}; + +static EnumPropertyItem *merge_type_itemf(PointerRNA *ptr) +{ + /* XXX need context here */ +#if 0 + Scene *scene= CTX_data_scene(C); + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); + + if(em->selectmode & SCE_SELECT_VERTEX) + if(em->selected.first && em->selected.last && + ((EditSelection*)em->selected.first)->type == EDITVERT && ((EditSelection*)em->selected.last)->type == EDITVERT) + event = pupmenu("Merge %t|At First %x6|At Last%x1|At Center%x3|At Cursor%x4|Collapse%x2"); + else if (em->selected.first && ((EditSelection*)em->selected.first)->type == EDITVERT) + event = pupmenu("Merge %t|At First %x6|At Center%x3|At Cursor%x4|Collapse%x2"); + else if (em->selected.last && ((EditSelection*)em->selected.last)->type == EDITVERT) + event = pupmenu("Merge %t|At Last %x1|At Center%x3|At Cursor%x4|Collapse%x2"); + else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2"); + else event = pupmenu("Merge %t|At Center%x3|At Cursor%x4|Collapse%x2"); + + BKE_mesh_end_editmesh(obedit->data, em); +#endif + + return merge_type_items; +} + +void MESH_OT_merge(wmOperatorType *ot) +{ + PropertyRNA *prop; + + /* identifiers */ + ot->name= "Merge"; + ot->idname= "MESH_OT_merge"; + + /* api callbacks */ + ot->exec= merge_exec; + ot->invoke= WM_menu_invoke; + ot->poll= ED_operator_editmesh; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + prop= RNA_def_enum(ot->srna, "type", merge_type_items, 6, "Type", "Merge method to use."); + RNA_def_enum_funcs(prop, merge_type_itemf); + RNA_def_boolean(ot->srna, "uvs", 0, "UVs", "Move UVs according to merge."); +} + +/************************ Vertex Path Operator *************************/ + +typedef struct PathNode { int u; int visited; ListBase edges; } PathNode; -typedef struct PathEdge{ +typedef struct PathEdge { struct PathEdge *next, *prev; int v; float w; @@ -5957,43 +6046,46 @@ void MESH_OT_select_vertex_path(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", type_items, PATH_SELECT_EDGE_LENGTH, "Type", "Method to compute distance."); } +/********************** Region/Loop Operators *************************/ + static int region_to_loop(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); EditEdge *eed; EditFace *efa; + int selected= 0; - if(em->totfacesel){ - for(eed=em->edges.first; eed; eed=eed->next) eed->f1 = 0; - - for(efa=em->faces.first; efa; efa=efa->next){ - if(efa->f&SELECT){ - efa->e1->f1++; - efa->e2->f1++; - efa->e3->f1++; - if(efa->e4) - efa->e4->f1++; - } - } - - EM_clear_flag_all(em, SELECT); - - for(eed=em->edges.first; eed; eed=eed->next){ - if(eed->f1 == 1) EM_select_edge(eed, 1); - } - - em->selectmode = SCE_SELECT_EDGE; - EM_selectmode_set(em); - // DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + for(eed=em->edges.first; eed; eed=eed->next) eed->f1 = 0; + + for(efa=em->faces.first; efa; efa=efa->next){ + if(efa->f&SELECT){ + efa->e1->f1++; + efa->e2->f1++; + efa->e3->f1++; + if(efa->e4) + efa->e4->f1++; -// if (EM_texFaceCheck()) + selected= 1; + } + } + if(!selected) + return OPERATOR_CANCELLED; + + EM_clear_flag_all(em, SELECT); + + for(eed=em->edges.first; eed; eed=eed->next){ + if(eed->f1 == 1) EM_select_edge(eed, 1); } - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + em->selectmode = SCE_SELECT_EDGE; + EM_selectmode_set(em); BKE_mesh_end_editmesh(obedit->data, em); + + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); + return OPERATOR_FINISHED; } @@ -6165,12 +6257,10 @@ static int loop_to_region(bContext *C, wmOperator *op) } freecollections(&allcollections); -// DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - -// if (EM_texFaceCheck()) + BKE_mesh_end_editmesh(obedit->data, em); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); - BKE_mesh_end_editmesh(obedit->data, em); + return OPERATOR_FINISHED; } @@ -6188,6 +6278,7 @@ void MESH_OT_loop_to_region(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/********************** UV/Color Operators *************************/ // XXX please check if these functions do what you want them to /* texface and vertex color editmode tools for the face menu */ @@ -6199,26 +6290,24 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); EditFace *efa; - short change = 0, ccw; + short change = 0; MTFace *tf; float u1, v1; - int shift = 0; // XXX + int dir= RNA_enum_get(op->ptr, "direction"); if (!EM_texFaceCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } - ccw = (shift); - for(efa=em->faces.first; efa; efa=efa->next) { if (efa->f & SELECT) { tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); u1= tf->uv[0][0]; v1= tf->uv[0][1]; - if (ccw) { + if (dir == DIRECTION_CCW) { if(efa->v4) { tf->uv[0][0]= tf->uv[3][0]; tf->uv[0][1]= tf->uv[3][1]; @@ -6276,23 +6365,21 @@ static int mesh_mirror_uvs(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); EditFace *efa; - short change = 0, altaxis; + short change = 0; MTFace *tf; float u1, v1; - int shift= 0; // XXX + int axis= RNA_enum_get(op->ptr, "axis"); if (!EM_texFaceCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "mesh has no uv/image layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } - altaxis = (shift); - for(efa=em->faces.first; efa; efa=efa->next) { if (efa->f & SELECT) { tf = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); - if (altaxis) { + if (axis == AXIS_Y) { u1= tf->uv[1][0]; v1= tf->uv[1][1]; if(efa->v4) { @@ -6368,24 +6455,22 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); EditFace *efa; - short change = 0, ccw; + short change = 0; MCol tmpcol, *mcol; - int shift= 0; // XXX + int dir= RNA_enum_get(op->ptr, "direction"); if (!EM_vertColorCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "mesh has no color layers"); + BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } - ccw = (shift); - for(efa=em->faces.first; efa; efa=efa->next) { if (efa->f & SELECT) { mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL); tmpcol= mcol[0]; - if (ccw) { + if (dir == DIRECTION_CCW) { if(efa->v4) { mcol[0]= mcol[3]; mcol[3]= mcol[2]; @@ -6428,9 +6513,9 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op) EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); EditFace *efa; - short change = 0, altaxis; + short change = 0; MCol tmpcol, *mcol; - int shift= 0; // XXX + int axis= RNA_enum_get(op->ptr, "axis"); if (!EM_vertColorCheck(em)) { BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers"); @@ -6438,12 +6523,10 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - altaxis = (shift); - for(efa=em->faces.first; efa; efa=efa->next) { if (efa->f & SELECT) { mcol = CustomData_em_get(&em->fdata, efa->data, CD_MCOL); - if (altaxis) { + if (axis == AXIS_Y) { tmpcol= mcol[1]; mcol[1]= mcol[2]; mcol[2]= tmpcol; @@ -6491,6 +6574,9 @@ void MESH_OT_uvs_rotate(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* props */ + RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate UVs around."); } void MESH_OT_uvs_mirror(wmOperatorType *ot) @@ -6505,6 +6591,9 @@ void MESH_OT_uvs_mirror(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* props */ + RNA_def_enum(ot->srna, "axis", axis_items, DIRECTION_CW, "Axis", "Axis to mirror UVs around."); } void MESH_OT_colors_rotate(wmOperatorType *ot) @@ -6519,6 +6608,9 @@ void MESH_OT_colors_rotate(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* props */ + RNA_def_enum(ot->srna, "direction", direction_items, DIRECTION_CW, "Direction", "Direction to rotate edge around."); } void MESH_OT_colors_mirror(wmOperatorType *ot) @@ -6533,22 +6625,34 @@ void MESH_OT_colors_mirror(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* props */ + RNA_def_enum(ot->srna, "axis", axis_items, DIRECTION_CW, "Axis", "Axis to mirror colors around."); } +/********************** Subdivide Operator *************************/ + static int subdivide_exec(bContext *C, wmOperator *op) -{ +{ Scene *scene = CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, 1, 0); - - BKE_mesh_end_editmesh(obedit->data, em); + int cuts= RNA_int_get(op->ptr,"number_cuts"); + float smooth= 0.292f*RNA_float_get(op->ptr, "smoothness"); + float fractal= RNA_float_get(op->ptr, "fractal")/100; + int flag= 0; + + if(smooth != 0.0f) + flag |= B_SMOOTH; + if(fractal != 0.0f) + flag |= B_FRACTAL; + + esubdivideflag(obedit, em, 1, smooth, fractal, scene->toolsettings->editbutflag|flag, cuts, 0); DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void MESH_OT_subdivide(wmOperatorType *ot) @@ -6563,173 +6667,14 @@ void MESH_OT_subdivide(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; -} - -static int subdivide_multi_exec(bContext *C, wmOperator *op) -{ - Scene *scene = CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - esubdivideflag(obedit, em, 1, 0.0, scene->toolsettings->editbutflag, RNA_int_get(op->ptr,"number_cuts"), 0); - - BKE_mesh_end_editmesh(obedit->data, em); - - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); - - return OPERATOR_FINISHED; -} - -void MESH_OT_subdivide_multi(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Subdivide Multi"; - ot->idname= "MESH_OT_subdivide_multi"; - - /* api callbacks */ - ot->exec= subdivide_multi_exec; - ot->poll= ED_operator_editmesh; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* props */ - RNA_def_int(ot->srna, "number_cuts", 4, 1, 100, "Number of Cuts", "", 1, INT_MAX); -} - -static int subdivide_multi_fractal_exec(bContext *C, wmOperator *op) -{ - Scene *scene = CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - esubdivideflag(obedit, em, 1, -(RNA_float_get(op->ptr, "random_factor")/100), scene->toolsettings->editbutflag, RNA_int_get(op->ptr, "number_cuts"), 0); - - BKE_mesh_end_editmesh(obedit->data, em); - - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); - - return OPERATOR_FINISHED; -} - -void MESH_OT_subdivide_multi_fractal(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Subdivide Multi Fractal"; - ot->idname= "MESH_OT_subdivide_multi_fractal"; - - /* api callbacks */ - ot->exec= subdivide_multi_fractal_exec; - ot->poll= ED_operator_editmesh; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_int(ot->srna, "number_cuts", 4, 1, 100, "Number of Cuts", "", 1, INT_MAX); - RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f); + RNA_def_int(ot->srna, "number_cuts", 1, 1, 10, "Number of Cuts", "", 1, INT_MAX); + RNA_def_float(ot->srna, "fractal", 0.0, 0.0f, FLT_MAX, "Fractal", "Fractal randomness factor.", 0.0f, 1000.0f); + RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1000.0f, "Smoothness", "Smoothness factor.", 0.0f, FLT_MAX); } -static int subdivide_smooth_exec(bContext *C, wmOperator *op) -{ - Scene *scene = CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - - esubdivideflag(obedit, em, 1, 0.292f*RNA_float_get(op->ptr, "smoothness"), scene->toolsettings->editbutflag | B_SMOOTH, 1, 0); - - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); - - return OPERATOR_FINISHED; -} - -void MESH_OT_subdivide_smooth(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Subdivide Smooth"; - ot->idname= "MESH_OT_subdivide_smooth"; - - /* api callbacks */ - ot->exec= subdivide_smooth_exec; - ot->poll= ED_operator_editmesh; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* props */ - RNA_def_float(ot->srna, "smoothness", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX); -} - -static int subdivs_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - uiPopupMenu *pup; - uiLayout *layout; - - pup= uiPupMenuBegin(C, "Subdivision Type", 0); - layout= uiPupMenuLayout(pup); - uiItemsEnumO(layout, "MESH_OT_subdivs", "type"); - uiPupMenuEnd(C, pup); - - return OPERATOR_CANCELLED; -} - -static int subdivs_exec(bContext *C, wmOperator *op) -{ - switch(RNA_int_get(op->ptr, "type")) - { - case 0: // simple - subdivide_exec(C,op); - break; - case 1: // multi - subdivide_multi_exec(C,op); - break; - case 2: // fractal; - subdivide_multi_fractal_exec(C,op); - break; - case 3: //smooth - subdivide_smooth_exec(C,op); - break; - } - - return OPERATOR_FINISHED; -} - -void MESH_OT_subdivs(wmOperatorType *ot) -{ - static EnumPropertyItem type_items[]= { - {0, "SIMPLE", 0, "Simple", ""}, - {1, "MULTI", 0, "Multi", ""}, - {2, "FRACTAL", 0, "Fractal", ""}, - {3, "SMOOTH", 0, "Smooth", ""}, - {0, NULL, 0, NULL, NULL}}; - - /* identifiers */ - ot->name= "subdivs"; - ot->idname= "MESH_OT_subdivs"; - - /* api callbacks */ - ot->invoke= subdivs_invoke; - ot->exec= subdivs_exec; - - ot->poll= ED_operator_editmesh; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /*props */ - RNA_def_enum(ot->srna, "type", type_items, 0, "Type", ""); - - /* this is temp, the ops are different, but they are called from subdivs, so all the possible props should be here as well*/ - RNA_def_int(ot->srna, "number_cuts", 4, 1, 10, "Number of Cuts", "", 1, INT_MAX); - RNA_def_float(ot->srna, "random_factor", 5.0, 0.0f, FLT_MAX, "Random Factor", "", 0.0f, 1000.0f); - RNA_def_float(ot->srna, "smoothness", 1.0f, 0.0f, 1000.0f, "Smoothness", "", 0.0f, FLT_MAX); - -} - -/* ************************************* */ +/********************** Fill Operators *************************/ /* note; the EM_selectmode_set() calls here illustrate how badly constructed it all is... from before the edge/face flags, with very mixed results.... */ @@ -6975,7 +6920,6 @@ static void fill_mesh(EditMesh *em) } - static int fill_mesh_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -6996,7 +6940,7 @@ static int fill_mesh_exec(bContext *C, wmOperator *op) void MESH_OT_fill(wmOperatorType *ot) { /* identifiers */ - ot->name= "Fill Mesh"; + ot->name= "Fill"; ot->idname= "MESH_OT_fill"; /* api callbacks */ @@ -7037,6 +6981,8 @@ void MESH_OT_beauty_fill(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/********************** Quad/Tri Operators *************************/ + static int quads_convert_to_tris_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); @@ -7124,13 +7070,29 @@ void MESH_OT_edge_flip(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/********************** Smooth/Solid Operators *************************/ + +void mesh_set_smooth_faces(EditMesh *em, short smooth) +{ + EditFace *efa; + + if(em==NULL) return; + + for(efa= em->faces.first; efa; efa=efa->next) { + if(efa->f & SELECT) { + if(smooth) efa->flag |= ME_SMOOTH; + else efa->flag &= ~ME_SMOOTH; + } + } +} + static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - mesh_set_smooth_faces(em,1); + mesh_set_smooth_faces(em, 1); BKE_mesh_end_editmesh(obedit->data, em); @@ -7143,7 +7105,7 @@ static int mesh_faces_shade_smooth_exec(bContext *C, wmOperator *op) void MESH_OT_faces_shade_smooth(wmOperatorType *ot) { /* identifiers */ - ot->name= "Smooth Face Shading"; + ot->name= "Shade Smooth"; ot->idname= "MESH_OT_faces_shade_smooth"; /* api callbacks */ @@ -7160,7 +7122,7 @@ static int mesh_faces_shade_solid_exec(bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - mesh_set_smooth_faces(em,0); + mesh_set_smooth_faces(em, 0); DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, obedit); @@ -7171,7 +7133,7 @@ static int mesh_faces_shade_solid_exec(bContext *C, wmOperator *op) void MESH_OT_faces_shade_solid(wmOperatorType *ot) { /* identifiers */ - ot->name= "Flat Face Shading"; + ot->name= "Shade Flat"; ot->idname= "MESH_OT_faces_shade_solid"; /* api callbacks */ diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 4d71ddbd647..6e098e04a14 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -85,7 +85,7 @@ void MESH_OT_primitive_ico_sphere_add(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_duplicate(struct wmOperatorType *ot); void MESH_OT_fgon_make(struct wmOperatorType *ot); void MESH_OT_fgon_clear(struct wmOperatorType *ot); @@ -151,7 +151,7 @@ void MESH_OT_loop_select(struct wmOperatorType *ot); void MESH_OT_select_all_toggle(struct wmOperatorType *ot); void MESH_OT_select_more(struct wmOperatorType *ot); void MESH_OT_select_less(struct wmOperatorType *ot); -void MESH_OT_select_invert(struct wmOperatorType *ot); +void MESH_OT_select_inverse(struct wmOperatorType *ot); void MESH_OT_select_non_manifold(struct wmOperatorType *ot); void MESH_OT_select_linked(struct wmOperatorType *ot); void MESH_OT_select_linked_pick(struct wmOperatorType *ot); @@ -170,7 +170,7 @@ void MESH_OT_loop_multi_select(struct wmOperatorType *ot); void MESH_OT_mark_seam(struct wmOperatorType *ot); void MESH_OT_mark_sharp(struct wmOperatorType *ot); void MESH_OT_vertices_smooth(struct wmOperatorType *ot); -void MESH_OT_flip_editnormals(struct wmOperatorType *ot); +void MESH_OT_flip_normals(struct wmOperatorType *ot); extern EditEdge *findnearestedge(ViewContext *vc, int *dist); extern void EM_automerge(int update); @@ -201,14 +201,11 @@ extern EditVert *findnearestvert(ViewContext *vc, int *dist, short sel, short st void join_triangles(EditMesh *em); int removedoublesflag(EditMesh *em, short flag, short automerge, float limit); /* return amount */ -void esubdivideflag(Object *obedit, EditMesh *em, int flag, float rad, int beauty, int numcuts, int seltype); +void esubdivideflag(Object *obedit, EditMesh *em, int flag, float smooth, float fractal, int beauty, int numcuts, int seltype); int EdgeSlide(EditMesh *em, wmOperator *op, short immediate, float imperc); +void MESH_OT_merge(struct wmOperatorType *ot); void MESH_OT_subdivide(struct wmOperatorType *ot); -void MESH_OT_subdivs(struct wmOperatorType *ot); -void MESH_OT_subdivide_multi(struct wmOperatorType *ot); -void MESH_OT_subdivide_multi_fractal(struct wmOperatorType *ot); -void MESH_OT_subdivide_smooth(struct wmOperatorType *ot); void MESH_OT_remove_doubles(struct wmOperatorType *ot); void MESH_OT_extrude(struct wmOperatorType *ot); void MESH_OT_spin(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 64fcfb681ed..6bc2f240859 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -59,18 +59,181 @@ #include "ED_transform.h" #include "ED_view3d.h" +#include "UI_interface.h" + #include "mesh_intern.h" +/******************************** menus *************************************/ + +static int vertex_specials_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + uiPopupMenu *pup; + uiLayout *layout; + + pup= uiPupMenuBegin(C, "Vertex Specials", 0); + layout= uiPupMenuLayout(pup); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN); + + uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles"); + uiItemO(layout, "Merge...", 0, "MESH_OT_merge"); // mergmenu(em) + uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth"); + uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path"); + //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape"); + //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all"); + + uiPupMenuEnd(C, pup); + + return OPERATOR_CANCELLED; +} + +static void MESH_OT_vertex_specials(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Vertex Specials"; + ot->idname= "MESH_OT_vertex_specials"; + + /* api callbacks */ + ot->invoke= vertex_specials_invoke; + ot->poll= ED_operator_editmesh; +} + +static int edge_specials_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + uiPopupMenu *pup; + uiLayout *layout; + + pup= uiPupMenuBegin(C, "Edge Specials", 0); + layout= uiPupMenuLayout(pup); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN); + + uiItemO(layout, "Mark Seam", 0, "MESH_OT_mark_seam"); + uiItemBooleanO(layout, "Clear Seam", 0, "MESH_OT_mark_seam", "clear", 1); + uiItemEnumO(layout, "Rotate Edge CW", 0, "MESH_OT_edge_rotate", "direction", 1); + uiItemEnumO(layout, "Rotate Edge CCW", 0, "MESH_OT_edge_rotate", "direction", 2); + //uiItemO(layout, "Loopcut", 0, "MESH_OT_loop_cut"); // CutEdgeloop(em, 1); + //uiItemO(layout, "Edge Slide", 0, "MESH_OT_edge_slide"); // EdgeSlide(em, 0,0.0); + uiItemO(layout, "Edge Loop", 0, "MESH_OT_loop_multi_select"); + uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1); + uiItemO(layout, NULL, 0, "MESH_OT_loop_to_region"); + uiItemO(layout, NULL, 0, "MESH_OT_region_to_loop"); + uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp"); + uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1); + + uiPupMenuEnd(C, pup); + + return OPERATOR_CANCELLED; +} + +static void MESH_OT_edge_specials(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Edge Specials"; + ot->idname= "MESH_OT_edge_specials"; + + /* api callbacks */ + ot->invoke= edge_specials_invoke; + ot->poll= ED_operator_editmesh; +} + +static int face_specials_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + uiPopupMenu *pup; + uiLayout *layout; + + pup= uiPupMenuBegin(C, "Face Specials", 0); + layout= uiPupMenuLayout(pup); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN); + + uiItemO(layout, NULL, 0, "MESH_OT_flip_normals"); + // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em) + uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth"); + uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_solid"); + uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris"); + uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads"); + uiItemO(layout, NULL, 0, "MESH_OT_edge_flip"); + uiItemS(layout); -/* ************************** registration **********************************/ + uiItemO(layout, NULL, 0, "MESH_OT_fill"); + uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill"); + + uiItemS(layout); + + // uiItemO(layout, NULL, 0, "MESH_OT_face_mode"); // mesh_set_face_flags(em, 1); + // uiItemBooleanO(layout, NULL, 0, "MESH_OT_face_mode", "clear", 1); // mesh_set_face_flags(em, 0); + // + // uiItemS(layout); + + uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_rotate", "direction"); + uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_uvs_mirror", "axis"); + uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_rotate", "direction"); + uiItemMenuEnumO(layout, NULL, 0, "MESH_OT_colors_mirror", "axis"); + + uiPupMenuEnd(C, pup); + + return OPERATOR_CANCELLED; +} + +static void MESH_OT_face_specials(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Face Specials"; + ot->idname= "MESH_OT_face_specials"; + + /* api callbacks */ + ot->invoke= face_specials_invoke; + ot->poll= ED_operator_editmesh; +} + +static int specials_invoke(bContext *C, wmOperator *op, wmEvent *event) +{ + uiPopupMenu *pup; + uiLayout *layout; + + pup= uiPupMenuBegin(C, "Specials", 0); + layout= uiPupMenuLayout(pup); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN); + + uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide"); + uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f); + uiItemO(layout, "Merge...", 0, "MESH_OT_merge"); + uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles"); + uiItemO(layout, "Hide", 0, "MESH_OT_hide"); + uiItemO(layout, "Reveal", 0, "MESH_OT_reveal"); + uiItemO(layout, "Select Inverse", 0, "MESH_OT_select_inverse"); + uiItemO(layout, NULL, 0, "MESH_OT_flip_normals"); + uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth"); + // uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em) + uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth"); + uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_solid"); + //uiItemO(layout, "Blend From Shape", 0, "MESH_OT_blend_from_shape"); + //uiItemO(layout, "Propagate to All Shapes", 0, "MESH_OT_shape_propagate_to_all"); + uiItemO(layout, "Select Vertex Path", 0, "MESH_OT_select_vertex_path"); + + uiPupMenuEnd(C, pup); + + return OPERATOR_CANCELLED; +} + +static void MESH_OT_specials(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Specials"; + ot->idname= "MESH_OT_specials"; + + /* api callbacks */ + ot->invoke= specials_invoke; + ot->poll= ED_operator_editmesh; +} + +/**************************** registration **********************************/ void ED_operatortypes_mesh(void) { WM_operatortype_append(MESH_OT_select_all_toggle); WM_operatortype_append(MESH_OT_select_more); WM_operatortype_append(MESH_OT_select_less); - WM_operatortype_append(MESH_OT_select_invert); + WM_operatortype_append(MESH_OT_select_inverse); WM_operatortype_append(MESH_OT_select_non_manifold); WM_operatortype_append(MESH_OT_select_linked); WM_operatortype_append(MESH_OT_select_linked_pick); @@ -80,11 +243,8 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_reveal); WM_operatortype_append(MESH_OT_select_by_number_vertices); WM_operatortype_append(MESH_OT_normals_make_consistent); + WM_operatortype_append(MESH_OT_merge); WM_operatortype_append(MESH_OT_subdivide); - WM_operatortype_append(MESH_OT_subdivide_multi); - WM_operatortype_append(MESH_OT_subdivide_multi_fractal); - WM_operatortype_append(MESH_OT_subdivide_smooth); - WM_operatortype_append(MESH_OT_subdivs); WM_operatortype_append(MESH_OT_faces_select_linked_flat); WM_operatortype_append(MESH_OT_edges_select_sharp); WM_operatortype_append(MESH_OT_primitive_plane_add); @@ -99,7 +259,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_primitive_ico_sphere_add); WM_operatortype_append(MESH_OT_fgon_clear); WM_operatortype_append(MESH_OT_fgon_make); - WM_operatortype_append(MESH_OT_duplicate_add); + WM_operatortype_append(MESH_OT_duplicate); WM_operatortype_append(MESH_OT_remove_doubles); WM_operatortype_append(MESH_OT_extrude); WM_operatortype_append(MESH_OT_spin); @@ -138,7 +298,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_mark_seam); WM_operatortype_append(MESH_OT_mark_sharp); WM_operatortype_append(MESH_OT_vertices_smooth); - WM_operatortype_append(MESH_OT_flip_editnormals); + WM_operatortype_append(MESH_OT_flip_normals); WM_operatortype_append(MESH_OT_knife_cut); WM_operatortype_append(MESH_OT_rip); @@ -148,6 +308,11 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_vertex_color_remove); WM_operatortype_append(MESH_OT_sticky_add); WM_operatortype_append(MESH_OT_sticky_remove); + + WM_operatortype_append(MESH_OT_vertex_specials); + WM_operatortype_append(MESH_OT_edge_specials); + WM_operatortype_append(MESH_OT_face_specials); + WM_operatortype_append(MESH_OT_specials); } /* note mesh keymap also for other space? */ @@ -172,7 +337,7 @@ void ED_keymap_mesh(wmWindowManager *wm) WM_keymap_add_item(keymap, "MESH_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "MESH_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "MESH_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_select_non_manifold", MKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0); WM_keymap_add_item(keymap, "MESH_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); @@ -184,12 +349,6 @@ void ED_keymap_mesh(wmWindowManager *wm) WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0); - WM_keymap_add_item(keymap, "MESH_OT_mark_seam", ONEKEY, KM_PRESS, KM_CTRL , 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_mark_seam", ONEKEY, KM_PRESS, KM_ALT , 0)->ptr,"clear",1); - - WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_CTRL , 0); - RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_mark_sharp", TWOKEY, KM_PRESS, KM_ALT , 0)->ptr,"set",1); - WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0); /* selection mode */ @@ -203,24 +362,17 @@ void ED_keymap_mesh(wmWindowManager *wm) /* tools */ WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_normals_make_consistent", NKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0)->ptr, "inside", 1); - WM_keymap_add_item(keymap, "MESH_OT_vertices_smooth", THREEKEY, KM_PRESS, KM_CTRL , 0); - WM_keymap_add_item(keymap, "MESH_OT_flip_editnormals", THREEKEY, KM_PRESS, KM_ALT , 0); - WM_keymap_add_item(keymap, "MESH_OT_subdivs", WKEY, KM_PRESS, 0, 0); // this is the menu - /*WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); - WM_keymap_add_item(keymap, "MESH_OT_subdivide_multi_fractal", WKEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "MESH_OT_subdivide_smooth", WKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);*/ - WM_keymap_add_item(keymap, "MESH_OT_remove_doubles", VKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_extrude", EKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_spin", RKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "MESH_OT_screw", NINEKEY, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "VIEW3D_OT_editmesh_face_toolbox", FKEY, KM_PRESS, KM_CTRL, 0); /* operators below are in this toolbox */ WM_keymap_add_item(keymap, "MESH_OT_fill", FKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "MESH_OT_beauty_fill", FKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "MESH_OT_quads_convert_to_tris", TKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_tris_convert_to_quads", JKEY, KM_PRESS, KM_ALT, 0); + WM_keymap_add_item(keymap, "MESH_OT_edge_flip", FKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_split", FOURKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MESH_OT_extrude_repeat", FOURKEY, KM_PRESS, KM_ALT, 0); @@ -238,7 +390,7 @@ void ED_keymap_mesh(wmWindowManager *wm) /* add/remove */ WM_keymap_add_item(keymap, "MESH_OT_edge_face_add", FKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "MESH_OT_duplicate_add", DKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "MESH_OT_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "OBJECT_OT_mesh_add", AKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, KM_SHIFT, 0); /* use KM_RELEASE because same key is used for tweaks */ @@ -250,6 +402,12 @@ void ED_keymap_mesh(wmWindowManager *wm) WM_keymap_add_item(keymap, "MESH_OT_fgon_clear", FKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0); WM_keymap_add_item(keymap, "MESH_OT_knife_cut", LEFTMOUSE, KM_PRESS, KM_ALT|KM_CTRL, 0); + + /* menus */ + WM_keymap_add_item(keymap, "MESH_OT_vertex_specials", VKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "MESH_OT_edge_specials", EKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "MESH_OT_face_specials", FKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "MESH_OT_specials", WKEY, KM_PRESS, 0, 0); /* UV's */ WM_keymap_add_item(keymap, "UV_OT_mapping_menu", UKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index b2040d328f2..f8e03e74f24 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1732,7 +1732,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) } /* ****** invert selection *******/ -static int object_select_invert_exec(bContext *C, wmOperator *op) +static int object_select_inverse_exec(bContext *C, wmOperator *op) { CTX_DATA_BEGIN(C, Base*, base, visible_bases) { if (base->flag & SELECT) @@ -1748,16 +1748,16 @@ static int object_select_invert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void OBJECT_OT_select_invert(wmOperatorType *ot) +void OBJECT_OT_select_inverse(wmOperatorType *ot) { /* identifiers */ - ot->name= "Invert selection"; - ot->description = "Invert th select of all visible objects."; - ot->idname= "OBJECT_OT_select_invert"; + ot->name= "Select Inverse"; + ot->description = "Invert selection of all visible objects."; + ot->idname= "OBJECT_OT_select_inverse"; /* api callbacks */ - ot->exec= object_select_invert_exec; + ot->exec= object_select_inverse_exec; ot->poll= ED_operator_scene_editable; /* flags */ @@ -3772,144 +3772,8 @@ void special_editmenu(Scene *scene, View3D *v3d) } } else if(obedit->type==OB_MESH) { - /* This is all that is needed, since all other functionality is in Ctrl+ V/E/F but some users didnt like, so for now have the old/big menu */ - /* - nr= pupmenu("Subdivide Mesh%t|Subdivide%x1|Subdivide Multi%x2|Subdivide Multi Fractal%x3|Subdivide Smooth%x4"); - switch(nr) { - case 1: - waitcursor(1); - esubdivideflag(1, 0.0, scene->toolsettings->editbutflag, 1, 0); - - break; - case 2: - if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return; - waitcursor(1); - esubdivideflag(1, 0.0, scene->toolsettings->editbutflag, numcuts, 0); - break; - case 3: - if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return; - randfac= 10; - if(button(&randfac, 1, 100, "Rand fac:")==0) return; - waitcursor(1); - fac= -( (float)randfac )/100; - esubdivideflag(1, fac, scene->toolsettings->editbutflag, numcuts, 0); - break; - - case 4: - fac= 1.0f; - if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return; - fac= 0.292f*fac; - - waitcursor(1); - esubdivideflag(1, fac, scene->toolsettings->editbutflag | B_SMOOTH, 1, 0); - break; - } - */ - - nr= pupmenu("Specials%t|Subdivide%x1|Subdivide Multi%x2|Subdivide Multi Fractal%x3|Subdivide Smooth%x12|Merge%x4|Remove Doubles%x5|Hide%x6|Reveal%x7|Select Swap%x8|Flip Normals %x9|Smooth %x10|Bevel %x11|Set Smooth %x14|Set Solid %x15|Blend From Shape%x16|Propagate To All Shapes%x17|Select Vertex Path%x18"); - - switch(nr) { - case 1: - waitcursor(1); -// XXX esubdivideflag(1, 0.0, scene->toolsettings->editbutflag, 1, 0); - - break; - case 2: -// XXX if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return; - waitcursor(1); -// XXX esubdivideflag(1, 0.0, scene->toolsettings->editbutflag, numcuts, 0); - break; - case 3: -// XXX if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return; - randfac= 10; -// XXX if(button(&randfac, 1, 100, "Rand fac:")==0) return; - waitcursor(1); - fac= -( (float)randfac )/100; -// XXX esubdivideflag(1, fac, scene->toolsettings->editbutflag, numcuts, 0); - break; - - case 12: /* smooth */ - /* if(button(&numcuts, 1, 128, "Number of Cuts:")==0) return; */ - fac= 1.0f; -// XXX if(fbutton(&fac, 0.0f, 5.0f, 10, 10, "Smooth:")==0) return; -// XXX fac= 0.292f*fac; - - waitcursor(1); -// XXX esubdivideflag(1, fac, scene->toolsettings->editbutflag | B_SMOOTH, 1, 0); - break; - - case 4: -// XXX mergemenu(); - break; - case 5: -// XXX notice("Removed %d Vertices", removedoublesflag(1, 0, scene->toolsettings->doublimit)); - break; - case 6: -// XXX hide_mesh(0); - break; - case 7: -// XXX reveal_mesh(); - break; - case 8: -// XXX selectswap_mesh(); - break; - case 9: -// XXX flip_editnormals(); - break; - case 10: -// XXX vertexsmooth(); - break; - case 11: -// XXX bevel_menu(); - break; - case 14: -// XXX mesh_set_smooth_faces(1); - break; - case 15: -// XXX mesh_set_smooth_faces(0); - break; - case 16: -// XXX shape_copy_select_from(); - break; - case 17: -// XXX shape_propagate(); - break; - case 18: -// XXX pathselect(); - break; - } - - - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - - if(nr>0) waitcursor(0); - } else if(ELEM(obedit->type, OB_CURVE, OB_SURF)) { - - nr= pupmenu("Specials%t|Subdivide%x1|Switch Direction%x2|Set Goal Weight%x3|Set Radius%x4|Smooth%x5|Smooth Radius%x6"); - - switch(nr) { - case 1: -// XXX subdivideNurb(); - break; - case 2: -// XXX switchdirectionNurb2(); - break; - case 3: -// XXX setweightNurb(); - break; - case 4: -// XXX setradiusNurb(); - break; - case 5: -// XXX smoothNurb(); - break; - case 6: -// XXX smoothradiusNurb(); - break; - } - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); } else if(obedit->type==OB_ARMATURE) { nr= pupmenu("Specials%t|Subdivide %x1|Subdivide Multi%x2|Switch Direction%x7|Flip Left-Right Names%x3|%l|AutoName Left-Right%x4|AutoName Front-Back%x5|AutoName Top-Bottom%x6"); diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index f7bdf5da924..0948bfa405b 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -45,7 +45,7 @@ void OBJECT_OT_parent_clear(struct wmOperatorType *ot); void OBJECT_OT_track_set(struct wmOperatorType *ot); void OBJECT_OT_track_clear(struct wmOperatorType *ot); void OBJECT_OT_select_all_toggle(struct wmOperatorType *ot); -void OBJECT_OT_select_invert(struct wmOperatorType *ot); +void OBJECT_OT_select_inverse(struct wmOperatorType *ot); void OBJECT_OT_select_random(struct wmOperatorType *ot); void OBJECT_OT_select_by_type(struct wmOperatorType *ot); void OBJECT_OT_select_by_layer(struct wmOperatorType *ot); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 37e9a2e75ff..3710271bd20 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -68,7 +68,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(OBJECT_OT_parent_clear); WM_operatortype_append(OBJECT_OT_track_set); WM_operatortype_append(OBJECT_OT_track_clear); - WM_operatortype_append(OBJECT_OT_select_invert); + WM_operatortype_append(OBJECT_OT_select_inverse); WM_operatortype_append(OBJECT_OT_select_random); WM_operatortype_append(OBJECT_OT_select_all_toggle); WM_operatortype_append(OBJECT_OT_select_by_type); @@ -139,7 +139,7 @@ void ED_keymap_object(wmWindowManager *wm) keymap= WM_keymap_listbase(wm, "Object Mode", 0, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "OBJECT_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "OBJECT_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_random", PADASTERKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_by_type", PADASTERKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "OBJECT_OT_select_by_layer", PADASTERKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index a902ec27a87..35088f0e4d1 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -86,95 +86,6 @@ #define B_SIMA_RECORD 8 #define B_SIMA_PLAY 9 -static void image_view_viewnavmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - int a; - - uiItemO(layout, NULL, 0, "IMAGE_OT_view_zoom_in"); - uiItemO(layout, NULL, 0, "IMAGE_OT_view_zoom_out"); - - uiItemS(layout); - - for(a=0; a<7; a++) { - const int ratios[7][2] = {{1, 8}, {1, 4}, {1, 2}, {1, 1}, {2, 1}, {4, 1}, {8, 1}}; - char namestr[128]; - - sprintf(namestr, "Zoom %d:%d", ratios[a][0], ratios[a][1]); - uiItemFloatO(layout, namestr, 0, "IMAGE_OT_view_zoom_ratio", "ratio", (float)ratios[a][0]/(float)ratios[a][1]); - } -} - -#if 0 -static void do_viewmenu(bContext *C, void *arg, int event) -{ - add_blockhandler(curarea, IMAGE_HANDLER_VIEW_PROPERTIES, UI_PNL_UNSTOW); - add_blockhandler(curarea, IMAGE_HANDLER_PROPERTIES, UI_PNL_UNSTOW); - add_blockhandler(curarea, IMAGE_HANDLER_PAINT, UI_PNL_UNSTOW); - add_blockhandler(curarea, IMAGE_HANDLER_CURVES, UI_PNL_UNSTOW); - - toggle_blockhandler(curarea, IMAGE_HANDLER_PREVIEW, 0); - scrarea_queue_winredraw(curarea); - - add_blockhandler(curarea, IMAGE_HANDLER_GAME_PROPERTIES, UI_PNL_UNSTOW); - add_blockhandler(curarea, IMAGE_HANDLER_GREASEPENCIL, UI_PNL_UNSTOW); - - allqueue(REDRAWIMAGE, 0); - allqueue(REDRAWVIEW3D, 0); -} -#endif - -static void image_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa= CTX_wm_area(C); - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - PointerRNA spaceptr, uvptr; - int show_paint, show_render, show_uvedit; - - /* retrieve state */ - RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &spaceptr); - RNA_pointer_create(&sc->id, &RNA_SpaceUVEditor, sima, &uvptr); - - show_render= ED_space_image_show_render(sima); - show_paint= ED_space_image_show_paint(sima); - show_uvedit= ED_space_image_show_uvedit(sima, CTX_data_edit_object(C)); - - /* create menu */ - uiItemO(layout, NULL, ICON_MENU_PANEL, "IMAGE_OT_properties"); - //if(show_render) uiItemO(layout, NULL, ICON_MENU_PANEL, "IMAGE_OT_toggle_compositing_preview_panel"); // Compositing Preview...|Shift P - - uiItemS(layout); - - uiItemR(layout, NULL, 0, &spaceptr, "update_automatically", 0, 0, 0); - // XXX if(show_uvedit) uiItemR(layout, NULL, 0, &uvptr, "local_view", 0, 0, 0); // "UV Local View", Numpad / - - uiItemS(layout); - - uiItemMenuF(layout, "View Navigation", 0, image_view_viewnavmenu); - if(show_uvedit) uiItemO(layout, NULL, 0, "IMAGE_OT_view_selected"); - uiItemO(layout, NULL, 0, "IMAGE_OT_view_all"); - - if(sa->full) uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Tile Window", Ctrl UpArrow - else uiItemO(layout, NULL, 0, "SCREEN_OT_screen_full_area"); // "Maximize Window", Ctr DownArrow -} - -static void image_selectmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "UV_OT_select_border"); - uiItemBooleanO(layout, "Border Select Pinned", 0, "UV_OT_select_border", "pinned", 1); // Border Select Pinned|Shift B - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "UV_OT_select_all_toggle"); - uiItemO(layout, NULL, 0, "UV_OT_select_invert"); - uiItemO(layout, NULL, 0, "UV_OT_unlink_selection"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "UV_OT_select_pinned"); - uiItemO(layout, NULL, 0, "UV_OT_select_linked"); -} - #if 0 static void do_image_imagemenu(void *arg, int event) { @@ -183,61 +94,7 @@ static void do_image_imagemenu(void *arg, int event) if (event >= 20) BPY_menu_do_python(PYMENU_IMAGE, event - 20); #endif } -#endif - -static void image_imagemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - bScreen *sc= CTX_wm_screen(C); - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - PointerRNA spaceptr, imaptr; - Image *ima; - ImBuf *ibuf; - int show_render; - - /* retrieve state */ - ima= ED_space_image(sima); - ibuf= ED_space_image_buffer(sima); - - show_render= ED_space_image_show_render(sima); - - RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &spaceptr); - - /* create menu */ - uiItemO(layout, NULL, 0, "IMAGE_OT_new"); // New... - uiItemO(layout, NULL, 0, "IMAGE_OT_open"); // Open... - - if(ima) { - if(!show_render) { - uiItemO(layout, NULL, 0, "IMAGE_OT_replace"); // Replace... - uiItemO(layout, NULL, 0, "IMAGE_OT_reload"); // Reload... - } - uiItemO(layout, NULL, 0, "IMAGE_OT_save"); // Save - uiItemO(layout, NULL, 0, "IMAGE_OT_save_as"); // Save As... - if(ima->source == IMA_SRC_SEQUENCE) - uiItemO(layout, NULL, 0, "IMAGE_OT_save_sequence"); // Save Changed Sequence Images - if(!show_render) { - uiItemS(layout); - - if(ima->packedfile) uiItemO(layout, NULL, 0, "IMAGE_OT_unpack"); // Unpack Image... - else uiItemO(layout, NULL, 0, "IMAGE_OT_pack"); // Pack Image - - /* only for dirty && specific image types : XXX poll? */ - if(ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) - if(ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_GENERATED) && ima->type != IMA_TYPE_MULTILAYER) - uiItemBooleanO(layout, "Pack As PNG", 0, "IMAGE_OT_pack", "as_png", 1); // Pack Image As PNG - - uiItemS(layout); - - uiItemR(layout, NULL, 0, &spaceptr, "image_painting", 0, 0, 0); - - /* move to realtime properties panel */ - RNA_id_pointer_create(&ima->id, &imaptr); - uiItemMenuEnumR(layout, NULL, 0, &imaptr, "mapping"); - } - } - -#if 0 #ifndef DISABLE_PYTHON { BPyMenu *pym; @@ -253,33 +110,6 @@ static void image_imagemenu(bContext *C, uiLayout *layout, void *arg_unused) } #endif #endif -} - -static void image_uvs_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "UV_OT_reveal"); - uiItemO(layout, NULL, 0, "UV_OT_hide"); - uiItemBooleanO(layout, "Hide Unselected", 0, "UV_OT_hide", "unselected", 1); -} - -static void image_uvs_transformmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemEnumO(layout, NULL, 0, "TFM_OT_transform", "mode", TFM_TRANSLATION); - uiItemEnumO(layout, NULL, 0, "TFM_OT_transform", "mode", TFM_ROTATION); - uiItemEnumO(layout, NULL, 0, "TFM_OT_transform", "mode", TFM_RESIZE); -} - -static void image_uvs_mirrormenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemEnumO(layout, NULL, 0, "UV_OT_mirror", "axis", 'x'); // "X Axis", M, 1 - uiItemEnumO(layout, NULL, 0, "UV_OT_mirror", "axis", 'y'); // "Y Axis", M, 2 -} - -static void image_uvs_weldalignmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - uiItemO(layout, NULL, 0, "UV_OT_weld"); // W, 1 - uiItemsEnumO(layout, "UV_OT_align", "axis"); // W, 2/3/4 -} #if 0 #ifndef DISABLE_PYTHON @@ -316,87 +146,7 @@ static void image_uvs_scriptsmenu (void *args_unused) #endif /* DISABLE_PYTHON */ #endif -static void image_uvsmenu(bContext *C, uiLayout *layout, void *arg_unused) -{ - bScreen *sc= CTX_wm_screen(C); - Scene *scene= CTX_data_scene(C); - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - PointerRNA uvptr, sceneptr; - Image *ima; - ImBuf *ibuf; - - /* retrieve state */ - ima= ED_space_image(sima); - ibuf= ED_space_image_buffer(sima); - - RNA_pointer_create(&sc->id, &RNA_SpaceUVEditor, sima, &uvptr); - RNA_id_pointer_create(&scene->id, &sceneptr); - - /* create menu */ - uiItemR(layout, NULL, 0, &uvptr, "snap_to_pixels", 0, 0, 0); - uiItemR(layout, NULL, 0, &uvptr, "constrain_to_image_bounds", 0, 0, 0); - - uiItemS(layout); - - uiItemR(layout, NULL, 0, &uvptr, "live_unwrap", 0, 0, 0); - uiItemO(layout, NULL, 0, "UV_OT_unwrap"); - uiItemBooleanO(layout, "Unpin", 0, "UV_OT_pin", "clear", 1); - uiItemO(layout, NULL, 0, "UV_OT_pin"); - - uiItemS(layout); - - uiItemO(layout, NULL, 0, "UV_OT_pack_islands"); - uiItemO(layout, NULL, 0, "UV_OT_average_islands_scale"); - uiItemO(layout, NULL, 0, "UV_OT_minimize_stretch"); - uiItemO(layout, NULL, 0, "UV_OT_stitch"); - - uiItemS(layout); - - uiItemMenuF(layout, "Transform", 0, image_uvs_transformmenu); - uiItemMenuF(layout, "Mirror", 0, image_uvs_mirrormenu); - uiItemMenuF(layout, "Weld/Align", 0, image_uvs_weldalignmenu); - - uiItemS(layout); - - uiItemR(layout, NULL, 0, &sceneptr, "proportional_editing", 0, 0, 0); - uiItemMenuEnumR(layout, NULL, 0, &sceneptr, "proportional_editing_falloff"); - - uiItemS(layout); - - uiItemMenuF(layout, "Show/Hide Faces", 0, image_uvs_showhidemenu); - #if 0 -#ifndef DISABLE_PYTHON - uiItemS(layout); - - uiItemMenuF(layout, "Scripts", image_uvs_scriptsmenu); -#endif -#endif -} - -static void image_menu_uvlayers(Object *obedit, char *menustr, int *active) -{ - Mesh *me= (Mesh*)obedit->data; - EditMesh *em= BKE_mesh_get_editmesh(me); - CustomDataLayer *layer; - int i, count = 0; - - menustr[0]= '\0'; - - for(i=0; i<em->fdata.totlayer; i++) { - layer = &em->fdata.layers[i]; - - if(layer->type == CD_MTFACE) { - menustr += sprintf(menustr, "%s%%x%d|", layer->name, count); - count++; - } - } - - *active= CustomData_get_active_layer(&em->fdata, CD_MTFACE); - - BKE_mesh_end_editmesh(me, em); -} - static void do_image_buttons(bContext *C, void *arg, int event) { switch(event) { @@ -405,7 +155,6 @@ static void do_image_buttons(bContext *C, void *arg, int event) break; } -#if 0 ToolSettings *settings= G.scene->toolsettings; ID *id, *idtest; int nr; @@ -660,279 +409,9 @@ static void do_image_buttons(bContext *C, void *arg, int event) imagespace_composite_flipbook(curarea); break; } -#endif -} - -#if 0 -static void do_image_buttons_set_uvlayer_callback(void *act, void *data) -{ - CustomData_set_layer_active(&G.editMesh->fdata, CD_MTFACE, *((int *)act)); - - BIF_undo_push("Set Active UV Texture"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWBUTSEDIT, 0); - allqueue(REDRAWIMAGE, 0); } #endif -static void sima_idpoin_handle(bContext *C, ID *id, int event) -{ - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - - switch(event) { - case UI_ID_BROWSE: - case UI_ID_DELETE: - ED_space_image_set(C, sima, scene, obedit, (Image*)id); - ED_undo_push(C, "Assign Image UV"); - break; - case UI_ID_RENAME: - break; - case UI_ID_ADD_NEW: - WM_operator_name_call(C, "IMAGE_OT_new", WM_OP_INVOKE_REGION_WIN, NULL); - break; - case UI_ID_OPEN: - WM_operator_name_call(C, "IMAGE_OT_open", WM_OP_INVOKE_REGION_WIN, NULL); - break; - case UI_ID_PIN: - ED_area_tag_refresh(CTX_wm_area(C)); - break; - } -} - -void image_header_buttons(const bContext *C, ARegion *ar) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa= CTX_wm_area(C); - Scene *scene= CTX_data_scene(C); - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - Image *ima; - ImBuf *ibuf; - uiBlock *block; - uiBut *but; - PointerRNA spaceptr, uvptr, sceneptr; - int xco, yco= 3, show_uvedit, show_render, show_paint, pinflag; - - /* retrieve state */ - ima= ED_space_image(sima); - ibuf= ED_space_image_buffer(sima); - - show_render= ED_space_image_show_render(sima); - show_paint= ED_space_image_show_paint(sima); - show_uvedit= ED_space_image_show_uvedit(sima, CTX_data_edit_object(C)); - - RNA_pointer_create(&sc->id, &RNA_SpaceImageEditor, sima, &spaceptr); - RNA_pointer_create(&sc->id, &RNA_SpaceUVEditor, sima, &uvptr); - RNA_id_pointer_create(&scene->id, &sceneptr); - - /* create block */ - block= uiBeginBlock(C, ar, "header buttons", UI_EMBOSS); - uiBlockSetHandleFunc(block, do_image_buttons, NULL); - - xco= ED_area_header_standardbuttons(C, block, yco); - - /* create pulldown menus */ - if((sa->flag & HEADER_NO_PULLDOWN)==0) { - char *menuname; - int xmax; - - xmax= GetButStringLength("View"); - uiDefMenuBut(block, image_viewmenu, NULL, "View", xco, yco, xmax-3, 20, ""); - xco+= xmax; - - if(show_uvedit) { - xmax= GetButStringLength("Select"); - uiDefMenuBut(block, image_selectmenu, NULL, "Select", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } - - menuname= (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))? "Image*": "Image"; - xmax= GetButStringLength(menuname); - uiDefMenuBut(block, image_imagemenu, NULL, menuname, xco, yco, xmax-3, 20, ""); - xco+= xmax; - - if(show_uvedit) { - xmax= GetButStringLength("UVs"); - uiDefMenuBut(block, image_uvsmenu, NULL, "UVs", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } - } - - uiBlockSetEmboss(block, UI_EMBOSS); - - /* image select */ - - pinflag= (show_render)? 0: UI_ID_PIN; - xco= uiDefIDPoinButs(block, CTX_data_main(C), NULL, (ID*)sima->image, ID_IM, &sima->pin, xco, yco, - sima_idpoin_handle, UI_ID_BROWSE|UI_ID_BROWSE_RENDER|UI_ID_RENAME|UI_ID_ADD_NEW|UI_ID_OPEN|UI_ID_DELETE|pinflag); - xco += 8; - - if(ima && !ELEM3(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE, IMA_SRC_VIEWER) && ima->ok) { - /* XXX this should not be a static var */ - static int headerbuttons_packdummy; - - headerbuttons_packdummy = 0; - - if (ima->packedfile) { - headerbuttons_packdummy = 1; - } - if (ima->packedfile && ibuf && (ibuf->userflags & IB_BITMAPDIRTY)) - uiDefIconButBitI(block, TOG, 1, 0 /* XXX B_SIMA_REPACK */, ICON_UGLYPACKAGE, xco,yco,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Re-Pack this image as PNG"); - else - uiDefIconButBitI(block, TOG, 1, 0 /* XXX B_SIMAPACKIMA */, ICON_PACKAGE, xco,yco,XIC,YIC, &headerbuttons_packdummy, 0, 0, 0, 0, "Pack/Unpack this image"); - - xco+= XIC+8; - } - - /* uv editing */ - if(show_uvedit) { - /* pivot */ - uiDefIconTextButS(block, ICONTEXTROW, B_NOP, ICON_ROTATE, - "Pivot: %t|Bounding Box Center %x0|Median Point %x3|2D Cursor %x1", - xco,yco,XIC+10,YIC, &ar->v2d.around, 0, 3.0, 0, 0, - "Rotation/Scaling Pivot (Hotkeys: Comma, Shift Comma, Period)"); - xco+= XIC + 18; - - /* selection modes */ - uiDefIconButBitS(block, TOG, UV_SYNC_SELECTION, B_REDR, ICON_EDIT, xco,yco,XIC,YIC, &scene->toolsettings->uv_flag, 0, 0, 0, 0, "Sync UV and Mesh Selection"); - xco+= XIC+8; - - if(scene->toolsettings->uv_flag & UV_SYNC_SELECTION) { - uiBlockBeginAlign(block); - - uiDefIconButBitS(block, TOG, SCE_SELECT_VERTEX, B_REDR, ICON_VERTEXSEL, - xco,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Vertex select mode"); - uiDefIconButBitS(block, TOG, SCE_SELECT_EDGE, B_REDR, ICON_EDGESEL, - xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Edge select mode"); - uiDefIconButBitS(block, TOG, SCE_SELECT_FACE, B_REDR, ICON_FACESEL, - xco+=XIC,yco,XIC,YIC, &scene->toolsettings->selectmode, 1.0, 0.0, 0, 0, "Face select mode"); - - uiBlockEndAlign(block); - } - else { - uiBlockBeginAlign(block); - - uiDefIconButS(block, ROW, B_REDR, ICON_VERTEXSEL, - xco,yco,XIC,YIC, &scene->toolsettings->uv_selectmode, 1.0, UV_SELECT_VERTEX, 0, 0, "Vertex select mode"); - uiDefIconButS(block, ROW, B_REDR, ICON_EDGESEL, - xco+=XIC,yco,XIC,YIC, &scene->toolsettings->uv_selectmode, 1.0, UV_SELECT_EDGE, 0, 0, "Edge select mode"); - uiDefIconButS(block, ROW, B_REDR, ICON_FACESEL, - xco+=XIC,yco,XIC,YIC, &scene->toolsettings->uv_selectmode, 1.0, UV_SELECT_FACE, 0, 0, "Face select mode"); - uiDefIconButS(block, ROW, B_REDR, ICON_LINKEDSEL, - xco+=XIC,yco,XIC,YIC, &scene->toolsettings->uv_selectmode, 1.0, UV_SELECT_ISLAND, 0, 0, "Island select mode"); - - uiBlockEndAlign(block); - - /* would use these if const's could go in strings - * SI_STICKY_LOC SI_STICKY_DISABLE SI_STICKY_VERTEX */ - but = uiDefIconTextButC(block, ICONTEXTROW, B_REDR, ICON_STICKY_UVS_LOC, - "Sticky UV Selection: %t|Disable%x1|Shared Location%x0|Shared Vertex%x2", - xco+=XIC+10,yco,XIC+10,YIC, &(sima->sticky), 0, 3.0, 0, 0, - "Sticky UV Selection (Hotkeys: Shift C, Alt C, Ctrl C)"); - } - - xco+= XIC + 16; - - /* snap options, identical to options in 3d view header */ - uiBlockBeginAlign(block); - - if (scene->toolsettings->snap_flag & SCE_SNAP) { - uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEO,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Use Snap or Grid (Shift Tab)."); - xco+= XIC; - uiDefButS(block, MENU, B_NOP, "Mode%t|Closest%x0|Center%x1|Median%x2",xco,yco,70,YIC, &scene->toolsettings->snap_target, 0, 0, 0, 0, "Snap Target Mode."); - xco+= 70; - } - else { - uiDefIconButBitS(block, TOG, SCE_SNAP, B_REDR, ICON_SNAP_GEAR,xco,yco,XIC,YIC, &scene->toolsettings->snap_flag, 0, 0, 0, 0, "Snap while Ctrl is held during transform (Shift Tab)."); - xco+= XIC; - } - - uiBlockEndAlign(block); - xco+= 8; - - /* uv layers */ - { - Object *obedit= CTX_data_edit_object(C); - char menustr[34*MAX_MTFACE]; - static int act; - - image_menu_uvlayers(obedit, menustr, &act); - - but = uiDefButI(block, MENU, B_NOP, menustr ,xco,yco,85,YIC, &act, 0, 0, 0, 0, "Active UV Layer for editing."); - // uiButSetFunc(but, do_image_buttons_set_uvlayer_callback, &act, NULL); - - xco+= 85; - } - - xco+= 8; - } - - if(ima) { - RenderResult *rr; - - /* render layers and passes */ - rr= BKE_image_get_renderresult(scene, ima); - if(rr) { - uiBlockBeginAlign(block); -#if 0 - uiblock_layer_pass_buttons(block, rr, &sima->iuser, B_REDR, xco, 0, 160); -#endif - uiBlockEndAlign(block); - xco+= 166; - } - - /* painting */ - uiDefIconButR(block, TOG, B_REDR, ICON_TPAINT_HLT, xco,yco,XIC,YIC, &spaceptr, "image_painting", 0, 0, 0, 0, 0, NULL); - xco+= XIC+8; - - /* image draw options */ - uiBlockBeginAlign(block); - uiDefIconButR(block, ROW, B_REDR, ICON_IMAGE_RGB, xco,yco,XIC,YIC, &spaceptr, "draw_channels", 0, 0, 0, 0, 0, NULL); - xco+= XIC; - if(ibuf==NULL || ibuf->channels==4) { - uiDefIconButR(block, ROW, B_REDR, ICON_IMAGE_RGB_ALPHA, xco,yco,XIC,YIC, &spaceptr, "draw_channels", 0, 0, SI_USE_ALPHA, 0, 0, NULL); - xco+= XIC; - uiDefIconButR(block, ROW, B_REDR, ICON_IMAGE_ALPHA, xco,yco,XIC,YIC, &spaceptr, "draw_channels", 0, 0, SI_SHOW_ALPHA, 0, 0, NULL); - xco+= XIC; - } - if(ibuf) { - if(ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels==1)) { - uiDefIconButR(block, ROW, B_REDR, ICON_IMAGE_ZDEPTH, xco,yco,XIC,YIC, &spaceptr, "draw_channels", 0, 0, SI_SHOW_ZBUF, 0, 0, NULL); - xco+= XIC; - } - } -#ifdef WITH_LCMS - uiDefIconButR(block, ROW, B_REDR, ICON_IMAGE_ALPHA, xco,yco,XIC,YIC, &spaceptr, "draw_channels", 0, 0, SI_COLOR_CORRECTION, 0, 0, NULL); - xco+= XIC; -#endif - xco+= 8; - - /* record & play */ - uiBlockBeginAlign(block); - if(ima->type==IMA_TYPE_COMPOSITE) { - uiDefIconButO(block, BUT, "IMAGE_OT_record_composite", WM_OP_INVOKE_REGION_WIN, ICON_REC, xco, yco, XIC, YIC, NULL); // Record Composite - xco+= XIC; - } - if((ima->type==IMA_TYPE_COMPOSITE) || ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { -//XXX uiDefIconButO(block, BUT, "IMAGE_OT_play_composite", WM_OP_INVOKE_REGION_WIN, ICON_PLAY, xco, yco, XIC, YIC, NULL); // PLAY - xco+= XIC; - } - uiBlockEndAlign(block); - xco+= 8; - - } - - /* draw lock */ - uiDefIconButR(block, ICONTOG, 0, ICON_UNLOCKED, xco,yco,XIC,YIC, &spaceptr, "update_automatically", 0, 0, 0, 0, 0, NULL); - - /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin); - - uiEndBlock(C, block); - uiDrawBlock(C, block); -} - /********************** toolbox operator *********************/ static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) @@ -948,10 +427,10 @@ static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) pup= uiPupMenuBegin(C, "Toolbox", 0); layout= uiPupMenuLayout(pup); - uiItemMenuF(layout, "View", 0, image_viewmenu); - if(show_uvedit) uiItemMenuF(layout, "Select", 0, image_selectmenu); - uiItemMenuF(layout, "Image", 0, image_imagemenu); - if(show_uvedit) uiItemMenuF(layout, "UVs", 0, image_uvsmenu); + uiItemM(layout, C, NULL, 0, "IMAGE_MT_view"); + if(show_uvedit) uiItemM(layout, C, NULL, 0, "IMAGE_MT_select"); + uiItemM(layout, C, NULL, 0, "IMAGE_MT_image"); + if(show_uvedit) uiItemM(layout, C, NULL, 0, "IMAGE_MT_uvs"); uiPupMenuEnd(C, pup); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index ef472d462c2..709fbb6299b 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -588,7 +588,6 @@ void ED_spacetype_image(void) BLI_addhead(&st->regiontypes, art); - BKE_spacetype_register(st); } diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 6d61f743917..0786ad17f1e 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -104,7 +104,7 @@ void SEQUENCER_OT_select_linked_pick(struct wmOperatorType *ot); void SEQUENCER_OT_select_handles(struct wmOperatorType *ot); void SEQUENCER_OT_select_active_side(struct wmOperatorType *ot); void SEQUENCER_OT_select_border(struct wmOperatorType *ot); -void SEQUENCER_OT_select_invert(struct wmOperatorType *ot); +void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot); /* sequencer_select.c */ diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index d1a2307ca3a..fd1d2237c10 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -83,7 +83,7 @@ void sequencer_operatortypes(void) /* sequencer_select.c */ WM_operatortype_append(SEQUENCER_OT_select_all_toggle); - WM_operatortype_append(SEQUENCER_OT_select_invert); + WM_operatortype_append(SEQUENCER_OT_select_inverse); WM_operatortype_append(SEQUENCER_OT_select); WM_operatortype_append(SEQUENCER_OT_select_more); WM_operatortype_append(SEQUENCER_OT_select_less); @@ -111,7 +111,7 @@ void sequencer_keymap(wmWindowManager *wm) WM_keymap_add_item(keymap, "SEQUENCER_OT_properties", NKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "SEQUENCER_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, 0, 0)->ptr, "type", SEQ_CUT_SOFT); RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_cut", KKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "type", SEQ_CUT_HARD); diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index bfd89ccdffb..335652235c6 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -244,7 +244,7 @@ void SEQUENCER_OT_select_all_toggle(struct wmOperatorType *ot) /* (de)select operator */ -static int sequencer_select_invert_exec(bContext *C, wmOperator *op) +static int sequencer_select_inverse_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Editing *ed= seq_give_editing(scene, FALSE); @@ -267,14 +267,14 @@ static int sequencer_select_invert_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void SEQUENCER_OT_select_invert(struct wmOperatorType *ot) +void SEQUENCER_OT_select_inverse(struct wmOperatorType *ot) { /* identifiers */ - ot->name= "Select Invert"; - ot->idname= "SEQUENCER_OT_select_invert"; + ot->name= "Select Inverse"; + ot->idname= "SEQUENCER_OT_select_inverse"; /* api callbacks */ - ot->exec= sequencer_select_invert_exec; + ot->exec= sequencer_select_inverse_exec; ot->poll= ED_operator_sequencer_active; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index daa872defff..d5ec5e10b94 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -644,6 +644,9 @@ static void view3d_view_alignviewmenu(bContext *C, uiLayout *layout, void *arg_u static void view3d_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) { ScrArea *sa= CTX_wm_area(C); + + uiItemO(layout, NULL, ICON_MENU_PANEL, "VIEW3D_OT_properties"); + uiItemO(layout, NULL, ICON_MENU_PANEL, "VIEW3D_OT_toolbar"); // uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_transform_orientations_panel"); // Transform Orientations... // uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_render_preview_panel"); // render preview... @@ -651,7 +654,7 @@ static void view3d_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) // uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_background_image_panel"); // Background Image.... // uiItemO(layout, ICON_MENU_PANEL, "VIEW3D_OT_toggle_grease_pencil_panel"); // Grease Pencil.... -// uiItemS(layout); + uiItemS(layout); uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_CAMERA); uiItemEnumO(layout, NULL, 0, "VIEW3D_OT_viewnumpad", "type", V3D_VIEW_TOP); @@ -1014,7 +1017,7 @@ static void view3d_select_objectmenu(bContext *C, uiLayout *layout, void *arg_un uiItemS(layout); uiItemO(layout, "Select/Deselect All", 0, "OBJECT_OT_select_all_toggle"); - uiItemO(layout, "Inverse", 0, "OBJECT_OT_select_invert"); + uiItemO(layout, "Inverse", 0, "OBJECT_OT_select_inverse"); uiItemO(layout, "Random", 0, "OBJECT_OT_select_random"); uiItemO(layout, "Select All by Layer", 0, "OBJECT_OT_select_by_layer"); uiItemMenuEnumO(layout, "Select All by Type", 0, "OBJECT_OT_select_by_type", "type"); @@ -1037,7 +1040,7 @@ static void view3d_select_meshmenu(bContext *C, uiLayout *layout, void *arg_unus uiItemS(layout); uiItemO(layout, "Select/Deselect All", 0, "MESH_OT_select_all_toggle"); - uiItemO(layout, "Inverse", 0, "MESH_OT_select_invert"); + uiItemO(layout, "Inverse", 0, "MESH_OT_select_inverse"); uiItemS(layout); @@ -1061,8 +1064,8 @@ static void view3d_select_meshmenu(bContext *C, uiLayout *layout, void *arg_unus uiItemO(layout, "Linked", 0, "MESH_OT_select_linked"); uiItemO(layout, "Vertex Path", 0, "MESH_OT_select_vertex_path"); // W, Alt 7 - // XXX uiItemO(layout, "Edge Loop", 0, "MESH_OT_select_edge_loop"); // loop_multiselect(0) - // XXX uiItemO(layout, "Edge Ring", 0, "MESH_OT_select_edge_ring"); // loop_multiselect(1) + uiItemO(layout, "Edge Loop", 0, "MESH_OT_loop_multi_select"); + uiItemBooleanO(layout, "Edge Ring", 0, "MESH_OT_loop_multi_select", "ring", 1); uiItemS(layout); @@ -1080,7 +1083,7 @@ static void view3d_select_curvemenu(bContext *C, uiLayout *layout, void *arg_unu uiItemS(layout); uiItemO(layout, NULL, 0, "CURVE_OT_select_all_toggle"); - uiItemO(layout, NULL, 0, "CURVE_OT_select_invert"); + uiItemO(layout, NULL, 0, "CURVE_OT_select_inverse"); uiItemO(layout, NULL, 0, "CURVE_OT_select_random"); // Random... uiItemO(layout, NULL, 0, "CURVE_OT_select_every_nth"); // Every Nth.. @@ -1182,7 +1185,7 @@ static void view3d_select_armaturemenu(bContext *C, uiLayout *layout, void *arg_ uiItemS(layout); uiItemO(layout, "Select/Deselect All", 0, "ARMATURE_OT_select_all_toggle"); - uiItemO(layout, "Inverse", 0, "ARMATURE_OT_select_invert"); + uiItemO(layout, "Inverse", 0, "ARMATURE_OT_select_inverse"); uiItemS(layout); @@ -1211,7 +1214,7 @@ static void view3d_select_posemenu(bContext *C, uiLayout *layout, void *arg_unus uiItemS(layout); uiItemO(layout, "Select/Deselect All", 0, "POSE_OT_select_all_toggle"); - uiItemO(layout, "Inverse", 0, "POSE_OT_select_invert"); + uiItemO(layout, "Inverse", 0, "POSE_OT_select_inverse"); uiItemO(layout, "Constraint Target", 0, "POSE_OT_select_constraint_target"); uiItemS(layout); @@ -1302,57 +1305,17 @@ static uiBlock *view3d_select_faceselmenu(bContext *C, ARegion *ar, void *arg_un return block; } -void do_view3d_edit_snapmenu(bContext *C, void *arg, int event) +static void view3d_edit_snapmenu(bContext *C, uiLayout *layout, void *arg_unused) { -#if 0 - switch (event) { - case 1: /*Selection to grid*/ - snap_sel_to_grid(); - ED_undo_push(C, "Snap selection to grid"); - break; - case 2: /*Selection to cursor*/ - snap_sel_to_curs(); - ED_undo_push(C, "Snap selection to cursor"); - break; - case 3: /*Selection to center of selection*/ - snap_to_center(); - ED_undo_push(C, "Snap selection to center"); - break; - case 4: /*Cursor to selection*/ - snap_curs_to_sel(); - break; - case 5: /*Cursor to grid*/ - snap_curs_to_grid(); - break; - case 6: /*Cursor to Active*/ - snap_curs_to_active(); - ED_undo_push(C, "Snap selection to center"); - break; - } -#endif -} + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_selected_to_grid"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_selected_to_cursor"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_selected_to_center"); -static uiBlock *view3d_edit_snapmenu(bContext *C, ARegion *ar, void *arg_unused) -{ - uiBlock *block; - short yco = 20, menuwidth = 120; + uiItemS(layout); - block= uiBeginBlock(C, ar, "view3d_edit_snapmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_snapmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Grid|Shift S, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Cursor|Shift S, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Selection -> Center|Shift S, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cursor -> Selection|Shift S, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cursor -> Grid|Shift S, 5", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cursor -> Active|Shift S, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); - - - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_cursor_to_selected"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_cursor_to_grid"); + uiItemO(layout, NULL, 0, "VIEW3D_OT_snap_cursor_to_active"); } void do_view3d_transform_moveaxismenu(bContext *C, void *arg, int event) @@ -2338,7 +2301,7 @@ static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unuse uiDefIconTextBlockBut(block, view3d_object_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_object_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Clear/Apply", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); + // XXX uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -2397,116 +2360,26 @@ static uiBlock *view3d_edit_objectmenu(bContext *C, ARegion *ar, void *arg_unuse } -static void do_view3d_edit_propfalloffmenu(bContext *C, void *arg, int event) +static void view3d_edit_mesh_verticesmenu(bContext *C, uiLayout *layout, void *arg_unused) { - ToolSettings *ts= CTX_data_tool_settings(C); - - ts->prop_mode= event; - -} + uiItemO(layout, "Merge...", 0, "MESH_OT_merge"); + uiItemO(layout, "Rip", 0, "MESH_OT_rip"); + uiItemO(layout, "Split", 0, "MESH_OT_split"); + uiItemO(layout, "Separate", 0, "MESH_OT_separate"); -static uiBlock *view3d_edit_propfalloffmenu(bContext *C, ARegion *ar, void *arg_unused) -{ - ToolSettings *ts= CTX_data_tool_settings(C); - uiBlock *block; - short yco = 20, menuwidth = 120; - - block= uiBeginBlock(C, ar, "view3d_edit_propfalloffmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_propfalloffmenu, NULL); - - if (ts->prop_mode==PROP_SMOOTH) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, ""); - else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Smooth|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SMOOTH, ""); - if (ts->prop_mode==PROP_SPHERE) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, ""); - else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sphere|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SPHERE, ""); - if (ts->prop_mode==PROP_ROOT) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, ""); - else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Root|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_ROOT, ""); - if (ts->prop_mode==PROP_SHARP) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, ""); - else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Sharp|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_SHARP, ""); - if (ts->prop_mode==PROP_LIN) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, ""); - else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Linear|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_LIN, ""); - if (ts->prop_mode==PROP_RANDOM) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, ""); - else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Random|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_RANDOM, ""); - if (ts->prop_mode==PROP_CONST) uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, ""); - else uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Constant|Shift O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, PROP_CONST, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; -} + uiItemS(layout); + uiItemO(layout, "Smooth", 0, "MESH_OT_vertices_smooth"); + uiItemO(layout, "Remove Doubles", 0, "MESH_OT_remove_doubles"); -void do_view3d_edit_mesh_verticesmenu(bContext *C, void *arg, int event) -{ #if 0 - Scene *scene= CTX_data_scene(C); - - switch(event) { - int count; - - case 0: /* make vertex parent */ - make_parent(); - break; - case 1: /* remove doubles */ - count= removedoublesflag(1, 0, ts->doublimit); - notice("Removed: %d", count); - if (count) { /* only undo and redraw if an action is taken */ - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - ED_undo_push(C, "Rem Doubles"); - } - break; - case 2: /* smooth */ - vertexsmooth(); - break; - case 3: /* separate */ - separate_mesh(); - break; - case 4: /*split */ - split_mesh(); - break; - case 5: /*merge */ - mergemenu(); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; - case 6: /* add hook */ - add_hook_menu(); - break; - case 7: /* rip */ - mesh_rip(); - break; - } -#endif -} - -static uiBlock *view3d_edit_mesh_verticesmenu(bContext *C, ARegion *ar, void *arg_unused) -{ - uiBlock *block; - short yco = 20, menuwidth = 120; - - block= uiBeginBlock(C, ar, "view3d_edit_mesh_verticesmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_mesh_verticesmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Merge...|Alt M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rip|V", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Split|Y", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Separate|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Smooth|W, Alt 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remove Doubles|W, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); + uiItemS(layout); - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Vertex Parent|Ctrl P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); // add_hook_menu(); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add Hook|Ctrl H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); // make_parent(); +#endif } -extern void editmesh_mark_sharp(int set); /* declared in editmesh_mods.c */ - void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event) { #if 0 @@ -2515,52 +2388,12 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event) short randfac; switch(event) { - - case 0: /* subdivide smooth */ - esubdivideflag(1, 0.0, ts->editbutflag | B_SMOOTH,1,0); - ED_undo_push(C, "Subdivide Smooth"); - break; - case 1: /*subdivide fractal */ - randfac= 10; - if(button(&randfac, 1, 100, "Rand fac:")==0) return; - fac= -( (float)randfac )/100; - esubdivideflag(1, fac, ts->editbutflag,1,0); - ED_undo_push(C, "Subdivide Fractal"); - break; - case 2: /* subdivide */ - esubdivideflag(1, 0.0, ts->editbutflag,1,0); - ED_undo_push(C, "Subdivide"); - break; - case 3: /* knife subdivide */ - KnifeSubdivide(KNIFE_PROMPT); - break; - case 4: /* Loop subdivide */ - CutEdgeloop(1); - break; - case 5: /* Make Edge/Face */ - addedgeface_mesh(); - break; - case 6: - bevel_menu(); - break; - case 7: /* Mark Seam */ - editmesh_mark_seam(0); - break; - case 8: /* Clear Seam */ - editmesh_mark_seam(1); - break; case 9: /* Crease SubSurf */ if(!multires_level1_test()) { initTransform(TFM_CREASE, CTX_EDGE); Transform(); } break; - case 10: /* Rotate Edge */ - edge_rotate_selected(2); - break; - case 11: /* Rotate Edge */ - edge_rotate_selected(1); - break; case 12: /* Edgeslide */ EdgeSlide(0,0.0); break; @@ -2575,16 +2408,6 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event) collapseEdges(); ED_undo_push(C, "Collapse"); break; - case 15: - editmesh_mark_sharp(1); - ED_undo_push(C, "Mark Sharp"); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; - case 16: - editmesh_mark_sharp(0); - ED_undo_push(C, "Clear Sharp"); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; case 17: /* Adjust Bevel Weight */ if(!multires_level1_test()) { initTransform(TFM_BWEIGHT, CTX_EDGE); @@ -2595,158 +2418,79 @@ void do_view3d_edit_mesh_edgesmenu(bContext *C, void *arg, int event) #endif } -static uiBlock *view3d_edit_mesh_edgesmenu(bContext *C, ARegion *ar, void *arg_unused) +static void view3d_edit_mesh_edgesmenu(bContext *C, uiLayout *layout, void *arg_unused) { - uiBlock *block; - short yco = 20, menuwidth = 120; + uiItemO(layout, NULL, 0, "MESH_OT_edge_face_add"); - block= uiBeginBlock(C, ar, "view3d_edit_mesh_edgesmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_mesh_edgesmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel|W, Alt 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Loop Subdivide...|Ctrl R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Knife Subdivide...|Shift K", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide|W, 1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide Fractal|W, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdivide Smooth|W, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); +#if 0 + uiItemO(layout, "Bevel", 0, "MESH_OT_bevel"); // bevelmenu(em) + uiItemO(layout, "Loop Subdivide...", 0, "MESH_OT_loop_subdivide"); // Ctr R, CutEdgeloop(1); + uiItemO(layout, "Knife Subdivide...", 0, "MESH_OT_loop_subdivide"); // Shift K, KnifeSubdivide(KNIFE_PROMPT); - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiItemS(layout); +#endif - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mark Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Seam|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mark Sharp|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear Sharp|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); - + uiItemO(layout, "Subdivide", 0, "MESH_OT_subdivide"); + uiItemFloatO(layout, "Subdivide Smooth", 0, "MESH_OT_subdivide", "smoothness", 1.0f); + + uiItemS(layout); + + uiItemO(layout, "Mark Seam", 0, "MESH_OT_mark_seam"); + uiItemBooleanO(layout, "Clear Seam", 0, "MESH_OT_mark_seam", "clear", 1); + + uiItemS(layout); + + uiItemO(layout, "Mark Sharp", 0, "MESH_OT_mark_sharp"); + uiItemBooleanO(layout, "Clear Sharp", 0, "MESH_OT_mark_sharp", "clear", 1); + +#if 0 + uiItemS(layout); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Adjust Bevel Weight|Ctrl Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Crease SubSurf|Shift E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, ""); +#endif - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiItemS(layout); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Edge CW|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Rotate Edge CCW|Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, ""); + uiItemEnumO(layout, "Rotate Edge CW", 0, "MESH_OT_edge_rotate", "direction", 1); + uiItemEnumO(layout, "Rotate Edge CCW", 0, "MESH_OT_edge_rotate", "direction", 2); +#if 0 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Slide Edge |Ctrl E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Edge Loop|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Collapse", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, ""); - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; -} - -void do_view3d_edit_mesh_facesmenu(bContext *C, void *arg, int event) -{ -#if 0 - Scene *scene= CTX_data_scene(C); - - switch(event) { - case 0: /* Fill Faces */ - fill_mesh(); - break; - case 1: /* Beauty Fill Faces */ - beauty_fill(); - break; - case 2: /* Quads to Tris */ - convert_to_triface(0); - countall(); - DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); - break; - case 3: /* Tris to Quads */ - join_triangles(); - break; - case 4: /* Flip triangle edges */ - edge_flip(); - break; - case 5: /* Make Edge/Face */ - addedgeface_mesh(); - break; - case 6: /* Set Smooth */ - mesh_set_smooth_faces(1); - break; - case 7: /* Set Solid */ - mesh_set_smooth_faces(0); - break; - } #endif } -static uiBlock *view3d_edit_mesh_facesmenu(bContext *C, ARegion *ar, void *arg_unused) +static void view3d_edit_mesh_facesmenu(bContext *C, uiLayout *layout, void *arg_unused) { - uiBlock *block; - short yco = 20, menuwidth = 120; + uiItemO(layout, NULL, 0, "MESH_OT_edge_face_add"); + uiItemO(layout, NULL, 0, "MESH_OT_fill"); + uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill"); - block= uiBeginBlock(C, ar, "view3d_edit_mesh_facesmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_mesh_facesmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Fill|Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Beautify Fill|Alt F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Quads to Triangles|Ctrl T", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Convert Triangles to Quads|Alt J", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Flip Triangle Edges|Ctrl Shift F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Smooth|W, Alt 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Solid|W, Alt 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; -} + uiItemS(layout); -void do_view3d_edit_mesh_normalsmenu(bContext *C, void *arg, int event) -{ -#if 0 - switch(event) { - case 0: /* flip */ - flip_editnormals(); - break; - case 1: /* recalculate inside */ - righthandfaces(2); - break; - case 2: /* recalculate outside */ - righthandfaces(1); - break; - } -#endif + uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris"); + uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads"); + uiItemO(layout, NULL, 0, "MESH_OT_edge_flip"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth"); + uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_solid"); } -static uiBlock *view3d_edit_mesh_normalsmenu(bContext *C, ARegion *ar, void *arg_unused) +static void view3d_edit_mesh_normalsmenu(bContext *C, uiLayout *layout, void *arg_unused) { - uiBlock *block; - short yco = 20, menuwidth = 120; + uiItemO(layout, "Recalculate Outside", 0, "MESH_OT_normals_make_consistent"); + uiItemBooleanO(layout, "Recalculate Inside", 0, "MESH_OT_normals_make_consistent", "inside", 1); - block= uiBeginBlock(C, ar, "view3d_edit_mesh_normalsmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_mesh_normalsmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recalculate Outside|Ctrl N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Recalculate Inside|Ctrl Shift N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Flip|W, 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; + uiItemS(layout); + + uiItemO(layout, NULL, 0, "MESH_OT_flip_normals"); } void do_view3d_edit_mirrormenu(bContext *C, void *arg, int event) @@ -2822,49 +2566,18 @@ static uiBlock *view3d_edit_mirrormenu(bContext *C, ARegion *ar, void *arg_unuse return block; } -static void do_view3d_edit_mesh_showhidemenu(bContext *C, void *arg, int event) +static void view3d_edit_mesh_showhidemenu(bContext *C, uiLayout *layout, void *arg_unused) { -#if 0 - - switch(event) { - - case 0: /* show hidden vertices */ - reveal_mesh(); - break; - case 1: /* hide selected vertices */ - hide_mesh(0); - break; - case 2: /* hide deselected vertices */ - hide_mesh(1); - break; - } -#endif -} - -static uiBlock *view3d_edit_mesh_showhidemenu(bContext *C, ARegion *ar, void *arg_unused) -{ - uiBlock *block; - short yco = 20, menuwidth = 120; - - block= uiBeginBlock(C, ar, "view3d_edit_mesh_showhidemenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_mesh_showhidemenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Unselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - - uiBlockSetDirection(block, UI_RIGHT); - uiTextBoundsBlock(block, 60); - return block; + uiItemO(layout, NULL, 0, "MESH_OT_reveal"); + uiItemO(layout, NULL, 0, "MESH_OT_hide"); + uiItemBooleanO(layout, "Hide Unselected", 0, "MESH_OT_hide", "unselected", 1); } #ifndef DISABLE_PYTHON +#if 0 static void do_view3d_edit_mesh_scriptsmenu(bContext *C, void *arg, int event) { -#if 0 BPY_menu_do_python(PYMENU_MESH, event); - -#endif } static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg_unused) @@ -2886,154 +2599,94 @@ static uiBlock *view3d_edit_mesh_scriptsmenu(bContext *C, ARegion *ar, void *arg return block; } +#endif #endif /* DISABLE_PYTHON */ +#if 0 static void do_view3d_edit_meshmenu(bContext *C, void *arg, int event) { -#if 0 - ToolSettings *ts= CTX_data_tool_settings(C); - Scene *scene= CTX_data_scene(C); ScrArea *sa= CTX_wm_area(C); - View3D *v3d= sa->spacedata.first; switch(event) { - case 0: /* Undo Editing */ - BIF_undo(); - break; - case 1: /* Redo Editing */ - BIF_redo(); - break; case 2: /* transform properties */ add_blockhandler(sa, VIEW3D_HANDLER_OBJECT, 0); break; case 4: /* insert keyframe */ common_insertkey(); break; - case 5: /* Extrude */ - extrude_mesh(); - break; - case 6: /* duplicate */ - duplicate_context_selected(); - break; - case 7: /* make edge face */ - addedgeface_mesh(); - break; - case 8: /* delete */ - delete_context_selected(); - break; - case 9: /* Shrink/Fatten Along Normals */ - initTransform(TFM_SHRINKFATTEN, CTX_NONE); - Transform(); - break; - case 10: /* Shear */ - initTransform(TFM_SHEAR, CTX_NONE); - Transform(); - break; - case 11: /* Warp */ - initTransform(TFM_WARP, CTX_NONE); - Transform(); - break; - case 12: /* proportional edit (toggle) */ - if(ts->proportional) ts->proportional= 0; - else ts->proportional= 1; - break; - case 13: /* automerge edit (toggle) */ - if(ts->automerge) ts->automerge= 0; - else ts->automerge= 1; - break; - case 15: - uv_autocalc_tface(); - break; case 16: /* delete keyframe */ common_deletekey(); break; } -#endif } +#endif -static uiBlock *view3d_edit_meshmenu(bContext *C, ARegion *ar, void *arg_unused) +static void view3d_edit_meshmenu(bContext *C, uiLayout *layout, void *arg_unused) { + Scene *scene= CTX_data_scene(C); ToolSettings *ts= CTX_data_tool_settings(C); - Object *obedit = CTX_data_edit_object(C); - uiBlock *block; - short yco= 0, menuwidth=120; - - block= uiBeginBlock(C, ar, "view3d_edit_meshmenu", UI_EMBOSSP); - uiBlockSetButmFunc(block, do_view3d_edit_meshmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|Ctrl Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Redo Editing|Ctrl Shift Z", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); -// XXX uiDefIconTextBlockBut(block, editmode_undohistorymenu, NULL, ICON_RIGHTARROW_THIN, "Undo History", 0, yco-=20, 120, 19, ""); + PointerRNA tsptr; - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + RNA_pointer_create(&scene->id, &RNA_ToolSettings, ts, &tsptr); + + uiItemO(layout, "Undo Editing", 0, "ED_OT_undo"); + uiItemO(layout, "Redo Editing", 0, "ED_OT_redo"); + +#if 0 + uiDefIconTextBlockBut(block, editmode_undohistorymenu, NULL, ICON_RIGHTARROW_THIN, "Undo History", 0, yco-=20, 120, 19, ""); +#endif + + uiItemS(layout); - uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); +#if 0 uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - +#endif + + uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu); + + uiItemS(layout); + +#if 0 uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "UV Unwrap|U", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 15, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Extrude|E", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Duplicate|Shift D", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Make Edge/Face|F", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, ""); - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete...|X", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBlockBut(block, view3d_edit_mesh_verticesmenu, NULL, ICON_RIGHTARROW_THIN, "Vertices", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_mesh_edgesmenu, NULL, ICON_RIGHTARROW_THIN, "Edges", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_mesh_facesmenu, NULL, ICON_RIGHTARROW_THIN, "Faces", 0, yco-=20, 120, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_mesh_normalsmenu, NULL, ICON_RIGHTARROW_THIN, "Normals", 0, yco-=20, 120, 19, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - - if(ts->proportional) { - uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_HLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); - } else { - uiDefIconTextBut(block, BUTM, 1, ICON_CHECKBOX_DEHLT, "Proportional Editing|O", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 12, ""); - } - uiDefIconTextBlockBut(block, view3d_edit_propfalloffmenu, NULL, ICON_RIGHTARROW_THIN, "Proportional Falloff", 0, yco-=20, 120, 19, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - /* PITA but we should let users know that automerge cant work with multires :/ */ - uiDefIconTextBut(block, BUTM, 1, - ts->automerge ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT, - ((Mesh*)obedit->data)->mr ? "AutoMerge Editing (disabled by multires)" : "AutoMerge Editing", - 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, ""); - - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); - - uiDefIconTextBlockBut(block, view3d_edit_mesh_showhidemenu, NULL, ICON_RIGHTARROW_THIN, "Show/Hide Vertices", 0, yco-=20, 120, 19, ""); + uiItemS(layout); +#endif + + uiItemO(layout, NULL, 0, "UV_OT_mapping_menu"); + + uiItemS(layout); + + uiItemO(layout, NULL, 0, "MESH_OT_extrude"); + uiItemO(layout, NULL, 0, "MESH_OT_duplicate"); + uiItemO(layout, "Delete...", 0, "MESH_OT_delete"); + + uiItemS(layout); + + uiItemMenuF(layout, "Vertices", 0, view3d_edit_mesh_verticesmenu); + uiItemMenuF(layout, "Edges", 0, view3d_edit_mesh_edgesmenu); + uiItemMenuF(layout, "Faces", 0, view3d_edit_mesh_facesmenu); + uiItemMenuF(layout, "Normals", 0, view3d_edit_mesh_normalsmenu); + + uiItemS(layout); + + uiItemR(layout, NULL, 0, &tsptr, "automerge_editing", 0, 0, 0); + uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O + uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O + + uiItemS(layout); + uiItemMenuF(layout, "Show/Hide", 0, view3d_edit_mesh_showhidemenu); + +#if 0 #ifndef DISABLE_PYTHON - uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiItemS(layout); uiDefIconTextBlockBut(block, view3d_edit_mesh_scriptsmenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, ""); #endif - - if(ar->alignment==RGN_ALIGN_TOP) { - uiBlockSetDirection(block, UI_DOWN); - } - else { - uiBlockSetDirection(block, UI_TOP); - uiBlockFlipOrder(block); - } - - uiTextBoundsBlock(block, 50); - return block; +#endif } static void view3d_edit_curve_controlpointsmenu(bContext *C, uiLayout *layout, void *arg_unused) @@ -3085,10 +2738,11 @@ static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unuse uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties...|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, ""); uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); - - uiItemS(layout); #endif + + uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu); + + uiItemS(layout); // XXX uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); // common_insertkey(); @@ -3111,7 +2765,7 @@ static void view3d_edit_curvemenu(bContext *C, uiLayout *layout, void *arg_unuse uiItemS(layout); uiItemR(layout, NULL, 0, &tsptr, "proportional_editing", 0, 0, 0); // |O - uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); + uiItemMenuEnumR(layout, NULL, 0, &tsptr, "proportional_editing_falloff"); // |Shift O uiItemS(layout); @@ -3203,7 +2857,7 @@ static uiBlock *view3d_edit_metaballmenu(bContext *C, ARegion *ar, void *arg_unu uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N",0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 7, ""); uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); + // XXX uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, ""); @@ -3280,9 +2934,12 @@ static void view3d_edit_latticemenu(bContext *C, uiLayout *layout, void *arg_unu uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); #endif + uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu); + + uiItemS(layout); + // XXX uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); // common_insertkey(); // XXX uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Delete Keyframe|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, ""); @@ -3504,7 +3161,7 @@ static uiBlock *view3d_edit_armaturemenu(bContext *C, ARegion *ar, void *arg_unu uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Bone Sketching|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, ""); uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, ""); - uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); + // XXX uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, ""); uiDefIconTextBlockBut(block, view3d_edit_armature_rollmenu, NULL, ICON_RIGHTARROW_THIN, "Bone Roll", 0, yco-=20, 120, 19, ""); if (arm->drawtype==ARM_ENVELOPE) @@ -4886,7 +4543,7 @@ static void view3d_header_pulldowns(const bContext *C, uiBlock *block, Object *o if (obedit) { if (ob && ob->type == OB_MESH) { xmax= GetButStringLength("Mesh"); - uiDefPulldownBut(block, view3d_edit_meshmenu, NULL, "Mesh", xco,yco, xmax-3, 20, ""); + uiDefMenuBut(block, view3d_edit_meshmenu, NULL, "Mesh", xco,yco, xmax-3, 20, ""); xco+= xmax; } else if (ob && ob->type == OB_CURVE) { xmax= GetButStringLength("Curve"); @@ -5270,36 +4927,3 @@ void view3d_header_buttons(const bContext *C, ARegion *ar) uiDrawBlock(C, block); } - - -/* edit face toolbox */ -static int editmesh_face_toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) -{ - uiPopupMenu *pup; - uiLayout *layout; - - pup= uiPupMenuBegin(C, "Edit Faces", 0); - layout= uiPupMenuLayout(pup); - - uiItemO(layout, NULL, 0, "MESH_OT_fill"); - uiItemO(layout, NULL, 0, "MESH_OT_beauty_fill"); - uiItemO(layout, NULL, 0, "MESH_OT_quads_convert_to_tris"); - uiItemO(layout, NULL, 0, "MESH_OT_tris_convert_to_quads"); - uiItemO(layout, NULL, 0, "MESH_OT_edge_flip"); - uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_smooth"); - uiItemO(layout, NULL, 0, "MESH_OT_faces_shade_solid"); - uiPupMenuEnd(C, pup); - - return OPERATOR_CANCELLED; -} - -void VIEW3D_OT_editmesh_face_toolbox(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Edit Faces"; - ot->idname= "VIEW3D_OT_editmesh_face_toolbox"; - - /* api callbacks */ - ot->invoke= editmesh_face_toolbox_invoke; - ot->poll= ED_operator_editmesh; -} diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 170090cfeb8..236f9b0904a 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -80,7 +80,6 @@ void VIEW3D_OT_manipulator(struct wmOperatorType *ot); void VIEW3D_OT_render_border(struct wmOperatorType *ot); void VIEW3D_OT_zoom_border(struct wmOperatorType *ot); void VIEW3D_OT_drawtype(struct wmOperatorType *ot); -void VIEW3D_OT_editmesh_face_toolbox(struct wmOperatorType *ot); void view3d_boxview_copy(ScrArea *sa, ARegion *ar); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 25405909d0b..eb0fbabeeed 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -83,7 +83,6 @@ void view3d_operatortypes(void) WM_operatortype_append(VIEW3D_OT_select_lasso); WM_operatortype_append(VIEW3D_OT_setcameratoview); WM_operatortype_append(VIEW3D_OT_drawtype); - WM_operatortype_append(VIEW3D_OT_editmesh_face_toolbox); WM_operatortype_append(VIEW3D_OT_localview); WM_operatortype_append(VIEW3D_OT_game_start); WM_operatortype_append(VIEW3D_OT_layers); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 4c855315bb3..801da08e611 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1342,11 +1342,11 @@ static int select_inverse_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void UV_OT_select_invert(wmOperatorType *ot) +void UV_OT_select_inverse(wmOperatorType *ot) { /* identifiers */ - ot->name= "Select Invert"; - ot->idname= "UV_OT_select_invert"; + ot->name= "Select Inverse"; + ot->idname= "UV_OT_select_inverse"; ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* api callbacks */ @@ -3079,7 +3079,7 @@ void UV_OT_tile_set(wmOperatorType *ot) void ED_operatortypes_uvedit(void) { WM_operatortype_append(UV_OT_select_all_toggle); - WM_operatortype_append(UV_OT_select_invert); + WM_operatortype_append(UV_OT_select_inverse); WM_operatortype_append(UV_OT_select); WM_operatortype_append(UV_OT_select_loop); WM_operatortype_append(UV_OT_select_linked); @@ -3134,7 +3134,7 @@ void ED_keymap_uvedit(wmWindowManager *wm) WM_keymap_add_item(keymap, "UV_OT_select_linked", LKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "UV_OT_unlink_selection", LKEY, KM_PRESS, KM_ALT, 0); WM_keymap_add_item(keymap, "UV_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "UV_OT_select_invert", IKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "UV_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "UV_OT_select_pinned", PKEY, KM_PRESS, KM_SHIFT, 0); /* uv operations */ diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index 95467d13e8d..c4f4704e47e 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1337,7 +1337,7 @@ static int mapping_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) void UV_OT_mapping_menu(wmOperatorType *ot) { /* identifiers */ - ot->name= "Mapping Menu"; + ot->name= "UV Mapping"; ot->idname= "UV_OT_mapping_menu"; /* api callbacks */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 5f03b7167f4..b363e55ca75 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -199,6 +199,10 @@ void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, prop_mode_items); RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode."); + prop= RNA_def_property(srna, "automerge_editing", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0); + RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location."); + prop= RNA_def_property(srna, "snap", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP); RNA_def_property_ui_text(prop, "Snap", "Snap while Ctrl is held during transform."); diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index bc422e5a20c..64f2d896954 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -151,7 +151,6 @@ wchar_t* Py_GetPath(void) /* must be called before Py_Initialize */ void BPY_start_python_path(void) { - char py_path[FILE_MAXDIR + 11] = ""; char *py_path_bundle= BLI_gethome_folder("python"); if(py_path_bundle==NULL) @@ -162,15 +161,21 @@ void BPY_start_python_path(void) #if (defined(WIN32) || defined(WIN64)) #if defined(FREE_WINDOWS) - sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); - putenv(py_path); + { + char py_path[FILE_MAXDIR + 11] = ""; + sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); + putenv(py_path); + } #else _putenv_s("PYTHONPATH", py_path_bundle); #endif #else #ifdef __sgi - sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); - putenv(py_path); + { + char py_path[FILE_MAXDIR + 11] = ""; + sprintf(py_path, "PYTHONPATH=%s", py_path_bundle); + putenv(py_path); + } #else setenv("PYTHONPATH", py_path_bundle, 1); #endif @@ -484,7 +489,10 @@ void BPY_run_ui_scripts(bContext *C, int reload) while((de = readdir(dir)) != NULL) { /* We could stat the file but easier just to let python * import it and complain if theres a problem */ - + + if(strstr(de->d_name, ".pyc")) + continue; + file_extension = strstr(de->d_name, ".py"); if(file_extension && *(file_extension + 3) == '\0') { diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 004cf2fb7c7..b183120dd2d 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -130,12 +130,12 @@ static PyObject *pyop_base_getattro( BPy_OperatorBase * self, PyObject *pyname ) PyObject *ret; wmOperatorType *ot; - if ((ot= WM_operatortype_find(name))) { - ret = PyCFunction_New( pyop_base_call_meth, pyname); /* set the name string as self, PyCFunction_New incref's self */ - } - else if ((ret = PyObject_GenericGetAttr((PyObject *)self, pyname))) { + if ((ret = PyObject_GenericGetAttr((PyObject *)self, pyname))) { /* do nothing, this accounts for methoddef's add and remove */ } + else if ((ot= WM_operatortype_find(name))) { + ret = PyCFunction_New( pyop_base_call_meth, pyname); /* set the name string as self, PyCFunction_New incref's self */ + } else { PyErr_Format( PyExc_AttributeError, "Operator \"%s\" not found", name); ret= NULL; diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 60a9afda0c4..f8567414717 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -352,9 +352,10 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class) idname = _PyUnicode_AsString(item); /* remove if it already exists */ - if ((ot=WM_operatortype_find(idname))) { - if(ot->pyop_data) + if ((ot=WM_operatortype_exists(idname))) { + if(ot->pyop_data) { Py_XDECREF((PyObject*)ot->pyop_data); + } WM_operatortype_remove(idname); } @@ -402,7 +403,7 @@ PyObject *PYOP_wrap_remove(PyObject *self, PyObject *value) return NULL; } - if (!(ot= WM_operatortype_find(idname))) { + if (!(ot= WM_operatortype_exists(idname))) { PyErr_Format( PyExc_AttributeError, "Operator \"%s\" does not exists, cant remove", idname); return NULL; } diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 50ba2aec867..ff3a2feb521 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -132,6 +132,7 @@ void WM_operator_free (struct wmOperator *op); void WM_operator_stack_clear(struct bContext *C); wmOperatorType *WM_operatortype_find(const char *idname); +wmOperatorType *WM_operatortype_exists(const char *idname); wmOperatorType *WM_operatortype_first(void); void WM_operatortype_append (void (*opfunc)(wmOperatorType*)); void WM_operatortype_append_ptr (void (*opfunc)(wmOperatorType*, void *), void *userdata); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index d003f0786de..9cec463193e 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -94,6 +94,17 @@ wmOperatorType *WM_operatortype_find(const char *idname) return NULL; } +wmOperatorType *WM_operatortype_exists(const char *idname) +{ + wmOperatorType *ot; + + for(ot= global_ops.first; ot; ot= ot->next) { + if(strncmp(ot->idname, idname, OP_MAX_TYPENAME)==0) + return ot; + } + return NULL; +} + wmOperatorType *WM_operatortype_first(void) { return global_ops.first; |