Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-03-09 18:18:53 +0300
committerTon Roosendaal <ton@blender.org>2006-03-09 18:18:53 +0300
commit4953b17be206d327d63cb16b4c2fb4d4603589e8 (patch)
tree8665af8b8e1d8ce0896008bc183ee6a2fe27b9ac /source/blender/src/editgroup.c
parent610a813c0c2d4087fe347f8bda55041f863c4c45 (diff)
Improved CTRL+G grouping menu; it now offers a choice to add to any
existing group, using a 2nd menu.
Diffstat (limited to 'source/blender/src/editgroup.c')
-rw-r--r--source/blender/src/editgroup.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/source/blender/src/editgroup.c b/source/blender/src/editgroup.c
index b1ae44477f0..4b699b719ab 100644
--- a/source/blender/src/editgroup.c
+++ b/source/blender/src/editgroup.c
@@ -101,29 +101,36 @@ void rem_selected_from_group(void)
void group_operation_with_menu(void)
{
- Base *base;
Group *group= NULL;
int mode;
- for(base=FIRSTBASE; base; base= base->next) {
- if TESTBASE(base) {
- group= find_group(base->object);
- if(group) break;
- }
- }
+ /* are there existing groups? */
+ for(group= G.main->group.first; group; group= group->id.next)
+ if(group->id.lib==NULL)
+ break;
- if(group && group->id.lib) {
- error("Cannot edit library data");
- return;
- }
-
- if(base)
- mode= pupmenu("Groups %t|Add to current Group %x3|Add to New Group %x1|Remove from all Groups %x2");
+ if(group)
+ mode= pupmenu("Groups %t|Add to existing Group %x3|Add to New Group %x1|Remove from all Groups %x2");
else
mode= pupmenu("Groups %t|Add to New Group %x1|Remove from all Groups %x2");
if(mode>0) {
if(group==NULL || mode==1) group= add_group();
+ if(mode==3) {
+ int tot= BLI_countlist(&G.main->group);
+ char *strp= MEM_callocN(tot*32 + 32, "group menu"), *strp1;
+
+ strp1= strp;
+ for(tot=1, group= G.main->group.first; group; group= group->id.next, tot++) {
+ if(group->id.lib==NULL) {
+ strp1 += sprintf(strp1, "%s %%x%d|", group->id.name+2, tot);
+ }
+ }
+ tot= pupmenu(strp);
+ MEM_freeN(strp);
+ if(tot>0) group= BLI_findlink(&G.main->group, tot-1);
+ else return;
+ }
if(mode==1 || mode==3) add_selected_to_group(group);
else if(mode==2) rem_selected_from_group();