no functional changes: SETLOOPER macro assumed a scene was defined called 'sce' used to loop over, now make this an argument, helps to make it clear what's going on.

This commit is contained in:
Campbell Barton 2010-12-17 15:37:59 +00:00
parent f53e8b78b4
commit 902b239aa8
11 changed files with 44 additions and 43 deletions

@ -173,7 +173,7 @@ kmi = km.items.new('wm.context_set_enum', 'COMMA', 'PRESS', ctrl=True)
kmi.properties.data_path = 'space_data.pivot_point'
kmi.properties.value = 'MEDIAN_POINT'
kmi = km.items.new('wm.context_toggle', 'COMMA', 'PRESS', alt=True)
kmi.properties.data_path = 'space_data.use_pivot_point_align'
kmi.properties.data_path = 'space_data.use_pivot_point'
kmi = km.items.new('wm.context_toggle', 'Q', 'PRESS')
kmi.properties.data_path = 'space_data.show_manipulator'
kmi = km.items.new('wm.context_set_enum', 'PERIOD', 'PRESS')

@ -51,8 +51,8 @@ struct Text;
#define SCE_COPY_LINK_DATA 2
#define SCE_COPY_FULL 3
#define SETLOOPER(s, b) sce= s, b= _setlooper_base_step(&sce, NULL); b; b= _setlooper_base_step(&sce, b)
struct Base *_setlooper_base_step(struct Scene **sce, struct Base *base);
#define SETLOOPER(_sce_basis, _sce_iter, _base) _sce_iter= _sce_basis, _base= _setlooper_base_step(&_sce_iter, NULL); _base; _base= _setlooper_base_step(&_sce_iter, _base)
struct Base *_setlooper_base_step(struct Scene **sce_iter, struct Base *base);
void free_avicodecdata(struct AviCodecData *acd);
void free_qtcodecdata(struct QuicktimeCodecData *acd);

