fixed some more screenupdate issues and eliminated a crash
authorRob Haarsma <phaseIV@zonnet.nl>
Tue, 13 May 2003 14:22:28 +0000 (14:22 +0000)
committerRob Haarsma <phaseIV@zonnet.nl>
Tue, 13 May 2003 14:22:28 +0000 (14:22 +0000)
when trying tio shear/warp not visible objects. (thanks Matt)

source/blender/src/editarmature.c
source/blender/src/editcurve.c
source/blender/src/editfont.c
source/blender/src/editmball.c
source/blender/src/editmesh.c
source/blender/src/editobject.c
source/blender/src/headerbuttons.c
source/blender/src/toolbox.c

index 4249c89294fd773c3b470b0c213366700c031c3a..f002f2fb2b6cda6fef2b69fa279e34ac769f67fc 100644 (file)
@@ -1522,11 +1522,8 @@ void add_primitiveArmature(int type)
        };
        
        countall();
-       allqueue(REDRAWVIEW3D, 0);
-       allqueue(REDRAWBUTSALL, 0);
-       allqueue(REDRAWBUTSHEAD, 0);
-       allqueue(REDRAWBUTSCONSTRAINT, 0);
-       allqueue(REDRAWNLA, 0);
+
+       allqueue(REDRAWALL, 0);
 }
 
 static void add_bone_input (Object *ob)
index 742dcbcb112c84eae6df6f444223bde3005d1972..927f02999d78924681f8ba60ec27da9c671281b8 100644 (file)
@@ -3796,10 +3796,8 @@ void add_primitiveCurve(int stype)
        BLI_addtail(&editNurb, nu);
        makeDispList(G.obedit);
        
-       allqueue(REDRAWBUTSALL, 0);
-       
        countall();
-       allqueue(REDRAWVIEW3D, 0);
+       allqueue(REDRAWALL, 0);
 }
 
 void add_primitiveNurb(int type)
@@ -3828,11 +3826,9 @@ void add_primitiveNurb(int type)
        nu= addNurbprim(4, type, newname);
        BLI_addtail(&editNurb,nu);
        makeDispList(G.obedit);
-       
-       allqueue(REDRAWBUTSALL, 0);
-       
+
        countall();
-       allqueue(REDRAWVIEW3D, 0);
+       allqueue(REDRAWALL, 0);
 }
 
 
index 8df636ae5f402a8434ba8bb087b3ad60f76cf5b9..aa4d10646a03aa9cd1186133e42810ad60d64236 100644 (file)
@@ -626,8 +626,8 @@ void add_primitiveFont(int dummy_argument)
        cu->pos= 4;
        
        make_editText();
-       allqueue(REDRAWVIEW3D, 0);
-       allqueue(REDRAWBUTSALL, 0);
+
+       allqueue(REDRAWALL, 0);
 }
 
 void to_upper(void)
index 3ab0dff5b6967d7dcf1a2f7bbfee161f3b5a4723..0107d4d61959b4ce959c0fecd7ae4104a72d62fb 100644 (file)
@@ -181,8 +181,7 @@ void add_primitiveMball(int dummy_argument)
        
        lastelem= ml;
        
-       allqueue(REDRAWVIEW3D, 0);
-       allqueue(REDRAWBUTSALL, 0);
+       allqueue(REDRAWALL, 0);
        makeDispList(G.obedit);
 }
 
index 806f31bcf5c7e3eca8c2f7fcbe1812fcaf106a57..7fd2ad5cf749f4118a5536572d90431c37aa487c 100644 (file)
@@ -4535,11 +4535,9 @@ void add_primitiveMesh(int type)
        
        if(type!=0 && type!=10) righthandfaces(1);
        countall();
-       allqueue(REDRAWVIEW3D, 0);
-       allqueue(REDRAWIPO, 0);
-       allqueue(REDRAWHEADERS, 0);
+
        allqueue(REDRAWINFO, 1);        /* 1, because header->win==0! */        
-       allqueue(REDRAWBUTSALL, 0);
+       allqueue(REDRAWALL, 0);
        makeDispList(G.obedit);
 
        if (type==13) notice("Oooh Oooh Oooh");
index 8fae5ccdcc894de57fdd6e98e23c435becddd0d4..2fed60d6a663a8a853e40cf40bafb30c34496316 100644 (file)
@@ -208,11 +208,9 @@ void add_object_draw(int type)     /* for toolbox */
        }
 
        redraw_test_buttons(BASACT);
-       allqueue(REDRAWIPO, 0);
-       allqueue(REDRAWBUTSEDIT, 0);
-       allqueue(REDRAWACTION,0);
-       allqueue(REDRAWHEADERS, 0);
-       allqueue(REDRAWNLA, 0);
+
+       allqueue(REDRAWALL, 0);
+
        deselect_all_area_oops();
        set_select_flag_oops();
        allqueue(REDRAWINFO, 1);        /* 1, because header->win==0! */
