merge trunk 17122:17213
[blender-staging.git] / source / blender / src / space.c
index b6221c2f84b5926138c62db0b51b681836bb3fb7..cbb4fe2624ca09a907632e22870d3c538dec3245 100644 (file)
 #include "BIF_toolbox.h"
 #include "BIF_usiblender.h"
 #include "BIF_previewrender.h"
+#include "BIF_sketch.h"
 
 #include "BSE_edit.h"
 #include "BSE_view.h"
 #include "BDR_sculptmode.h"
 #include "BDR_unwrapper.h"
 #include "BDR_gpencil.h"
+#include "BDR_sketch.h"
 
 #include "BLO_readfile.h" /* for BLO_blendhandle_close */
 
@@ -1259,11 +1261,13 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        return; /* return if event was processed (swallowed) by handler(s) */
                        }
 #endif
+                       if(BIF_paintSketch(LEFTMOUSE)) return;
                        if(gpencil_do_paint(sa, L_MOUSE)) return;
                        if(BIF_do_manipulator(sa)) return;
                }
                else if(event==RIGHTMOUSE) {
                        if(gpencil_do_paint(sa, R_MOUSE)) return;
+                       if(BIF_paintSketch(RIGHTMOUSE)) return;
                }
                
                /* swap mouse buttons based on user preference */
@@ -1306,6 +1310,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        }
                                }
                        }
+                       
+                       BDR_queueDrawSketch();
 
                        /* Handle retopo painting */
                        if(retopo_mesh_paint_check()) {
@@ -1908,7 +1914,16 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                                else if(G.obedit->type==OB_LATTICE)
                                                        deselectall_Latt();
                                                else if(G.obedit->type==OB_ARMATURE)
-                                                       deselectall_armature(1, 1);     /* 1 == toggle */
+                                               {
+                                                       if (BIF_fullSketchMode())
+                                                       {
+                                                               BIF_selectAllSketch(1);
+                                                       }
+                                                       else
+                                                       {
+                                                               deselectall_armature(1, 1);     /* 1 == toggle */
+                                                       }
+                                               }
                                        }
                                        else if (ob && (ob->flag & OB_POSEMODE)){
                                                deselectall_posearmature(ob, 1, 1);
@@ -1976,6 +1991,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                else if(G.qual==LR_ALTKEY) {
                                        if(ob && (ob->flag & OB_POSEMODE))
                                                pose_clear_constraints();       /* poseobject.c */
+                                       else if (BIF_fullSketchMode())
+                                       {
+                                               BIF_convertSketch();
+                                       }
                                        else
                                                convertmenu();  /* editobject.c */
                                }
@@ -2783,7 +2802,7 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        case DELKEY:
                                if(G.qual==0 || G.qual==LR_SHIFTKEY)
                                        delete_context_selected();
-                               if(G.qual==LR_ALTKEY)
+                               else if(G.qual==LR_ALTKEY)
                                        gpencil_delete_menu();
                                break;
                        case YKEY:
@@ -2945,7 +2964,11 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                break;
 
                        case ESCKEY:
-                               if(G.qual==0) {
+                               if (G.qual == 0 && BIF_validSketchMode())
+                               {
+                                       BIF_cancelStrokeSketch();
+                               }
+                               else if(G.qual==0) {
                                        if (G.vd->flag & V3D_DISPIMAGE) {
                                                G.vd->flag &= ~V3D_DISPIMAGE;
                                                doredraw= 1;