@ -1358,9 +1358,9 @@ Object **get_collisionobjects(Scene *scene, Object *self, Group *group, unsigned
add_collision_object(&objs, &numobj, &maxobj, go->ob, self, 0);
}
else {
Scene *sce; /* for SETLOOPER macro */
Scene *sce_iter;
/* add objects in same layer in scene */
for(SETLOOPER(scene, base)) {
for(SETLOOPER(scene, sce_iter, base)) {
if(base->lay & self->lay)
add_collision_object(&objs, &numobj, &maxobj, base->object, self, 0);
@ -1417,11 +1417,11 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
add_collider_cache_object(&objs, go->ob, self, 0);
}
else {
Scene *sce; /* for SETLOOPER macro */
Scene *sce_iter;
Base *base;
/* add objects in same layer in scene */
for(SETLOOPER(scene, base)) {
for(SETLOOPER(scene, sce_iter, base)) {
if(!self || (base->lay & self->lay))
add_collider_cache_object(&objs, base->object, self, 0);

@ -2139,10 +2139,10 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s
Object *ob;
Group *group;
GroupObject *go;
Scene *sce;
Scene *sce_iter;
/* set ob flags where animated systems are */
for(SETLOOPER(scene, base)) {
for(SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
if(do_time) {
@ -2167,12 +2167,12 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay, const s
}
}
for(sce= scene; sce; sce= sce->set)
DAG_scene_flush_update(bmain, sce, lay, 1);
for(sce_iter= scene; sce_iter; sce_iter= sce_iter->set)
DAG_scene_flush_update(bmain, sce_iter, lay, 1);
if(do_time) {
/* test: set time flag, to disable baked systems to update */
for(SETLOOPER(scene, base)) {
for(SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
if(ob->recalc)
ob->recalc |= OB_RECALC_TIME;
@ -2240,7 +2240,7 @@ void DAG_ids_flush_update(Main *bmain, int time)
void DAG_on_load_update(Main *bmain, const short do_time)
{
Scene *scene, *sce;
Scene *scene;
Base *base;
Object *ob;
Group *group;
@ -2251,15 +2251,16 @@ void DAG_on_load_update(Main *bmain, const short do_time)
dag_current_scene_layers(bmain, &scene, &lay);
if(scene && scene->theDag) {
Scene *sce_iter;
/* derivedmeshes and displists are not saved to file so need to be
remade, tag them so they get remade in the scene update loop,
note armature poses or object matrices are preserved and do not
require updates, so we skip those */
dag_scene_flush_layers(scene, lay);
for(SETLOOPER(scene, base)) {
for(SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
node= (sce->theDag)? dag_get_node(sce->theDag, ob): NULL;
node= (sce_iter->theDag)? dag_get_node(sce_iter->theDag, ob): NULL;
oblay= (node)? node->lay: ob->lay;
if(oblay & lay) {

@ -2464,7 +2464,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
{
Main *bmain = baker->main;
Scene *scene = baker->scene;
Scene *sce; /* SETLOOPER macro only */
Scene *sce_iter; /* SETLOOPER macro only */
Base *base;
ListBase pidlist;
PTCacheID *pid = baker->pid;
@ -2535,7 +2535,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
cache->flag &= ~PTCACHE_BAKED;
}
}
else for(SETLOOPER(scene, base)) {
else for(SETLOOPER(scene, sce_iter, base)) {
/* cache/bake everything in the scene */
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
@ -2624,7 +2624,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker)
BKE_ptcache_write_cache(pid, 0);
}
}
else for(SETLOOPER(scene, base)) {
else for(SETLOOPER(scene, sce_iter, base)) {
BKE_ptcache_ids_from_object(&pidlist, base->object, scene, MAX_DUPLI_RECUR);
for(pid=pidlist.first; pid; pid=pid->next) {

@ -1077,20 +1077,20 @@ float get_render_aosss_error(RenderData *r, float error)
}
/* helper function for the SETLOOPER macro */
Base *_setlooper_base_step(Scene **sce, Base *base)
Base *_setlooper_base_step(Scene **sce_iter, Base *base)
{
if(base && base->next) {
/* common case, step to the next */
return base->next;
}
else if(base==NULL && (*sce)->base.first) {
else if(base==NULL && (*sce_iter)->base.first) {
/* first time looping, return the scenes first base */
return (Base *)(*sce)->base.first;
return (Base *)(*sce_iter)->base.first;
}
else {
/* reached the end, get the next base in the set */
while((*sce= (*sce)->set)) {
base= (Base *)(*sce)->base.first;
while((*sce_iter= (*sce_iter)->set)) {
base= (Base *)(*sce_iter)->base.first;
if(base) {
return base;
}

@ -1726,7 +1726,6 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
{
RegionView3D *rv3d= ar->regiondata;
Base *base;
Scene *sce;
short zbuf= v3d->zbuf;
short flag= v3d->flag;
float glalphaclip= U.glalphaclip;
@ -1759,7 +1758,8 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
/* draw set first */
if(scene->set) {
for(SETLOOPER(scene->set, base)) {
Scene *sce_iter;
for(SETLOOPER(scene->set, sce_iter, base)) {
if(v3d->lay & base->lay) {
if (func == NULL || func(base)) {
draw_object(scene, ar, v3d, base, 0);
@ -1881,14 +1881,14 @@ static void gpu_update_lamps_shadows(Scene *scene, View3D *v3d)
{
ListBase shadows;
View3DShadow *shadow;
Scene *sce;
Scene *sce_iter;
Base *base;
Object *ob;
shadows.first= shadows.last= NULL;
/* update lamp transform and gather shadow lamps */
for(SETLOOPER(scene, base)) {
for(SETLOOPER(scene, sce_iter, base)) {
ob= base->object;
if(ob->type == OB_LAMP)
@ -2036,7 +2036,6 @@ static void view3d_main_area_setup_view(Scene *scene, View3D *v3d, ARegion *ar,
void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, int winy, float viewmat[][4], float winmat[][4])
{
Scene *sce;
Base *base;
float backcol[3];
int bwinx, bwiny;
@ -2091,7 +2090,8 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* draw set first */
if(scene->set) {
for(SETLOOPER(scene->set, base)) {
Scene *sce_iter;
for(SETLOOPER(scene->set, sce_iter, base)) {
if(v3d->lay & base->lay) {
UI_ThemeColorBlend(TH_WIRE, TH_BACK, 0.6f);
draw_object(scene, ar, v3d, base, DRAW_CONSTCOLOR|DRAW_SCENESET);
@ -2295,7 +2295,6 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
Scene *scene= CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
Scene *sce;
Base *base;
Object *ob;
float backcol[3];
@ -2389,7 +2388,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* draw set first */
if(scene->set) {
for(SETLOOPER(scene->set, base)) {
Scene *sce_iter;
for(SETLOOPER(scene->set, sce_iter, base)) {
if(v3d->lay & base->lay) {

@ -756,10 +756,10 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
{
Base *base;
Object *ob;
Scene *sce;
Scene *sce_iter;
GPULamp *lamp;
for(SETLOOPER(shi->gpumat->scene, base)) {
for(SETLOOPER(shi->gpumat->scene, sce_iter, base)) {
ob= base->object;
if(ob->type==OB_LAMP) {

@ -874,10 +874,10 @@ static void object_simplify_update(Object *ob)
static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Scene *sce;
Scene *sce_iter;
Base *base;
for(SETLOOPER(scene, base))
for(SETLOOPER(scene, sce_iter, base))
object_simplify_update(base->object);
DAG_ids_flush_update(bmain, 0);

@ -4679,7 +4679,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
Object *ob;
Group *group;
ObjectInstanceRen *obi;
Scene *sce;
Scene *sce_iter;
float mat[4][4];
int lay, vectorlay, redoimat= 0;
@ -4688,7 +4688,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
* NULL is just for init */
set_dupli_tex_mat(NULL, NULL, NULL);
for(SETLOOPER(re->scene, base)) {
for(SETLOOPER(re->scene, sce_iter, base)) {
ob= base->object;
/* imat objects has to be done here, since displace can have texture using Object map-input */
mul_m4_m4m4(mat, ob->obmat, re->viewmat);
@ -4698,7 +4698,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
ob->transflag &= ~OB_RENDER_DUPLI;
}
for(SETLOOPER(re->scene, base)) {
for(SETLOOPER(re->scene, sce_iter, base)) {
ob= base->object;
/* in the prev/next pass for making speed vectors, avoid creating
@ -4836,7 +4836,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
/* imat objects has to be done again, since groups can mess it up */
if(redoimat) {
for(SETLOOPER(re->scene, base)) {
for(SETLOOPER(re->scene, sce_iter, base)) {
ob= base->object;
mul_m4_m4m4(mat, ob->obmat, re->viewmat);
invert_m4_m4(ob->imat, mat);

@ -227,10 +227,10 @@ static unsigned int KX_Mcol2uint_new(MCol col)
static void SetDefaultFaceType(Scene* scene)
{
default_face_mode = TF_DYNAMIC;
Scene *sce;
Scene *sce_iter;
Base *base;
for(SETLOOPER(scene,base))
for(SETLOOPER(scene, sce_iter, base))
{
if (base->object->type == OB_LAMP)
{
@ -1931,7 +1931,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
Scene *blenderscene = kxscene->GetBlenderScene();
// for SETLOOPER
Scene *sce;
Scene *sce_iter;
Base *base;
// Get the frame settings of the canvas.
@ -2012,7 +2012,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
// Beware of name conflict in linked data, it will not crash but will create confusion
// in Python scripting and in certain actuators (replace mesh). Linked scene *should* have
// no conflicting name for Object, Object data and Action.
for (SETLOOPER(blenderscene, base))
for (SETLOOPER(blenderscene, sce_iter, base))
{
Object* blenderobject = base->object;
allblobj.insert(blenderobject);