diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-07 23:07:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-07 23:24:05 +0400 |
commit | b3afbcab8ff2330c1473647be330a3ffe9b11885 (patch) | |
tree | e86b9c7d9676e63b8da92da79889dee13b8be186 /source/blender/blenloader/intern/readfile.c | |
parent | 1c24d954f4ac63f22b703756b6664a4ad1b363d4 (diff) |
ListBase API: add utility api funcs for clearing and checking empty
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 738b682188a..f41baf5553a 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -489,7 +489,7 @@ void blo_split_main(ListBase *mainlist, Main *main) mainlist->first = mainlist->last = main; main->next = NULL; - if (main->library.first == NULL) + if (BLI_listbase_is_empty(&main->library)) return; for (lib = main->library.first; lib; lib = lib->id.next) { @@ -1573,7 +1573,7 @@ static void link_list(FileData *fd, ListBase *lb) /* only direct data */ { Link *ln, *prev; - if (lb->first == NULL) return; + if (BLI_listbase_is_empty(lb)) return; lb->first = newdataadr(fd, lb->first); ln = lb->first; @@ -1592,7 +1592,7 @@ static void link_glob_list(FileData *fd, ListBase *lb) /* for glob data */ Link *ln, *prev; void *poin; - if (lb->first == NULL) return; + if (BLI_listbase_is_empty(lb)) return; poin = newdataadr(fd, lb->first); if (lb->first) { oldnewmap_insert(fd->globmap, lb->first, poin, 0); @@ -3127,7 +3127,7 @@ static void direct_link_mball(FileData *fd, MetaBall *mb) link_list(fd, &(mb->elems)); - mb->disp.first = mb->disp.last = NULL; + BLI_listbase_clear(&mb->disp); mb->editelems = NULL; /* mb->edit_elems.first= mb->edit_elems.last= NULL;*/ mb->lastelem = NULL; @@ -3539,7 +3539,7 @@ static void direct_link_material(FileData *fd, Material *ma) } ma->preview = direct_link_preview_image(fd, ma->preview); - ma->gpumaterial.first = ma->gpumaterial.last = NULL; + BLI_listbase_clear(&ma->gpumaterial); } /* ************ READ PARTICLE SETTINGS ***************** */ @@ -3585,7 +3585,7 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) } } else - cache->mem_cache.first = cache->mem_cache.last = NULL; + BLI_listbase_clear(&cache->mem_cache); cache->flag &= ~PTCACHE_SIMULATION_VALID; cache->simframe = 0; @@ -3656,7 +3656,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) if (part->dupliweights.first && part->dup_group) { int index_ok = 0; /* check for old files without indices (all indexes 0) */ - if (part->dupliweights.first == part->dupliweights.last) { + if (BLI_listbase_is_single(&part->dupliweights)) { /* special case for only one object in the group */ index_ok = 1; } @@ -3684,7 +3684,7 @@ static void lib_link_particlesettings(FileData *fd, Main *main) } } else { - part->dupliweights.first = part->dupliweights.last = NULL; + BLI_listbase_clear(&part->dupliweights); } if (part->boids) { @@ -3847,8 +3847,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles) psys->free_edit = NULL; psys->pathcache = NULL; psys->childcache = NULL; - psys->pathcachebufs.first = psys->pathcachebufs.last = NULL; - psys->childcachebufs.first = psys->childcachebufs.last = NULL; + BLI_listbase_clear(&psys->pathcachebufs); + BLI_listbase_clear(&psys->childcachebufs); psys->frand = NULL; psys->pdd = NULL; psys->renderdata = NULL; @@ -4540,8 +4540,8 @@ static void direct_link_pose(FileData *fd, bPose *pose) if (pchan->mpath) direct_link_motionpath(fd, pchan->mpath); - pchan->iktree.first = pchan->iktree.last = NULL; - pchan->siktree.first = pchan->siktree.last = NULL; + BLI_listbase_clear(&pchan->iktree); + BLI_listbase_clear(&pchan->siktree); /* in case this value changes in future, clamp else we get undefined behavior */ CLAMP(pchan->rotmode, ROT_MODE_MIN, ROT_MODE_MAX); @@ -4643,8 +4643,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) } BKE_ptcache_free(cache); } - smd->domain->ptcaches[1].first = NULL; - smd->domain->ptcaches[1].last = NULL; + BLI_listbase_clear(&smd->domain->ptcaches[1]); smd->domain->point_cache[1] = NULL; } } @@ -5036,7 +5035,7 @@ static void direct_link_object(FileData *fd, Object *ob) ob->bb = NULL; ob->derivedDeform = NULL; ob->derivedFinal = NULL; - ob->gpulamp.first= ob->gpulamp.last = NULL; + BLI_listbase_clear(&ob->gpulamp); link_list(fd, &ob->pc_ids); /* Runtime curve data */ @@ -5519,11 +5518,11 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) win->curswin = NULL; win->tweak = NULL; - win->queue.first = win->queue.last = NULL; - win->handlers.first = win->handlers.last = NULL; - win->modalhandlers.first = win->modalhandlers.last = NULL; - win->subwindows.first = win->subwindows.last = NULL; - win->gesture.first = win->gesture.last = NULL; + BLI_listbase_clear(&win->queue); + BLI_listbase_clear(&win->handlers); + BLI_listbase_clear(&win->modalhandlers); + BLI_listbase_clear(&win->subwindows); + BLI_listbase_clear(&win->gesture); win->drawdata = NULL; win->drawmethod = -1; @@ -5535,19 +5534,19 @@ static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm) win->modalcursor = 0; } - wm->timers.first = wm->timers.last = NULL; - wm->operators.first = wm->operators.last = NULL; - wm->paintcursors.first = wm->paintcursors.last = NULL; - wm->queue.first = wm->queue.last = NULL; + BLI_listbase_clear(&wm->timers); + BLI_listbase_clear(&wm->operators); + BLI_listbase_clear(&wm->paintcursors); + BLI_listbase_clear(&wm->queue); BKE_reports_init(&wm->reports, RPT_STORE); - wm->keyconfigs.first = wm->keyconfigs.last = NULL; + BLI_listbase_clear(&wm->keyconfigs); wm->defaultconf = NULL; wm->addonconf = NULL; wm->userconf = NULL; - wm->jobs.first = wm->jobs.last = NULL; - wm->drags.first = wm->drags.last = NULL; + BLI_listbase_clear(&wm->jobs); + BLI_listbase_clear(&wm->drags); wm->windrawable = NULL; wm->winactive = NULL; @@ -6189,9 +6188,9 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype) ar->v2d.tab_num = 0; ar->v2d.tab_cur = 0; ar->v2d.sms = NULL; - ar->panels_category.first = ar->panels_category.last = NULL; - ar->handlers.first = ar->handlers.last = NULL; - ar->uiblocks.first = ar->uiblocks.last = NULL; + BLI_listbase_clear(&ar->panels_category); + BLI_listbase_clear(&ar->handlers); + BLI_listbase_clear(&ar->uiblocks); ar->headerstr = NULL; ar->swinid = 0; ar->type = NULL; @@ -6266,7 +6265,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) link_list(fd, &(sa->spacedata)); link_list(fd, &(sa->regionbase)); - sa->handlers.first = sa->handlers.last = NULL; + BLI_listbase_clear(&sa->handlers); sa->type = NULL; /* spacetype callbacks */ sa->region_active_win = -1; @@ -6323,9 +6322,9 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) direct_link_gpencil(fd, v3d->gpd); } v3d->localvd = newdataadr(fd, v3d->localvd); - v3d->afterdraw_transp.first = v3d->afterdraw_transp.last = NULL; - v3d->afterdraw_xray.first = v3d->afterdraw_xray.last = NULL; - v3d->afterdraw_xraytransp.first = v3d->afterdraw_xraytransp.last = NULL; + BLI_listbase_clear(&v3d->afterdraw_transp); + BLI_listbase_clear(&v3d->afterdraw_xray); + BLI_listbase_clear(&v3d->afterdraw_xraytransp); v3d->properties_storage = NULL; v3d->defmaterial = NULL; @@ -6339,7 +6338,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) SpaceIpo *sipo = (SpaceIpo *)sl; sipo->ads = newdataadr(fd, sipo->ads); - sipo->ghostCurves.first = sipo->ghostCurves.last = NULL; + BLI_listbase_clear(&sipo->ghostCurves); } else if (sl->spacetype == SPACE_NLA) { SpaceNla *snla = (SpaceNla *)sl; @@ -6407,7 +6406,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) link_list(fd, &snode->treepath); snode->edittree = NULL; - snode->linkdrag.first = snode->linkdrag.last = NULL; + BLI_listbase_clear(&snode->linkdrag); } else if (sl->spacetype == SPACE_TEXT) { SpaceText *st= (SpaceText *)sl; @@ -6418,7 +6417,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) } else if (sl->spacetype == SPACE_TIME) { SpaceTime *stime = (SpaceTime *)sl; - stime->caches.first = stime->caches.last = NULL; + BLI_listbase_clear(&stime->caches); } else if (sl->spacetype == SPACE_LOGIC) { SpaceLogic *slogic = (SpaceLogic *)sl; @@ -6508,7 +6507,7 @@ static bool direct_link_screen(FileData *fd, bScreen *sc) } } - sa->actionzones.first = sa->actionzones.last = NULL; + BLI_listbase_clear(&sa->actionzones); sa->v1 = newdataadr(fd, sa->v1); sa->v2 = newdataadr(fd, sa->v2); @@ -6764,8 +6763,8 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip) clip->tracking.stabilization.rot_track = newdataadr(fd, clip->tracking.stabilization.rot_track); clip->tracking.dopesheet.ok = 0; - clip->tracking.dopesheet.channels.first = clip->tracking.dopesheet.channels.last = NULL; - clip->tracking.dopesheet.coverage_segments.first = clip->tracking.dopesheet.coverage_segments.last = NULL; + BLI_listbase_clear(&clip->tracking.dopesheet.channels); + BLI_listbase_clear(&clip->tracking.dopesheet.coverage_segments); link_list(fd, &tracking->objects); |