diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-08-29 04:53:29 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-08-29 04:53:29 +0400 |
commit | 141dd5233ede83a6d3882713c95bba47cee90a68 (patch) | |
tree | 23cdf3e596bba784d101f9e32f234b399ffba4b1 /source/blender/blenkernel/intern/group.c | |
parent | 22b30da565de53a0a1d34079d72b08fdb54ec8e3 (diff) | |
parent | 8321acaf439b33cca0b054565be176047d289134 (diff) |
Merged changes in the trunk up to revision 50257.
Conflicts resolved:
source/blender/blenkernel/CMakeLists.txt
Diffstat (limited to 'source/blender/blenkernel/intern/group.c')
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index b615f8c0d9f..0d9a69008ee 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -167,11 +167,13 @@ static int add_to_group_internal(Group *group, Object *ob) { GroupObject *go; - if (group == NULL || ob == NULL) return 0; + if (group == NULL || ob == NULL) { + return FALSE; + } /* check if the object has been added already */ - for (go = group->gobject.first; go; go = go->next) { - if (go->ob == ob) return 0; + if (BLI_findptr(&group->gobject, ob, offsetof(GroupObject, ob))) { + return FALSE; } go = MEM_callocN(sizeof(GroupObject), "groupobject"); @@ -179,7 +181,7 @@ static int add_to_group_internal(Group *group, Object *ob) go->ob = ob; - return 1; + return TRUE; } int add_to_group(Group *group, Object *object, Scene *scene, Base *base) @@ -245,15 +247,11 @@ int rem_from_group(Group *group, Object *object, Scene *scene, Base *base) int object_in_group(Object *ob, Group *group) { - GroupObject *go; - - if (group == NULL || ob == NULL) return 0; - - for (go = group->gobject.first; go; go = go->next) { - if (go->ob == ob) - return 1; + if (group == NULL || ob == NULL) { + return FALSE; } - return 0; + + return (BLI_findptr(&group->gobject, ob, offsetof(GroupObject, ob)) != NULL); } Group *find_group(Object *ob, Group *group) |