* Bug fix in view3d menus - wasn't checking a pointer's initialisation strictly enough.

This commit is contained in:
Matt Ebb 2004-01-14 15:51:37 +00:00
parent 3cfa085a46
commit c1a1ba93ae
2 changed files with 55 additions and 61 deletions

@ -1943,7 +1943,7 @@ void copy_attr_menu()
*/ */
strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Drawtype%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|Properties%x9|Logic Bricks%x10|%l"); strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Drawtype%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|Properties%x9|Logic Bricks%x10|%l");
ob= OBACT; if(!(ob=OBACT)) return;
strcat (str, "|Object Constraints%x22"); strcat (str, "|Object Constraints%x22");
@ -1975,9 +1975,8 @@ void copy_attr(short event)
if(G.scene->id.lib) return; if(G.scene->id.lib) return;
ob= OBACT; if(!(ob=OBACT)) return;
if(OBACT==0) return;
if(G.obedit) { if(G.obedit) {
/* obedit_copymenu(); */ /* obedit_copymenu(); */
return; return;
@ -2184,8 +2183,7 @@ void make_links_menu()
short event=0; short event=0;
char str[140]; char str[140];
if(OBACT==0) return; if(!(ob=OBACT)) return;
ob= OBACT;
strcpy(str, "Make Links %t|To Scene...%x1|%l|Object Ipo%x4"); strcpy(str, "Make Links %t|To Scene...%x1|%l|Object Ipo%x4");
@ -2226,8 +2224,7 @@ void make_links(short event)
short *totcolp, nr; short *totcolp, nr;
char *strp; char *strp;
if(OBACT==0) return; if(!(ob=OBACT)) return;
ob= OBACT;
if(event==1) { if(event==1) {
IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), 0, &nr); IDnames_to_pupstring(&strp, NULL, NULL, &(G.main->scene), 0, &nr);

@ -1153,13 +1153,11 @@ static void do_view3d_edit_object_makelinksmenu(void *arg, int event)
static uiBlock *view3d_edit_object_makelinksmenu(void *arg_unused) static uiBlock *view3d_edit_object_makelinksmenu(void *arg_unused)
{ {
Object *ob; Object *ob=NULL;
uiBlock *block; uiBlock *block;
short yco = 20, menuwidth = 120; short yco = 20, menuwidth = 120;
ob= OBACT;
block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_makelinksmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_makelinksmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_view3d_edit_object_makelinksmenu, NULL); uiBlockSetButmFunc(block, do_view3d_edit_object_makelinksmenu, NULL);
@ -1169,28 +1167,31 @@ static uiBlock *view3d_edit_object_makelinksmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Ctrl L, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Ipo|Ctrl L, 2", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
if(ob->type==OB_MESH) { if ((ob=OBACT)) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); if(ob->type==OB_MESH) {
} else if(ob->type==OB_CURVE) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Mesh Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); } else if(ob->type==OB_CURVE) {
} else if(ob->type==OB_FONT) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Curve Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); } else if(ob->type==OB_FONT) {
} else if(ob->type==OB_SURF) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Text Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surface Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); } else if(ob->type==OB_SURF) {
} else if(ob->type==OB_MBALL) { uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Surface Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 4", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_CAMERA) { } else if(ob->type==OB_MBALL) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Materials|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
} else if(ob->type==OB_LAMP) { } else if(ob->type==OB_CAMERA) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_LATTICE) { } else if(ob->type==OB_LAMP) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lamp Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_ARMATURE) { } else if(ob->type==OB_LATTICE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Lattice Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
} else if(ob->type==OB_ARMATURE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Armature Data|Ctrl L, 3", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
}
} }
uiBlockSetDirection(block, UI_RIGHT); uiBlockSetDirection(block, UI_RIGHT);
@ -1226,13 +1227,10 @@ static void do_view3d_edit_object_singleusermenu(void *arg, int event)
static uiBlock *view3d_edit_object_singleusermenu(void *arg_unused) static uiBlock *view3d_edit_object_singleusermenu(void *arg_unused)
{ {
Object *ob;
uiBlock *block; uiBlock *block;
short yco = 20, menuwidth = 120; short yco = 20, menuwidth = 120;
ob= OBACT;
block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_singleusermenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_singleusermenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_view3d_edit_object_singleusermenu, NULL); uiBlockSetButmFunc(block, do_view3d_edit_object_singleusermenu, NULL);
@ -1274,13 +1272,11 @@ static void do_view3d_edit_object_copyattrmenu(void *arg, int event)
static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused) static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused)
{ {
Object *ob; Object *ob=NULL;
uiBlock *block; uiBlock *block;
short yco = 20, menuwidth = 120; short yco = 20, menuwidth = 120;
ob= OBACT;
block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_copyattrmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); block= uiNewBlock(&curarea->uiblocks, "view3d_edit_object_copyattrmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_view3d_edit_object_copyattrmenu, NULL); uiBlockSetButmFunc(block, do_view3d_edit_object_copyattrmenu, NULL);
@ -1302,25 +1298,28 @@ static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Constraints|Ctrl C, 11", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Constraints|Ctrl C, 11", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 22, "");
if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_SURF) || if ((ob= OBACT)) {
(ob->type == OB_FONT) || (ob->type == OB_MBALL)) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Texture Space|Ctrl C, 12", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
}
if(ob->type == OB_FONT) { if ((ob->type == OB_MESH) || (ob->type == OB_CURVE) || (ob->type == OB_SURF) ||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Font Settings|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, ""); (ob->type == OB_FONT) || (ob->type == OB_MBALL)) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 14", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Texture Space|Ctrl C, 12", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 17, "");
} }
if(ob->type == OB_CURVE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
}
if(ob->type==OB_MESH) { if(ob->type == OB_FONT) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdiv|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Font Settings|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 18, "");
} uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 14", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
}
if(ob->type == OB_CURVE) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Bevel Settings|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 19, "");
}
if( give_parteff(ob) ) { if(ob->type==OB_MESH) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Particle Settings|Ctrl C, 14", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, ""); uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subdiv|Ctrl C, 13", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
}
if( give_parteff(ob) ) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Particle Settings|Ctrl C, 14", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, "");
}
} }
uiBlockSetDirection(block, UI_RIGHT); uiBlockSetDirection(block, UI_RIGHT);
@ -2872,12 +2871,10 @@ static void do_view3d_faceselmenu(void *arg, int event)
{ {
/* code copied from buttons.c :( /* code copied from buttons.c :(
would be nice if it was split up into functions */ would be nice if it was split up into functions */
Mesh *me; Mesh *me=NULL;
Object *ob; Object *ob=NULL;
extern TFace *lasttface; /* caches info on tface bookkeeping ?*/ extern TFace *lasttface; /* caches info on tface bookkeeping ?*/
ob= OBACT;
switch(event) { switch(event) {
case 0: /* copy draw mode */ case 0: /* copy draw mode */
case 1: /* copy UVs */ case 1: /* copy UVs */