Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/collision.c
| Show First 20 Lines • Show All 497 Lines • ▼ Show 20 Lines | if (ob->dup_group && level == 0) { | ||||
| /* add objects */ | /* add objects */ | ||||
| for (go= group->gobject.first; go; go= go->next) | for (go= group->gobject.first; go; go= go->next) | ||||
| add_collision_object(objs, numobj, maxobj, go->ob, self, level+1, modifier_type); | add_collision_object(objs, numobj, maxobj, go->ob, self, level+1, modifier_type); | ||||
| } | } | ||||
| } | } | ||||
| // return all collision objects in scene | // return all collision objects in scene | ||||
| // collision object will exclude self | // collision object will exclude self | ||||
| Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned int *numcollobj, unsigned int modifier_type) | Object **get_collisionobjects_ext(Scene *scene, Object *self, Group *group, int layer, unsigned int *numcollobj, unsigned int modifier_type, bool dupli) | ||||
| { | { | ||||
| Base *base; | Base *base; | ||||
| Object **objs; | Object **objs; | ||||
| GroupObject *go; | GroupObject *go; | ||||
| unsigned int numobj= 0, maxobj= 100; | unsigned int numobj= 0, maxobj= 100; | ||||
| int level = dupli ? 0 : 1; | |||||
| objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray"); | objs= MEM_callocN(sizeof(Object *)*maxobj, "CollisionObjectsArray"); | ||||
| /* gather all collision objects */ | /* gather all collision objects */ | ||||
| if (group) { | if (group) { | ||||
| /* use specified group */ | /* use specified group */ | ||||
| for (go= group->gobject.first; go; go= go->next) | for (go= group->gobject.first; go; go= go->next) | ||||
| add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0, modifier_type); | add_collision_object(&objs, &numobj, &maxobj, go->ob, self, level, modifier_type); | ||||
| } | } | ||||
| else { | else { | ||||
| Scene *sce_iter; | Scene *sce_iter; | ||||
| /* add objects in same layer in scene */ | /* add objects in same layer in scene */ | ||||
| for (SETLOOPER(scene, sce_iter, base)) { | for (SETLOOPER(scene, sce_iter, base)) { | ||||
| /* Need to check for active layers, too. | if ( base->lay & layer ) | ||||
| Otherwise this check fails if the objects are not on the same layer - DG */ | add_collision_object(&objs, &numobj, &maxobj, base->object, self, level, modifier_type); | ||||
| if ((base->lay & self->lay) || (base->lay & scene->lay)) | |||||
| add_collision_object(&objs, &numobj, &maxobj, base->object, self, 0, modifier_type); | |||||
| } | } | ||||
| } | } | ||||
| *numcollobj= numobj; | *numcollobj= numobj; | ||||
| return objs; | return objs; | ||||
| } | } | ||||
| Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned int *numcollobj, unsigned int modifier_type) | |||||
| { | |||||
| /* Need to check for active layers, too. | |||||
| Otherwise this check fails if the objects are not on the same layer - DG */ | |||||
| return get_collisionobjects_ext(scene, self, group, self->lay | scene->lay, numcollobj, modifier_type, true); | |||||
| } | |||||
| static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self, int level) | static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self, int level) | ||||
| { | { | ||||
| CollisionModifierData *cmd= NULL; | CollisionModifierData *cmd= NULL; | ||||
| ColliderCache *col; | ColliderCache *col; | ||||
| if (ob == self) | if (ob == self) | ||||
| return; | return; | ||||
| ▲ Show 20 Lines • Show All 890 Lines • Show Last 20 Lines | |||||