From 915cc956baff85d47387736ab367ab3774ee3353 Mon Sep 17 00:00:00 2001 From: Nathan Craddock Date: Fri, 7 Aug 2020 11:47:23 -0600 Subject: Cleanup: Rename soops to space_outliner No functional changes. Rename soops, soutliner, and so to space_outliner. --- source/blender/blenloader/intern/readfile.c | 41 ++++++++++++----------- source/blender/blenloader/intern/versioning_250.c | 4 +-- source/blender/blenloader/intern/versioning_260.c | 12 ++++--- source/blender/blenloader/intern/versioning_280.c | 41 ++++++++++++----------- source/blender/blenloader/intern/writefile.c | 18 +++++----- 5 files changed, 61 insertions(+), 55 deletions(-) (limited to 'source/blender/blenloader') diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index dc2eda7686b..f85e8d51778 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6964,31 +6964,31 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) BLO_read_data_address(reader, &snla->ads); } else if (sl->spacetype == SPACE_OUTLINER) { - SpaceOutliner *soops = (SpaceOutliner *)sl; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; /* use newdataadr_no_us and do not free old memory avoiding double * frees and use of freed memory. this could happen because of a * bug fixed in revision 58959 where the treestore memory address * was not unique */ - TreeStore *ts = newdataadr_no_us(reader->fd, soops->treestore); - soops->treestore = NULL; + TreeStore *ts = newdataadr_no_us(reader->fd, space_outliner->treestore); + space_outliner->treestore = NULL; if (ts) { TreeStoreElem *elems = newdataadr_no_us(reader->fd, ts->data); - soops->treestore = BLI_mempool_create( + space_outliner->treestore = BLI_mempool_create( sizeof(TreeStoreElem), ts->usedelem, 512, BLI_MEMPOOL_ALLOW_ITER); if (ts->usedelem && elems) { int i; for (i = 0; i < ts->usedelem; i++) { - TreeStoreElem *new_elem = BLI_mempool_alloc(soops->treestore); + TreeStoreElem *new_elem = BLI_mempool_alloc(space_outliner->treestore); *new_elem = elems[i]; } } /* we only saved what was used */ - soops->storeflag |= SO_TREESTORE_CLEANUP; // at first draw + space_outliner->storeflag |= SO_TREESTORE_CLEANUP; // at first draw } - soops->treehash = NULL; - soops->tree.first = soops->tree.last = NULL; + space_outliner->treehash = NULL; + space_outliner->tree.first = space_outliner->tree.last = NULL; } else if (sl->spacetype == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)sl; @@ -7215,20 +7215,20 @@ static void lib_link_area(BlendLibReader *reader, ID *parent_id, ScrArea *area) break; } case SPACE_OUTLINER: { - SpaceOutliner *so = (SpaceOutliner *)sl; - BLO_read_id_address(reader, NULL, &so->search_tse.id); + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; + BLO_read_id_address(reader, NULL, &space_outliner->search_tse.id); - if (so->treestore) { + if (space_outliner->treestore) { TreeStoreElem *tselem; BLI_mempool_iter iter; - BLI_mempool_iternew(so->treestore, &iter); + BLI_mempool_iternew(space_outliner->treestore, &iter); while ((tselem = BLI_mempool_iterstep(&iter))) { BLO_read_id_address(reader, NULL, &tselem->id); } - if (so->treehash) { + if (space_outliner->treehash) { /* rebuild hash table, because it depends on ids too */ - so->storeflag |= SO_TREESTORE_REBUILD; + space_outliner->storeflag |= SO_TREESTORE_REBUILD; } } break; @@ -7787,15 +7787,16 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, } } else if (sl->spacetype == SPACE_OUTLINER) { - SpaceOutliner *so = (SpaceOutliner *)sl; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; - so->search_tse.id = restore_pointer_by_name(id_map, so->search_tse.id, USER_IGNORE); + space_outliner->search_tse.id = restore_pointer_by_name( + id_map, space_outliner->search_tse.id, USER_IGNORE); - if (so->treestore) { + if (space_outliner->treestore) { TreeStoreElem *tselem; BLI_mempool_iter iter; - BLI_mempool_iternew(so->treestore, &iter); + BLI_mempool_iternew(space_outliner->treestore, &iter); while ((tselem = BLI_mempool_iterstep(&iter))) { /* Do not try to restore pointers to drivers/sequence/etc., * can crash in undo case! */ @@ -7806,9 +7807,9 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, tselem->id = NULL; } } - if (so->treehash) { + if (space_outliner->treehash) { /* rebuild hash table, because it depends on ids too */ - so->storeflag |= SO_TREESTORE_REBUILD; + space_outliner->storeflag |= SO_TREESTORE_REBUILD; } } } diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index bef37bdd960..0e753c84476 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -270,9 +270,9 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb) break; case SPACE_OUTLINER: { - SpaceOutliner *soops = (SpaceOutliner *)sl; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; - memcpy(®ion->v2d, &soops->v2d, sizeof(View2D)); + memcpy(®ion->v2d, &space_outliner->v2d, sizeof(View2D)); region->v2d.scroll &= ~V2D_SCROLL_LEFT; region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 3f24a7f14ca..1ac90398c0a 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -2349,10 +2349,14 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) for (area = screen->areabase.first; area; area = area->next) { for (sl = area->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_OUTLINER) { - SpaceOutliner *so = (SpaceOutliner *)sl; - - if (!ELEM(so->outlinevis, SO_SCENES, SO_LIBRARIES, SO_SEQUENCE, SO_DATA_API)) { - so->outlinevis = SO_SCENES; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; + + if (!ELEM(space_outliner->outlinevis, + SO_SCENES, + SO_LIBRARIES, + SO_SEQUENCE, + SO_DATA_API)) { + space_outliner->outlinevis = SO_SCENES; } } } diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 8bb04f8debf..4222df27cb7 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1282,20 +1282,20 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) { if (space->spacetype == SPACE_OUTLINER) { - SpaceOutliner *soutliner = (SpaceOutliner *)space; + SpaceOutliner *space_outliner = (SpaceOutliner *)space; - soutliner->outlinevis = SO_VIEW_LAYER; + space_outliner->outlinevis = SO_VIEW_LAYER; if (BLI_listbase_count_at_most(&layer->layer_collections, 2) == 1) { - if (soutliner->treestore == NULL) { - soutliner->treestore = BLI_mempool_create( + if (space_outliner->treestore == NULL) { + space_outliner->treestore = BLI_mempool_create( sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER); } /* Create a tree store element for the collection. This is normally * done in check_persistent (outliner_tree.c), but we need to access * it here :/ (expand element if it's the only one) */ - TreeStoreElem *tselem = BLI_mempool_calloc(soutliner->treestore); + TreeStoreElem *tselem = BLI_mempool_calloc(space_outliner->treestore); tselem->type = TSE_LAYER_COLLECTION; tselem->id = layer->layer_collections.first; tselem->nr = tselem->used = 0; @@ -2025,15 +2025,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) for (area = screen->areabase.first; area; area = area->next) { for (sl = area->spacedata.first; sl; sl = sl->next) { if (sl->spacetype == SPACE_OUTLINER) { - SpaceOutliner *so = (SpaceOutliner *)sl; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; - if (!ELEM(so->outlinevis, + if (!ELEM(space_outliner->outlinevis, SO_SCENES, SO_LIBRARIES, SO_SEQUENCE, SO_DATA_API, SO_ID_ORPHANS)) { - so->outlinevis = SO_VIEW_LAYER; + space_outliner->outlinevis = SO_VIEW_LAYER; } } } @@ -2413,9 +2413,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { if (sl->spacetype == SPACE_OUTLINER) { - SpaceOutliner *soops = (SpaceOutliner *)sl; - soops->filter_id_type = ID_GR; - soops->outlinevis = SO_VIEW_LAYER; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; + space_outliner->filter_id_type = ID_GR; + space_outliner->outlinevis = SO_VIEW_LAYER; } } } @@ -3412,9 +3412,10 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) break; } case SPACE_OUTLINER: { - SpaceOutliner *so = (SpaceOutliner *)sl; - so->filter &= ~(SO_FILTER_UNUSED_1 | SO_FILTER_UNUSED_5 | SO_FILTER_UNUSED_12); - so->storeflag &= ~(SO_TREESTORE_UNUSED_1); + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; + space_outliner->filter &= ~(SO_FILTER_UNUSED_1 | SO_FILTER_UNUSED_5 | + SO_FILTER_UNUSED_12); + space_outliner->storeflag &= ~(SO_TREESTORE_UNUSED_1); break; } case SPACE_FILE: { @@ -4028,9 +4029,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) if (sl->spacetype != SPACE_OUTLINER) { continue; } - SpaceOutliner *so = (SpaceOutliner *)sl; - so->filter &= ~SO_FLAG_UNUSED_1; - so->show_restrict_flags = SO_RESTRICT_ENABLE | SO_RESTRICT_HIDE; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; + space_outliner->filter &= ~SO_FLAG_UNUSED_1; + space_outliner->show_restrict_flags = SO_RESTRICT_ENABLE | SO_RESTRICT_HIDE; } } } @@ -4162,9 +4163,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } /* Mark outliners as dirty for syncing and enable synced selection */ if (sl->spacetype == SPACE_OUTLINER) { - SpaceOutliner *soutliner = (SpaceOutliner *)sl; - soutliner->sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL; - soutliner->flag |= SO_SYNC_SELECT; + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; + space_outliner->sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL; + space_outliner->flag |= SO_SYNC_SELECT; } } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index a393b4e07b7..755fb73572d 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2838,12 +2838,12 @@ static void write_uilist(BlendWriter *writer, uiList *ui_list) } } -static void write_soops(BlendWriter *writer, SpaceOutliner *so) +static void write_space_outliner(BlendWriter *writer, SpaceOutliner *space_outliner) { - BLI_mempool *ts = so->treestore; + BLI_mempool *ts = space_outliner->treestore; if (ts) { - SpaceOutliner so_flat = *so; + SpaceOutliner space_outliner_flat = *space_outliner; int elems = BLI_mempool_len(ts); /* linearize mempool to array */ @@ -2864,7 +2864,7 @@ static void write_soops(BlendWriter *writer, SpaceOutliner *so) ts_flat.totelem = elems; ts_flat.data = data_addr; - BLO_write_struct(writer, SpaceOutliner, so); + BLO_write_struct(writer, SpaceOutliner, space_outliner); BLO_write_struct_at_address(writer, TreeStore, ts, &ts_flat); BLO_write_struct_array_at_address(writer, TreeStoreElem, elems, data_addr, data); @@ -2872,12 +2872,12 @@ static void write_soops(BlendWriter *writer, SpaceOutliner *so) MEM_freeN(data); } else { - so_flat.treestore = NULL; - BLO_write_struct_at_address(writer, SpaceOutliner, so, &so_flat); + space_outliner_flat.treestore = NULL; + BLO_write_struct_at_address(writer, SpaceOutliner, space_outliner, &space_outliner_flat); } } else { - BLO_write_struct(writer, SpaceOutliner, so); + BLO_write_struct(writer, SpaceOutliner, space_outliner); } } @@ -2953,8 +2953,8 @@ static void write_area_regions(BlendWriter *writer, ScrArea *area) BLO_write_struct(writer, SpaceSeq, sl); } else if (sl->spacetype == SPACE_OUTLINER) { - SpaceOutliner *so = (SpaceOutliner *)sl; - write_soops(writer, so); + SpaceOutliner *space_outliner = (SpaceOutliner *)sl; + write_space_outliner(writer, space_outliner); } else if (sl->spacetype == SPACE_IMAGE) { BLO_write_struct(writer, SpaceImage, sl); -- cgit v1.2.3