diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-23 00:52:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-23 00:52:58 +0300 |
commit | 3b0a5dd15884aed00d988d73a72f4946673f8be9 (patch) | |
tree | 07f488e24eb2b9f9b3dfce9d15ac66dabd74b7e4 /source/blender/blenkernel/intern/group.c | |
parent | 97ee7f8609bed555ff4bd371b7e25d13b2d6a0d6 (diff) | |
parent | 7547c6a250cd6f36c9894605b822380a1261febf (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern/group.c')
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 6026913d247..95c7730431a 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -59,69 +59,19 @@ static void free_group_object(GroupObject *go) MEM_freeN(go); } - +/** Free (or release) any data used by this group (does not free the group itself). */ void BKE_group_free(Group *group) { /* don't free group itself */ GroupObject *go; - BKE_previewimg_free(&group->preview); + /* No animdata here. */ while ((go = BLI_pophead(&group->gobject))) { free_group_object(go); } -} -void BKE_group_unlink(Main *bmain, Group *group) -{ - Material *ma; - Object *ob; - Scene *sce; - SceneRenderLayer *srl; - - for (ma = bmain->mat.first; ma; ma = ma->id.next) { - if (ma->group == group) - ma->group = NULL; - } - for (ma = bmain->mat.first; ma; ma = ma->id.next) { - if (ma->group == group) - ma->group = NULL; - } - for (sce = bmain->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 (BKE_group_object_unlink(group, base->object, sce, base) && - BKE_group_object_find(NULL, base->object) == NULL) - { - base->object->flag &= ~OB_FROMGROUP; - base->flag &= ~OB_FROMGROUP; - } - } - - for (srl = sce->r.layers.first; srl; srl = srl->next) { - FreestyleLineSet *lineset; - - if (srl->light_override == group) - srl->light_override = NULL; - for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { - if (lineset->group == group) - lineset->group = NULL; - } - } - } - - for (ob = bmain->object.first; ob; ob = ob->id.next) { - - if (ob->dup_group == group) { - ob->dup_group = NULL; - } - } - - /* group stays in library, but no members */ - BKE_group_free(group); - group->id.us = 0; + BKE_previewimg_free(&group->preview); } Group *BKE_group_add(Main *bmain, const char *name) |