Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-05-06 19:15:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-06 19:15:33 +0400
commitc93d7a193ab450f89664a70e0204c14531be4877 (patch)
tree7263e2b9b83922d766f59f3f7531157c0f71be35 /source/blender/blenkernel/intern/group.c
parent53b221960acaa63cc50bd8095d0ea11f9de539e1 (diff)
style cleanup: BKE_*.c files which deal with library functions
Diffstat (limited to 'source/blender/blenkernel/intern/group.c')
-rw-r--r--source/blender/blenkernel/intern/group.c184
1 files changed, 92 insertions, 92 deletions
diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c
index c722522250c..2fc436ab4de 100644
--- a/source/blender/blenkernel/intern/group.c
+++ b/source/blender/blenkernel/intern/group.c
@@ -66,7 +66,7 @@ void BKE_group_free(Group *group)
GroupObject *go;
while (group->gobject.first) {
- go= group->gobject.first;
+ go = group->gobject.first;
BLI_remlink(&group->gobject, go);
free_group_object(go);
}
@@ -74,67 +74,67 @@ void BKE_group_free(Group *group)
void BKE_group_unlink(Group *group)
{
- Main *bmain= G.main;
+ Main *bmain = G.main;
Material *ma;
Object *ob;
Scene *sce;
SceneRenderLayer *srl;
ParticleSystem *psys;
- 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 (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;
+ 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 (rem_from_group(group, base->object, sce, base) && find_group(base->object, NULL)==NULL) {
+ for (; base; base = base->next) {
+ if (rem_from_group(group, base->object, sce, base) && 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;
+ for (srl = sce->r.layers.first; srl; srl = srl->next) {
+ if (srl->light_override == group)
+ srl->light_override = NULL;
}
}
- for (ob= bmain->object.first; ob; ob= ob->id.next) {
+ for (ob = bmain->object.first; ob; ob = ob->id.next) {
- if (ob->dup_group==group) {
- ob->dup_group= NULL;
-#if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
+ if (ob->dup_group == group) {
+ ob->dup_group = NULL;
+#if 0 /* XXX OLD ANIMSYS, NLASTRIPS ARE NO LONGER USED */
{
bActionStrip *strip;
/* duplicator strips use a group object, we remove it */
- for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+ for (strip = ob->nlastrips.first; strip; strip = strip->next) {
if (strip->object)
- strip->object= NULL;
+ strip->object = NULL;
}
}
#endif
}
- for (psys=ob->particlesystem.first; psys; psys=psys->next) {
- if (psys->part->dup_group==group)
- psys->part->dup_group= NULL;
-#if 0 /* not used anymore, only keps for readfile.c, no need to account for this */
- if (psys->part->eff_group==group)
- psys->part->eff_group= NULL;
+ for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+ if (psys->part->dup_group == group)
+ psys->part->dup_group = NULL;
+#if 0 /* not used anymore, only keps for readfile.c, no need to account for this */
+ if (psys->part->eff_group == group)
+ psys->part->eff_group = NULL;
#endif
}
}
/* group stays in library, but no members */
BKE_group_free(group);
- group->id.us= 0;
+ group->id.us = 0;
}
Group *add_group(const char *name)
@@ -142,7 +142,7 @@ Group *add_group(const char *name)
Group *group;
group = BKE_libblock_alloc(&G.main->group, ID_GR, name);
- group->layer= (1<<20)-1;
+ group->layer = (1 << 20) - 1;
return group;
}
@@ -150,7 +150,7 @@ Group *BKE_group_copy(Group *group)
{
Group *groupn;
- groupn= MEM_dupallocN(group);
+ groupn = MEM_dupallocN(group);
BLI_duplicatelist(&groupn->gobject, &group->gobject);
return groupn;
@@ -161,17 +161,17 @@ 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 0;
/* check if the object has been added already */
- for (go= group->gobject.first; go; go= go->next) {
- if (go->ob==ob) return 0;
+ for (go = group->gobject.first; go; go = go->next) {
+ if (go->ob == ob) return 0;
}
- go= MEM_callocN(sizeof(GroupObject), "groupobject");
+ go = MEM_callocN(sizeof(GroupObject), "groupobject");
BLI_addtail(&group->gobject, go);
- go->ob= ob;
+ go->ob = ob;
return 1;
}
@@ -179,10 +179,10 @@ static int add_to_group_internal(Group *group, Object *ob)
int add_to_group(Group *group, Object *object, Scene *scene, Base *base)
{
if (add_to_group_internal(group, object)) {
- if ((object->flag & OB_FROMGROUP)==0) {
+ if ((object->flag & OB_FROMGROUP) == 0) {
- if (scene && base==NULL)
- base= BKE_scene_base_find(scene, object);
+ if (scene && base == NULL)
+ base = BKE_scene_base_find(scene, object);
object->flag |= OB_FROMGROUP;
@@ -201,18 +201,18 @@ static int rem_from_group_internal(Group *group, Object *ob)
{
GroupObject *go, *gon;
int removed = 0;
- if (group==NULL) return 0;
+ if (group == NULL) return 0;
- go= group->gobject.first;
+ go = group->gobject.first;
while (go) {
- gon= go->next;
- if (go->ob==ob) {
+ gon = go->next;
+ if (go->ob == ob) {
BLI_remlink(&group->gobject, go);
free_group_object(go);
removed = 1;
/* should break here since an object being in a group twice cant happen? */
}
- go= gon;
+ go = gon;
}
return removed;
}
@@ -222,8 +222,8 @@ int rem_from_group(Group *group, Object *object, Scene *scene, Base *base)
if (rem_from_group_internal(group, object)) {
/* object can be NULL */
if (object && find_group(object, NULL) == NULL) {
- if (scene && base==NULL)
- base= BKE_scene_base_find(scene, object);
+ if (scene && base == NULL)
+ base = BKE_scene_base_find(scene, object);
object->flag &= ~OB_FROMGROUP;
@@ -241,10 +241,10 @@ int object_in_group(Object *ob, Group *group)
{
GroupObject *go;
- if (group==NULL || ob==NULL) return 0;
+ if (group == NULL || ob == NULL) return 0;
- for (go= group->gobject.first; go; go= go->next) {
- if (go->ob==ob)
+ for (go = group->gobject.first; go; go = go->next) {
+ if (go->ob == ob)
return 1;
}
return 0;
@@ -253,14 +253,14 @@ int object_in_group(Object *ob, Group *group)
Group *find_group(Object *ob, Group *group)
{
if (group)
- group= group->id.next;
+ group = group->id.next;
else
- group= G.main->group.first;
+ group = G.main->group.first;
while (group) {
if (object_in_group(ob, group))
return group;
- group= group->id.next;
+ group = group->id.next;
}
return NULL;
}
@@ -269,11 +269,11 @@ void group_tag_recalc(Group *group)
{
GroupObject *go;
- if (group==NULL) return;
+ if (group == NULL) return;
- for (go= group->gobject.first; go; go= go->next) {
+ for (go = group->gobject.first; go; go = go->next) {
if (go->ob)
- go->ob->recalc= go->recalc;
+ go->ob->recalc = go->recalc;
}
}
@@ -286,7 +286,7 @@ int group_is_animated(Object *UNUSED(parent), Group *group)
return 1;
#endif
- for (go= group->gobject.first; go; go= go->next)
+ for (go = group->gobject.first; go; go = go->next)
if (go->ob && go->ob->proxy)
return 1;
@@ -298,38 +298,38 @@ int group_is_animated(Object *UNUSED(parent), Group *group)
/* keep checking nla.c though, in case internal structure of strip changes */
static void group_replaces_nla(Object *parent, Object *target, char mode)
{
- static ListBase nlastrips={NULL, NULL};
- static bAction *action= NULL;
- static int done= 0;
+ static ListBase nlastrips = {NULL, NULL};
+ static bAction *action = NULL;
+ static int done = 0;
bActionStrip *strip, *nstrip;
- if (mode=='s') {
+ if (mode == 's') {
- for (strip= parent->nlastrips.first; strip; strip= strip->next) {
- if (strip->object==target) {
- if (done==0) {
+ for (strip = parent->nlastrips.first; strip; strip = strip->next) {
+ if (strip->object == target) {
+ if (done == 0) {
/* clear nla & action from object */
- nlastrips= target->nlastrips;
- target->nlastrips.first= target->nlastrips.last= NULL;
- action= target->action;
- target->action= NULL;
+ nlastrips = target->nlastrips;
+ target->nlastrips.first = target->nlastrips.last = NULL;
+ action = target->action;
+ target->action = NULL;
target->nlaflag |= OB_NLA_OVERRIDE;
- done= 1;
+ done = 1;
}
- nstrip= MEM_dupallocN(strip);
+ nstrip = MEM_dupallocN(strip);
BLI_addtail(&target->nlastrips, nstrip);
}
}
}
- else if (mode=='e') {
+ else if (mode == 'e') {
if (done) {
BLI_freelistN(&target->nlastrips);
- target->nlastrips= nlastrips;
- target->action= action;
+ target->nlastrips = nlastrips;
+ target->action = action;
- nlastrips.first= nlastrips.last= NULL; /* not needed, but yah... :) */
- action= NULL;
- done= 0;
+ nlastrips.first = nlastrips.last = NULL; /* not needed, but yah... :) */
+ action = NULL;
+ done = 0;
}
}
}
@@ -353,30 +353,30 @@ void group_handle_recalc_and_update(Scene *scene, Object *UNUSED(parent), Group
int cfrao;
/* switch to local time */
- cfrao= scene->r.cfra;
+ cfrao = scene->r.cfra;
/* we need a DAG per group... */
- for (go= group->gobject.first; go; go= go->next) {
+ for (go = group->gobject.first; go; go = go->next) {
if (go->ob && go->recalc) {
- go->ob->recalc= go->recalc;
+ go->ob->recalc = go->recalc;
group_replaces_nla(parent, go->ob, 's');
BKE_object_handle_update(scene, go->ob);
group_replaces_nla(parent, go->ob, 'e');
/* leave recalc tags in case group members are in normal scene */
- go->ob->recalc= go->recalc;
+ go->ob->recalc = go->recalc;
}
}
/* restore */
- scene->r.cfra= cfrao;
+ scene->r.cfra = cfrao;
}
else
#endif
{
/* only do existing tags, as set by regular depsgraph */
- for (go= group->gobject.first; go; go= go->next) {
+ for (go = group->gobject.first; go; go = go->next) {
if (go->ob) {
if (go->ob->recalc) {
BKE_object_handle_update(scene, go->ob);
@@ -391,17 +391,17 @@ Object *group_get_member_with_action(Group *group, bAction *act)
{
GroupObject *go;
- if (group==NULL || act==NULL) return NULL;
+ if (group == NULL || act == NULL) return NULL;
- for (go= group->gobject.first; go; go= go->next) {
+ for (go = group->gobject.first; go; go = go->next) {
if (go->ob) {
- if (go->ob->action==act)
+ if (go->ob->action == act)
return go->ob;
if (go->ob->nlastrips.first) {
bActionStrip *strip;
- for (strip= go->ob->nlastrips.first; strip; strip= strip->next) {
- if (strip->act==act)
+ for (strip = go->ob->nlastrips.first; strip; strip = strip->next) {
+ if (strip->act == act)
return go->ob;
}
}
@@ -418,21 +418,21 @@ void group_relink_nla_objects(Object *ob)
GroupObject *go;
bActionStrip *strip;
- if (ob==NULL || ob->dup_group==NULL) return;
- group= ob->dup_group;
+ if (ob == NULL || ob->dup_group == NULL) return;
+ group = ob->dup_group;
- for (strip= ob->nlastrips.first; strip; strip= strip->next) {
+ for (strip = ob->nlastrips.first; strip; strip = strip->next) {
if (strip->object) {
- for (go= group->gobject.first; go; go= go->next) {
+ for (go = group->gobject.first; go; go = go->next) {
if (go->ob) {
- if (strcmp(go->ob->id.name, strip->object->id.name)==0)
+ if (strcmp(go->ob->id.name, strip->object->id.name) == 0)
break;
}
}
if (go)
- strip->object= go->ob;
+ strip->object = go->ob;
else
- strip->object= NULL;
+ strip->object = NULL;
}
}