merge with 2.5 at r18570
authorJoseph Eagar <joeedh@gmail.com>
Mon, 19 Jan 2009 06:04:57 +0000 (06:04 +0000)
committerJoseph Eagar <joeedh@gmail.com>
Mon, 19 Jan 2009 06:04:57 +0000 (06:04 +0000)
1  2 
projectfiles_vc9/blender/blender.vcproj
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c

index 56afd7e452114da814924a466a9cbee3c7e3863e,56afd7e452114da814924a466a9cbee3c7e3863e..2c49c02b6d7ac5cf1bf7f72323ef8f80bb64fdb5
@@@ -1,7 -1,7 +1,7 @@@
  <?xml version="1.0" encoding="Windows-1252"?>\r
  <VisualStudioProject\r
        ProjectType="Visual C++"\r
--      Version="9,00"\r
++      Version="9.00"\r
        Name="blender"\r
        ProjectGUID="{F78B7FC9-DE32-465E-9F26-BB0B6B7A2EAF}"\r
        RootNamespace="blender"\r
index acb5d0b6ea01774596083adb8289f060d31c1e30,f9793a14faa9062b14647900eadf91b24c60996c..8272ef1107084b6acf85834372ce47598de63549
@@@ -3112,54 -3319,6 +3320,50 @@@ void MESH_OT_de_select_all(wmOperatorTy
        ot->poll= ED_operator_editmesh;
  }
  
-       bm = editmesh_to_bmesh(em, CTX_data_scene(C));
 +static int bmesh_test_exec(bContext *C, wmOperator *op)
 +{
 +      Object *obedit= CTX_data_edit_object(C);
 +      EditMesh *em= ((Mesh *)obedit->data)->edit_mesh;
 +      EditMesh *em2;
 +      BMesh *bm;
 +
-       G.totvert = bm->totvert;
-       G.totedge = bm->totedge;
-       G.totface = bm->totface;
++      bm = editmesh_to_bmesh(em);
 +
 +      /*do stuff here, call bmop's.*/
 +      //BMOP_DupeFromFlag(bm, BM_ALL, BM_SELECT);
 +      {
 +                      BMOperator op;
 +
 +                      BMO_Init_Op(&op, BMOP_SPLIT);
 +                      BMO_HeaderFlag_To_Slot(bm, &op, BMOP_SPLIT_MULTIN, BM_SELECT, BM_ALL);
 +
 +                      BMO_Exec_Op(bm, &op);
 +                      BMO_Finish_Op(bm, &op);
 +      }
 +      em2 = bmesh_to_editmesh(bm);
 +      
 +      /*free em's data, then copy the contents of the em2 struct
 +        to em, then free the em2 struct.*/
 +      free_editMesh(em);
 +      *em = *em2;
 +      MEM_freeN(em2); 
 +      
 +      BM_Free_Mesh(bm);
 +      WM_event_add_notifier(C, NC_OBJECT|ND_DRAW|ND_TRANSFORM|ND_GEOM_SELECT, obedit);
 +      return OPERATOR_FINISHED;
 +}
 +
 +void MESH_OT_bmesh_test(wmOperatorType *ot)
 +{
 +      /* identifiers */
 +      ot->name= "bmesh test op";
 +      ot->idname= "MESH_OT_bmesh_test";
 +      
 +      /* api callbacks */
 +      ot->exec= bmesh_test_exec;
 +      ot->poll= ED_operator_editmesh;
 +}
 +
  /* ******************** **************** */
  
  void EM_select_more(EditMesh *em)
index 18f5370c25fb76573bb38da87c87481c75819f5c,a8edd9153fa8e0b068d0bfe9602893e3fb7c9011..0c504595acb6dd234de7e688e38146f5f50e9db3
@@@ -92,12 -91,23 +92,23 @@@ int editedge_containsVert(struct EditEd
  int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
  int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
  
 -void em_setup_viewcontext(struct bContext *C, ViewContext *vc);
 +void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc);
  
  /* ******************* editmesh_add.c */
