diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-18 13:45:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-18 13:45:50 +0400 |
commit | 88fddb3cc34e0e1fe8da6f038f2ed377684b2ea9 (patch) | |
tree | bd21d5b828797d4988fbc5dfcc53c528fcd4d0d9 /source/blender/blenkernel | |
parent | e204d67cc79f2a7851611a4558ad95bb1b624859 (diff) |
make links now allows groups - this means you can make objects have matching groups to the active more easily.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index b8ba3095905..3aa7148d821 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -177,6 +177,8 @@ typedef enum eObjectSet { } eObjectSet; struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter); +struct LinkNode *BKE_object_groups(struct Object *ob); +void BKE_object_groups_clear(struct Scene *scene, struct Base *base, struct Object *object); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index a3145ddeedd..048560f3a83 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -3156,7 +3156,7 @@ static void obrel_list_add(LinkNode **links, Object *ob) * If OB_SET_VISIBLE or OB_SET_SELECTED are collected, * then also add related objects according to the given includeFilters. */ -struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter) +LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet objectSet, eObRelationTypes includeFilter) { LinkNode *links = NULL; @@ -3235,3 +3235,32 @@ struct LinkNode *BKE_object_relational_superset(struct Scene *scene, eObjectSet return links; } + +/** + * return all groups this object is apart of, caller must free. + */ +struct LinkNode *BKE_object_groups(Object *ob) +{ + LinkNode *group_linknode = NULL; + Group *group = NULL; + while ((group = find_group(ob, group))) { + BLI_linklist_prepend(&group_linknode, group); + } + + return group_linknode; +} + +void BKE_object_groups_clear(Scene *scene, Base *base, Object *object) +{ + Group *group = NULL; + + BLI_assert(base->object == object); + + if (scene && base == NULL) { + base = BKE_scene_base_find(scene, object); + } + + while ((group = find_group(base->object, group))) { + rem_from_group(group, object, scene, base); + } +} |