index 8a0c903554f3bf4a0af9d40cb411ecdd18d369e7..977bdb2fd63496626dc67a8e8ddca911db293be4 100644 (file)
@@ -2780,6 +2780,9 @@ static void do_info_editmenu(void *arg, int event)
                if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) {
                        error("Only editable 3D objects can be sheared");
                }
+               else if ((base->lay & G.vd->lay)==0) {
+                       error("Only objects on visible layers can be sheared");
+               }
                else {
                        if (!G.obedit) {
                                enter_editmode();
@@ -2805,6 +2808,9 @@ static void do_info_editmenu(void *arg, int event)
                if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) {
                        error("Only editable 3D objects can be warped");
                }
+               else if ((base->lay & G.vd->lay)==0) {
+                       error("Only objects on visible layers can be warped");
+               }
                else {
                        if (!G.obedit) {
                                enter_editmode();
index 4a625e3e8375ffff555a2f39f7b339cdb1f0cea1..c9c77ee4858d13797e6d747cc8c8593a56b7475b 100644 (file)
@@ -567,6 +567,13 @@ void tbox_execute(void)
        unsigned short event=0;
        unsigned short qual1=0, qual2=0;
 
+       /* needed to check for valid selected objects */
+       Base *base;
+       Object *ob;
+
+       base= BASACT;
+       ob= base->object;
+
        if(tbfunc) {
                tbfunc(tbval);
        }
@@ -590,30 +597,48 @@ void tbox_execute(void)
                }
                /* ctrl-s (Shear): switch into editmode ### */
                else if(strcmp(tbstr1, "c|s")==0) {
-                       if (!G.obedit) {
-                               enter_editmode();
-                               /* ### put these into a deselectall_gen() */
-                               if(G.obedit->type==OB_MESH) deselectall_mesh();
-                               else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) deselectall_nurb();
-                               else if(G.obedit->type==OB_MBALL) deselectall_mball();
-                               else if(G.obedit->type==OB_LATTICE) deselectall_Latt();
-                               /* ### */
+                       /* check that a valid object is selected to prevent crash */
+                       if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) {
+                               error("Only editable 3D objects can be sheared");
+                       }
+                       else if ((base->lay & G.vd->lay)==0) {
+                               error("Only objects on visible layers can be warped");
+                       }
+                       else {
+                               if (!G.obedit) {
+                                       enter_editmode();
+                                       /* ### put these into a deselectall_gen() */
+                                       if(G.obedit->type==OB_MESH) deselectall_mesh();
+                                       else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) deselectall_nurb();
+                                       else if(G.obedit->type==OB_MBALL) deselectall_mball();
+                                       else if(G.obedit->type==OB_LATTICE) deselectall_Latt();
+                                       /* ### */
+                               }
+                               qual1 = LEFTCTRLKEY;
+                               event = SKEY;
                        }
-                       qual1 = LEFTCTRLKEY;
-                       event = SKEY;
                }
                else if(strcmp(tbstr1, "W")==0) {
-                       if (!G.obedit) {
-                               enter_editmode();
-                               /* ### put these into a deselectall_gen() */
-                               if(G.obedit->type==OB_MESH) deselectall_mesh();
-                               else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) deselectall_nurb();
-                               else if(G.obedit->type==OB_MBALL) deselectall_mball();
-                               else if(G.obedit->type==OB_LATTICE) deselectall_Latt();
-                               /* ### */
+                       /* check that a valid object is selected to prevent crash */
+                       if ((ob->type==OB_LAMP) || (ob->type==OB_EMPTY) || (ob->type==OB_FONT) || (ob->type==OB_CAMERA)) {
+                               error("Only editable 3D objects can be warped");
+                       }
+                       else if ((base->lay & G.vd->lay)==0) {
+                               error("Only objects on visible layers can be warped");
+                       }
+                       else {
+                               if (!G.obedit) {
+                                       enter_editmode();
+                                       /* ### put these into a deselectall_gen() */
+                                       if(G.obedit->type==OB_MESH) deselectall_mesh();
+                                       else if ELEM(G.obedit->type, OB_CURVE, OB_SURF) deselectall_nurb();
+                                       else if(G.obedit->type==OB_MBALL) deselectall_mball();
+                                       else if(G.obedit->type==OB_LATTICE) deselectall_Latt();
+                                       /* ### */
+                               }
+                               qual1 = LEFTSHIFTKEY;
+                               event = WKEY;
                        }
-                       qual1 = LEFTSHIFTKEY;
-                       event = WKEY;
                }
 
                else if(strlen(tbstr1)<4 || (strlen(tbstr1)==4 && tbstr1[2]=='F')) {