2.5
authorTon Roosendaal <ton@blender.org>
Sat, 31 Jan 2009 13:30:56 +0000 (13:30 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 31 Jan 2009 13:30:56 +0000 (13:30 +0000)
Edit Mesh:

- Added back "Edge Shortest Path select"
  It now also does regular selection, more fun!
  It's mapped to CTRL+click now, and makes or clears selections
  between current and previously activated edge.
  Seam/Sharp/etc marking is a toolsetting mode still. These
  options cannot become properties easily, because the tool
  uses the properties of selected edge to clear...

- Removed a whole bunch of G.f flags, related to mesh drawing.
  It's all now local in me->drawflags. Here's the list of
  removed old globals:

G_DRAWEDGES
G_DRAWFACES
G_DRAWNORMALS
G_DRAW_VNORMALS

G_ALLEDGES
G_HIDDENEDGES

G_DRAWCREASES
G_DRAWSEAMS
G_DRAWSHARP
G_DRAWBWEIGHTS

G_DRAW_EDGELEN
G_DRAW_FACEAREA
G_DRAW_EDGEANG

19 files changed:
source/blender/blenkernel/BKE_global.h
source/blender/blenkernel/intern/mesh.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/mesh/editface.c
source/blender/editors/mesh/editmesh.c
source/blender/editors/mesh/editmesh_lib.c
source/blender/editors/mesh/editmesh_mods.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/mesh/mesh_intern.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/makesdna/DNA_mesh_types.h
source/blender/windowmanager/intern/wm_event_system.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm_event_system.h
source/blender/windowmanager/wm_window.h

index 0d5208ed90dc09a69fbd42b4c6822cff57e11551..ac161caeb2ea354c18bb694f18d100a0d9bf55e7 100644 (file)
@@ -117,37 +117,24 @@ typedef struct Global {
 #define G_RENDER_SHADOW        (1 <<  3)
 #define G_BACKBUFSEL   (1 <<  4)
 #define G_PICKSEL              (1 <<  5)
-#define G_DRAWNORMALS  (1 <<  6)
-#define G_DRAWFACES            (1 <<  7)
+
 #define G_FACESELECT   (1 <<  8)
-#define G_DRAW_EXT             (1 <<  9)
+
 #define G_VERTEXPAINT  (1 << 10)
-#define G_ALLEDGES             (1 << 11)
+
 #define G_DEBUG                        (1 << 12)
 #define G_DOSCRIPTLINKS (1 << 13)
-#define G_DRAW_VNORMALS        (1 << 14)
+
 #define G_WEIGHTPAINT  (1 << 15)       
 #define G_TEXTUREPAINT (1 << 16)
 /* #define G_NOFROZEN  (1 << 17) also removed */
 #define G_GREASEPENCIL         (1 << 17)
-#define G_DRAWEDGES            (1 << 18)
-#define G_DRAWCREASES  (1 << 19)
-#define G_DRAWSEAMS     (1 << 20)
-#define G_HIDDENEDGES   (1 << 21)
-/* Measurement info Drawing */
-#define G_DRAW_EDGELEN  (1 << 22) 
-#define G_DRAW_FACEAREA (1 << 23)
-#define G_DRAW_EDGEANG  (1 << 24)
-
-/* #define G_RECORDKEYS        (1 << 25)   also removed */
-
-#define G_DRAWSHARP     (1 << 28) /* draw edges with the sharp flag */
+
 #define G_SCULPTMODE    (1 << 29)
 #define G_PARTICLEEDIT (1 << 30)
 
 /* #define G_AUTOMATKEYS       (1 << 30)   also removed */
 #define G_HIDDENHANDLES (1 << 31) /* used for curves only */
-#define G_DRAWBWEIGHTS (1 << 31)
 
 /* macro for testing face select mode
  * Texture paint could be removed since selected faces are not used
index b8d485065b1eb03a14a34d1c5f20a0f6c2c9bbb1..dd63d798089dac5dbf2bf34afad7bd310a7401be 100644 (file)
@@ -185,7 +185,8 @@ Mesh *add_mesh(char *name)
        me->texflag= AUTOSPACE;
        me->flag= ME_TWOSIDED;
        me->bb= unit_boundbox();
-
+       me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
+       
        return me;
 }
 
index bd266b08e870ff64f8674accd8e2321421dce0c5..f53b6dad1736812701073b49c6a368946e5ec958 100644 (file)
@@ -8682,6 +8682,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                bScreen *screen;
                Scene *scene;
                Material *ma;
+               Mesh *me;
                Scene *sce;
                Tex *tx;
                
@@ -8718,6 +8719,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        if(tx->nodetree && strlen(tx->nodetree->id.name)==0)
                                strcpy(tx->nodetree->id.name, "NTTexture Nodetree");
                }
+               
+               /* copy standard draw flag to meshes(used to be global, is not available here) */
+               for(me= main->mesh.first; me; me= me->id.next) {
+                       me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
+               }
        }
 
        /* TODO: should be moved into one of the version blocks once this branch moves to trunk and we can
index 4ca302ab06c58ac12744cd7e57b568ce6f8460a8..b62877bd76e7e473a15629e859d269b0ce34e463 100644 (file)
@@ -826,6 +826,8 @@ int minmax_tface(Scene *scene, float *min, float *max)
        return ok;
 }
 
+/* ******************** edge loop shortest path ********************* */
+
 #define ME_SEAM_DONE 2         /* reuse this flag */
 
 static float edgetag_cut_cost(EditMesh *em, int e1, int e2, int vert)
@@ -871,7 +873,11 @@ static void edgetag_add_adjacent(EditMesh *em, Heap *heap, int mednum, int vertn
 
 void edgetag_context_set(Scene *scene, EditEdge *eed, int val)
 {
+       
        switch (scene->toolsettings->edge_mode) {
+       case EDGE_MODE_SELECT:
+               EM_select_edge(eed, val);
+               break;
        case EDGE_MODE_TAG_SEAM:
                if (val)                {eed->seam = 255;}
                else                    {eed->seam = 0;}
@@ -894,6 +900,8 @@ void edgetag_context_set(Scene *scene, EditEdge *eed, int val)
 int edgetag_context_check(Scene *scene, EditEdge *eed)
 {
        switch (scene->toolsettings->edge_mode) {
+       case EDGE_MODE_SELECT:
+               return (eed->f & SELECT) ? 1 : 0;
        case EDGE_MODE_TAG_SEAM:
                return eed->seam ? 1 : 0;
        case EDGE_MODE_TAG_SHARP:
@@ -1029,6 +1037,8 @@ int edgetag_shortest_path(Scene *scene, EditMesh *em, EditEdge *source, EditEdge
        return 1;
 }
 
+/* *************************************** */
+
 static void seam_edgehash_insert_face(EdgeHash *ehash, MFace *mf)
 {
        BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL);
@@ -1094,7 +1104,7 @@ void seam_mark_clear_tface(Scene *scene, short mode)
 // XXX if (G.rt == 8)
 //             unwrap_lscm(1);
 
-       G.f |= G_DRAWSEAMS;
+       me->drawflag |= ME_DRAWSEAMS;
        BIF_undo_push("Mark Seam");
 
 // XXX notifier!               object_tface_flags_changed(OBACT, 1);
index 58041120a428b8a3fe424c1e243bc880ab476262..77371fdbd20c99a9091a576779f2f8062c4528fd 100644 (file)
@@ -643,7 +643,7 @@ static int edgeDrawFlagInfo_cmp(const void *av, const void *bv)
 }
 #endif
 
-static void edge_drawflags(EditMesh *em)
+static void edge_drawflags(Mesh *me, EditMesh *em)
 {
        EditVert *eve;
        EditEdge *eed, *e1, *e2, *e3, *e4;
@@ -692,7 +692,7 @@ static void edge_drawflags(EditMesh *em)
                efa= efa->next;
        }
 
-       if(G.f & G_ALLEDGES) {
+       if(me->drawflag & ME_ALLEDGES) {
                efa= em->faces.first;
                while(efa) {
                        if(efa->e1->f2>=2) efa->e1->f2= 1;
@@ -1042,7 +1042,7 @@ void load_editMesh(Scene *scene, Object *ob)
        /* eed->f1 : flag for dynaface (cylindertest, old engine) */
        /* eve->f1 : flag for dynaface (sphere test, old engine) */
        /* eve->f2 : being used in vertexnormals */
-       edge_drawflags(em);
+       edge_drawflags(me, em);
        
        EM_stats_update(em);
        
@@ -1146,9 +1146,9 @@ void load_editMesh(Scene *scene, Object *ob)
                eve->tmp.l = a++;  /* counter */
                        
                mvert->flag= 0;
-               if(eve->f1==1) mvert->flag |= ME_SPHERETEST;
                mvert->flag |= (eve->f & SELECT);
                if (eve->h) mvert->flag |= ME_HIDE;
+               
                mvert->bweight= (char)(255.0*eve->bweight);
 
                eve= eve->next;
index a3b33e71cf4ccfe2d14bb0065d1c614ed98bbe3e..40e2179ddbefe67a6a98f86d595bb3da2e8cdbc5 100644 (file)
@@ -187,7 +187,7 @@ static int EM_check_selection(EditMesh *em, void *data)
        
        for(ese = em->selected.first; ese; ese = ese->next){
                if(ese->data == data) return 1;
-               }
+       }
        
        return 0;
 }
index fda9766b2fc3afb21f931bdda963789e82226193..bcf40c16538f6cc27d807147522f5cbc701252ce 100644 (file)
@@ -1924,15 +1924,6 @@ void loop_multiselect(EditMesh *em, int looptype)
 
 /* ***************** loop select (non modal) ************** */
 
-static EnumPropertyItem prop_select_types[] = {
-       {0, "LOOP_EXCLUSIVE", "Loop Exclusive", ""},
-       {1, "LOOP_EXTEND", "Loop Extend", ""},
-       {2, "RING_EXCLUSIVE", "Ring Exclusive", ""},
-       {3, "RING_EXTEND", "Ring Extend", ""},
-       {0, NULL, NULL, NULL}
-};
-
-
 static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring)
 {
        ViewContext vc;
@@ -1948,97 +1939,138 @@ static void mouse_mesh_loop(bContext *C, short mval[2], short extend, short ring
        
        eed= findnearestedge(&vc, &dist);
        if(eed) {
-               /* XXX: should toolsettings do this? */
-               if (vc.scene->toolsettings->edge_mode == EDGE_MODE_SELECT) {
-                       if(extend==0) EM_clear_flag_all(em, SELECT);
-               
-                       if((eed->f & SELECT)==0) select=1;
-                       else if(extend) select=0;
+               if(extend==0) EM_clear_flag_all(em, SELECT);
+       
+               if((eed->f & SELECT)==0) select=1;
+               else if(extend) select=0;
 
-                       if(em->selectmode & SCE_SELECT_FACE) {
-                               faceloop_select(em, eed, select);
-                       }
-                       else if(em->selectmode & SCE_SELECT_EDGE) {
-                       if(ring)
-                                       edgering_select(em, eed, select);
-                       else
-                                       edgeloop_select(em, eed, select);
-                       }
-                   else if(em->selectmode & SCE_SELECT_VERTEX) {
-                       if(ring)
-                                       edgering_select(em, eed, select);
-                       else 
-                                       edgeloop_select(em, eed, select);
-                       }
+               if(em->selectmode & SCE_SELECT_FACE) {
+                       faceloop_select(em, eed, select);
+               }
+               else if(em->selectmode & SCE_SELECT_EDGE) {
+                       if(ring)
+                               edgering_select(em, eed, select);
+                       else
+                               edgeloop_select(em, eed, select);
+               }
+               else if(em->selectmode & SCE_SELECT_VERTEX) {
+                       if(ring)
+                               edgering_select(em, eed, select);
+                       else 
+                               edgeloop_select(em, eed, select);
+               }
 
-                       EM_selectmode_flush(em);
+               EM_selectmode_flush(em);
 //                     if (EM_texFaceCheck())
+               
+               WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
+       }
+}
+
+static int mesh_loop_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       ARegion *ar= CTX_wm_region(C);
+       short mval[2];  
+       
+       mval[0]= event->x - ar->winrct.xmin;
+       mval[1]= event->y - ar->winrct.ymin;
+       
+       view3d_operator_needs_opengl(C);
+       
+       mouse_mesh_loop(C, mval, RNA_boolean_get(op->ptr, "extend"),
+                                       RNA_boolean_get(op->ptr, "ring"));
+       
+       /* cannot do tweaks for as long this keymap is after transform map */
+       return OPERATOR_FINISHED;
+}
+
+void MESH_OT_loop_select(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Loop Select";
+       ot->idname= "MESH_OT_loop_select";
+       
+       /* api callbacks */
+       ot->invoke= mesh_loop_select_invoke;
+       ot->poll= ED_operator_editmesh;
+       
+       /* properties */
+       RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
+       RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "");
+}
+
+/* ******************* mesh shortest path select, uses prev-selected edge ****************** */
+
+/* since you want to create paths with multiple selects, it doesn't have extend option */
+static void mouse_mesh_shortest_path(bContext *C, short mval[2])
+{
+       ViewContext vc;
+       EditMesh *em;
+       EditEdge *eed;
+       int dist= 50;
+       
+       em_setup_viewcontext(C, &vc);
+       vc.mval[0]= mval[0];
+       vc.mval[1]= mval[1];
+       em= vc.em;
+       
+       eed= findnearestedge(&vc, &dist);
+       if(eed) {
+               Mesh *me= vc.obedit->data;
+               int path = 0;
+               
+               if (em->selected.last) {
+                       EditSelection *ese = em->selected.last;
                        
-               } 
-               else {
-                       int act = (edgetag_context_check(vc.scene, eed)==0);
-                       int path = 0;
-                       
-                       if (ring && em->selected.last) {
-                               EditSelection *ese = em->selected.last;
-       
-                               if(ese && ese->type == EDITEDGE) {
-                                       EditEdge *eed_act;
-                                       eed_act = (EditEdge*)ese->data;
-                                       if (eed_act != eed) {
-                                               /* If extend, we need to use the last active edge, (if it exists) */
-                                               if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) {
-                                                       EM_remove_selection(em, eed_act, EDITEDGE);
-                                                       EM_select_edge(eed_act, 0);
-                                                       path = 1;
-                                               }
+                       if(ese && ese->type == EDITEDGE) {
+                               EditEdge *eed_act;
+                               eed_act = (EditEdge*)ese->data;
+                               if (eed_act != eed) {
+                                       if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) {
+                                               EM_remove_selection(em, eed_act, EDITEDGE);
+                                               path = 1;
                                        }
                                }
                        }
-                       if (path==0) {
-                               edgetag_context_set(vc.scene, eed, act); /* switch the edge option */
-                       }
-                       
-                       if (act) {
-                               if ((eed->f & SELECT)==0) {
-                                       EM_select_edge(eed, 1);
-                                       EM_selectmode_flush(em);
-                               }
-                               /* even if this is selected it may not be in the selection list */
-                               EM_store_selection(em, eed, EDITEDGE);
-                       } else {
-                               if (eed->f & SELECT) {
-                                       EM_select_edge(eed, 0);
-                                       /* logic is differnt from above here since if this was selected we dont know if its in the selection list or not */
-                                       EM_remove_selection(em, eed, EDITEDGE);
-                                       
-                                       EM_selectmode_flush(em);
-                               }
-                       }
+               }
+               if (path==0) {
+                       int act = (edgetag_context_check(vc.scene, eed)==0);
+                       edgetag_context_set(vc.scene, eed, act); /* switch the edge option */
+               }
+               
+               EM_selectmode_flush(em);
+
+               /* even if this is selected it may not be in the selection list */
+               if(edgetag_context_check(vc.scene, eed)==0)
+                       EM_remove_selection(em, eed, EDITEDGE);
+               else
+                       EM_store_selection(em, eed, EDITEDGE);
+       
+               /* force drawmode for mesh */
+               switch (vc.scene->toolsettings->edge_mode) {
                        
-                       switch (vc.scene->toolsettings->edge_mode) {
                        case EDGE_MODE_TAG_SEAM:
-                               G.f |= G_DRAWSEAMS;
+                               me->drawflag |= ME_DRAWSEAMS;
                                break;
                        case EDGE_MODE_TAG_SHARP:
-                               G.f |= G_DRAWSHARP;
+                               me->drawflag |= ME_DRAWSHARP;
                                break;
                        case EDGE_MODE_TAG_CREASE:      
-                               G.f |= G_DRAWCREASES;
+                               me->drawflag |= ME_DRAWCREASES;
                                break;
                        case EDGE_MODE_TAG_BEVEL:
-                               G.f |= G_DRAWBWEIGHTS;
+                               me->drawflag |= ME_DRAWBWEIGHTS;
                                break;
-                       }
-                       
-                       DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
                }
                
+               DAG_object_flush_update(vc.scene, vc.obedit, OB_RECALC_DATA);
+       
                WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, vc.obedit);
        }
 }
 
-static int mesh_loop_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
+
+static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        ARegion *ar= CTX_wm_region(C);
        short mval[2];  
@@ -2047,29 +2079,27 @@ static int mesh_loop_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
        mval[1]= event->y - ar->winrct.ymin;
        
        view3d_operator_needs_opengl(C);
+
+       mouse_mesh_shortest_path(C, mval);
        
-       mouse_mesh_loop(C, mval, RNA_boolean_get(op->ptr, "extend"),
-                                       RNA_boolean_get(op->ptr, "ring"));
-       
-       /* cannot do tweaks for as long this keymap is after transform map */
        return OPERATOR_FINISHED;
 }
-
-void MESH_OT_loop_select(wmOperatorType *ot)
+       
+void MESH_OT_shortest_path_select(wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name= "Loop Select";
-       ot->idname= "MESH_OT_loop_select";
+       ot->name= "Shortest Path Select";
+       ot->idname= "MESH_OT_shortest_path_select";
        
        /* api callbacks */
-       ot->invoke= mesh_loop_select_invoke;
+       ot->invoke= mesh_shortest_path_select_invoke;
        ot->poll= ED_operator_editmesh;
        
        /* properties */
        RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "");
-       RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "");
 }
 
+
 /* ************************************************** */
 
 
@@ -3603,13 +3633,12 @@ void EM_selectmode_menu(EditMesh *em)
 
 void editmesh_mark_seam(EditMesh *em, int clear)
 {
+       Mesh *me= NULL; // XXX
        EditEdge *eed;
        
        /* auto-enable seams drawing */
        if(clear==0) {
-               if(!(G.f & G_DRAWSEAMS)) {
-                       G.f |= G_DRAWSEAMS;
-               }
+               me->drawflag |= ME_DRAWSEAMS;
        }
 
        if(clear) {
@@ -3637,16 +3666,13 @@ void editmesh_mark_seam(EditMesh *em, int clear)
 
 void editmesh_mark_sharp(EditMesh *em, int set)
 {
+       Mesh *me= NULL;
        EditEdge *eed;
 
-#if 0
        /* auto-enable sharp edge drawing */
        if(set) {
-               if(!(G.f & G_DRAWSEAMS)) {
-                       G.f |= G_DRAWSEAMS;
-               }
+               me->drawflag |= ME_DRAWSHARP;
        }
-#endif
 
        if(set) {
                eed= em->edges.first;
index 68d75f640653a227eeb3ad82a96dda95a9237035..23a810ba66b2d5ae692593d74b983bf116356de6 100644 (file)
@@ -3901,7 +3901,8 @@ typedef struct SlideVert {
 
 int EdgeSlide(EditMesh *em, short immediate, float imperc)
 {
-//     NumInput num;
+//     NumInput num; XXX
+       Mesh *me= NULL; // XXX
        EditFace *efa;
        EditEdge *eed,*first=NULL,*last=NULL, *temp = NULL;
        EditVert *ev, *nearest;
@@ -4180,7 +4181,7 @@ int EdgeSlide(EditMesh *em, short immediate, float imperc)
                        return 0;
                }
 
-               if(G.f & G_DRAW_EDGELEN) {
+               if(me->drawflag & ME_DRAW_EDGELEN) {
                        if(!(tempsv->up->f & SELECT)) {
                                tempsv->up->f |= SELECT;
                                tempsv->up->f2 |= 16;
@@ -4633,7 +4634,7 @@ int EdgeSlide(EditMesh *em, short immediate, float imperc)
        }
        
        
-       if(G.f & G_DRAW_EDGELEN) {
+       if(me->drawflag & ME_DRAW_EDGELEN) {
                look = vertlist;
                while(look) {   
                        tempsv  = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
index 45b2d1fc5f7c9055eb7751777b07249a11eccc54..e665b7e70fca57179b05dc09b07be11343a37785 100644 (file)
@@ -185,7 +185,7 @@ 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);
-
+void MESH_OT_shortest_path_select(struct wmOperatorType *ot);
 
 extern EditEdge *findnearestedge(ViewContext *vc, int *dist);
 extern void EM_automerge(int update);
index 1b86add2376180e0d3a6efb6c5fdbb51a3584cc9..4df5b39ac47243797739c73065c84d8a66d885cd 100644 (file)
@@ -146,6 +146,8 @@ void ED_operatortypes_mesh(void)
        WM_operatortype_append(MESH_OT_dupli_extrude_cursor);
        WM_operatortype_append(MESH_OT_loop_select);
        WM_operatortype_append(MESH_OT_add_edge_face);
+       WM_operatortype_append(MESH_OT_shortest_path_select);
+       
        
 }
 
@@ -156,6 +158,7 @@ void ED_keymap_mesh(wmWindowManager *wm)
        wmKeymapItem *kmi;
        
        /* selecting */
+       /* standard mouse selection goes via space_view3d */
        WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_ALT, 0);
        kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT, 0);
        RNA_boolean_set(kmi->ptr, "extend", 1);
@@ -164,7 +167,9 @@ void ED_keymap_mesh(wmWindowManager *wm)
        kmi= WM_keymap_add_item(keymap, "MESH_OT_loop_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_ALT|KM_CTRL, 0);
        RNA_boolean_set(kmi->ptr, "extend", 1);
        RNA_boolean_set(kmi->ptr, "ring", 1);
-                                          
+
+       WM_keymap_add_item(keymap, "MESH_OT_shortest_path_select", SELECTMOUSE, KM_PRESS, KM_CTRL, 0);
+       
        WM_keymap_add_item(keymap, "MESH_OT_de_select_all", 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);
index f34f520e2695d78265028342c9935db8c387a871..92c8b8f0b69edeb1d9c5e857c1c725eb6bf20e4d 100644 (file)
@@ -135,13 +135,14 @@ static EdgeHash *get_tface_mesh_marked_edge_info(Mesh *me)
 static int draw_tfaces3D__setHiddenOpts(void *userData, int index)
 {
        struct { Mesh *me; EdgeHash *eh; } *data = userData;
-       MEdge *med = &data->me->medge[index];
+       Mesh *me= data->me;
+       MEdge *med = &me->medge[index];
        uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
 
-       if((G.f & G_DRAWSEAMS) && (med->flag&ME_SEAM)) {
+       if((me->drawflag & ME_DRAWSEAMS) && (med->flag&ME_SEAM)) {
                return 0;
-       } else if(G.f & G_DRAWEDGES){ 
-               if (G.f&G_HIDDENEDGES) {
+       } else if(me->drawflag & ME_DRAWEDGES){ 
+               if (me->drawflag & ME_HIDDENEDGES) {
                        return 1;
                } else {
                        return (flags & eEdge_Visible);
@@ -154,11 +155,12 @@ static int draw_tfaces3D__setHiddenOpts(void *userData, int index)
 static int draw_tfaces3D__setSeamOpts(void *userData, int index)
 {
        struct { Mesh *me; EdgeHash *eh; } *data = userData;
+       Mesh *me= data->me;
        MEdge *med = &data->me->medge[index];
        uintptr_t flags = (intptr_t) BLI_edgehash_lookup(data->eh, med->v1, med->v2);
 
-       if (med->flag&ME_SEAM) {
-               if (G.f&G_HIDDENEDGES) {
+       if (med->flag & ME_SEAM) {
+               if (me->drawflag & ME_HIDDENEDGES) {
                        return 1;
                } else {
                        return (flags & eEdge_Visible);
@@ -217,7 +219,7 @@ static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh
        dm->drawMappedEdges(dm, draw_tfaces3D__setHiddenOpts, &data);
 
                /* Draw Seams */
-       if(G.f & G_DRAWSEAMS) {
+       if(me->drawflag & ME_DRAWSEAMS) {
                UI_ThemeColor(TH_EDGE_SEAM);
                glLineWidth(2);
 
@@ -227,7 +229,7 @@ static void draw_tfaces3D(RegionView3D *rv3d, Object *ob, Mesh *me, DerivedMesh
        }
 
        /* Draw Selected Faces */
-       if(G.f & G_DRAWFACES) {
+       if(me->drawflag & ME_DRAWFACES) {
                glEnable(GL_BLEND);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                UI_ThemeColor4(TH_FACE_SELECT);
index 8430e4b874bb93eedd5b06666b5870e343b2bd06..dd101231b4989f21f64d855e8ccb37bbccc0ce40 100644 (file)
@@ -1712,7 +1712,7 @@ static void draw_em_fancy_verts(Scene *scene, View3D *v3d, Object *obedit, EditM
        glPointSize(1.0);
 }
 
-static void draw_em_fancy_edges(Scene *scene, View3D *v3d, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
+static void draw_em_fancy_edges(Scene *scene, View3D *v3d, Mesh *me, DerivedMesh *cageDM, short sel_only, EditEdge *eed_act)
 {
        int pass;
        unsigned char wireCol[4], selCol[4], actCol[4];
@@ -1746,7 +1746,7 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, DerivedMesh *cageDM,
                if(scene->selectmode == SCE_SELECT_FACE) {
                        draw_dm_edges_sel(cageDM, wireCol, selCol, actCol, eed_act);
                }       
-               else if( (G.f & G_DRAWEDGES) || (scene->selectmode & SCE_SELECT_EDGE) ) {       
+               else if( (me->drawflag & ME_DRAWEDGES) || (scene->selectmode & SCE_SELECT_EDGE) ) {     
                        if(cageDM->drawMappedEdgesInterp && (scene->selectmode & SCE_SELECT_VERTEX)) {
                                glShadeModel(GL_SMOOTH);
                                draw_dm_edges_sel_interp(cageDM, wireCol, selCol);
@@ -1771,6 +1771,7 @@ static void draw_em_fancy_edges(Scene *scene, View3D *v3d, DerivedMesh *cageDM,
 
 static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, EditMesh *em)
 {
+       Mesh *me= ob->data;
        EditEdge *eed;
        EditFace *efa;
        float v1[3], v2[3], v3[3], v4[3];
@@ -1800,7 +1801,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
 
        if(v3d->zbuf) bglPolygonOffset(rv3d->dist, 5.0);
        
-       if(G.f & G_DRAW_EDGELEN) {
+       if(me->drawflag & ME_DRAW_EDGELEN) {
                UI_GetThemeColor3fv(TH_TEXT, col);
                /* make color a bit more red */
                if(col[0]> 0.5) {col[1]*=0.7; col[2]*= 0.7;}
@@ -1826,7 +1827,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
                }
        }
 
-       if(G.f & G_DRAW_FACEAREA) {
+       if(me->drawflag & ME_DRAW_FACEAREA) {
 // XXX         extern int faceselectedOR(EditFace *efa, int flag);             // editmesh.h shouldn't be in this file... ok for now?
                
                UI_GetThemeColor3fv(TH_TEXT, col);
@@ -1862,7 +1863,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E
                }
        }
 
-       if(G.f & G_DRAW_EDGEANG) {
+       if(me->drawflag & ME_DRAW_EDGEANG) {
                EditEdge *e1, *e2, *e3, *e4;
                
                UI_GetThemeColor3fv(TH_TEXT, col);
@@ -2018,7 +2019,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
                }
        }
        
-       if((G.f & (G_DRAWFACES)) || FACESEL_PAINT_TEST) {       /* transp faces */
+       if((me->drawflag & (ME_DRAWFACES)) || FACESEL_PAINT_TEST) {     /* transp faces */
                unsigned char col1[4], col2[4], col3[4];
                        
                UI_GetThemeColor4ubv(TH_FACE, (char *)col1);
@@ -2055,14 +2056,14 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
        }
 
        /* here starts all fancy draw-extra over */
-       if((G.f & G_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
-               /* we are drawing textures and 'G_DRAWEDGES' is disabled, dont draw any edges */
+       if((me->drawflag & ME_DRAWEDGES)==0 && CHECK_OB_DRAWTEXTURE(v3d, dt)) {
+               /* we are drawing textures and 'ME_DRAWEDGES' is disabled, dont draw any edges */
                
                /* only draw selected edges otherwise there is no way of telling if a face is selected */
-               draw_em_fancy_edges(scene, v3d, cageDM, 1, eed_act);
+               draw_em_fancy_edges(scene, v3d, me, cageDM, 1, eed_act);
                
        } else {
-               if(G.f & G_DRAWSEAMS) {
+               if(me->drawflag & ME_DRAWSEAMS) {
                        UI_ThemeColor(TH_EDGE_SEAM);
                        glLineWidth(2);
        
@@ -2072,7 +2073,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
                        glLineWidth(1);
                }
                
-               if(G.f & G_DRAWSHARP) {
+               if(me->drawflag & ME_DRAWSHARP) {
                        UI_ThemeColor(TH_EDGE_SHARP);
                        glLineWidth(2);
        
@@ -2082,30 +2083,30 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
                        glLineWidth(1);
                }
        
-               if(G.f & G_DRAWCREASES) {
+               if(me->drawflag & ME_DRAWCREASES) {
                        draw_dm_creases(cageDM);
                }
-               if(G.f & G_DRAWBWEIGHTS) {
+               if(me->drawflag & ME_DRAWBWEIGHTS) {
                        draw_dm_bweights(scene, cageDM);
                }
        
-               draw_em_fancy_edges(scene, v3d, cageDM, 0, eed_act);
+               draw_em_fancy_edges(scene, v3d, me, cageDM, 0, eed_act);
        }
        if(em) {
 // XXX         retopo_matrix_update(v3d);
 
                draw_em_fancy_verts(scene, v3d, ob, em, cageDM, eve_act);
 
-               if(G.f & G_DRAWNORMALS) {
+               if(me->drawflag & ME_DRAWNORMALS) {
                        UI_ThemeColor(TH_NORMAL);
                        draw_dm_face_normals(scene, cageDM);
                }
-               if(G.f & G_DRAW_VNORMALS) {
+               if(me->drawflag & ME_DRAW_VNORMALS) {
                        UI_ThemeColor(TH_NORMAL);
                        draw_dm_vert_normals(scene, cageDM);
                }
 
-               if(G.f & (G_DRAW_EDGELEN|G_DRAW_FACEAREA|G_DRAW_EDGEANG))
+               if(me->drawflag & (ME_DRAW_EDGELEN|ME_DRAW_FACEAREA|ME_DRAW_EDGEANG))
                        draw_em_measure_stats(v3d, rv3d, ob, em);
        }
 
@@ -4903,9 +4904,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
                        dtx= dtx & (OB_DRAWWIRE|OB_TEXSPACE);
                }
 
-               if(G.f & G_DRAW_EXT) {
-                       if(ob->type==OB_EMPTY || ob->type==OB_CAMERA || ob->type==OB_LAMP) dt= OB_WIRE;
-               }
        }
 
        /* draw outline for selected solid objects, mesh does itself */
index ddb45bdd736a17ea8be42ca2b6cefe157788aada..5bffe6b1124a5908635fe96f08edd8316b3f9f0f 100644 (file)
@@ -413,6 +413,7 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, EditMesh *em, MTFac
 static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
 {
        ToolSettings *settings;
+       Mesh *me= obedit->data;
        EditMesh *em;
        EditFace *efa, *efa_act;
        MTFace *tf, *activetf = NULL;
@@ -422,7 +423,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
        int drawfaces, interpedges, lastsel, sel;
        Image *ima= sima->image;
        
-       em= ((Mesh*)obedit->data)->edit_mesh;
+       em= me->edit_mesh;
        activetf= EM_get_active_mtface(em, &efa_act, NULL, 0); /* will be set to NULL if hidden */
 
        settings= scene->toolsettings;
@@ -457,7 +458,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
        if(sima->flag & SI_DRAW_STRETCH) {
                draw_uvs_stretch(sima, scene, em, activetf);
        }
-       else if(G.f & G_DRAWFACES) {
+       else if(me->drawflag & ME_DRAWFACES) {
                /* draw transparent faces */
                UI_GetThemeColor4ubv(TH_FACE, col1);
                UI_GetThemeColor4ubv(TH_FACE_SELECT, col2);
@@ -614,7 +615,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
                        col2[0] = col2[1] = col2[2] = 128; col2[3] = 255;
                        glColor4ubv((unsigned char *)col2); 
                        
-                       if(G.f & G_DRAWEDGES) {
+                       if(me->drawflag & ME_DRAWEDGES) {
                                UI_GetThemeColor4ubv(TH_VERTEX_SELECT, col1);
                                lastsel = sel = 0;
 
index 7da057efdb1d5a8b9cf9fabd314ca7053586bba2..3ecfe416c79b8076018b74111a88a113c1ac50eb 100644 (file)
@@ -89,8 +89,9 @@ typedef struct Mesh {
        float size[3];
        float rot[3];
        
-       float cubemapsize, pad;
-
+       float cubemapsize;
+       
+       int drawflag;
        short smoothresh, flag;
 
        short subdiv, subdivr;
@@ -126,6 +127,45 @@ typedef struct TFace {
 #define ME_SUBSURF             128
 #define ME_OPT_EDGES   256
 
+/* me->drawflag, int */ 
+#define ME_DRAWEDGES   (1 << 0)
+#define ME_DRAWFACES   (1 << 1)
+#define ME_DRAWNORMALS (1 << 2)
+#define ME_DRAW_VNORMALS (1 << 3)
+
+#define ME_ALLEDGES            (1 << 4)
+#define ME_HIDDENEDGES  (1 << 5)
+
+#define ME_DRAWCREASES (1 << 6)
+#define ME_DRAWSEAMS    (1 << 7)
+#define ME_DRAWSHARP    (1 << 8)
+#define ME_DRAWBWEIGHTS        (1 << 8)
+
+#define ME_DRAW_EDGELEN  (1 << 10) 
+#define ME_DRAW_FACEAREA (1 << 11)
+#define ME_DRAW_EDGEANG  (1 << 12)
+
+/* old global flags:
+#define G_DRAWEDGES            (1 << 18)
+#define G_DRAWFACES            (1 <<  7)
+#define G_DRAWNORMALS  (1 <<  6)
+#define G_DRAW_VNORMALS        (1 << 14)
+
+#define G_ALLEDGES             (1 << 11)
+#define G_HIDDENEDGES   (1 << 21)
+
+#define G_DRAWCREASES  (1 << 19)
+#define G_DRAWSEAMS     (1 << 20)
+#define G_DRAWSHARP     (1 << 28)
+#define G_DRAWBWEIGHTS (1 << 31)
+
+#define G_DRAW_EDGELEN  (1 << 22) 
+#define G_DRAW_FACEAREA (1 << 23)
+#define G_DRAW_EDGEANG  (1 << 24)
+*/
+
+
+
 /* Subsurf Type */
 #define ME_CC_SUBSURF          0
 #define ME_SIMPLE_SUBSURF      1
index 7df47ce346249bd9d0f1b000a2e80cfdebf2b573..3d7cb25b134c71a1e349deab8a73691d512ad230 100644 (file)
@@ -72,14 +72,6 @@ void wm_event_add(wmWindow *win, wmEvent *event_to_add)
        BLI_addtail(&win->queue, event);
 }
 
-wmEvent *wm_event_next(wmWindow *win)
-{
-       wmEvent *event= win->queue.first;
-
-       if(event) BLI_remlink(&win->queue, event);
-       return event;
-}
-
 static void wm_event_free(wmEvent *event)
 {
        if(event->customdata && event->customdatafree)
@@ -789,9 +781,9 @@ void wm_event_do_handlers(bContext *C)
                if( win->screen==NULL )
                        wm_event_free_all(win);
                
-               while( (event=wm_event_next(win)) ) {
+               while( (event= win->queue.first) ) {
                        int action;
-
+                       
                        CTX_wm_window_set(C, win);
                        
                        /* we let modal handlers get active area/region, also wm_paintcursor_test needs it */
@@ -852,6 +844,9 @@ void wm_event_do_handlers(bContext *C)
                                        win->eventstate->prevy= event->y;
                                }
                        }
+                       
+                       /* unlink and free here, blender-quit then frees all */
+                       BLI_remlink(&win->queue, event);
                        wm_event_free(event);
                        
                }
index a496ebc3bea91b25d9ee597f84eef271858b86e2..55d0fd4ab465efafd58e4893d0a3975cf7051e97 100644 (file)
@@ -461,6 +461,15 @@ static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
     ot->poll= WM_operator_winactive;
 }
 
+static int wm_exit_blender_op(bContext *C, wmOperator *op)
+{
+       WM_operator_free(op);
+       
+       WM_exit(C);     
+       
+       return OPERATOR_FINISHED;
+}
+
 static void WM_OT_exit_blender(wmOperatorType *ot)
 {
        ot->name= "Exit Blender";
@@ -531,18 +540,18 @@ static int border_apply(bContext *C, wmOperator *op, int event_type)
        
        if(rect->xmin==rect->xmax || rect->ymin==rect->ymax)
                return 0;
-       else {
-               
-               /* operator arguments and storage. */
-               RNA_int_set(op->ptr, "xmin", rect->xmin);
-               RNA_int_set(op->ptr, "ymin", rect->ymin);
-               RNA_int_set(op->ptr, "xmax", rect->xmax);
-               RNA_int_set(op->ptr, "ymax", rect->ymax);
-               if( RNA_struct_find_property(op->ptr, "event_type") )
-                       RNA_int_set(op->ptr, "event_type", event_type);
                
-               op->type->exec(C, op);
-       }
+       /* operator arguments and storage. */
+       RNA_int_set(op->ptr, "xmin", rect->xmin);
+       RNA_int_set(op->ptr, "ymin", rect->ymin);
+       RNA_int_set(op->ptr, "xmax", rect->xmax);
+       RNA_int_set(op->ptr, "ymax", rect->ymax);
+       if( RNA_struct_find_property(op->ptr, "event_type") )
+               RNA_int_set(op->ptr, "event_type", event_type);
+       
+       op->type->exec(C, op);
+       
+       return 1;
 }
 
 static void wm_gesture_end(bContext *C, wmOperator *op)
index eebf89982c17ef200bfca1832fc914a96801e1d4..bf34406b1111d755dbb6a1296d44a074d0710705 100644 (file)
@@ -322,21 +322,6 @@ int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op)
        
 }
 
-       
-/* exit blender */
-int wm_exit_blender_op(bContext *C, wmOperator *op)
-{
-       wmWindowManager *wm= CTX_wm_manager(C);
-       wmWindow *win= wm->windows.first;
-
-       while(win) {
-               wm_window_close(C, win);
-               win= win->next;
-       }
-
-       return OPERATOR_FINISHED;
-}
-
 
 /* ************ events *************** */
 
index 8a5806497a395e3459802cc9b69a406f6dfe1359..5205c8c17e1aaa0f4af3e98591126b01b06dc61e 100644 (file)
@@ -78,7 +78,6 @@ enum {
 /* wm_event_system.c */
 void           wm_event_add(wmWindow *win, wmEvent *event_to_add);
 void           wm_event_free_all               (wmWindow *win);
-wmEvent                *wm_event_next                  (wmWindow *win);
 
                        /* goes over entire hierarchy:  events -> window -> screen -> area -> region */
 void           wm_event_do_handlers    (bContext *C);
index 97b9f434982a372e5e9a5ecdf1b64ded353ab876..86ceac9203ed2da8c6ff33f0f649d812b16417f1 100644 (file)
@@ -58,7 +58,6 @@ void          wm_window_testbreak             (void);
 int                    wm_window_duplicate_op  (bContext *C, wmOperator *op);
 int                    wm_window_rip_op        (bContext *C, wmOperator *op, struct wmEvent *event);
 int                    wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op);
-int                    wm_exit_blender_op(bContext *C, wmOperator *op);
 
 
 #endif /* WM_WINDOW_H */