Merge 16964:17122
[blender.git] / source / blender / src / space.c
index 6cd573c580ddf2be9c6e39db644a92bc1e7ee731..71c31fea209f043266bf281f9b568d2c2aa63025 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 */
 
@@ -1254,11 +1256,13 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        return; /* return if event was processed (swallowed) by handler(s) */
                        }
                        
+                       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 */
@@ -1301,6 +1305,8 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                        }
                                }
                        }
+                       
+                       BDR_queueDrawSketch();
 
                        /* Handle retopo painting */
                        if(retopo_mesh_paint_check()) {
@@ -1901,7 +1907,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 (G.scene->toolsettings->bone_sketching & BONE_SKETCHING)
+                                                       {
+                                                               BIF_selectAllSketch(1);
+                                                       }
+                                                       else
+                                                       {
+                                                               deselectall_armature(1, 1);     /* 1 == toggle */
+                                                       }
+                                               }
                                        }
                                        else if (ob && (ob->flag & OB_POSEMODE)){
                                                deselectall_posearmature(ob, 1, 1);
@@ -1969,6 +1984,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_validSketchMode())
+                                       {
+                                               BIF_convertSketch();
+                                       }
                                        else
                                                convertmenu();  /* editobject.c */
                                }
@@ -2776,7 +2795,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:
@@ -2938,7 +2957,11 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                                break;
 
                        case ESCKEY:
-                               if(G.qual==0) {
+                               if (G.qual == 0 && BIF_validSketchMode())
+                               {
+                                       BIF_endStrokeSketch();
+                               }
+                               else if(G.qual==0) {
                                        if (G.vd->flag & V3D_DISPIMAGE) {
                                                G.vd->flag &= ~V3D_DISPIMAGE;
                                                doredraw= 1;