From 517048eb3d40aff562feed2110da20ccba407d27 Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Thu, 26 Jan 2006 21:18:02 +0000 Subject: [PATCH] * Put the Add->Group menu in the top info header too. --- source/blender/src/header_info.c | 44 ++++++++++++++++++++++++++++++++ source/blender/src/toolbox.c | 5 ++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c index 41138f47ee4..4ad9b559b2e 100644 --- a/source/blender/src/header_info.c +++ b/source/blender/src/header_info.c @@ -43,6 +43,7 @@ #include #endif +#include "DNA_group_types.h" #include "DNA_ID.h" #include "DNA_image_types.h" #include "DNA_lamp_types.h" @@ -77,6 +78,7 @@ #include "BIF_drawscene.h" #include "BKE_blender.h" +#include "BKE_depsgraph.h" #include "BKE_exotic.h" #include "BKE_global.h" #include "BKE_image.h" @@ -1181,6 +1183,44 @@ static uiBlock *info_add_lampmenu(void *arg_unused) return block; } +static void do_info_add_groupmenu(void *arg, int event) +{ + Object *ob; + + add_object_draw(OB_EMPTY); + ob= OBACT; + + ob->dup_group= BLI_findlink(&G.main->group, event); + if(ob->dup_group) { + id_us_plus((ID *)ob->dup_group); + ob->transflag |= OB_DUPLIGROUP; + DAG_scene_sort(G.scene); + } +} + + +static uiBlock *info_add_groupmenu(void *arg_unused) +{ + uiBlock *block; + short yco= 0; + + Group *group; + int a; + int tot= BLI_countlist(&G.main->group); + + block= uiNewBlock(&curarea->uiblocks, "add_groupmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin); + uiBlockSetButmFunc(block, do_info_add_groupmenu, NULL); + + for(a=0, group= G.main->group.first; group; group= group->id.next, a++) { + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, group->id.name+2, 0, yco-=20, 160, 19, NULL, 0.0, 0.0, 1, a, ""); + } + + uiBlockSetDirection(block, UI_RIGHT); + uiTextBoundsBlock(block, 50); + + return block; +} + void do_info_addmenu(void *arg, int event) { switch(event) { @@ -1244,6 +1284,10 @@ static uiBlock *info_addmenu(void *arg_unused) uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBlockBut(block, info_add_groupmenu, NULL, ICON_RIGHTARROW_THIN, "Group", 0, yco-=20, 120, 19, ""); + + uiDefBut(block, SEPR, 0, "", 0, yco-=6, 120, 6, NULL, 0.0, 0.0, 0, 0, ""); + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Camera", 0, yco-=20, 120, 19, NULL, 0.0, 0.0, 1, 6, ""); uiDefIconTextBlockBut(block, info_add_lampmenu, NULL, ICON_RIGHTARROW_THIN, "Lamp", 0, yco-=20, 120, 19, ""); diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index 876177e0f7b..5372bb292db 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -2243,8 +2243,8 @@ static TBitem addmenu_armature[]= { { -1, "", 0, do_info_addmenu}}; /* dynamic items */ -#define TB_ADD_GROUP 6 -#define TB_ADD_LAMP 9 +#define TB_ADD_GROUP 7 +#define TB_ADD_LAMP 10 static TBitem tb_add[]= { { 0, "Mesh", 0, addmenu_mesh}, @@ -2253,6 +2253,7 @@ static TBitem tb_add[]= { { 0, "Meta", 3, addmenu_meta}, { 0, "Text", 4, NULL}, { 0, "Empty", 5, NULL}, +{ 0, "SEPR", 0, NULL}, { 0, "Group", 10, NULL}, { 0, "SEPR", 0, NULL}, { 0, "Camera", 6, NULL},