Bugfix #14412
authorTon Roosendaal <ton@blender.org>
Wed, 17 Sep 2008 17:47:59 +0000 (17:47 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 17 Sep 2008 17:47:59 +0000 (17:47 +0000)
Outliner option 'unlink group' didn't remove its members, in case the
group members were local in file, a confusing situation happened. Now
it removes members.

source/blender/blenkernel/intern/group.c

index 2ffe8590b59b232dcb914a6be0fbafdb60b0b93d..0d2f86bb15180551f6ab9459621bc7f861ac250e 100644 (file)
@@ -91,6 +91,16 @@ void unlink_group(Group *group)
                        ma->group= NULL;
        }
        for (sce= G.main->scene.first; sce; sce= sce->id.next) {
+               Base *base= sce->base.first;
+               
+               /* ensure objects are not in this group */
+               for(; base; base= base->next) {
+                       if(rem_from_group(group, base->object) && find_group(base->object, NULL)==NULL) {
+                               base->object->flag &= ~OB_FROMGROUP;
+                               base->flag &= ~OB_FROMGROUP;
+                       }
+               }                       
+               
                for(srl= sce->r.layers.first; srl; srl= srl->next) {
                        if (srl->light_override==group)
                                srl->light_override= NULL;
@@ -117,6 +127,9 @@ void unlink_group(Group *group)
                                psys->part->eff_group= NULL;
                }
        }
+       
+       /* group stays in library, but no members */
+       free_group(group);
        group->id.us= 0;
 }