diff options
author | Matt Ebb <matt@mke3.net> | 2006-01-27 00:18:02 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2006-01-27 00:18:02 +0300 |
commit | 517048eb3d40aff562feed2110da20ccba407d27 (patch) | |
tree | 02676a76a6b75c5fb07e743980748d2b0343df86 /source/blender/src/header_info.c | |
parent | fa54435615cc8129bf5ea4fea542386195f17dcf (diff) |
* Put the Add->Group menu in the top info header too.
Diffstat (limited to 'source/blender/src/header_info.c')
-rw-r--r-- | source/blender/src/header_info.c | 44 |
1 files changed, 44 insertions, 0 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 <config.h> #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, ""); |