+ void MESH_OT_add_primitive_plane(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_cube(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_circle(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_cylinder(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_tube(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_cone(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_grid(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_monkey(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_uv_sphere(struct wmOperatorType *ot);
+ void MESH_OT_add_primitive_ico_sphere(struct wmOperatorType *ot);
  
  /* ******************* editmesh_lib.c */
+ void EM_stats_update(EditMesh *em);
  extern void EM_fgon_flags(EditMesh *em);
  extern void EM_hide_reset(EditMesh *em);
  
@@@ -161,9 -167,20 +168,19 @@@ extern struct EditFace *EM_face_from_fa
  /* ******************* editmesh_mods.c */
  
  void MESH_OT_de_select_all(struct wmOperatorType *ot);
 +void MESH_OT_bmesh_test(struct wmOperatorType *ot);
 -
 -
 -extern EditEdge *findnearestedge(ViewContext *vc, int *dist);
+ void MESH_OT_select_more(struct wmOperatorType *ot);
+ void MESH_OT_select_less(struct wmOperatorType *ot);
+ void MESH_OT_selectswap_mesh(struct wmOperatorType *ot);
+ void MESH_OT_select_non_manifold(struct wmOperatorType *ot);
+ void MESH_OT_selectconnected_mesh_all(struct wmOperatorType *ot);
+ void MESH_OT_selectconnected_mesh(struct wmOperatorType *ot);
+ void MESH_OT_hide_mesh(struct wmOperatorType *ot);
+ void MESH_OT_reveal_mesh(struct wmOperatorType *ot);
+ void MESH_OT_righthandfaces(struct wmOperatorType *ot);
+ void MESH_OT_select_linked_flat_faces(struct wmOperatorType *ot);
+ void MESH_OT_select_sharp_edges(struct wmOperatorType *ot);
 +extern EditEdge *findnearestedge(struct ViewContext *vc, int *dist);
  extern void EM_automerge(int update);
  void editmesh_select_by_material(EditMesh *em, int index);
  void righthandfaces(EditMesh *em, int select);        /* makes faces righthand turning */
index bd52b2deaefa646e3608b377efe67e4793314cd6,997e1f5596743da18f6dd907583b55c9f4602e4f..fdfe3e0ff8eed2be7144dc12dd6c12c29c9a007f
@@@ -65,18 -104,79 +104,80 @@@ static void MESH_OT_add_duplicate(wmOpe
  void ED_operatortypes_mesh(void)
  {
        WM_operatortype_append(MESH_OT_de_select_all);
 -
 +      WM_operatortype_append(MESH_OT_bmesh_test);
+       WM_operatortype_append(MESH_OT_select_more);
+       WM_operatortype_append(MESH_OT_select_less);
+       WM_operatortype_append(MESH_OT_selectswap_mesh);
+       WM_operatortype_append(MESH_OT_select_non_manifold);
+       WM_operatortype_append(MESH_OT_selectconnected_mesh_all);
+       WM_operatortype_append(MESH_OT_selectconnected_mesh);
+       WM_operatortype_append(MESH_OT_hide_mesh);
+       WM_operatortype_append(MESH_OT_reveal_mesh);
+       WM_operatortype_append(MESH_OT_righthandfaces);
+       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_select_linked_flat_faces);
+       WM_operatortype_append(MESH_OT_select_sharp_edges);
+       WM_operatortype_append(MESH_OT_add_primitive_plane);
+       WM_operatortype_append(MESH_OT_add_primitive_cube);
+       WM_operatortype_append(MESH_OT_add_primitive_circle);
+       WM_operatortype_append(MESH_OT_add_primitive_cylinder);
+       WM_operatortype_append(MESH_OT_add_primitive_tube);
+       WM_operatortype_append(MESH_OT_add_primitive_cone);
+       WM_operatortype_append(MESH_OT_add_primitive_grid);
+       WM_operatortype_append(MESH_OT_add_primitive_monkey);
+       WM_operatortype_append(MESH_OT_add_primitive_uv_sphere);
+       WM_operatortype_append(MESH_OT_add_primitive_ico_sphere);
+       WM_operatortype_append(MESH_OT_add_duplicate);
  }
  
  /* note mesh keymap also for other space? */
  void ED_keymap_mesh(wmWindowManager *wm)
- {
+ {     
        ListBase *keymap= WM_keymap_listbase(wm, "EditMesh", 0, 0);
        
+       /* selecting */
        WM_keymap_add_item(keymap, "MESH_OT_de_select_all", AKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_bmesh_test", DKEY, KM_PRESS, 0, 0);
-       WM_keymap_add_item(keymap, "MESH_OT_bmesh_test", TKEY, KM_PRESS, 0, 0);
++      WM_keymap_add_item(keymap, "MESH_OT_bmesh_test", JKEY, 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_selectswap_mesh", 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_selectconnected_mesh_all", LKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_selectconnected_mesh", LKEY, KM_PRESS, 0, 0);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_selectconnected_mesh", LKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "deselect", 1);
+       
+       RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_linked_flat_faces", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);
+       RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_select_sharp_edges", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0);           
        
- //    RNA_int_set(WM_keymap_add_item(keymap, "OBJECT_OT_viewzoom", PADPLUSKEY, KM_PRESS, 0, 0)->ptr, "delta", 1);
+       /* hide */
+       WM_keymap_add_item(keymap, "MESH_OT_hide_mesh", HKEY, KM_PRESS, 0, 0);
+       RNA_boolean_set(WM_keymap_add_item(keymap, "MESH_OT_hide_mesh", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "swap", 1);
+       WM_keymap_add_item(keymap, "MESH_OT_reveal_mesh", HKEY, KM_PRESS, KM_ALT, 0);
+       
+       /* tools */
+       RNA_int_set(WM_keymap_add_item(keymap, "MESH_OT_righthandfaces", NKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0)->ptr, "select", 2);
+       RNA_int_set(WM_keymap_add_item(keymap, "MESH_OT_righthandfaces", NKEY, KM_PRESS, KM_CTRL, 0)->ptr, "select", 1);
+       
+       WM_keymap_add_item(keymap, "MESH_OT_subdivide", WKEY, KM_PRESS, 0, 0);
+       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);
+       /* add */
+       WM_keymap_add_item(keymap, "MESH_OT_add_duplicate", DKEY, KM_PRESS, KM_SHIFT, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_plane", ZEROKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_cube", ONEKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_circle", TWOKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_cylinder", THREEKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_tube", FOURKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_cone", FIVEKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_grid", SIXKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_uv_sphere", SEVENKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_ico_sphere", EIGHTKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_item(keymap, "MESH_OT_add_primitive_monkey", NINEKEY, KM_PRESS, KM_CTRL, 0);
  }