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:
-rw-r--r--source/blender/blenkernel/intern/screen.c8
-rw-r--r--source/blender/blenloader/intern/readfile.c41
-rw-r--r--source/blender/blenloader/intern/versioning_250.c4
-rw-r--r--source/blender/blenloader/intern/versioning_260.c12
-rw-r--r--source/blender/blenloader/intern/versioning_280.c41
-rw-r--r--source/blender/blenloader/intern/writefile.c18
-rw-r--r--source/blender/editors/include/ED_outliner.h3
-rw-r--r--source/blender/editors/space_outliner/outliner_collections.c159
-rw-r--r--source/blender/editors/space_outliner/outliner_dragdrop.c76
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c234
-rw-r--r--source/blender/editors/space_outliner/outliner_edit.c219
-rw-r--r--source/blender/editors/space_outliner/outliner_intern.h35
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c141
-rw-r--r--source/blender/editors/space_outliner/outliner_sync.c62
-rw-r--r--source/blender/editors/space_outliner/outliner_tools.c331
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c555
-rw-r--r--source/blender/editors/space_outliner/outliner_utils.c45
-rw-r--r--source/blender/editors/space_outliner/space_outliner.c70
18 files changed, 1162 insertions, 892 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index c510b3a2dfb..3a49c180172 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -159,15 +159,15 @@ void BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area
break;
}
case SPACE_OUTLINER: {
- SpaceOutliner *so = (SpaceOutliner *)sl;
+ SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
- BKE_LIB_FOREACHID_PROCESS_ID(data, so->search_tse.id, IDWALK_CB_NOP);
+ BKE_LIB_FOREACHID_PROCESS_ID(data, space_outliner->search_tse.id, IDWALK_CB_NOP);
- if (so->treestore != NULL) {
+ if (space_outliner->treestore != NULL) {
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))) {
BKE_LIB_FOREACHID_PROCESS_ID(data, tselem->id, IDWALK_CB_NOP);
}
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(&region->v2d, &soops->v2d, sizeof(View2D));
+ memcpy(&region->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);
diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h
index 9853b4644c1..1d1471f0be6 100644
--- a/source/blender/editors/include/ED_outliner.h
+++ b/source/blender/editors/include/ED_outliner.h
@@ -45,7 +45,8 @@ void ED_outliner_select_sync_from_all_tag(struct bContext *C);
bool ED_outliner_select_sync_is_dirty(const struct bContext *C);
-void ED_outliner_select_sync_from_outliner(struct bContext *C, struct SpaceOutliner *soops);
+void ED_outliner_select_sync_from_outliner(struct bContext *C,
+ struct SpaceOutliner *space_outliner);
void ED_outliner_select_sync_flag_outliners(const struct bContext *C);
diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c
index 0964e0c753e..efb91528e14 100644
--- a/source/blender/editors/space_outliner/outliner_collections.c
+++ b/source/blender/editors/space_outliner/outliner_collections.c
@@ -142,10 +142,14 @@ TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *custom
*/
void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct IDsSelectedData data = {{NULL}};
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, outliner_find_selected_objects, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ outliner_find_selected_objects,
+ &data);
LISTBASE_FOREACH (LinkData *, link, &data.selected_array) {
TreeElement *ten_selected = (TreeElement *)link->data;
Object *ob = (Object *)TREESTORE(ten_selected)->id;
@@ -162,14 +166,15 @@ void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
bool ED_outliner_collections_editor_poll(bContext *C)
{
- SpaceOutliner *so = CTX_wm_space_outliner(C);
- return (so != NULL) && ELEM(so->outlinevis, SO_VIEW_LAYER, SO_SCENES, SO_LIBRARIES);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ return (space_outliner != NULL) &&
+ ELEM(space_outliner->outlinevis, SO_VIEW_LAYER, SO_SCENES, SO_LIBRARIES);
}
static bool outliner_view_layer_collections_editor_poll(bContext *C)
{
- SpaceOutliner *so = CTX_wm_space_outliner(C);
- return (so != NULL) && (so->outlinevis == SO_VIEW_LAYER);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ return (space_outliner != NULL) && (space_outliner->outlinevis == SO_VIEW_LAYER);
}
/** \} */
@@ -203,7 +208,7 @@ static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void
static int collection_new_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -215,10 +220,14 @@ static int collection_new_exec(bContext *C, wmOperator *op)
};
if (RNA_boolean_get(op->ptr, "nested")) {
- outliner_build_tree(bmain, scene, view_layer, soops, region);
+ outliner_build_tree(bmain, scene, view_layer, space_outliner, region);
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, collection_find_selected_to_add, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ collection_find_selected_to_add,
+ &data);
if (data.error) {
BKE_report(op->reports, RPT_ERROR, "More than one collection is selected");
@@ -240,7 +249,7 @@ static int collection_new_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&data.collection->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
- outliner_cleanup_tree(soops);
+ outliner_cleanup_tree(space_outliner);
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
return OPERATOR_FINISHED;
}
@@ -273,7 +282,7 @@ void OUTLINER_OT_collection_new(wmOperatorType *ot)
struct CollectionEditData {
Scene *scene;
- SpaceOutliner *soops;
+ SpaceOutliner *space_outliner;
GSet *collections_to_edit;
};
@@ -303,11 +312,11 @@ static TreeTraversalAction collection_find_data_to_edit(TreeElement *te, void *c
void outliner_collection_delete(
bContext *C, Main *bmain, Scene *scene, ReportList *reports, bool hierarchy)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -315,7 +324,7 @@ void outliner_collection_delete(
/* We first walk over and find the Collections we actually want to delete
* (ignoring duplicates). */
outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
+ space_outliner, &space_outliner->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
/* Effectively delete the collections. */
GSetIterator collections_to_edit_iter;
@@ -436,14 +445,18 @@ static TreeTraversalAction outliner_find_first_selected_layer_collection(TreeEle
static LayerCollection *outliner_active_layer_collection(bContext *C)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct CollectionObjectsSelectData data = {
.layer_collection = NULL,
};
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, outliner_find_first_selected_layer_collection, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ outliner_find_first_selected_layer_collection,
+ &data);
return data.layer_collection;
}
@@ -527,14 +540,18 @@ static TreeTraversalAction outliner_find_first_selected_collection(TreeElement *
static TreeElement *outliner_active_collection(bContext *C)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct CollectionDuplicateData data = {
.te = NULL,
};
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, outliner_find_first_selected_collection, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ outliner_find_first_selected_collection,
+ &data);
return data.te;
}
@@ -635,10 +652,10 @@ static int collection_link_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
Collection *active_collection = CTX_data_layer_collection(C)->collection;
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
if (ID_IS_LINKED(active_collection) ||
@@ -651,7 +668,7 @@ static int collection_link_exec(bContext *C, wmOperator *op)
/* We first walk over and find the Collections we actually want to link (ignoring duplicates). */
outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
+ space_outliner, &space_outliner->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
/* Effectively link the collections. */
GSetIterator collections_to_edit_iter;
@@ -697,10 +714,10 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
@@ -708,7 +725,7 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
/* We first walk over and find the Collections we actually want to instance
* (ignoring duplicates). */
outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
+ space_outliner, &space_outliner->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
/* Find an active collection to add to, that doesn't give dependency cycles. */
LayerCollection *active_lc = BKE_layer_collection_get_active(view_layer);
@@ -790,21 +807,25 @@ static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, v
static bool collections_view_layer_poll(bContext *C, bool clear, int flag)
{
/* Poll function so the right click menu show current state of selected collections. */
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
- if (!(soops && soops->outlinevis == SO_VIEW_LAYER)) {
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ if (!(space_outliner && space_outliner->outlinevis == SO_VIEW_LAYER)) {
return false;
}
Scene *scene = CTX_data_scene(C);
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
bool result = false;
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ layer_collection_find_data_to_edit,
+ &data);
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
@@ -857,10 +878,10 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
bool clear = strstr(op->idname, "clear") != NULL;
int flag = strstr(op->idname, "holdout") ?
@@ -870,8 +891,12 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
data.collections_to_edit = BLI_gset_ptr_new(__func__);
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ layer_collection_find_data_to_edit,
+ &data);
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
@@ -991,15 +1016,19 @@ static int collection_isolate_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const bool extend = RNA_boolean_get(op->ptr, "extend");
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ layer_collection_find_data_to_edit,
+ &data);
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
@@ -1083,17 +1112,21 @@ static int collection_visibility_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const bool is_inside = strstr(op->idname, "inside") != NULL;
const bool show = strstr(op->idname, "show") != NULL;
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ layer_collection_find_data_to_edit,
+ &data);
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
@@ -1225,20 +1258,24 @@ static int collection_flag_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const bool is_render = strstr(op->idname, "render");
const bool clear = strstr(op->idname, "show") || strstr(op->idname, "enable");
int flag = is_render ? COLLECTION_RESTRICT_RENDER : COLLECTION_RESTRICT_VIEWPORT;
struct CollectionEditData data = {
.scene = scene,
- .soops = soops,
+ .space_outliner = space_outliner,
};
data.collections_to_edit = BLI_gset_ptr_new(__func__);
- const bool has_layer_collection = soops->outlinevis == SO_VIEW_LAYER;
+ const bool has_layer_collection = space_outliner->outlinevis == SO_VIEW_LAYER;
if (has_layer_collection) {
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, layer_collection_find_data_to_edit, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ layer_collection_find_data_to_edit,
+ &data);
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
LayerCollection *layer_collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
@@ -1261,8 +1298,12 @@ static int collection_flag_exec(bContext *C, wmOperator *op)
BLI_gset_free(data.collections_to_edit, NULL);
}
else {
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, collection_find_data_to_edit, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ collection_find_data_to_edit,
+ &data);
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
Collection *collection = BLI_gsetIterator_getKey(&collections_to_edit_iter);
@@ -1351,7 +1392,7 @@ void OUTLINER_OT_collection_disable_render(wmOperatorType *ot)
struct OutlinerHideEditData {
Scene *scene;
ViewLayer *view_layer;
- SpaceOutliner *soops;
+ SpaceOutliner *space_outliner;
GSet *collections_to_edit;
GSet *bases_to_edit;
};
@@ -1397,17 +1438,21 @@ static int outliner_hide_exec(bContext *C, wmOperator *UNUSED(op))
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct OutlinerHideEditData data = {
.scene = scene,
.view_layer = view_layer,
- .soops = soops,
+ .space_outliner = space_outliner,
};
data.collections_to_edit = BLI_gset_ptr_new("outliner_hide_exec__collections_to_edit");
data.bases_to_edit = BLI_gset_ptr_new("outliner_hide_exec__bases_to_edit");
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, outliner_hide_find_data_to_edit, &data);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ outliner_hide_find_data_to_edit,
+ &data);
GSetIterator collections_to_edit_iter;
GSET_ITER (collections_to_edit_iter, data.collections_to_edit) {
diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.c b/source/blender/editors/space_outliner/outliner_dragdrop.c
index 5baaef958fa..94052223e39 100644
--- a/source/blender/editors/space_outliner/outliner_dragdrop.c
+++ b/source/blender/editors/space_outliner/outliner_dragdrop.c
@@ -90,13 +90,13 @@ static TreeElement *outliner_dropzone_element(TreeElement *te,
}
/* Find tree element to drop into. */
-static TreeElement *outliner_dropzone_find(const SpaceOutliner *soops,
+static TreeElement *outliner_dropzone_find(const SpaceOutliner *space_outliner,
const float fmval[2],
const bool children)
{
TreeElement *te;
- for (te = soops->tree.first; te; te = te->next) {
+ for (te = space_outliner->tree.first; te; te = te->next) {
TreeElement *te_valid = outliner_dropzone_element(te, fmval, children);
if (te_valid) {
return te_valid;
@@ -108,11 +108,11 @@ static TreeElement *outliner_dropzone_find(const SpaceOutliner *soops,
static TreeElement *outliner_drop_find(bContext *C, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
float fmval[2];
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- return outliner_dropzone_find(soops, fmval, true);
+ return outliner_dropzone_find(space_outliner, fmval, true);
}
static ID *outliner_ID_drop_find(bContext *C, const wmEvent *event, short idcode)
@@ -131,14 +131,14 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
const wmEvent *event,
TreeElementInsertType *r_insert_type)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
TreeElement *te_hovered;
float view_mval[2];
UI_view2d_region_to_view(
&region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
- te_hovered = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
+ te_hovered = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]);
if (te_hovered) {
/* Mouse hovers an element (ignoring x-axis),
@@ -146,7 +146,7 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
const float margin = UI_UNIT_Y * (1.0f / 4);
if (view_mval[1] < (te_hovered->ys + margin)) {
- if (TSELEM_OPEN(TREESTORE(te_hovered), soops)) {
+ if (TSELEM_OPEN(TREESTORE(te_hovered), space_outliner)) {
/* inserting after a open item means we insert into it, but as first child */
if (BLI_listbase_is_empty(&te_hovered->subtree)) {
*r_insert_type = TE_INSERT_INTO;
@@ -168,8 +168,8 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
/* Mouse doesn't hover any item (ignoring x-axis),
* so it's either above list bounds or below. */
- TreeElement *first = soops->tree.first;
- TreeElement *last = soops->tree.last;
+ TreeElement *first = space_outliner->tree.first;
+ TreeElement *last = space_outliner->tree.last;
if (view_mval[1] < last->ys) {
*r_insert_type = TE_INSERT_AFTER;
@@ -262,11 +262,11 @@ static bool parent_drop_allowed(TreeElement *te, Object *potential_child)
return true;
}
-static bool allow_parenting_without_modifier_key(SpaceOutliner *soops)
+static bool allow_parenting_without_modifier_key(SpaceOutliner *space_outliner)
{
- switch (soops->outlinevis) {
+ switch (space_outliner->outlinevis) {
case SO_VIEW_LAYER:
- return soops->filter & SO_FILTER_NO_COLLECTION;
+ return space_outliner->filter & SO_FILTER_NO_COLLECTION;
case SO_SCENES:
return true;
default:
@@ -279,9 +279,9 @@ static bool parent_drop_poll(bContext *C,
const wmEvent *event,
const char **UNUSED(r_tooltip))
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
- bool changed = outliner_flag_set(&soops->tree, TSE_DRAG_ANY, false);
+ bool changed = outliner_flag_set(&space_outliner->tree, TSE_DRAG_ANY, false);
if (changed) {
ED_region_tag_redraw_no_rebuild(CTX_wm_region(C));
}
@@ -291,7 +291,7 @@ static bool parent_drop_poll(bContext *C,
return false;
}
- if (!allow_parenting_without_modifier_key(soops)) {
+ if (!allow_parenting_without_modifier_key(space_outliner)) {
if (!event->shift) {
return false;
}
@@ -319,9 +319,9 @@ static void parent_drop_set_parents(bContext *C,
const bool keep_transform)
{
Main *bmain = CTX_data_main(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
- TreeElement *te = outliner_find_id(soops, &soops->tree, &parent->id);
+ TreeElement *te = outliner_find_id(space_outliner, &space_outliner->tree, &parent->id);
Scene *scene = (Scene *)outliner_search_back(te, ID_SCE);
if (scene == NULL) {
@@ -418,9 +418,9 @@ static bool parent_clear_poll(bContext *C,
const wmEvent *event,
const char **UNUSED(r_tooltip))
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
- if (!allow_parenting_without_modifier_key(soops)) {
+ if (!allow_parenting_without_modifier_key(space_outliner)) {
if (!event->shift) {
return false;
}
@@ -649,7 +649,7 @@ static bool collection_drop_init(bContext *C,
const wmEvent *event,
CollectionDrop *data)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
/* Get collection to drop into. */
TreeElementInsertType insert_type;
@@ -685,7 +685,7 @@ static bool collection_drop_init(bContext *C,
/* Get collection to drag out of. */
ID *parent = drag_id->from_parent;
Collection *from_collection = collection_parent_from_ID(parent);
- if (event->ctrl || soops->outlinevis == SO_SCENES) {
+ if (event->ctrl || space_outliner->outlinevis == SO_SCENES) {
from_collection = NULL;
}
@@ -712,9 +712,9 @@ static bool collection_drop_poll(bContext *C,
const wmEvent *event,
const char **r_tooltip)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
- bool changed = outliner_flag_set(&soops->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
+ bool changed = outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
CollectionDrop data;
if (!event->shift && collection_drop_init(C, drag, event, &data)) {
@@ -787,12 +787,12 @@ static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
bool relative_after = false;
if (ELEM(data.insert_type, TE_INSERT_BEFORE, TE_INSERT_AFTER)) {
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
relative = data.to;
relative_after = (data.insert_type == TE_INSERT_AFTER);
- TreeElement *parent_te = outliner_find_parent_element(&soops->tree, NULL, data.te);
+ TreeElement *parent_te = outliner_find_parent_element(&space_outliner->tree, NULL, data.te);
data.to = (parent_te) ? outliner_collection_from_tree_element(parent_te) : NULL;
}
@@ -860,14 +860,14 @@ void OUTLINER_OT_collection_drop(wmOperatorType *ot)
#define OUTLINER_DRAG_SCOLL_OUTSIDE_PAD 7 /* In UI units */
-static TreeElement *outliner_item_drag_element_find(SpaceOutliner *soops,
+static TreeElement *outliner_item_drag_element_find(SpaceOutliner *space_outliner,
ARegion *region,
const wmEvent *event)
{
/* note: using EVT_TWEAK_ events to trigger dragging is fine,
* it sends coordinates from where dragging was started */
const float my = UI_view2d_region_to_view_y(&region->v2d, event->mval[1]);
- return outliner_find_item_at_y(soops, &soops->tree, my);
+ return outliner_find_item_at_y(space_outliner, &space_outliner->tree, my);
}
static int outliner_item_drag_drop_invoke(bContext *C,
@@ -875,8 +875,8 @@ static int outliner_item_drag_drop_invoke(bContext *C,
const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
- TreeElement *te = outliner_item_drag_element_find(soops, region, event);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ TreeElement *te = outliner_item_drag_element_find(space_outliner, region, event);
if (!te) {
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
@@ -912,7 +912,7 @@ static int outliner_item_drag_drop_invoke(bContext *C,
/* Only drag element under mouse if it was not selected before. */
if ((TREESTORE(te)->flag & TSE_SELECTED) == 0) {
- outliner_flag_set(&soops->tree, TSE_SELECTED, 0);
+ outliner_flag_set(&space_outliner->tree, TSE_SELECTED, 0);
TREESTORE(te)->flag |= TSE_SELECTED;
}
@@ -922,12 +922,20 @@ static int outliner_item_drag_drop_invoke(bContext *C,
};
if (GS(data.drag_id->name) == ID_OB) {
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, outliner_find_selected_objects, &selected);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ outliner_find_selected_objects,
+ &selected);
}
else {
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, outliner_find_selected_collections, &selected);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ outliner_find_selected_collections,
+ &selected);
}
LISTBASE_FOREACH (LinkData *, link, &selected.selected_array) {
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 4271eaded99..28e233b6dd2 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -86,7 +86,7 @@
/* ****************************************************** */
/* Tree Size Functions */
-static void outliner_tree_dimensions_impl(SpaceOutliner *soops,
+static void outliner_tree_dimensions_impl(SpaceOutliner *space_outliner,
ListBase *lb,
int *width,
int *height)
@@ -98,20 +98,20 @@ static void outliner_tree_dimensions_impl(SpaceOutliner *soops,
}
TreeStoreElem *tselem = TREESTORE(te);
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_tree_dimensions_impl(soops, &te->subtree, width, height);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_tree_dimensions_impl(space_outliner, &te->subtree, width, height);
}
else {
- outliner_tree_dimensions_impl(soops, &te->subtree, width, NULL);
+ outliner_tree_dimensions_impl(space_outliner, &te->subtree, width, NULL);
}
}
}
-static void outliner_tree_dimensions(SpaceOutliner *soops, int *r_width, int *r_height)
+static void outliner_tree_dimensions(SpaceOutliner *space_outliner, int *r_width, int *r_height)
{
*r_width = 0;
*r_height = 0;
- outliner_tree_dimensions_impl(soops, &soops->tree, r_width, r_height);
+ outliner_tree_dimensions_impl(space_outliner, &space_outliner->tree, r_width, r_height);
}
/**
@@ -667,13 +667,13 @@ static void scenes__collection_set_flag_recursive_fn(bContext *C, void *poin, vo
static void namebutton_fn(bContext *C, void *tsep, char *oldname)
{
Main *bmain = CTX_data_main(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
Object *obedit = CTX_data_edit_object(C);
- BLI_mempool *ts = soops->treestore;
+ BLI_mempool *ts = space_outliner->treestore;
TreeStoreElem *tselem = tsep;
if (ts && tselem) {
- TreeElement *te = outliner_find_tree_element(&soops->tree, tselem);
+ TreeElement *te = outliner_find_tree_element(&space_outliner->tree, tselem);
if (tselem->type == 0) {
BLI_libblock_ensure_unique_name(bmain, tselem->id->name);
@@ -760,7 +760,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
char newname[sizeof(bone->name)];
/* always make current object active */
- tree_element_active(C, &tvc, soops, te, OL_SETSEL_NORMAL, true);
+ tree_element_active(C, &tvc, space_outliner, te, OL_SETSEL_NORMAL, true);
/* restore bone name */
BLI_strncpy(newname, bone->name, sizeof(bone->name));
@@ -778,7 +778,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
char newname[sizeof(pchan->name)];
/* always make current pose-bone active */
- tree_element_active(C, &tvc, soops, te, OL_SETSEL_NORMAL, true);
+ tree_element_active(C, &tvc, space_outliner, te, OL_SETSEL_NORMAL, true);
BLI_assert(ob->type == OB_ARMATURE);
@@ -980,7 +980,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
Scene *scene,
ViewLayer *view_layer,
ARegion *region,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
RestrictPropertiesActive props_active_parent)
{
@@ -1022,28 +1022,28 @@ static void outliner_draw_restrictbuts(uiBlock *block,
int restrict_column_offset = 0;
/* This will determine the order of drawing from RIGHT to LEFT. */
- if (soops->outlinevis == SO_VIEW_LAYER) {
- if (soops->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) {
+ if (space_outliner->outlinevis == SO_VIEW_LAYER) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) {
restrict_offsets.indirect_only = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
}
- if (soops->show_restrict_flags & SO_RESTRICT_HOLDOUT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HOLDOUT) {
restrict_offsets.holdout = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
restrict_offsets.render = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
}
- if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
restrict_offsets.viewport = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
}
- if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) {
restrict_offsets.hide = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
}
- if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) {
restrict_offsets.select = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
}
BLI_assert((restrict_column_offset * UI_UNIT_X + V2D_SCROLL_WIDTH) ==
- outliner_restrict_columns_width(soops));
+ outliner_restrict_columns_width(space_outliner));
/* Create buttons. */
uiBut *bt;
@@ -1053,8 +1053,8 @@ static void outliner_draw_restrictbuts(uiBlock *block,
RestrictPropertiesActive props_active = props_active_parent;
if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) {
- if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) {
- if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
+ if (tselem->type == TSE_R_LAYER && (space_outliner->outlinevis == SO_SCENES)) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
/* View layer render toggle. */
ViewLayer *layer = te->directdata;
@@ -1087,7 +1087,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
Object *ob = (Object *)tselem->id;
RNA_id_pointer_create(&ob->id, &ptr);
- if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) {
Base *base = (te->directdata) ? (Base *)te->directdata :
BKE_view_layer_base_find(view_layer, ob);
if (base) {
@@ -1119,7 +1119,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1144,7 +1144,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1169,7 +1169,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1200,7 +1200,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
PointerRNA ptr;
RNA_pointer_create(tselem->id, &RNA_Constraint, con, &ptr);
- if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1229,7 +1229,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
PointerRNA ptr;
RNA_pointer_create(tselem->id, &RNA_Modifier, md, &ptr);
- if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1252,7 +1252,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1284,7 +1284,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
RNA_pointer_create(&arm->id, &RNA_Bone, bone, &ptr);
- if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1306,7 +1306,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
- if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) {
bt = uiDefIconButBitI(block,
UI_BTYPE_ICON_TOGGLE,
BONE_UNSELECTABLE,
@@ -1330,7 +1330,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
else if (tselem->type == TSE_EBONE) {
EditBone *ebone = (EditBone *)te->directdata;
- if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
bt = uiDefIconButBitI(block,
UI_BTYPE_ICON_TOGGLE,
BONE_HIDDEN_A,
@@ -1351,7 +1351,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
- if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) {
bt = uiDefIconButBitI(block,
UI_BTYPE_ICON_TOGGLE,
BONE_UNSELECTABLE,
@@ -1376,7 +1376,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
ID *id = tselem->id;
bGPDlayer *gpl = (bGPDlayer *)te->directdata;
- if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) {
bt = uiDefIconButBitS(block,
UI_BTYPE_ICON_TOGGLE,
GP_LAYER_HIDE,
@@ -1397,7 +1397,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
- if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) {
bt = uiDefIconButBitS(block,
UI_BTYPE_ICON_TOGGLE,
GP_LAYER_LOCKED,
@@ -1430,7 +1430,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
Collection *collection = outliner_collection_from_tree_element(te);
if (layer_collection != NULL) {
- if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1459,7 +1459,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_HOLDOUT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HOLDOUT) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1488,7 +1488,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) {
bt = uiDefIconButR_prop(
block,
UI_BTYPE_ICON_TOGGLE,
@@ -1521,7 +1521,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1558,7 +1558,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1593,7 +1593,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
}
- if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
0,
@@ -1637,16 +1637,16 @@ static void outliner_draw_restrictbuts(uiBlock *block,
scene, te, &collection_ptr, &layer_collection_ptr, &props, &props_active);
}
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
outliner_draw_restrictbuts(
- block, scene, view_layer, region, soops, &te->subtree, props_active);
+ block, scene, view_layer, region, space_outliner, &te->subtree, props_active);
}
}
}
static void outliner_draw_userbuts(uiBlock *block,
ARegion *region,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb)
{
@@ -1707,8 +1707,8 @@ static void outliner_draw_userbuts(uiBlock *block,
}
}
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_userbuts(block, region, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_draw_userbuts(block, region, space_outliner, &te->subtree);
}
}
}
@@ -1742,7 +1742,7 @@ static void outliner_draw_rnacols(ARegion *region, int sizex)
}
static void outliner_draw_rnabuts(
- uiBlock *block, ARegion *region, SpaceOutliner *soops, int sizex, ListBase *lb)
+ uiBlock *block, ARegion *region, SpaceOutliner *space_outliner, int sizex, ListBase *lb)
{
PointerRNA *ptr;
PropertyRNA *prop;
@@ -1754,7 +1754,7 @@ static void outliner_draw_rnabuts(
ptr = &te->rnaptr;
prop = te->directdata;
- if (!TSELEM_OPEN(tselem, soops)) {
+ if (!TSELEM_OPEN(tselem, space_outliner)) {
if (RNA_property_type(prop) == PROP_POINTER) {
uiBut *but = uiDefAutoButR(block,
ptr,
@@ -1811,8 +1811,8 @@ static void outliner_draw_rnabuts(
}
}
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_rnabuts(block, region, soops, sizex, &te->subtree);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_draw_rnabuts(block, region, space_outliner, sizex, &te->subtree);
}
}
}
@@ -1823,7 +1823,7 @@ static void outliner_buttons(const bContext *C,
const float restrict_column_width,
TreeElement *te)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
uiBut *bt;
TreeStoreElem *tselem;
int spx, dx, len;
@@ -1850,7 +1850,7 @@ static void outliner_buttons(const bContext *C,
spx = te->xs + 1.8f * UI_UNIT_X;
if ((tselem->type == TSE_LAYER_COLLECTION) &&
- (soops->show_restrict_flags & SO_RESTRICT_ENABLE)) {
+ (space_outliner->show_restrict_flags & SO_RESTRICT_ENABLE)) {
spx += UI_UNIT_X;
}
dx = region->v2d.cur.xmax - (spx + restrict_column_width + 0.2f * UI_UNIT_X);
@@ -2833,7 +2833,7 @@ static void outliner_draw_iconrow(bContext *C,
uiBlock *block,
const uiFontStyle *fstyle,
const TreeViewContext *tvc,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
int level,
int xmax,
@@ -2858,7 +2858,7 @@ static void outliner_draw_iconrow(bContext *C,
active = OL_DRAWSEL_ACTIVE;
}
else {
- active = tree_element_active(C, tvc, soops, te, OL_SETSEL_NONE, false);
+ active = tree_element_active(C, tvc, space_outliner, te, OL_SETSEL_NONE, false);
}
}
else if (tselem->type == TSE_GP_LAYER) {
@@ -2866,7 +2866,8 @@ static void outliner_draw_iconrow(bContext *C,
active = (gpl->flag & GP_LAYER_ACTIVE) ? OL_DRAWSEL_ACTIVE : OL_DRAWSEL_NONE;
}
else {
- active = tree_element_type_active(C, tvc, soops, te, tselem, OL_SETSEL_NONE, false);
+ active = tree_element_type_active(
+ C, tvc, space_outliner, te, tselem, OL_SETSEL_NONE, false);
}
if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER, TSE_GP_LAYER)) {
@@ -2888,7 +2889,7 @@ static void outliner_draw_iconrow(bContext *C,
block,
fstyle,
tvc,
- soops,
+ space_outliner,
&te->subtree,
level + 1,
xmax,
@@ -2947,7 +2948,7 @@ static void outliner_draw_tree_element(bContext *C,
const uiFontStyle *fstyle,
const TreeViewContext *tvc,
ARegion *region,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
TreeElement *te,
bool draw_grayed_out,
int startx,
@@ -3021,7 +3022,7 @@ static void outliner_draw_tree_element(bContext *C,
active = OL_DRAWSEL_ACTIVE;
}
else {
- if (tree_element_active(C, tvc, soops, te, OL_SETSEL_NONE, false)) {
+ if (tree_element_active(C, tvc, space_outliner, te, OL_SETSEL_NONE, false)) {
/* active items like camera or material */
icon_bgcolor[3] = 0.2f;
active = OL_DRAWSEL_ACTIVE;
@@ -3036,14 +3037,14 @@ static void outliner_draw_tree_element(bContext *C,
}
}
else {
- active = tree_element_type_active(C, tvc, soops, te, tselem, OL_SETSEL_NONE, false);
+ active = tree_element_type_active(C, tvc, space_outliner, te, tselem, OL_SETSEL_NONE, false);
/* active collection*/
icon_bgcolor[3] = 0.2f;
}
/* Checkbox to enable collections. */
if ((tselem->type == TSE_LAYER_COLLECTION) &&
- (soops->show_restrict_flags & SO_RESTRICT_ENABLE)) {
+ (space_outliner->show_restrict_flags & SO_RESTRICT_ENABLE)) {
tselem_draw_layer_collection_enable_icon(
tvc->scene, block, xmax, (float)startx + offsx + UI_UNIT_X, (float)*starty, te, 0.8f);
offsx += UI_UNIT_X;
@@ -3081,7 +3082,7 @@ static void outliner_draw_tree_element(bContext *C,
int icon_x = startx;
/* Icons a bit higher. */
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
UI_icon_draw_alpha((float)icon_x + 2 * ufac,
(float)*starty + 1 * ufac,
ICON_DISCLOSURE_TRI_DOWN,
@@ -3130,7 +3131,7 @@ static void outliner_draw_tree_element(bContext *C,
offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name));
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
- if (!TSELEM_OPEN(tselem, soops)) {
+ if (!TSELEM_OPEN(tselem, space_outliner)) {
if (te->subtree.first) {
if (tselem->type == 0 && te->idcode == ID_SCE) {
/* pass */
@@ -3146,7 +3147,7 @@ static void outliner_draw_tree_element(bContext *C,
block,
fstyle,
tvc,
- soops,
+ space_outliner,
&te->subtree,
0,
xmax,
@@ -3165,7 +3166,7 @@ static void outliner_draw_tree_element(bContext *C,
te->ys = *starty;
te->xend = startx + offsx;
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
*starty -= UI_UNIT_Y;
LISTBASE_FOREACH (TreeElement *, ten, &te->subtree) {
@@ -3177,7 +3178,7 @@ static void outliner_draw_tree_element(bContext *C,
fstyle,
tvc,
region,
- soops,
+ space_outliner,
ten,
draw_children_grayed_out,
startx + UI_UNIT_X,
@@ -3196,7 +3197,7 @@ static void outliner_draw_tree_element(bContext *C,
}
static void outliner_draw_hierarchy_lines_recursive(uint pos,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
int startx,
const uchar col[4],
@@ -3264,9 +3265,14 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
*starty -= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_hierarchy_lines_recursive(
- pos, soops, &te->subtree, startx + UI_UNIT_X, col, draw_children_grayed_out, starty);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_draw_hierarchy_lines_recursive(pos,
+ space_outliner,
+ &te->subtree,
+ startx + UI_UNIT_X,
+ col,
+ draw_children_grayed_out,
+ starty);
}
}
@@ -3296,7 +3302,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos,
}
}
-static void outliner_draw_hierarchy_lines(SpaceOutliner *soops,
+static void outliner_draw_hierarchy_lines(SpaceOutliner *space_outliner,
ListBase *lb,
int startx,
int *starty)
@@ -3310,14 +3316,14 @@ static void outliner_draw_hierarchy_lines(SpaceOutliner *soops,
col[3] = 255;
GPU_blend(true);
- outliner_draw_hierarchy_lines_recursive(pos, soops, lb, startx, col, false, starty);
+ outliner_draw_hierarchy_lines_recursive(pos, space_outliner, lb, startx, col, false, starty);
GPU_blend(false);
immUnbindProgram();
}
static void outliner_draw_struct_marks(ARegion *region,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
int *starty)
{
@@ -3325,7 +3331,7 @@ static void outliner_draw_struct_marks(ARegion *region,
TreeStoreElem *tselem = TREESTORE(te);
/* selection status */
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
if (tselem->type == TSE_RNA_STRUCT) {
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
@@ -3337,8 +3343,8 @@ static void outliner_draw_struct_marks(ARegion *region,
}
*starty -= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_draw_struct_marks(region, soops, &te->subtree, starty);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_draw_struct_marks(region, space_outliner, &te->subtree, starty);
if (tselem->type == TSE_RNA_STRUCT) {
GPUVertFormat *format = immVertexFormat();
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -3358,7 +3364,7 @@ static void outliner_draw_struct_marks(ARegion *region,
static void outliner_draw_highlights_recursive(uint pos,
const ARegion *region,
- const SpaceOutliner *soops,
+ const SpaceOutliner *space_outliner,
const ListBase *lb,
const float col_selection[4],
const float col_active[4],
@@ -3367,8 +3373,9 @@ static void outliner_draw_highlights_recursive(uint pos,
int start_x,
int *io_start_y)
{
- const bool is_searching = (SEARCHING_OUTLINER(soops) ||
- (soops->outlinevis == SO_DATA_API && soops->search_string[0] != 0));
+ const bool is_searching = (SEARCHING_OUTLINER(space_outliner) ||
+ (space_outliner->outlinevis == SO_DATA_API &&
+ space_outliner->search_string[0] != 0));
LISTBASE_FOREACH (TreeElement *, te, lb) {
const TreeStoreElem *tselem = TREESTORE(te);
@@ -3427,10 +3434,10 @@ static void outliner_draw_highlights_recursive(uint pos,
}
*io_start_y -= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
outliner_draw_highlights_recursive(pos,
region,
- soops,
+ space_outliner,
&te->subtree,
col_selection,
col_active,
@@ -3443,7 +3450,7 @@ static void outliner_draw_highlights_recursive(uint pos,
}
static void outliner_draw_highlights(ARegion *region,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
int startx,
int *starty)
{
@@ -3463,8 +3470,8 @@ static void outliner_draw_highlights(ARegion *region,
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
outliner_draw_highlights_recursive(pos,
region,
- soops,
- &soops->tree,
+ space_outliner,
+ &space_outliner->tree,
col_selection,
col_active,
col_highlight,
@@ -3479,7 +3486,7 @@ static void outliner_draw_tree(bContext *C,
uiBlock *block,
const TreeViewContext *tvc,
ARegion *region,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
const float restrict_column_width,
TreeElement **te_edit)
{
@@ -3489,16 +3496,16 @@ static void outliner_draw_tree(bContext *C,
GPU_blend_set_func_separate(
GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* Only once. */
- if (soops->outlinevis == SO_DATA_API) {
+ if (space_outliner->outlinevis == SO_DATA_API) {
/* struct marks */
starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
- outliner_draw_struct_marks(region, soops, &soops->tree, &starty);
+ outliner_draw_struct_marks(region, space_outliner, &space_outliner->tree, &starty);
}
/* draw highlights before hierarchy */
starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
startx = 0;
- outliner_draw_highlights(region, soops, startx, &starty);
+ outliner_draw_highlights(region, space_outliner, startx, &starty);
/* set scissor so tree elements or lines can't overlap restriction icons */
float scissor[4] = {0};
@@ -3513,18 +3520,18 @@ static void outliner_draw_tree(bContext *C,
/* Gray hierarchy lines. */
starty = (int)region->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET;
startx = UI_UNIT_X / 2 - (U.pixelsize + 1) / 2;
- outliner_draw_hierarchy_lines(soops, &soops->tree, startx, &starty);
+ outliner_draw_hierarchy_lines(space_outliner, &space_outliner->tree, startx, &starty);
/* Items themselves. */
starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
startx = 0;
- LISTBASE_FOREACH (TreeElement *, te, &soops->tree) {
+ LISTBASE_FOREACH (TreeElement *, te, &space_outliner->tree) {
outliner_draw_tree_element(C,
block,
fstyle,
tvc,
region,
- soops,
+ space_outliner,
te,
(te->flag & TE_DRAGGING) != 0,
startx,
@@ -3582,21 +3589,23 @@ static int outliner_data_api_buttons_start_x(int max_tree_width)
return max_ii(OL_RNA_COLX, max_tree_width + OL_RNA_COL_SPACEX);
}
-static int outliner_width(SpaceOutliner *soops, int max_tree_width, float restrict_column_width)
+static int outliner_width(SpaceOutliner *space_outliner,
+ int max_tree_width,
+ float restrict_column_width)
{
- if (soops->outlinevis == SO_DATA_API) {
+ if (space_outliner->outlinevis == SO_DATA_API) {
return outliner_data_api_buttons_start_x(max_tree_width) + OL_RNA_COL_SIZEX + 10 * UI_DPI_FAC;
}
return max_tree_width + restrict_column_width;
}
static void outliner_update_viewable_area(ARegion *region,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
int tree_width,
int tree_height,
float restrict_column_width)
{
- int sizex = outliner_width(soops, tree_width, restrict_column_width);
+ int sizex = outliner_width(space_outliner, tree_width, restrict_column_width);
int sizey = tree_height;
/* extend size to allow for horizontal scrollbar and extra offset */
@@ -3613,14 +3622,14 @@ void draw_outliner(const bContext *C)
Main *mainvar = CTX_data_main(C);
ARegion *region = CTX_wm_region(C);
View2D *v2d = &region->v2d;
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
uiBlock *block;
TreeElement *te_edit = NULL;
TreeViewContext tvc;
outliner_viewcontext_init(C, &tvc);
- outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, soops, region); /* Always. */
+ outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, space_outliner, region); /* Always. */
/* If global sync select is dirty, flag other outliners */
if (ED_outliner_select_sync_is_dirty(C)) {
@@ -3628,9 +3637,9 @@ void draw_outliner(const bContext *C)
}
/* Sync selection state from view layer */
- if (!ELEM(soops->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS) &&
- soops->flag & SO_SYNC_SELECT) {
- outliner_sync_selection(C, soops);
+ if (!ELEM(space_outliner->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS) &&
+ space_outliner->flag & SO_SYNC_SELECT) {
+ outliner_sync_selection(C, space_outliner);
}
/* force display to pixel coords */
@@ -3639,37 +3648,43 @@ void draw_outliner(const bContext *C)
UI_view2d_view_ortho(v2d);
/* draw outliner stuff (background, hierarchy lines and names) */
- const float restrict_column_width = outliner_restrict_columns_width(soops);
+ const float restrict_column_width = outliner_restrict_columns_width(space_outliner);
outliner_back(region);
block = UI_block_begin(C, region, __func__, UI_EMBOSS);
- outliner_draw_tree((bContext *)C, block, &tvc, region, soops, restrict_column_width, &te_edit);
+ outliner_draw_tree(
+ (bContext *)C, block, &tvc, region, space_outliner, restrict_column_width, &te_edit);
/* Compute outliner dimensions after it has been drawn. */
int tree_width, tree_height;
- outliner_tree_dimensions(soops, &tree_width, &tree_height);
+ outliner_tree_dimensions(space_outliner, &tree_width, &tree_height);
/* Default to no emboss for outliner UI. */
UI_block_emboss_set(block, UI_EMBOSS_NONE);
- if (soops->outlinevis == SO_DATA_API) {
+ if (space_outliner->outlinevis == SO_DATA_API) {
int buttons_start_x = outliner_data_api_buttons_start_x(tree_width);
/* draw rna buttons */
outliner_draw_rnacols(region, buttons_start_x);
UI_block_emboss_set(block, UI_EMBOSS);
- outliner_draw_rnabuts(block, region, soops, buttons_start_x, &soops->tree);
+ outliner_draw_rnabuts(block, region, space_outliner, buttons_start_x, &space_outliner->tree);
UI_block_emboss_set(block, UI_EMBOSS_NONE);
}
- else if (soops->outlinevis == SO_ID_ORPHANS) {
+ else if (space_outliner->outlinevis == SO_ID_ORPHANS) {
/* draw user toggle columns */
- outliner_draw_userbuts(block, region, soops, &soops->tree);
+ outliner_draw_userbuts(block, region, space_outliner, &space_outliner->tree);
}
else if (restrict_column_width > 0.0f) {
/* draw restriction columns */
RestrictPropertiesActive props_active;
memset(&props_active, 1, sizeof(RestrictPropertiesActive));
- outliner_draw_restrictbuts(
- block, tvc.scene, tvc.view_layer, region, soops, &soops->tree, props_active);
+ outliner_draw_restrictbuts(block,
+ tvc.scene,
+ tvc.view_layer,
+ region,
+ space_outliner,
+ &space_outliner->tree,
+ props_active);
}
UI_block_emboss_set(block, UI_EMBOSS);
@@ -3683,5 +3698,6 @@ void draw_outliner(const bContext *C)
UI_block_draw(C, block);
/* Update total viewable region. */
- outliner_update_viewable_area(region, soops, tree_width, tree_height, restrict_column_width);
+ outliner_update_viewable_area(
+ region, space_outliner, tree_width, tree_height, restrict_column_width);
}
diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c
index 0fbcee12207..cd2fcd8e2cf 100644
--- a/source/blender/editors/space_outliner/outliner_edit.c
+++ b/source/blender/editors/space_outliner/outliner_edit.c
@@ -103,21 +103,22 @@ static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const
}
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
float view_mval[2];
UI_view2d_region_to_view(
&region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
- TreeElement *hovered_te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
+ TreeElement *hovered_te = outliner_find_item_at_y(
+ space_outliner, &space_outliner->tree, view_mval[1]);
if (hovered_te) {
- hovered_te = outliner_find_item_at_x_in_row(soops, hovered_te, view_mval[0], NULL);
+ hovered_te = outliner_find_item_at_x_in_row(space_outliner, hovered_te, view_mval[0], NULL);
}
bool changed = false;
if (!hovered_te || !(hovered_te->store_elem->flag & TSE_HIGHLIGHTED)) {
- changed = outliner_flag_set(&soops->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
+ changed = outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED | TSE_DRAG_ANY, false);
if (hovered_te) {
hovered_te->store_elem->flag |= TSE_HIGHLIGHTED;
changed = true;
@@ -174,14 +175,14 @@ typedef struct OpenCloseData {
static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
float view_mval[2];
UI_view2d_region_to_view(
&region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
if (event->type == MOUSEMOVE) {
- TreeElement *te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
+ TreeElement *te = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]);
OpenCloseData *data = (OpenCloseData *)op->customdata;
@@ -221,7 +222,7 @@ static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEv
static int outliner_item_openclose_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const bool toggle_all = RNA_boolean_get(op->ptr, "all");
@@ -229,7 +230,7 @@ static int outliner_item_openclose_invoke(bContext *C, wmOperator *op, const wmE
UI_view2d_region_to_view(
&region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
- TreeElement *te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
+ TreeElement *te = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]);
if (te && outliner_item_is_co_within_close_toggle(te, view_mval[0])) {
TreeStoreElem *tselem = TREESTORE(te);
@@ -438,13 +439,14 @@ static void do_outliner_item_rename(ReportList *reports,
static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
/* Rename active element if key pressed, otherwise rename element at cursor coordinates */
if (event->val == KM_PRESS) {
- TreeElement *active_element = outliner_find_element_with_flag(&soops->tree, TSE_ACTIVE);
+ TreeElement *active_element = outliner_find_element_with_flag(&space_outliner->tree,
+ TSE_ACTIVE);
if (active_element) {
do_item_rename(region, active_element, TREESTORE(active_element), op->reports);
@@ -456,7 +458,7 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even
else {
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- for (te = soops->tree.first; te; te = te->next) {
+ for (te = space_outliner->tree.first; te; te = te->next) {
do_outliner_item_rename(op->reports, region, te, fmval);
}
}
@@ -567,15 +569,15 @@ static int outliner_id_delete_invoke_do(bContext *C,
static int outliner_id_delete_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
- BLI_assert(region && soops);
+ BLI_assert(region && space_outliner);
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- for (te = soops->tree.first; te; te = te->next) {
+ for (te = space_outliner->tree.first; te; te = te->next) {
int ret;
if ((ret = outliner_id_delete_invoke_do(C, op->reports, te, fmval))) {
@@ -608,7 +610,7 @@ void OUTLINER_OT_id_delete(wmOperatorType *ot)
static int outliner_id_remap_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const short id_type = (short)RNA_enum_get(op->ptr, "id_type");
ID *old_id = BLI_findlink(which_libbase(CTX_data_main(C), id_type),
@@ -617,7 +619,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
RNA_enum_get(op->ptr, "new_id"));
/* check for invalid states */
- if (soops == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
@@ -684,14 +686,14 @@ static bool outliner_id_remap_find_tree_element(bContext *C,
static int outliner_id_remap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
float fmval[2];
if (!RNA_property_is_set(op->ptr, RNA_struct_find_property(op->ptr, "id_type"))) {
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- outliner_id_remap_find_tree_element(C, op, &soops->tree, fmval[1]);
+ outliner_id_remap_find_tree_element(C, op, &space_outliner->tree, fmval[1]);
}
return WM_operator_props_dialog_popup(C, op, 200);
@@ -783,7 +785,7 @@ void id_remap_fn(bContext *C,
/** \name ID Copy Operator
* \{ */
-static int outliner_id_copy_tag(SpaceOutliner *soops, ListBase *tree)
+static int outliner_id_copy_tag(SpaceOutliner *space_outliner, ListBase *tree)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -802,8 +804,8 @@ static int outliner_id_copy_tag(SpaceOutliner *soops, ListBase *tree)
}
/* go over sub-tree */
- if (TSELEM_OPEN(tselem, soops)) {
- num_ids += outliner_id_copy_tag(soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ num_ids += outliner_id_copy_tag(space_outliner, &te->subtree);
}
}
@@ -813,12 +815,12 @@ static int outliner_id_copy_tag(SpaceOutliner *soops, ListBase *tree)
static int outliner_id_copy_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
char str[FILE_MAX];
BKE_copybuffer_begin(bmain);
- const int num_ids = outliner_id_copy_tag(soops, &soops->tree);
+ const int num_ids = outliner_id_copy_tag(space_outliner, &space_outliner->tree);
if (num_ids == 0) {
BKE_report(op->reports, RPT_INFO, "No selected data-blocks to copy");
return OPERATOR_CANCELLED;
@@ -968,15 +970,15 @@ static int outliner_lib_relocate_invoke_do(
static int outliner_lib_relocate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
- BLI_assert(region && soops);
+ BLI_assert(region && space_outliner);
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- for (te = soops->tree.first; te; te = te->next) {
+ for (te = space_outliner->tree.first; te; te = te->next) {
int ret;
if ((ret = outliner_lib_relocate_invoke_do(C, op->reports, te, fmval, false))) {
@@ -1019,15 +1021,15 @@ void lib_relocate_fn(bContext *C,
static int outliner_lib_reload_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te;
float fmval[2];
- BLI_assert(region && soops);
+ BLI_assert(region && space_outliner);
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- for (te = soops->tree.first; te; te = te->next) {
+ for (te = space_outliner->tree.first; te; te = te->next) {
int ret;
if ((ret = outliner_lib_relocate_invoke_do(C, op->reports, te, fmval, true))) {
@@ -1194,14 +1196,14 @@ int common_restrict_check(bContext *C, Object *ob)
static int outliner_toggle_expanded_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
- if (outliner_flag_is_any_test(&soops->tree, TSE_CLOSED, 1)) {
- outliner_flag_set(&soops->tree, TSE_CLOSED, 0);
+ if (outliner_flag_is_any_test(&space_outliner->tree, TSE_CLOSED, 1)) {
+ outliner_flag_set(&space_outliner->tree, TSE_CLOSED, 0);
}
else {
- outliner_flag_set(&soops->tree, TSE_CLOSED, 1);
+ outliner_flag_set(&space_outliner->tree, TSE_CLOSED, 1);
}
ED_region_tag_redraw(region);
@@ -1231,27 +1233,28 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot)
static int outliner_select_all_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
int action = RNA_enum_get(op->ptr, "action");
if (action == SEL_TOGGLE) {
- action = outliner_flag_is_any_test(&soops->tree, TSE_SELECTED, 1) ? SEL_DESELECT : SEL_SELECT;
+ action = outliner_flag_is_any_test(&space_outliner->tree, TSE_SELECTED, 1) ? SEL_DESELECT :
+ SEL_SELECT;
}
switch (action) {
case SEL_SELECT:
- outliner_flag_set(&soops->tree, TSE_SELECTED, 1);
+ outliner_flag_set(&space_outliner->tree, TSE_SELECTED, 1);
break;
case SEL_DESELECT:
- outliner_flag_set(&soops->tree, TSE_SELECTED, 0);
+ outliner_flag_set(&space_outliner->tree, TSE_SELECTED, 0);
break;
case SEL_INVERT:
- outliner_flag_flip(&soops->tree, TSE_SELECTED);
+ outliner_flag_flip(&space_outliner->tree, TSE_SELECTED);
break;
}
- ED_outliner_select_sync_from_outliner(C, soops);
+ ED_outliner_select_sync_from_outliner(C, space_outliner);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -1283,7 +1286,7 @@ void OUTLINER_OT_select_all(wmOperatorType *ot)
/** \name View Show Active (Outliner) Operator
* \{ */
-static void outliner_set_coordinates_element_recursive(SpaceOutliner *soops,
+static void outliner_set_coordinates_element_recursive(SpaceOutliner *space_outliner,
TreeElement *te,
int startx,
int *starty)
@@ -1295,22 +1298,22 @@ static void outliner_set_coordinates_element_recursive(SpaceOutliner *soops,
te->ys = (float)(*starty);
*starty -= UI_UNIT_Y;
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
TreeElement *ten;
for (ten = te->subtree.first; ten; ten = ten->next) {
- outliner_set_coordinates_element_recursive(soops, ten, startx + UI_UNIT_X, starty);
+ outliner_set_coordinates_element_recursive(space_outliner, ten, startx + UI_UNIT_X, starty);
}
}
}
/* to retrieve coordinates with redrawing the entire tree */
-void outliner_set_coordinates(ARegion *region, SpaceOutliner *soops)
+void outliner_set_coordinates(ARegion *region, SpaceOutliner *space_outliner)
{
TreeElement *te;
int starty = (int)(region->v2d.tot.ymax) - UI_UNIT_Y;
- for (te = soops->tree.first; te; te = te->next) {
- outliner_set_coordinates_element_recursive(soops, te, 0, &starty);
+ for (te = space_outliner->tree.first; te; te = te->next) {
+ outliner_set_coordinates_element_recursive(space_outliner, te, 0, &starty);
}
}
@@ -1332,7 +1335,7 @@ static int outliner_open_back(TreeElement *te)
/* Return element representing the active base or bone in the outliner, or NULL if none exists */
static TreeElement *outliner_show_active_get_element(bContext *C,
- SpaceOutliner *so,
+ SpaceOutliner *space_outliner,
ViewLayer *view_layer)
{
TreeElement *te;
@@ -1343,7 +1346,7 @@ static TreeElement *outliner_show_active_get_element(bContext *C,
return NULL;
}
- te = outliner_find_id(so, &so->tree, &obact->id);
+ te = outliner_find_id(space_outliner, &space_outliner->tree, &obact->id);
if (te != NULL && obact->type == OB_ARMATURE) {
/* traverse down the bone hierarchy in case of armature */
@@ -1366,41 +1369,44 @@ static TreeElement *outliner_show_active_get_element(bContext *C,
return te;
}
-static void outliner_show_active(SpaceOutliner *so, ARegion *region, TreeElement *te, ID *id)
+static void outliner_show_active(SpaceOutliner *space_outliner,
+ ARegion *region,
+ TreeElement *te,
+ ID *id)
{
/* open up tree to active object/bone */
if (TREESTORE(te)->id == id) {
if (outliner_open_back(te)) {
- outliner_set_coordinates(region, so);
+ outliner_set_coordinates(region, space_outliner);
}
return;
}
LISTBASE_FOREACH (TreeElement *, ten, &te->subtree) {
- outliner_show_active(so, region, ten, id);
+ outliner_show_active(space_outliner, region, ten, id);
}
}
static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOutliner *so = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
ARegion *region = CTX_wm_region(C);
View2D *v2d = &region->v2d;
- TreeElement *active_element = outliner_show_active_get_element(C, so, view_layer);
+ TreeElement *active_element = outliner_show_active_get_element(C, space_outliner, view_layer);
if (active_element) {
ID *id = TREESTORE(active_element)->id;
/* Expand all elements in the outliner with matching ID */
- LISTBASE_FOREACH (TreeElement *, te, &so->tree) {
- outliner_show_active(so, region, te, id);
+ LISTBASE_FOREACH (TreeElement *, te, &space_outliner->tree) {
+ outliner_show_active(space_outliner, region, te, id);
}
/* Also open back from the active_element (only done for the first found occurrence of ID
* though). */
- outliner_show_active(so, region, active_element, id);
+ outliner_show_active(space_outliner, region, active_element, id);
/* Center view on first element found */
int size_y = BLI_rcti_size_y(&v2d->mask) + 1;
@@ -1484,7 +1490,7 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
/* find next element that has this name */
static TreeElement *outliner_find_name(
- SpaceOutliner *soops, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound)
+ SpaceOutliner *space_outliner, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound)
{
TreeElement *te, *tes;
@@ -1506,7 +1512,7 @@ static TreeElement *outliner_find_name(
}
}
- tes = outliner_find_name(soops, &te->subtree, name, flags, prev, prevFound);
+ tes = outliner_find_name(space_outliner, &te->subtree, name, flags, prev, prevFound);
if (tes) {
return tes;
}
@@ -1517,37 +1523,37 @@ static TreeElement *outliner_find_name(
}
static void outliner_find_panel(
- Scene *UNUSED(scene), ARegion *region, SpaceOutliner *soops, int again, int flags)
+ Scene *UNUSED(scene), ARegion *region, SpaceOutliner *space_outliner, int again, int flags)
{
ReportList *reports = NULL; /* CTX_wm_reports(C); */
TreeElement *te = NULL;
TreeElement *last_find;
TreeStoreElem *tselem;
int ytop, xdelta, prevFound = 0;
- char name[sizeof(soops->search_string)];
+ char name[sizeof(space_outliner->search_string)];
/* get last found tree-element based on stored search_tse */
- last_find = outliner_find_tse(soops, &soops->search_tse);
+ last_find = outliner_find_tse(space_outliner, &space_outliner->search_tse);
/* determine which type of search to do */
if (again && last_find) {
/* no popup panel - previous + user wanted to search for next after previous */
- BLI_strncpy(name, soops->search_string, sizeof(name));
- flags = soops->search_flags;
+ BLI_strncpy(name, space_outliner->search_string, sizeof(name));
+ flags = space_outliner->search_flags;
/* try to find matching element */
- te = outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound);
+ te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, last_find, &prevFound);
if (te == NULL) {
/* no more matches after previous, start from beginning again */
prevFound = 1;
- te = outliner_find_name(soops, &soops->tree, name, flags, last_find, &prevFound);
+ te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, last_find, &prevFound);
}
}
else {
/* pop up panel - no previous, or user didn't want search after previous */
name[0] = '\0';
/* XXX if (sbutton(name, 0, sizeof(name) - 1, "Find: ") && name[0]) { */
- /* te = outliner_find_name(soops, &soops->tree, name, flags, NULL, &prevFound); */
+ /* te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, NULL, &prevFound); */
/* } */
/* else return; XXX RETURN! XXX */
}
@@ -1557,12 +1563,12 @@ static void outliner_find_panel(
tselem = TREESTORE(te);
if (tselem) {
/* expand branches so that it will be visible, we need to get correct coordinates */
- if (outliner_open_back(soops, te)) {
- outliner_set_coordinates(region, soops);
+ if (outliner_open_back(space_outliner, te)) {
+ outliner_set_coordinates(region, space_outliner);
}
/* deselect all visible, and select found element */
- outliner_flag_set(soops, &soops->tree, TSE_SELECTED, 0);
+ outliner_flag_set(space_outliner, &space_outliner->tree, TSE_SELECTED, 0);
tselem->flag |= TSE_SELECTED;
/* make te->ys center of view */
@@ -1579,10 +1585,10 @@ static void outliner_find_panel(
region->v2d.cur.xmax += xdelta;
/* store selection */
- soops->search_tse = *tselem;
+ space_outliner->search_tse = *tselem;
- BLI_strncpy(soops->search_string, name, sizeof(soops->search_string));
- soops->search_flags = flags;
+ BLI_strncpy(space_outliner->search_string, name, sizeof(space_outliner->search_string));
+ space_outliner->search_flags = flags;
/* redraw */
ED_region_tag_redraw_no_rebuild(region);
@@ -1628,23 +1634,23 @@ static void outliner_openclose_level(ListBase *lb, int curlevel, int level, int
static int outliner_one_level_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
const bool add = RNA_boolean_get(op->ptr, "open");
int level;
- level = outliner_flag_is_any_test(&soops->tree, TSE_CLOSED, 1);
+ level = outliner_flag_is_any_test(&space_outliner->tree, TSE_CLOSED, 1);
if (add == 1) {
if (level) {
- outliner_openclose_level(&soops->tree, 1, level, 1);
+ outliner_openclose_level(&space_outliner->tree, 1, level, 1);
}
}
else {
if (level == 0) {
- level = outliner_count_levels(&soops->tree, 0);
+ level = outliner_count_levels(&space_outliner->tree, 0);
}
if (level) {
- outliner_openclose_level(&soops->tree, 1, level - 1, 0);
+ outliner_openclose_level(&space_outliner->tree, 1, level - 1, 0);
}
}
@@ -1699,7 +1705,7 @@ static int subtree_has_objects(ListBase *lb)
}
/* recursive helper function for Show Hierarchy operator */
-static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *soops, ListBase *lb)
+static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *space_outliner, ListBase *lb)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -1734,8 +1740,8 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *soops, List
tselem->flag |= TSE_CLOSED;
}
- if (TSELEM_OPEN(tselem, soops)) {
- tree_element_show_hierarchy(scene, soops, &te->subtree);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ tree_element_show_hierarchy(scene, space_outliner, &te->subtree);
}
}
}
@@ -1743,12 +1749,12 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOutliner *soops, List
/* show entire object level hierarchy */
static int outliner_show_hierarchy_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
/* recursively open/close levels */
- tree_element_show_hierarchy(scene, soops, &soops->tree);
+ tree_element_show_hierarchy(scene, space_outliner, &space_outliner->tree);
ED_region_tag_redraw(region);
@@ -1782,8 +1788,8 @@ static bool ed_operator_outliner_datablocks_active(bContext *C)
{
ScrArea *area = CTX_wm_area(C);
if ((area) && (area->spacetype == SPACE_OUTLINER)) {
- SpaceOutliner *so = CTX_wm_space_outliner(C);
- return (so->outlinevis == SO_DATA_API);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ return (space_outliner->outlinevis == SO_DATA_API);
}
return 0;
}
@@ -1957,7 +1963,7 @@ enum {
} /*eDrivers_EditModes*/;
/* Recursively iterate over tree, finding and working on selected items */
-static void do_outliner_drivers_editop(SpaceOutliner *soops,
+static void do_outliner_drivers_editop(SpaceOutliner *space_outliner,
ListBase *tree,
ReportList *reports,
short mode)
@@ -2025,8 +2031,8 @@ static void do_outliner_drivers_editop(SpaceOutliner *soops,
}
/* go over sub-tree */
- if (TSELEM_OPEN(tselem, soops)) {
- do_outliner_drivers_editop(soops, &te->subtree, reports, mode);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ do_outliner_drivers_editop(space_outliner, &te->subtree, reports, mode);
}
}
}
@@ -2039,15 +2045,16 @@ static void do_outliner_drivers_editop(SpaceOutliner *soops,
static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
/* check for invalid states */
- if (soutliner == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
/* recursively go into tree, adding selected items */
- do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_ADD);
+ do_outliner_drivers_editop(
+ space_outliner, &space_outliner->tree, op->reports, DRIVERS_EDITMODE_ADD);
/* send notifiers */
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); /* XXX */
@@ -2078,15 +2085,16 @@ void OUTLINER_OT_drivers_add_selected(wmOperatorType *ot)
static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
/* check for invalid states */
- if (soutliner == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
/* recursively go into tree, adding selected items */
- do_outliner_drivers_editop(soutliner, &soutliner->tree, op->reports, DRIVERS_EDITMODE_REMOVE);
+ do_outliner_drivers_editop(
+ space_outliner, &space_outliner->tree, op->reports, DRIVERS_EDITMODE_REMOVE);
/* send notifiers */
WM_event_add_notifier(C, ND_KEYS, NULL); /* XXX */
@@ -2153,7 +2161,7 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add)
}
/* Recursively iterate over tree, finding and working on selected items */
-static void do_outliner_keyingset_editop(SpaceOutliner *soops,
+static void do_outliner_keyingset_editop(SpaceOutliner *space_outliner,
KeyingSet *ks,
ListBase *tree,
short mode)
@@ -2211,8 +2219,8 @@ static void do_outliner_keyingset_editop(SpaceOutliner *soops,
}
/* go over sub-tree */
- if (TSELEM_OPEN(tselem, soops)) {
- do_outliner_keyingset_editop(soops, ks, &te->subtree, mode);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ do_outliner_keyingset_editop(space_outliner, ks, &te->subtree, mode);
}
}
}
@@ -2225,7 +2233,7 @@ static void do_outliner_keyingset_editop(SpaceOutliner *soops,
static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
@@ -2234,12 +2242,12 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "Operation requires an active keying set");
return OPERATOR_CANCELLED;
}
- if (soutliner == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
/* recursively go into tree, adding selected items */
- do_outliner_keyingset_editop(soutliner, ks, &soutliner->tree, KEYINGSET_EDITMODE_ADD);
+ do_outliner_keyingset_editop(space_outliner, ks, &space_outliner->tree, KEYINGSET_EDITMODE_ADD);
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
@@ -2270,17 +2278,18 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot)
static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(op))
{
- SpaceOutliner *soutliner = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
KeyingSet *ks = verify_active_keyingset(scene, 1);
/* check for invalid states */
- if (soutliner == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
/* recursively go into tree, adding selected items */
- do_outliner_keyingset_editop(soutliner, ks, &soutliner->tree, KEYINGSET_EDITMODE_REMOVE);
+ do_outliner_keyingset_editop(
+ space_outliner, ks, &space_outliner->tree, KEYINGSET_EDITMODE_REMOVE);
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
@@ -2313,8 +2322,8 @@ static bool ed_operator_outliner_id_orphans_active(bContext *C)
{
ScrArea *area = CTX_wm_area(C);
if (area != NULL && area->spacetype == SPACE_OUTLINER) {
- SpaceOutliner *so = CTX_wm_space_outliner(C);
- return (so->outlinevis == SO_ID_ORPHANS);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ return (space_outliner->outlinevis == SO_ID_ORPHANS);
}
return true;
}
@@ -2382,7 +2391,7 @@ static int outliner_orphans_purge_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
ScrArea *area = CTX_wm_area(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int num_tagged[INDEX_ID_MAX] = {0};
if ((num_tagged[INDEX_ID_NULL] = RNA_int_get(op->ptr, "num_deleted")) == 0) {
@@ -2409,7 +2418,7 @@ static int outliner_orphans_purge_exec(bContext *C, wmOperator *op)
* handling notifiers/redraw which leads to deleting the same object twice.
* cleanup tree here to prevent such cases. */
if ((area != NULL) && (area->spacetype == SPACE_OUTLINER)) {
- outliner_cleanup_tree(soops);
+ outliner_cleanup_tree(space_outliner);
}
DEG_relations_tag_update(bmain);
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 1aac0721390..33dbbb274c0 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -170,7 +170,8 @@ typedef enum {
/* The outliner display modes that support the filter system.
* Note: keep it synced with space_outliner.py */
-#define SUPPORT_FILTER_OUTLINER(soops_) (ELEM((soops_)->outlinevis, SO_VIEW_LAYER))
+#define SUPPORT_FILTER_OUTLINER(space_outliner_) \
+ (ELEM((space_outliner_)->outlinevis, SO_VIEW_LAYER))
/* Outliner Searching --
*
@@ -227,13 +228,13 @@ typedef enum TreeItemSelectAction {
/* outliner_tree.c ----------------------------------------------- */
void outliner_free_tree(ListBase *tree);
-void outliner_cleanup_tree(struct SpaceOutliner *soops);
+void outliner_cleanup_tree(struct SpaceOutliner *space_outliner);
void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree);
void outliner_build_tree(struct Main *mainvar,
struct Scene *scene,
struct ViewLayer *view_layer,
- struct SpaceOutliner *soops,
+ struct SpaceOutliner *space_outliner,
struct ARegion *region);
bool outliner_element_needs_rebuild_on_open_change(const TreeStoreElem *tselem);
@@ -264,20 +265,20 @@ int tree_element_id_type_to_index(TreeElement *te);
/* outliner_select.c -------------------------------------------- */
eOLDrawState tree_element_type_active(struct bContext *C,
const TreeViewContext *tvc,
- struct SpaceOutliner *soops,
+ struct SpaceOutliner *space_outliner,
TreeElement *te,
TreeStoreElem *tselem,
const eOLSetState set,
bool recursive);
eOLDrawState tree_element_active(struct bContext *C,
const TreeViewContext *tvc,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
TreeElement *te,
const eOLSetState set,
const bool handle_all_types);
void outliner_item_select(struct bContext *C,
- struct SpaceOutliner *soops,
+ struct SpaceOutliner *space_outliner,
struct TreeElement *te,
const short select_flag);
@@ -301,7 +302,7 @@ typedef void (*outliner_operation_fn)(struct bContext *C,
void outliner_do_object_operation_ex(struct bContext *C,
struct ReportList *reports,
struct Scene *scene,
- struct SpaceOutliner *soops,
+ struct SpaceOutliner *space_outliner,
struct ListBase *lb,
outliner_operation_fn operation_fn,
void *user_data,
@@ -309,7 +310,7 @@ void outliner_do_object_operation_ex(struct bContext *C,
void outliner_do_object_operation(struct bContext *C,
struct ReportList *reports,
struct Scene *scene,
- struct SpaceOutliner *soops,
+ struct SpaceOutliner *space_outliner,
struct ListBase *lb,
outliner_operation_fn operation_fn);
@@ -371,7 +372,7 @@ void item_object_mode_exit_fn(struct bContext *C,
struct TreeStoreElem *tselem,
void *user_data);
-void outliner_set_coordinates(struct ARegion *region, struct SpaceOutliner *soops);
+void outliner_set_coordinates(struct ARegion *region, struct SpaceOutliner *space_outliner);
void outliner_item_openclose(TreeElement *te, bool open, bool toggle_all);
@@ -485,34 +486,36 @@ void OUTLINER_OT_unhide_all(struct wmOperatorType *ot);
void outliner_viewcontext_init(const struct bContext *C, TreeViewContext *tvc);
-TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops,
+TreeElement *outliner_find_item_at_y(const SpaceOutliner *space_outliner,
const ListBase *tree,
float view_co_y);
-TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *soops,
+TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *space_outliner,
const TreeElement *parent_te,
float view_co_x,
bool *multiple_objects);
-TreeElement *outliner_find_tse(struct SpaceOutliner *soops, const TreeStoreElem *tse);
+TreeElement *outliner_find_tse(struct SpaceOutliner *space_outliner, const TreeStoreElem *tse);
TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store_elem);
TreeElement *outliner_find_parent_element(ListBase *lb,
TreeElement *parent_te,
const TreeElement *child_te);
-TreeElement *outliner_find_id(struct SpaceOutliner *soops, ListBase *lb, const struct ID *id);
+TreeElement *outliner_find_id(struct SpaceOutliner *space_outliner,
+ ListBase *lb,
+ const struct ID *id);
TreeElement *outliner_find_posechannel(ListBase *lb, const struct bPoseChannel *pchan);
TreeElement *outliner_find_editbone(ListBase *lb, const struct EditBone *ebone);
TreeElement *outliner_search_back_te(TreeElement *te, short idcode);
struct ID *outliner_search_back(TreeElement *te, short idcode);
-bool outliner_tree_traverse(const SpaceOutliner *soops,
+bool outliner_tree_traverse(const SpaceOutliner *space_outliner,
ListBase *tree,
int filter_te_flag,
int filter_tselem_flag,
TreeTraversalFunc func,
void *customdata);
-float outliner_restrict_columns_width(const struct SpaceOutliner *soops);
+float outliner_restrict_columns_width(const struct SpaceOutliner *space_outliner);
TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag);
bool outliner_is_element_visible(const TreeElement *te);
void outliner_scroll_view(struct ARegion *region, int delta_y);
/* outliner_sync.c ---------------------------------------------- */
-void outliner_sync_selection(const struct bContext *C, struct SpaceOutliner *soops);
+void outliner_sync_selection(const struct bContext *C, struct SpaceOutliner *space_outliner);
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 8bf05c3018a..1ac1b46f0d1 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -334,7 +334,7 @@ static void do_outliner_ebone_select_recursive(bArmature *arm, EditBone *ebone_p
static eOLDrawState tree_element_set_active_object(bContext *C,
Scene *scene,
ViewLayer *view_layer,
- SpaceOutliner *UNUSED(soops),
+ SpaceOutliner *UNUSED(space_outliner),
TreeElement *te,
const eOLSetState set,
bool recursive)
@@ -526,7 +526,7 @@ static eOLDrawState tree_element_active_camera(bContext *C,
static eOLDrawState tree_element_active_world(bContext *C,
Scene *scene,
ViewLayer *UNUSED(sl),
- SpaceOutliner *UNUSED(soops),
+ SpaceOutliner *UNUSED(space_outliner),
TreeElement *te,
const eOLSetState set)
{
@@ -1033,7 +1033,7 @@ static eOLDrawState tree_element_active_layer_collection(bContext *C,
/* generic call for ID data check or make/check active in UI */
eOLDrawState tree_element_active(bContext *C,
const TreeViewContext *tvc,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
TreeElement *te,
const eOLSetState set,
const bool handle_all_types)
@@ -1045,13 +1045,13 @@ eOLDrawState tree_element_active(bContext *C,
case ID_OB:
if (handle_all_types) {
return tree_element_set_active_object(
- C, tvc->scene, tvc->view_layer, soops, te, set, false);
+ C, tvc->scene, tvc->view_layer, space_outliner, te, set, false);
}
break;
case ID_MA:
return tree_element_active_material(C, tvc->scene, tvc->view_layer, te, set);
case ID_WO:
- return tree_element_active_world(C, tvc->scene, tvc->view_layer, soops, te, set);
+ return tree_element_active_world(C, tvc->scene, tvc->view_layer, space_outliner, te, set);
case ID_CA:
return tree_element_active_camera(C, tvc->scene, tvc->view_layer, te, set);
}
@@ -1063,7 +1063,7 @@ eOLDrawState tree_element_active(bContext *C,
*/
eOLDrawState tree_element_type_active(bContext *C,
const TreeViewContext *tvc,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
TreeElement *te,
TreeStoreElem *tselem,
const eOLSetState set,
@@ -1080,7 +1080,8 @@ eOLDrawState tree_element_type_active(bContext *C,
return tree_element_active_modifier(C, tvc->scene, tvc->view_layer, te, tselem, set);
case TSE_LINKED_OB:
if (set != OL_SETSEL_NONE) {
- tree_element_set_active_object(C, tvc->scene, tvc->view_layer, soops, te, set, false);
+ tree_element_set_active_object(
+ C, tvc->scene, tvc->view_layer, space_outliner, te, set, false);
}
else if (tselem->id == (ID *)tvc->obact) {
return OL_DRAWSEL_NORMAL;
@@ -1126,7 +1127,7 @@ eOLDrawState tree_element_type_active(bContext *C,
*/
static void do_outliner_item_activate_tree_element(bContext *C,
const TreeViewContext *tvc,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
TreeElement *te,
TreeStoreElem *tselem,
const bool extend,
@@ -1153,7 +1154,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
tree_element_set_active_object(C,
tvc->scene,
tvc->view_layer,
- soops,
+ space_outliner,
te,
(extend && tselem->type == 0) ? OL_SETSEL_EXTEND :
OL_SETSEL_NORMAL,
@@ -1169,7 +1170,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), (Scene *)tselem->id);
}
}
- else if ((te->idcode == ID_GR) && (soops->outlinevis != SO_VIEW_LAYER)) {
+ else if ((te->idcode == ID_GR) && (space_outliner->outlinevis != SO_VIEW_LAYER)) {
Collection *gr = (Collection *)tselem->id;
if (extend) {
@@ -1210,18 +1211,23 @@ static void do_outliner_item_activate_tree_element(bContext *C,
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, tvc->scene);
}
else { /* Rest of types. */
- tree_element_active(C, tvc, soops, te, OL_SETSEL_NORMAL, false);
+ tree_element_active(C, tvc, space_outliner, te, OL_SETSEL_NORMAL, false);
}
}
else if (do_activate_data) {
- tree_element_type_active(
- C, tvc, soops, te, tselem, extend ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL, recursive);
+ tree_element_type_active(C,
+ tvc,
+ space_outliner,
+ te,
+ tselem,
+ extend ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
+ recursive);
}
}
/* Select the item using the set flags */
void outliner_item_select(bContext *C,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
TreeElement *te,
const short select_flag)
{
@@ -1233,7 +1239,7 @@ void outliner_item_select(bContext *C,
/* Clear previous active when activating and clear selection when not extending selection */
const short clear_flag = (activate ? TSE_ACTIVE : 0) | (extend ? 0 : TSE_SELECTED);
if (clear_flag) {
- outliner_flag_set(&soops->tree, clear_flag, false);
+ outliner_flag_set(&space_outliner->tree, clear_flag, false);
}
if (select_flag & OL_ITEM_SELECT) {
@@ -1250,12 +1256,12 @@ void outliner_item_select(bContext *C,
tselem->flag |= TSE_ACTIVE;
do_outliner_item_activate_tree_element(C,
&tvc,
- soops,
+ space_outliner,
te,
tselem,
extend,
select_flag & OL_ITEM_RECURSIVE,
- activate_data || soops->flag & SO_SYNC_SELECT);
+ activate_data || space_outliner->flag & SO_SYNC_SELECT);
/* Mode toggle on data activate for now, but move later */
if (select_flag & OL_ITEM_TOGGLE_MODE) {
@@ -1296,15 +1302,15 @@ static bool do_outliner_range_select_recursive(ListBase *lb,
/* Select a range of items between cursor and active element */
static void do_outliner_range_select(bContext *C,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
TreeElement *cursor,
const bool extend)
{
- TreeElement *active = outliner_find_element_with_flag(&soops->tree, TSE_ACTIVE);
+ TreeElement *active = outliner_find_element_with_flag(&space_outliner->tree, TSE_ACTIVE);
/* If no active element exists, activate the element under the cursor */
if (!active) {
- outliner_item_select(C, soops, cursor, OL_ITEM_SELECT | OL_ITEM_ACTIVATE);
+ outliner_item_select(C, space_outliner, cursor, OL_ITEM_SELECT | OL_ITEM_ACTIVATE);
return;
}
@@ -1312,29 +1318,29 @@ static void do_outliner_range_select(bContext *C,
const bool active_selected = (tselem->flag & TSE_SELECTED);
if (!extend) {
- outliner_flag_set(&soops->tree, TSE_SELECTED, false);
+ outliner_flag_set(&space_outliner->tree, TSE_SELECTED, false);
}
/* Select active if under cursor */
if (active == cursor) {
- outliner_item_select(C, soops, cursor, OL_ITEM_SELECT);
+ outliner_item_select(C, space_outliner, cursor, OL_ITEM_SELECT);
return;
}
/* If active is not selected or visible, select and activate the element under the cursor */
if (!active_selected || !outliner_is_element_visible(active)) {
- outliner_item_select(C, soops, cursor, OL_ITEM_SELECT | OL_ITEM_ACTIVATE);
+ outliner_item_select(C, space_outliner, cursor, OL_ITEM_SELECT | OL_ITEM_ACTIVATE);
return;
}
- do_outliner_range_select_recursive(&soops->tree, active, cursor, false);
+ do_outliner_range_select_recursive(&space_outliner->tree, active, cursor, false);
}
-static bool outliner_is_co_within_restrict_columns(const SpaceOutliner *soops,
+static bool outliner_is_co_within_restrict_columns(const SpaceOutliner *space_outliner,
const ARegion *region,
float view_co_x)
{
- return (view_co_x > region->v2d.cur.xmax - outliner_restrict_columns_width(soops));
+ return (view_co_x > region->v2d.cur.xmax - outliner_restrict_columns_width(space_outliner));
}
/**
@@ -1349,20 +1355,20 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
const bool deselect_all)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te;
float view_mval[2];
bool changed = false, rebuild_tree = false;
UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
- if (outliner_is_co_within_restrict_columns(soops, region, view_mval[0])) {
+ if (outliner_is_co_within_restrict_columns(space_outliner, region, view_mval[0])) {
return OPERATOR_CANCELLED;
}
- if (!(te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]))) {
+ if (!(te = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]))) {
if (deselect_all) {
- outliner_flag_set(&soops->tree, TSE_SELECTED, false);
+ outliner_flag_set(&space_outliner->tree, TSE_SELECTED, false);
changed = true;
}
}
@@ -1375,7 +1381,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
/* The row may also contain children, if one is hovered we want this instead of current te. */
bool merged_elements = false;
TreeElement *activate_te = outliner_find_item_at_x_in_row(
- soops, te, view_mval[0], &merged_elements);
+ space_outliner, te, view_mval[0], &merged_elements);
/* If the selected icon was an aggregate of multiple elements, run the search popup */
if (merged_elements) {
@@ -1386,7 +1392,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
TreeStoreElem *activate_tselem = TREESTORE(activate_te);
if (use_range) {
- do_outliner_range_select(C, soops, activate_te, extend);
+ do_outliner_range_select(C, space_outliner, activate_te, extend);
}
else {
const bool is_over_name_icons = outliner_item_is_co_over_name_icons(activate_te,
@@ -1399,7 +1405,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
(is_over_name_icons ? OL_ITEM_SELECT_DATA : 0) |
(extend ? OL_ITEM_EXTEND : 0) | OL_ITEM_TOGGLE_MODE;
- outliner_item_select(C, soops, activate_te, select_flag);
+ outliner_item_select(C, space_outliner, activate_te, select_flag);
}
changed = true;
@@ -1413,7 +1419,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
ED_region_tag_redraw_no_rebuild(region);
}
- ED_outliner_select_sync_from_outliner(C, soops);
+ ED_outliner_select_sync_from_outliner(C, space_outliner);
}
return OPERATOR_FINISHED;
@@ -1457,20 +1463,24 @@ void OUTLINER_OT_item_activate(wmOperatorType *ot)
/* ****************************************************** */
/* **************** Box Select Tool ****************** */
-static void outliner_item_box_select(
- bContext *C, SpaceOutliner *soops, Scene *scene, rctf *rectf, TreeElement *te, bool select)
+static void outliner_item_box_select(bContext *C,
+ SpaceOutliner *space_outliner,
+ Scene *scene,
+ rctf *rectf,
+ TreeElement *te,
+ bool select)
{
TreeStoreElem *tselem = TREESTORE(te);
if (te->ys <= rectf->ymax && te->ys + UI_UNIT_Y >= rectf->ymin) {
outliner_item_select(
- C, soops, te, (select ? OL_ITEM_SELECT : OL_ITEM_DESELECT) | OL_ITEM_EXTEND);
+ C, space_outliner, te, (select ? OL_ITEM_SELECT : OL_ITEM_DESELECT) | OL_ITEM_EXTEND);
}
/* Look at its children. */
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
for (te = te->subtree.first; te; te = te->next) {
- outliner_item_box_select(C, soops, scene, rectf, te, select);
+ outliner_item_box_select(C, space_outliner, scene, rectf, te, select);
}
}
}
@@ -1478,35 +1488,35 @@ static void outliner_item_box_select(
static int outliner_box_select_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
rctf rectf;
const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode");
const bool select = (sel_op != SEL_OP_SUB);
if (SEL_OP_USE_PRE_DESELECT(sel_op)) {
- outliner_flag_set(&soops->tree, TSE_SELECTED, 0);
+ outliner_flag_set(&space_outliner->tree, TSE_SELECTED, 0);
}
WM_operator_properties_border_to_rctf(op, &rectf);
UI_view2d_region_to_view_rctf(&region->v2d, &rectf, &rectf);
- LISTBASE_FOREACH (TreeElement *, te, &soops->tree) {
- outliner_item_box_select(C, soops, scene, &rectf, te, select);
+ LISTBASE_FOREACH (TreeElement *, te, &space_outliner->tree) {
+ outliner_item_box_select(C, space_outliner, scene, &rectf, te, select);
}
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_region_tag_redraw(region);
- ED_outliner_select_sync_from_outliner(C, soops);
+ ED_outliner_select_sync_from_outliner(C, space_outliner);
return OPERATOR_FINISHED;
}
static int outliner_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
float view_mval[2];
const bool tweak = RNA_boolean_get(op->ptr, "tweak");
@@ -1515,7 +1525,7 @@ static int outliner_box_select_invoke(bContext *C, wmOperator *op, const wmEvent
&region->v2d, event->mval[0], event->mval[1], &view_mval[0], &view_mval[1]);
/* Find element clicked on */
- TreeElement *te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
+ TreeElement *te = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]);
/* Pass through if click is over name or icons, or not tweak event */
if (te && tweak && outliner_item_is_co_over_name_icons(te, view_mval[0])) {
@@ -1559,10 +1569,11 @@ void OUTLINER_OT_select_box(wmOperatorType *ot)
/* **************** Walk Select Tool ****************** */
/* Given a tree element return the rightmost child that is visible in the outliner */
-static TreeElement *outliner_find_rightmost_visible_child(SpaceOutliner *soops, TreeElement *te)
+static TreeElement *outliner_find_rightmost_visible_child(SpaceOutliner *space_outliner,
+ TreeElement *te)
{
while (te->subtree.last) {
- if (TSELEM_OPEN(TREESTORE(te), soops)) {
+ if (TSELEM_OPEN(TREESTORE(te), space_outliner)) {
te = te->subtree.last;
}
else {
@@ -1573,10 +1584,10 @@ static TreeElement *outliner_find_rightmost_visible_child(SpaceOutliner *soops,
}
/* Find previous visible element in the tree */
-static TreeElement *outliner_find_previous_element(SpaceOutliner *soops, TreeElement *te)
+static TreeElement *outliner_find_previous_element(SpaceOutliner *space_outliner, TreeElement *te)
{
if (te->prev) {
- te = outliner_find_rightmost_visible_child(soops, te->prev);
+ te = outliner_find_rightmost_visible_child(space_outliner, te->prev);
}
else if (te->parent) {
/* Use parent if at beginning of list */
@@ -1602,11 +1613,11 @@ static TreeElement *outliner_element_find_successor_in_parents(TreeElement *te)
}
/* Find next visible element in the tree */
-static TreeElement *outliner_find_next_element(SpaceOutliner *soops, TreeElement *te)
+static TreeElement *outliner_find_next_element(SpaceOutliner *space_outliner, TreeElement *te)
{
TreeStoreElem *tselem = TREESTORE(te);
- if (TSELEM_OPEN(tselem, soops) && te->subtree.first) {
+ if (TSELEM_OPEN(tselem, space_outliner) && te->subtree.first) {
te = te->subtree.first;
}
else if (te->next) {
@@ -1619,7 +1630,7 @@ static TreeElement *outliner_find_next_element(SpaceOutliner *soops, TreeElement
return te;
}
-static TreeElement *do_outliner_select_walk(SpaceOutliner *soops,
+static TreeElement *do_outliner_select_walk(SpaceOutliner *space_outliner,
TreeElement *te,
const int direction,
const bool extend,
@@ -1629,10 +1640,10 @@ static TreeElement *do_outliner_select_walk(SpaceOutliner *soops,
switch (direction) {
case UI_SELECT_WALK_UP:
- te = outliner_find_previous_element(soops, te);
+ te = outliner_find_previous_element(space_outliner, te);
break;
case UI_SELECT_WALK_DOWN:
- te = outliner_find_next_element(soops, te);
+ te = outliner_find_next_element(space_outliner, te);
break;
case UI_SELECT_WALK_LEFT:
outliner_item_openclose(te, false, toggle_all);
@@ -1654,14 +1665,14 @@ static TreeElement *do_outliner_select_walk(SpaceOutliner *soops,
/* Find the active element to walk from, or set one if none exists.
* Changed is set to true if the active element is found, or false if it was set */
-static TreeElement *find_walk_select_start_element(SpaceOutliner *soops, bool *changed)
+static TreeElement *find_walk_select_start_element(SpaceOutliner *space_outliner, bool *changed)
{
- TreeElement *active_te = outliner_find_element_with_flag(&soops->tree, TSE_ACTIVE);
+ TreeElement *active_te = outliner_find_element_with_flag(&space_outliner->tree, TSE_ACTIVE);
*changed = false;
/* If no active element exists, use the first element in the tree */
if (!active_te) {
- active_te = soops->tree.first;
+ active_te = space_outliner->tree.first;
*changed = true;
}
@@ -1694,7 +1705,7 @@ static void outliner_walk_scroll(ARegion *region, TreeElement *te)
static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
ARegion *region = CTX_wm_region(C);
const short direction = RNA_enum_get(op->ptr, "direction");
@@ -1702,20 +1713,22 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven
const bool toggle_all = RNA_boolean_get(op->ptr, "toggle_all");
bool changed;
- TreeElement *active_te = find_walk_select_start_element(soops, &changed);
+ TreeElement *active_te = find_walk_select_start_element(space_outliner, &changed);
/* If finding the active element did not modify the selection, proceed to walk */
if (!changed) {
- active_te = do_outliner_select_walk(soops, active_te, direction, extend, toggle_all);
+ active_te = do_outliner_select_walk(space_outliner, active_te, direction, extend, toggle_all);
}
- outliner_item_select(
- C, soops, active_te, OL_ITEM_SELECT | OL_ITEM_ACTIVATE | (extend ? OL_ITEM_EXTEND : 0));
+ outliner_item_select(C,
+ space_outliner,
+ active_te,
+ OL_ITEM_SELECT | OL_ITEM_ACTIVATE | (extend ? OL_ITEM_EXTEND : 0));
/* Scroll outliner to focus on walk element */
outliner_walk_scroll(region, active_te);
- ED_outliner_select_sync_from_outliner(C, soops);
+ ED_outliner_select_sync_from_outliner(C, space_outliner);
ED_region_tag_redraw(region);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_outliner/outliner_sync.c b/source/blender/editors/space_outliner/outliner_sync.c
index a4be4062746..3055d15725b 100644
--- a/source/blender/editors/space_outliner/outliner_sync.c
+++ b/source/blender/editors/space_outliner/outliner_sync.c
@@ -99,9 +99,9 @@ void ED_outliner_select_sync_flag_outliners(const bContext *C)
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
if (sl->spacetype == SPACE_OUTLINER) {
- SpaceOutliner *soutliner = (SpaceOutliner *)sl;
+ SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
- soutliner->sync_select_dirty |= wm->outliner_sync_select_dirty;
+ space_outliner->sync_select_dirty |= wm->outliner_sync_select_dirty;
}
}
}
@@ -128,13 +128,13 @@ typedef struct SyncSelectTypes {
* interaction mode and outliner display mode
*/
static void outliner_sync_select_from_outliner_set_types(bContext *C,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
SyncSelectTypes *sync_types)
{
TreeViewContext tvc;
outliner_viewcontext_init(C, &tvc);
- const bool sequence_view = soops->outlinevis == SO_SEQUENCE;
+ const bool sequence_view = space_outliner->outlinevis == SO_SEQUENCE;
sync_types->object = !sequence_view;
sync_types->edit_bone = !sequence_view && (tvc.ob_edit && tvc.ob_edit->type == OB_ARMATURE);
@@ -148,22 +148,24 @@ static void outliner_sync_select_from_outliner_set_types(bContext *C,
* Returns true if a sync is needed.
*/
static bool outliner_sync_select_to_outliner_set_types(const bContext *C,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
SyncSelectTypes *sync_types)
{
TreeViewContext tvc;
outliner_viewcontext_init(C, &tvc);
- const bool sequence_view = soops->outlinevis == SO_SEQUENCE;
+ const bool sequence_view = space_outliner->outlinevis == SO_SEQUENCE;
sync_types->object = !sequence_view &&
- (soops->sync_select_dirty & WM_OUTLINER_SYNC_SELECT_FROM_OBJECT);
+ (space_outliner->sync_select_dirty & WM_OUTLINER_SYNC_SELECT_FROM_OBJECT);
sync_types->edit_bone = !sequence_view && (tvc.ob_edit && tvc.ob_edit->type == OB_ARMATURE) &&
- (soops->sync_select_dirty & WM_OUTLINER_SYNC_SELECT_FROM_EDIT_BONE);
+ (space_outliner->sync_select_dirty &
+ WM_OUTLINER_SYNC_SELECT_FROM_EDIT_BONE);
sync_types->pose_bone = !sequence_view && (tvc.ob_pose && tvc.ob_pose->mode == OB_MODE_POSE) &&
- (soops->sync_select_dirty & WM_OUTLINER_SYNC_SELECT_FROM_POSE_BONE);
- sync_types->sequence = sequence_view &&
- (soops->sync_select_dirty & WM_OUTLINER_SYNC_SELECT_FROM_SEQUENCE);
+ (space_outliner->sync_select_dirty &
+ WM_OUTLINER_SYNC_SELECT_FROM_POSE_BONE);
+ sync_types->sequence = sequence_view && (space_outliner->sync_select_dirty &
+ WM_OUTLINER_SYNC_SELECT_FROM_SEQUENCE);
return sync_types->object || sync_types->edit_bone || sync_types->pose_bone ||
sync_types->sequence;
@@ -349,11 +351,11 @@ static void outliner_sync_selection_from_outliner(Scene *scene,
}
/* Set clean outliner and mark other outliners for syncing */
-void ED_outliner_select_sync_from_outliner(bContext *C, SpaceOutliner *soops)
+void ED_outliner_select_sync_from_outliner(bContext *C, SpaceOutliner *space_outliner)
{
/* Don't sync if not checked or in certain outliner display modes */
- if (!(soops->flag & SO_SYNC_SELECT) ||
- ELEM(soops->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS)) {
+ if (!(space_outliner->flag & SO_SYNC_SELECT) ||
+ ELEM(space_outliner->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS)) {
return;
}
@@ -361,7 +363,7 @@ void ED_outliner_select_sync_from_outliner(bContext *C, SpaceOutliner *soops)
ViewLayer *view_layer = CTX_data_view_layer(C);
SyncSelectTypes sync_types;
- outliner_sync_select_from_outliner_set_types(C, soops, &sync_types);
+ outliner_sync_select_from_outliner_set_types(C, space_outliner, &sync_types);
/* To store elements that have been selected to prevent linked object sync errors */
SelectedItems selected_items;
@@ -369,24 +371,24 @@ void ED_outliner_select_sync_from_outliner(bContext *C, SpaceOutliner *soops)
selected_items_init(&selected_items);
outliner_sync_selection_from_outliner(
- scene, view_layer, &soops->tree, &sync_types, &selected_items);
+ scene, view_layer, &space_outliner->tree, &sync_types, &selected_items);
selected_items_free(&selected_items);
/* Tag for updates and clear dirty flag toprevent a sync to the outliner on draw */
if (sync_types.object) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_OBJECT;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_OBJECT;
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
else if (sync_types.edit_bone) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_EDIT_BONE;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_EDIT_BONE;
}
else if (sync_types.pose_bone) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_POSE_BONE;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_POSE_BONE;
}
if (sync_types.sequence) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_SEQUENCE;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_SEQUENCE;
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene);
}
}
@@ -491,7 +493,7 @@ typedef struct SyncSelectActiveData {
/** Sync select and active flags from active view layer, bones, and sequences to the outliner. */
static void outliner_sync_selection_to_outliner(ViewLayer *view_layer,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *tree,
SyncSelectActiveData *active_data,
const SyncSelectTypes *sync_types)
@@ -524,7 +526,8 @@ static void outliner_sync_selection_to_outliner(ViewLayer *view_layer,
}
/* Sync subtree elements */
- outliner_sync_selection_to_outliner(view_layer, soops, &te->subtree, active_data, sync_types);
+ outliner_sync_selection_to_outliner(
+ view_layer, space_outliner, &te->subtree, active_data, sync_types);
}
}
@@ -540,11 +543,12 @@ static void get_sync_select_active_data(const bContext *C, SyncSelectActiveData
}
/* If outliner is dirty sync selection from view layer and sequwncer */
-void outliner_sync_selection(const bContext *C, SpaceOutliner *soops)
+void outliner_sync_selection(const bContext *C, SpaceOutliner *space_outliner)
{
/* Set which types of data to sync from sync dirty flag and outliner display mode */
SyncSelectTypes sync_types;
- const bool sync_required = outliner_sync_select_to_outliner_set_types(C, soops, &sync_types);
+ const bool sync_required = outliner_sync_select_to_outliner_set_types(
+ C, space_outliner, &sync_types);
if (sync_required) {
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -554,20 +558,20 @@ void outliner_sync_selection(const bContext *C, SpaceOutliner *soops)
get_sync_select_active_data(C, &active_data);
outliner_sync_selection_to_outliner(
- view_layer, soops, &soops->tree, &active_data, &sync_types);
+ view_layer, space_outliner, &space_outliner->tree, &active_data, &sync_types);
/* Keep any unsynced data in the dirty flag */
if (sync_types.object) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_OBJECT;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_OBJECT;
}
if (sync_types.edit_bone) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_EDIT_BONE;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_EDIT_BONE;
}
if (sync_types.pose_bone) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_POSE_BONE;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_POSE_BONE;
}
if (sync_types.sequence) {
- soops->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_SEQUENCE;
+ space_outliner->sync_select_dirty &= ~WM_OUTLINER_SYNC_SELECT_FROM_SEQUENCE;
}
}
}
diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c
index 3233529e2d1..6532ff189b5 100644
--- a/source/blender/editors/space_outliner/outliner_tools.c
+++ b/source/blender/editors/space_outliner/outliner_tools.c
@@ -95,7 +95,7 @@
/** \name ID/Library/Data Set/Un-link Utilities
* \{ */
-static void set_operation_types(SpaceOutliner *soops,
+static void set_operation_types(SpaceOutliner *space_outliner,
ListBase *lb,
int *scenelevel,
int *objectlevel,
@@ -192,8 +192,9 @@ static void set_operation_types(SpaceOutliner *soops,
}
}
}
- if (TSELEM_OPEN(tselem, soops)) {
- set_operation_types(soops, &te->subtree, scenelevel, objectlevel, idlevel, datalevel);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ set_operation_types(
+ space_outliner, &te->subtree, scenelevel, objectlevel, idlevel, datalevel);
}
}
}
@@ -393,7 +394,7 @@ static void unlink_world_fn(bContext *UNUSED(C),
static void outliner_do_libdata_operation(bContext *C,
ReportList *reports,
Scene *scene,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
outliner_operation_fn operation_fn,
void *user_data)
@@ -409,9 +410,9 @@ static void outliner_do_libdata_operation(bContext *C,
operation_fn(C, reports, scene, te, tsep, tselem, user_data);
}
}
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
outliner_do_libdata_operation(
- C, reports, scene, soops, &te->subtree, operation_fn, user_data);
+ C, reports, scene, space_outliner, &te->subtree, operation_fn, user_data);
}
}
}
@@ -474,15 +475,15 @@ static bool scene_fn(bContext *C,
static int outliner_scene_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const eOutliner_PropSceneOps event = RNA_enum_get(op->ptr, "type");
- if (outliner_do_scene_operation(C, event, &soops->tree, scene_fn) == false) {
+ if (outliner_do_scene_operation(C, event, &space_outliner->tree, scene_fn) == false) {
return OPERATOR_CANCELLED;
}
if (event == OL_SCENE_OP_DELETE) {
- outliner_cleanup_tree(soops);
+ outliner_cleanup_tree(space_outliner);
ED_undo_push(C, "Delete Scene(s)");
}
else {
@@ -572,12 +573,12 @@ static void merged_element_search_update_fn(const bContext *UNUSED(C),
/* Activate an element from the merged element search menu */
static void merged_element_search_exec_fn(struct bContext *C, void *UNUSED(arg1), void *element)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te = (TreeElement *)element;
- outliner_item_select(C, soops, te, OL_ITEM_SELECT | OL_ITEM_ACTIVATE);
+ outliner_item_select(C, space_outliner, te, OL_ITEM_SELECT | OL_ITEM_ACTIVATE);
- ED_outliner_select_sync_from_outliner(C, soops);
+ ED_outliner_select_sync_from_outliner(C, space_outliner);
}
/**
@@ -670,8 +671,9 @@ static void object_select_hierarchy_fn(bContext *C,
{
/* Don't extend because this toggles, which is nice for Ctrl-Click but not for a menu item.
* it's especially confusing when multiple items are selected since some toggle on/off. */
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
- outliner_item_select(C, soops, te, OL_ITEM_SELECT | OL_ITEM_ACTIVATE | OL_ITEM_RECURSIVE);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
+ outliner_item_select(
+ C, space_outliner, te, OL_ITEM_SELECT | OL_ITEM_ACTIVATE | OL_ITEM_RECURSIVE);
}
static void object_deselect_fn(bContext *C,
@@ -922,7 +924,7 @@ static void singleuser_world_fn(bContext *C,
void outliner_do_object_operation_ex(bContext *C,
ReportList *reports,
Scene *scene_act,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
outliner_operation_fn operation_fn,
void *user_data,
@@ -947,10 +949,16 @@ void outliner_do_object_operation_ex(bContext *C,
select_handled = true;
}
}
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
if ((select_handled == false) || select_recurse) {
- outliner_do_object_operation_ex(
- C, reports, scene_act, soops, &te->subtree, operation_fn, NULL, select_recurse);
+ outliner_do_object_operation_ex(C,
+ reports,
+ scene_act,
+ space_outliner,
+ &te->subtree,
+ operation_fn,
+ NULL,
+ select_recurse);
}
}
}
@@ -959,11 +967,12 @@ void outliner_do_object_operation_ex(bContext *C,
void outliner_do_object_operation(bContext *C,
ReportList *reports,
Scene *scene_act,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
outliner_operation_fn operation_fn)
{
- outliner_do_object_operation_ex(C, reports, scene_act, soops, lb, operation_fn, NULL, true);
+ outliner_do_object_operation_ex(
+ C, reports, scene_act, space_outliner, lb, operation_fn, NULL, true);
}
/** \} */
@@ -1221,7 +1230,7 @@ static void modifier_fn(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem
}
static void outliner_do_data_operation(
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
int type,
int event,
ListBase *lb,
@@ -1238,8 +1247,8 @@ static void outliner_do_data_operation(
operation_fn(event, te, tselem, arg);
}
}
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_do_data_operation(soops, type, event, &te->subtree, operation_fn, arg);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_do_data_operation(space_outliner, type, event, &te->subtree, operation_fn, arg);
}
}
}
@@ -1359,13 +1368,13 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
wmWindow *win = CTX_wm_window(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int event;
const char *str = NULL;
bool selection_changed = false;
/* check for invalid states */
- if (soops == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
@@ -1373,7 +1382,8 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
if (event == OL_OP_SELECT) {
Scene *sce = scene; /* To be able to delete, scenes are set... */
- outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_select_fn);
+ outliner_do_object_operation(
+ C, op->reports, scene, space_outliner, &space_outliner->tree, object_select_fn);
if (scene != sce) {
WM_window_set_active_scene(bmain, C, win, sce);
}
@@ -1383,8 +1393,14 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
}
else if (event == OL_OP_SELECT_HIERARCHY) {
Scene *sce = scene; /* To be able to delete, scenes are set... */
- outliner_do_object_operation_ex(
- C, op->reports, scene, soops, &soops->tree, object_select_hierarchy_fn, NULL, false);
+ outliner_do_object_operation_ex(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ object_select_hierarchy_fn,
+ NULL,
+ false);
if (scene != sce) {
WM_window_set_active_scene(bmain, C, win, sce);
}
@@ -1392,31 +1408,35 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
selection_changed = true;
}
else if (event == OL_OP_DESELECT) {
- outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_deselect_fn);
+ outliner_do_object_operation(
+ C, op->reports, scene, space_outliner, &space_outliner->tree, object_deselect_fn);
str = "Deselect Objects";
selection_changed = true;
}
else if (event == OL_OP_REMAP) {
- outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_fn, NULL);
+ outliner_do_libdata_operation(
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_remap_fn, NULL);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
}
else if (event == OL_OP_LOCALIZED) { /* disabled, see above enum (ton) */
- outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, id_local_fn);
+ outliner_do_object_operation(
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_local_fn);
str = "Localized Objects";
}
else if (event == OL_OP_RENAME) {
- outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, item_rename_fn);
+ outliner_do_object_operation(
+ C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn);
str = "Rename Object";
}
else if (event == OL_OP_OBJECT_MODE_ENTER) {
outliner_do_object_operation(
- C, op->reports, scene, soops, &soops->tree, item_object_mode_enter_fn);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, item_object_mode_enter_fn);
str = "Enter Current Mode";
}
else if (event == OL_OP_OBJECT_MODE_EXIT) {
outliner_do_object_operation(
- C, op->reports, scene, soops, &soops->tree, item_object_mode_exit_fn);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, item_object_mode_exit_fn);
str = "Exit Current Mode";
}
else {
@@ -1497,7 +1517,7 @@ static int outliner_delete_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
const Base *basact_prev = BASACT(view_layer);
@@ -1507,8 +1527,12 @@ static int outliner_delete_exec(bContext *C, wmOperator *op)
/* Get selected objects skipping duplicates to prevent deleting objects linked to multiple
* collections twice */
GSet *objects_to_delete = BLI_gset_ptr_new(__func__);
- outliner_tree_traverse(
- soops, &soops->tree, 0, TSE_SELECTED, outliner_find_objects_to_delete, objects_to_delete);
+ outliner_tree_traverse(space_outliner,
+ &space_outliner->tree,
+ 0,
+ TSE_SELECTED,
+ outliner_find_objects_to_delete,
+ objects_to_delete);
if (delete_hierarchy) {
BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
@@ -1531,7 +1555,7 @@ static int outliner_delete_exec(bContext *C, wmOperator *op)
* outliner several mouse events can be handled in one cycle without
* handling notifiers/redraw which leads to deleting the same object twice.
* cleanup tree here to prevent such cases. */
- outliner_cleanup_tree(soops);
+ outliner_cleanup_tree(space_outliner);
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
@@ -1650,7 +1674,7 @@ static bool outliner_id_operation_item_poll(bContext *C,
PropertyRNA *UNUSED(prop),
const int enum_value)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
switch (enum_value) {
case OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE:
@@ -1660,7 +1684,7 @@ static bool outliner_id_operation_item_poll(bContext *C,
case OUTLINER_IDOP_OVERRIDE_LIBRARY_RESET_HIERARCHY:
return true;
case OUTLINER_IDOP_SINGLE:
- if (!soops || ELEM(soops->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
+ if (!space_outliner || ELEM(space_outliner->outlinevis, SO_SCENES, SO_VIEW_LAYER)) {
return true;
}
/* TODO (dalai): enable in the few cases where this can be supported
@@ -1698,16 +1722,17 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
Scene *scene = CTX_data_scene(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerIdOpTypes event;
/* check for invalid states */
- if (soops == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
event = RNA_enum_get(op->ptr, "type");
@@ -1716,7 +1741,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
/* unlink datablock from its parent */
if (objectlevel) {
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, unlink_object_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, unlink_object_fn, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, NULL);
ED_undo_push(C, "Unlink Object");
@@ -1725,36 +1750,56 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
switch (idlevel) {
case ID_AC:
- outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, unlink_action_fn, NULL);
+ outliner_do_libdata_operation(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ unlink_action_fn,
+ NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Unlink action");
break;
case ID_MA:
- outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, unlink_material_fn, NULL);
+ outliner_do_libdata_operation(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ unlink_material_fn,
+ NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
ED_undo_push(C, "Unlink material");
break;
case ID_TE:
- outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, unlink_texture_fn, NULL);
+ outliner_do_libdata_operation(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ unlink_texture_fn,
+ NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
ED_undo_push(C, "Unlink texture");
break;
case ID_WO:
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, unlink_world_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, unlink_world_fn, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
ED_undo_push(C, "Unlink world");
break;
case ID_GR:
- outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, unlink_collection_fn, NULL);
+ outliner_do_libdata_operation(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ unlink_collection_fn,
+ NULL);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, NULL);
ED_undo_push(C, "Unlink Collection");
@@ -1767,7 +1812,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
case OUTLINER_IDOP_LOCAL: {
/* make local */
- outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_local_fn, NULL);
+ outliner_do_libdata_operation(
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_local_fn, NULL);
ED_undo_push(C, "Localized Data");
break;
}
@@ -1776,8 +1822,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
outliner_do_libdata_operation(C,
op->reports,
scene,
- soops,
- &soops->tree,
+ space_outliner,
+ &space_outliner->tree,
id_override_library_create_fn,
&(OutlinerLibOverrideData){.do_hierarchy = false});
ED_undo_push(C, "Overridden Data");
@@ -1788,8 +1834,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
outliner_do_libdata_operation(C,
op->reports,
scene,
- soops,
- &soops->tree,
+ space_outliner,
+ &space_outliner->tree,
id_override_library_create_fn,
&(OutlinerLibOverrideData){.do_hierarchy = true});
ED_undo_push(C, "Overridden Data Hierarchy");
@@ -1800,8 +1846,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
outliner_do_libdata_operation(C,
op->reports,
scene,
- soops,
- &soops->tree,
+ space_outliner,
+ &space_outliner->tree,
id_override_library_reset_fn,
&(OutlinerLibOverrideData){.do_hierarchy = false});
ED_undo_push(C, "Reset Overridden Data");
@@ -1812,8 +1858,8 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
outliner_do_libdata_operation(C,
op->reports,
scene,
- soops,
- &soops->tree,
+ space_outliner,
+ &space_outliner->tree,
id_override_library_reset_fn,
&(OutlinerLibOverrideData){.do_hierarchy = true});
ED_undo_push(C, "Reset Overridden Data Hierarchy");
@@ -1823,16 +1869,26 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
/* make single user */
switch (idlevel) {
case ID_AC:
- outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, singleuser_action_fn, NULL);
+ outliner_do_libdata_operation(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ singleuser_action_fn,
+ NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Single-User Action");
break;
case ID_WO:
- outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, singleuser_world_fn, NULL);
+ outliner_do_libdata_operation(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ singleuser_world_fn,
+ NULL);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
ED_undo_push(C, "Single-User World");
@@ -1847,7 +1903,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_DELETE: {
if (idlevel > 0) {
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, id_delete_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_delete_fn, NULL);
ED_undo_push(C, "Delete");
}
break;
@@ -1855,7 +1911,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_REMAP: {
if (idlevel > 0) {
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, id_remap_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_remap_fn, NULL);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
}
@@ -1879,7 +1935,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_FAKE_ADD: {
/* set fake user */
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, id_fake_user_set_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_fake_user_set_fn, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Add Fake User");
@@ -1887,8 +1943,13 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
case OUTLINER_IDOP_FAKE_CLEAR: {
/* clear fake user */
- outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, id_fake_user_clear_fn, NULL);
+ outliner_do_libdata_operation(C,
+ op->reports,
+ scene,
+ space_outliner,
+ &space_outliner->tree,
+ id_fake_user_clear_fn,
+ NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Clear Fake User");
@@ -1897,7 +1958,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_RENAME: {
/* rename */
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, item_rename_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Rename");
@@ -1905,7 +1966,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
case OUTLINER_IDOP_SELECT_LINKED:
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, id_select_linked_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_select_linked_fn, NULL);
ED_outliner_select_sync_from_all_tag(C);
ED_undo_push(C, "Select");
break;
@@ -1975,23 +2036,24 @@ static const EnumPropertyItem outliner_lib_op_type_items[] = {
static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutlinerLibOpTypes event;
/* check for invalid states */
- if (soops == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
event = RNA_enum_get(op->ptr, "type");
switch (event) {
case OL_LIB_RENAME: {
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, item_rename_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
ED_undo_push(C, "Rename Library");
@@ -1999,20 +2061,20 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
}
case OL_LIB_DELETE: {
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, id_delete_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, id_delete_fn, NULL);
ED_undo_push(C, "Delete Library");
break;
}
case OL_LIB_RELOCATE: {
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, lib_relocate_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, lib_relocate_fn, NULL);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
break;
}
case OL_LIB_RELOAD: {
outliner_do_libdata_operation(
- C, op->reports, scene, soops, &soops->tree, lib_reload_fn, NULL);
+ C, op->reports, scene, space_outliner, &space_outliner->tree, lib_reload_fn, NULL);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
break;
@@ -2053,7 +2115,7 @@ void OUTLINER_OT_lib_operation(wmOperatorType *ot)
* \{ */
static void outliner_do_id_set_operation(
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
int type,
ListBase *lb,
ID *newid,
@@ -2070,8 +2132,8 @@ static void outliner_do_id_set_operation(
operation_fn(te, tselem, tsep, newid);
}
}
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_do_id_set_operation(soops, type, &te->subtree, newid, operation_fn);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_do_id_set_operation(space_outliner, type, &te->subtree, newid, operation_fn);
}
}
}
@@ -2100,16 +2162,17 @@ static void actionset_id_fn(TreeElement *UNUSED(te),
static int outliner_action_set_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
bAction *act;
/* check for invalid states */
- if (soops == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
/* get action to use */
act = BLI_findlink(&bmain->actions, RNA_enum_get(op->ptr, "action"));
@@ -2131,10 +2194,12 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
/* perform action if valid channel */
if (datalevel == TSE_ANIM_DATA) {
- outliner_do_id_set_operation(soops, datalevel, &soops->tree, (ID *)act, actionset_id_fn);
+ outliner_do_id_set_operation(
+ space_outliner, datalevel, &space_outliner->tree, (ID *)act, actionset_id_fn);
}
else if (idlevel == ID_AC) {
- outliner_do_id_set_operation(soops, idlevel, &soops->tree, (ID *)act, actionset_id_fn);
+ outliner_do_id_set_operation(
+ space_outliner, idlevel, &space_outliner->tree, (ID *)act, actionset_id_fn);
}
else {
return OPERATOR_CANCELLED;
@@ -2212,17 +2277,18 @@ static const EnumPropertyItem prop_animdata_op_types[] = {
static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
{
wmWindowManager *wm = CTX_wm_manager(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_AnimDataOps event;
/* check for invalid states */
- if (soops == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
event = RNA_enum_get(op->ptr, "type");
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
if (datalevel != TSE_ANIM_DATA) {
return OPERATOR_CANCELLED;
@@ -2232,7 +2298,8 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
switch (event) {
case OUTLINER_ANIMOP_CLEAR_ADT:
/* Remove Animation Data - this may remove the active action, in some cases... */
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, clear_animdata_fn, NULL);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, clear_animdata_fn, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Clear Animation Data");
@@ -2249,15 +2316,19 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_ANIMOP_CLEAR_ACT:
/* clear active action - using standard rules */
outliner_do_data_operation(
- soops, datalevel, event, &soops->tree, unlinkact_animdata_fn, NULL);
+ space_outliner, datalevel, event, &space_outliner->tree, unlinkact_animdata_fn, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
ED_undo_push(C, "Unlink action");
break;
case OUTLINER_ANIMOP_REFRESH_DRV:
- outliner_do_data_operation(
- soops, datalevel, event, &soops->tree, refreshdrivers_animdata_fn, NULL);
+ outliner_do_data_operation(space_outliner,
+ datalevel,
+ event,
+ &space_outliner->tree,
+ refreshdrivers_animdata_fn,
+ NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
/* ED_undo_push(C, "Refresh Drivers"); No undo needed - shouldn't have any impact? */
@@ -2265,7 +2336,7 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_ANIMOP_CLEAR_DRV:
outliner_do_data_operation(
- soops, datalevel, event, &soops->tree, cleardrivers_animdata_fn, NULL);
+ space_outliner, datalevel, event, &space_outliner->tree, cleardrivers_animdata_fn, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
ED_undo_push(C, "Clear Drivers");
@@ -2312,17 +2383,19 @@ static const EnumPropertyItem prop_constraint_op_types[] = {
static int outliner_constraint_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropConstraintOps event;
event = RNA_enum_get(op->ptr, "type");
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, constraint_fn, C);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, constraint_fn, C);
if (event == OL_CONSTRAINTOP_DELETE) {
- outliner_cleanup_tree(soops);
+ outliner_cleanup_tree(space_outliner);
}
ED_undo_push(C, "Constraint operation");
@@ -2362,17 +2435,19 @@ static const EnumPropertyItem prop_modifier_op_types[] = {
static int outliner_modifier_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropModifierOps event;
event = RNA_enum_get(op->ptr, "type");
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, modifier_fn, C);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, modifier_fn, C);
if (event == OL_MODIFIER_OP_DELETE) {
- outliner_cleanup_tree(soops);
+ outliner_cleanup_tree(space_outliner);
}
ED_undo_push(C, "Modifier operation");
@@ -2414,35 +2489,39 @@ static const EnumPropertyItem prop_data_op_types[] = {
static int outliner_data_operation_exec(bContext *C, wmOperator *op)
{
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
eOutliner_PropDataOps event;
/* check for invalid states */
- if (soops == NULL) {
+ if (space_outliner == NULL) {
return OPERATOR_CANCELLED;
}
event = RNA_enum_get(op->ptr, "type");
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
switch (datalevel) {
case TSE_POSE_CHANNEL: {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, pchan_fn, NULL);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, pchan_fn, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
ED_undo_push(C, "PoseChannel operation");
break;
}
case TSE_BONE: {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, bone_fn, NULL);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, bone_fn, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
ED_undo_push(C, "Bone operation");
break;
}
case TSE_EBONE: {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, ebone_fn, NULL);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, ebone_fn, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
ED_undo_push(C, "EditBone operation");
@@ -2450,12 +2529,14 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
}
case TSE_SEQUENCE: {
Scene *scene = CTX_data_scene(C);
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, sequence_fn, scene);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, sequence_fn, scene);
break;
}
case TSE_GP_LAYER: {
- outliner_do_data_operation(soops, datalevel, event, &soops->tree, gpencil_layer_fn, NULL);
+ outliner_do_data_operation(
+ space_outliner, datalevel, event, &space_outliner->tree, gpencil_layer_fn, NULL);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
ED_undo_push(C, "Grease Pencil Layer operation");
@@ -2464,7 +2545,7 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
case TSE_RNA_STRUCT:
if (event == OL_DOP_SELECT_LINKED) {
outliner_do_data_operation(
- soops, datalevel, event, &soops->tree, data_select_linked_fn, C);
+ space_outliner, datalevel, event, &space_outliner->tree, data_select_linked_fn, C);
}
break;
@@ -2518,8 +2599,11 @@ static int outliner_operator_menu(bContext *C, const char *opname)
return OPERATOR_INTERFACE;
}
-static int do_outliner_operation_event(
- bContext *C, ARegion *region, SpaceOutliner *soops, TreeElement *te, const float mval[2])
+static int do_outliner_operation_event(bContext *C,
+ ARegion *region,
+ SpaceOutliner *space_outliner,
+ TreeElement *te,
+ const float mval[2])
{
ReportList *reports = CTX_wm_reports(C); /* XXX... */
@@ -2530,8 +2614,8 @@ static int do_outliner_operation_event(
/* select object that's clicked on and popup context menu */
if (!(tselem->flag & TSE_SELECTED)) {
- if (outliner_flag_is_any_test(&soops->tree, TSE_SELECTED, 1)) {
- outliner_flag_set(&soops->tree, TSE_SELECTED, 0);
+ if (outliner_flag_is_any_test(&space_outliner->tree, TSE_SELECTED, 1)) {
+ outliner_flag_set(&space_outliner->tree, TSE_SELECTED, 0);
}
tselem->flag |= TSE_SELECTED;
@@ -2539,10 +2623,11 @@ static int do_outliner_operation_event(
/* Only redraw, don't rebuild here because TreeElement pointers will
* become invalid and operations will crash. */
ED_region_tag_redraw_no_rebuild(region);
- ED_outliner_select_sync_from_outliner(C, soops);
+ ED_outliner_select_sync_from_outliner(C, space_outliner);
}
- set_operation_types(soops, &soops->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
+ set_operation_types(
+ space_outliner, &space_outliner->tree, &scenelevel, &objectlevel, &idlevel, &datalevel);
if (scenelevel) {
if (objectlevel || datalevel || idlevel) {
@@ -2611,7 +2696,7 @@ static int do_outliner_operation_event(
}
for (te = te->subtree.first; te; te = te->next) {
- int retval = do_outliner_operation_event(C, region, soops, te, mval);
+ int retval = do_outliner_operation_event(C, region, space_outliner, te, mval);
if (retval) {
return retval;
}
@@ -2623,7 +2708,7 @@ static int do_outliner_operation_event(
static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
uiBut *but = UI_context_active_but_get(C);
TreeElement *te;
float fmval[2];
@@ -2634,8 +2719,8 @@ static int outliner_operation(bContext *C, wmOperator *UNUSED(op), const wmEvent
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &fmval[0], &fmval[1]);
- for (te = soops->tree.first; te; te = te->next) {
- int retval = do_outliner_operation_event(C, region, soops, te, fmval);
+ for (te = space_outliner->tree.first; te; te = te->next) {
+ int retval = do_outliner_operation_event(C, region, space_outliner, te, fmval);
if (retval) {
return retval;
}
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index e1d92c551c3..6eaed649c6c 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -88,7 +88,7 @@
#endif
/* prototypes */
-static TreeElement *outliner_add_collection_recursive(SpaceOutliner *soops,
+static TreeElement *outliner_add_collection_recursive(SpaceOutliner *space_outliner,
Collection *collection,
TreeElement *ten);
static void outliner_make_object_parent_hierarchy(ListBase *lb);
@@ -96,9 +96,9 @@ static void outliner_make_object_parent_hierarchy(ListBase *lb);
/* ********************************************************* */
/* Persistent Data */
-static void outliner_storage_cleanup(SpaceOutliner *soops)
+static void outliner_storage_cleanup(SpaceOutliner *space_outliner)
{
- BLI_mempool *ts = soops->treestore;
+ BLI_mempool *ts = space_outliner->treestore;
if (ts) {
TreeStoreElem *tselem;
@@ -114,8 +114,8 @@ static void outliner_storage_cleanup(SpaceOutliner *soops)
/* cleanup only after reading file or undo step, and always for
* RNA data-blocks view in order to save memory */
- if (soops->storeflag & SO_TREESTORE_CLEANUP) {
- soops->storeflag &= ~SO_TREESTORE_CLEANUP;
+ if (space_outliner->storeflag & SO_TREESTORE_CLEANUP) {
+ space_outliner->storeflag &= ~SO_TREESTORE_CLEANUP;
BLI_mempool_iternew(ts, &iter);
while ((tselem = BLI_mempool_iterstep(&iter))) {
@@ -127,10 +127,10 @@ static void outliner_storage_cleanup(SpaceOutliner *soops)
if (unused) {
if (BLI_mempool_len(ts) == unused) {
BLI_mempool_destroy(ts);
- soops->treestore = NULL;
- if (soops->treehash) {
- BKE_outliner_treehash_free(soops->treehash);
- soops->treehash = NULL;
+ space_outliner->treestore = NULL;
+ if (space_outliner->treehash) {
+ BKE_outliner_treehash_free(space_outliner->treehash);
+ space_outliner->treehash = NULL;
}
}
else {
@@ -145,35 +145,39 @@ static void outliner_storage_cleanup(SpaceOutliner *soops)
}
}
BLI_mempool_destroy(ts);
- soops->treestore = new_ts;
- if (soops->treehash) {
+ space_outliner->treestore = new_ts;
+ if (space_outliner->treehash) {
/* update hash table to fix broken pointers */
- BKE_outliner_treehash_rebuild_from_treestore(soops->treehash, soops->treestore);
+ BKE_outliner_treehash_rebuild_from_treestore(space_outliner->treehash,
+ space_outliner->treestore);
}
}
}
}
- else if (soops->treehash) {
- BKE_outliner_treehash_clear_used(soops->treehash);
+ else if (space_outliner->treehash) {
+ BKE_outliner_treehash_clear_used(space_outliner->treehash);
}
}
}
-static void check_persistent(SpaceOutliner *soops, TreeElement *te, ID *id, short type, short nr)
+static void check_persistent(
+ SpaceOutliner *space_outliner, TreeElement *te, ID *id, short type, short nr)
{
TreeStoreElem *tselem;
- if (soops->treestore == NULL) {
+ if (space_outliner->treestore == NULL) {
/* if treestore was not created in readfile.c, create it here */
- soops->treestore = BLI_mempool_create(sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
+ space_outliner->treestore = BLI_mempool_create(
+ sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
}
- if (soops->treehash == NULL) {
- soops->treehash = BKE_outliner_treehash_create_from_treestore(soops->treestore);
+ if (space_outliner->treehash == NULL) {
+ space_outliner->treehash = BKE_outliner_treehash_create_from_treestore(
+ space_outliner->treestore);
}
/* find any unused tree element in treestore and mark it as used
* (note that there may be multiple unused elements in case of linked objects) */
- tselem = BKE_outliner_treehash_lookup_unused(soops->treehash, type, nr, id);
+ tselem = BKE_outliner_treehash_lookup_unused(space_outliner->treehash, type, nr, id);
if (tselem) {
te->store_elem = tselem;
tselem->used = 1;
@@ -181,14 +185,14 @@ static void check_persistent(SpaceOutliner *soops, TreeElement *te, ID *id, shor
}
/* add 1 element to treestore */
- tselem = BLI_mempool_alloc(soops->treestore);
+ tselem = BLI_mempool_alloc(space_outliner->treestore);
tselem->type = type;
tselem->nr = type ? nr : 0;
tselem->id = id;
tselem->used = 0;
tselem->flag = TSE_CLOSED;
te->store_elem = tselem;
- BKE_outliner_treehash_add_element(soops->treehash, tselem);
+ BKE_outliner_treehash_add_element(space_outliner->treehash, tselem);
}
/* ********************************************************* */
@@ -202,10 +206,10 @@ void outliner_free_tree(ListBase *tree)
}
}
-void outliner_cleanup_tree(SpaceOutliner *soops)
+void outliner_cleanup_tree(SpaceOutliner *space_outliner)
{
- outliner_free_tree(&soops->tree);
- outliner_storage_cleanup(soops);
+ outliner_free_tree(&space_outliner->tree);
+ outliner_storage_cleanup(space_outliner);
}
/**
@@ -230,8 +234,12 @@ void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree)
/* ********************************************************* */
/* Prototype, see functions below */
-static TreeElement *outliner_add_element(
- SpaceOutliner *soops, ListBase *lb, void *idv, TreeElement *parent, short type, short index);
+static TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
+ ListBase *lb,
+ void *idv,
+ TreeElement *parent,
+ short type,
+ short index);
/* -------------------------------------------------------- */
@@ -247,17 +255,21 @@ bool outliner_element_needs_rebuild_on_open_change(const TreeStoreElem *tselem)
}
/* special handling of hierarchical non-lib data */
-static void outliner_add_bone(
- SpaceOutliner *soops, ListBase *lb, ID *id, Bone *curBone, TreeElement *parent, int *a)
+static void outliner_add_bone(SpaceOutliner *space_outliner,
+ ListBase *lb,
+ ID *id,
+ Bone *curBone,
+ TreeElement *parent,
+ int *a)
{
- TreeElement *te = outliner_add_element(soops, lb, id, parent, TSE_BONE, *a);
+ TreeElement *te = outliner_add_element(space_outliner, lb, id, parent, TSE_BONE, *a);
(*a)++;
te->name = curBone->name;
te->directdata = curBone;
for (curBone = curBone->childbase.first; curBone; curBone = curBone->next) {
- outliner_add_bone(soops, &te->subtree, id, curBone, te, a);
+ outliner_add_bone(space_outliner, &te->subtree, id, curBone, te, a);
}
}
@@ -270,7 +282,7 @@ static bool outliner_animdata_test(AnimData *adt)
}
#ifdef WITH_FREESTYLE
-static void outliner_add_line_styles(SpaceOutliner *soops,
+static void outliner_add_line_styles(SpaceOutliner *space_outliner,
ListBase *lb,
Scene *sce,
TreeElement *te)
@@ -294,75 +306,81 @@ static void outliner_add_line_styles(SpaceOutliner *soops,
continue;
}
linestyle->id.tag &= ~LIB_TAG_DOIT;
- outliner_add_element(soops, lb, linestyle, te, 0, 0);
+ outliner_add_element(space_outliner, lb, linestyle, te, 0, 0);
}
}
}
}
#endif
-static void outliner_add_scene_contents(SpaceOutliner *soops,
+static void outliner_add_scene_contents(SpaceOutliner *space_outliner,
ListBase *lb,
Scene *sce,
TreeElement *te)
{
/* View layers */
- TreeElement *ten = outliner_add_element(soops, lb, sce, te, TSE_R_LAYER_BASE, 0);
+ TreeElement *ten = outliner_add_element(space_outliner, lb, sce, te, TSE_R_LAYER_BASE, 0);
ten->name = IFACE_("View Layers");
ViewLayer *view_layer;
for (view_layer = sce->view_layers.first; view_layer; view_layer = view_layer->next) {
- TreeElement *tenlay = outliner_add_element(soops, &ten->subtree, sce, ten, TSE_R_LAYER, 0);
+ TreeElement *tenlay = outliner_add_element(
+ space_outliner, &ten->subtree, sce, ten, TSE_R_LAYER, 0);
tenlay->name = view_layer->name;
tenlay->directdata = view_layer;
}
/* World */
- outliner_add_element(soops, lb, sce->world, te, 0, 0);
+ outliner_add_element(space_outliner, lb, sce->world, te, 0, 0);
/* Collections */
- ten = outliner_add_element(soops, lb, &sce->id, te, TSE_SCENE_COLLECTION_BASE, 0);
+ ten = outliner_add_element(space_outliner, lb, &sce->id, te, TSE_SCENE_COLLECTION_BASE, 0);
ten->name = IFACE_("Scene Collection");
- outliner_add_collection_recursive(soops, sce->master_collection, ten);
+ outliner_add_collection_recursive(space_outliner, sce->master_collection, ten);
/* Objects */
- ten = outliner_add_element(soops, lb, sce, te, TSE_SCENE_OBJECTS_BASE, 0);
+ ten = outliner_add_element(space_outliner, lb, sce, te, TSE_SCENE_OBJECTS_BASE, 0);
ten->name = IFACE_("Objects");
FOREACH_SCENE_OBJECT_BEGIN (sce, ob) {
- outliner_add_element(soops, &ten->subtree, ob, ten, 0, 0);
+ outliner_add_element(space_outliner, &ten->subtree, ob, ten, 0, 0);
}
FOREACH_SCENE_OBJECT_END;
outliner_make_object_parent_hierarchy(&ten->subtree);
/* Animation Data */
if (outliner_animdata_test(sce->adt)) {
- outliner_add_element(soops, lb, sce, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, lb, sce, te, TSE_ANIM_DATA, 0);
}
}
/* Can be inlined if necessary. */
-static void outliner_add_object_contents(SpaceOutliner *soops,
+static void outliner_add_object_contents(SpaceOutliner *space_outliner,
TreeElement *te,
TreeStoreElem *tselem,
Object *ob)
{
if (outliner_animdata_test(ob->adt)) {
- outliner_add_element(soops, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
}
- outliner_add_element(
- soops, &te->subtree, ob->poselib, te, 0, 0); /* XXX FIXME.. add a special type for this. */
+ outliner_add_element(space_outliner,
+ &te->subtree,
+ ob->poselib,
+ te,
+ 0,
+ 0); /* XXX FIXME.. add a special type for this. */
if (ob->proxy && !ID_IS_LINKED(ob)) {
- outliner_add_element(soops, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
+ outliner_add_element(space_outliner, &te->subtree, ob->proxy, te, TSE_PROXY, 0);
}
- outliner_add_element(soops, &te->subtree, ob->data, te, 0, 0);
+ outliner_add_element(space_outliner, &te->subtree, ob->data, te, 0, 0);
if (ob->pose) {
bArmature *arm = ob->data;
bPoseChannel *pchan;
- TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0);
+ TreeElement *tenla = outliner_add_element(
+ space_outliner, &te->subtree, ob, te, TSE_POSE_BASE, 0);
tenla->name = IFACE_("Pose");
@@ -372,7 +390,8 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
int a = 0, const_index = 1000; /* ensure unique id for bone constraints */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next, a++) {
- ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
+ ten = outliner_add_element(
+ space_outliner, &tenla->subtree, ob, tenla, TSE_POSE_CHANNEL, a);
ten->name = pchan->name;
ten->directdata = pchan;
pchan->temp = (void *)ten;
@@ -382,13 +401,13 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
bConstraint *con;
TreeElement *ten1;
TreeElement *tenla1 = outliner_add_element(
- soops, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
+ space_outliner, &ten->subtree, ob, ten, TSE_CONSTRAINT_BASE, 0);
/* char *str; */
tenla1->name = IFACE_("Constraints");
for (con = pchan->constraints.first; con; con = con->next, const_index++) {
ten1 = outliner_add_element(
- soops, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
+ space_outliner, &tenla1->subtree, ob, tenla1, TSE_CONSTRAINT, const_index);
#if 0 /* disabled as it needs to be reworked for recoded constraints system */
target = get_constraint_target(con, &str);
if (str && str[0]) {
@@ -429,13 +448,14 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
if (ob->pose->agroups.first) {
bActionGroup *agrp;
TreeElement *ten_bonegrp = outliner_add_element(
- soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
+ space_outliner, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
int a = 0;
ten_bonegrp->name = IFACE_("Bone Groups");
for (agrp = ob->pose->agroups.first; agrp; agrp = agrp->next, a++) {
TreeElement *ten;
- ten = outliner_add_element(soops, &ten_bonegrp->subtree, ob, ten_bonegrp, TSE_POSEGRP, a);
+ ten = outliner_add_element(
+ space_outliner, &ten_bonegrp->subtree, ob, ten_bonegrp, TSE_POSEGRP, a);
ten->name = agrp->name;
ten->directdata = agrp;
}
@@ -443,20 +463,21 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
}
for (int a = 0; a < ob->totcol; a++) {
- outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
+ outliner_add_element(space_outliner, &te->subtree, ob->mat[a], te, 0, a);
}
if (ob->constraints.first) {
/* Object *target; */
bConstraint *con;
TreeElement *ten;
- TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
+ TreeElement *tenla = outliner_add_element(
+ space_outliner, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
/* char *str; */
int a;
tenla->name = IFACE_("Constraints");
for (con = ob->constraints.first, a = 0; con; con = con->next, a++) {
- ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
+ ten = outliner_add_element(space_outliner, &tenla->subtree, ob, tenla, TSE_CONSTRAINT, a);
#if 0 /* disabled due to constraints system targets recode... code here needs review */
target = get_constraint_target(con, &str);
if (str && str[0]) {
@@ -477,37 +498,54 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
if (ob->modifiers.first) {
ModifierData *md;
- TreeElement *ten_mod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
+ TreeElement *ten_mod = outliner_add_element(
+ space_outliner, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
int index;
ten_mod->name = IFACE_("Modifiers");
for (index = 0, md = ob->modifiers.first; md; index++, md = md->next) {
TreeElement *ten = outliner_add_element(
- soops, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index);
+ space_outliner, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index);
ten->name = md->name;
ten->directdata = md;
if (md->type == eModifierType_Lattice) {
- outliner_add_element(
- soops, &ten->subtree, ((LatticeModifierData *)md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(space_outliner,
+ &ten->subtree,
+ ((LatticeModifierData *)md)->object,
+ ten,
+ TSE_LINKED_OB,
+ 0);
}
else if (md->type == eModifierType_Curve) {
- outliner_add_element(
- soops, &ten->subtree, ((CurveModifierData *)md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(space_outliner,
+ &ten->subtree,
+ ((CurveModifierData *)md)->object,
+ ten,
+ TSE_LINKED_OB,
+ 0);
}
else if (md->type == eModifierType_Armature) {
- outliner_add_element(
- soops, &ten->subtree, ((ArmatureModifierData *)md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(space_outliner,
+ &ten->subtree,
+ ((ArmatureModifierData *)md)->object,
+ ten,
+ TSE_LINKED_OB,
+ 0);
}
else if (md->type == eModifierType_Hook) {
- outliner_add_element(
- soops, &ten->subtree, ((HookModifierData *)md)->object, ten, TSE_LINKED_OB, 0);
+ outliner_add_element(space_outliner,
+ &ten->subtree,
+ ((HookModifierData *)md)->object,
+ ten,
+ TSE_LINKED_OB,
+ 0);
}
else if (md->type == eModifierType_ParticleSystem) {
ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys;
TreeElement *ten_psys;
- ten_psys = outliner_add_element(soops, &ten->subtree, ob, te, TSE_LINKED_PSYS, 0);
+ ten_psys = outliner_add_element(space_outliner, &ten->subtree, ob, te, TSE_LINKED_PSYS, 0);
ten_psys->directdata = psys;
ten_psys->name = psys->part->id.name + 2;
}
@@ -518,12 +556,13 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
if (ob->defbase.first) {
bDeformGroup *defgroup;
TreeElement *ten;
- TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
+ TreeElement *tenla = outliner_add_element(
+ space_outliner, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
int a;
tenla->name = IFACE_("Vertex Groups");
for (defgroup = ob->defbase.first, a = 0; defgroup; defgroup = defgroup->next, a++) {
- ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
+ ten = outliner_add_element(space_outliner, &tenla->subtree, ob, tenla, TSE_DEFGROUP, a);
ten->name = defgroup->name;
ten->directdata = defgroup;
}
@@ -531,12 +570,12 @@ static void outliner_add_object_contents(SpaceOutliner *soops,
/* duplicated group */
if (ob->instance_collection && (ob->transflag & OB_DUPLICOLLECTION)) {
- outliner_add_element(soops, &te->subtree, ob->instance_collection, te, 0, 0);
+ outliner_add_element(space_outliner, &te->subtree, ob->instance_collection, te, 0, 0);
}
}
/* Can be inlined if necessary. */
-static void outliner_add_id_contents(SpaceOutliner *soops,
+static void outliner_add_id_contents(SpaceOutliner *space_outliner,
TreeElement *te,
TreeStoreElem *tselem,
ID *id)
@@ -553,11 +592,11 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
break;
}
case ID_SCE: {
- outliner_add_scene_contents(soops, &te->subtree, (Scene *)id, te);
+ outliner_add_scene_contents(space_outliner, &te->subtree, (Scene *)id, te);
break;
}
case ID_OB: {
- outliner_add_object_contents(soops, te, tselem, (Object *)id);
+ outliner_add_object_contents(space_outliner, te, tselem, (Object *)id);
break;
}
case ID_ME: {
@@ -565,12 +604,12 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
int a;
if (outliner_animdata_test(me->adt)) {
- outliner_add_element(soops, &te->subtree, me, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, me, te, TSE_ANIM_DATA, 0);
}
- outliner_add_element(soops, &te->subtree, me->key, te, 0, 0);
+ outliner_add_element(space_outliner, &te->subtree, me->key, te, 0, 0);
for (a = 0; a < me->totcol; a++) {
- outliner_add_element(soops, &te->subtree, me->mat[a], te, 0, a);
+ outliner_add_element(space_outliner, &te->subtree, me->mat[a], te, 0, a);
}
/* could do tfaces with image links, but the images are not grouped nicely.
* would require going over all tfaces, sort images in use. etc... */
@@ -581,11 +620,11 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
int a;
if (outliner_animdata_test(cu->adt)) {
- outliner_add_element(soops, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, cu, te, TSE_ANIM_DATA, 0);
}
for (a = 0; a < cu->totcol; a++) {
- outliner_add_element(soops, &te->subtree, cu->mat[a], te, 0, a);
+ outliner_add_element(space_outliner, &te->subtree, cu->mat[a], te, 0, a);
}
break;
}
@@ -594,11 +633,11 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
int a;
if (outliner_animdata_test(mb->adt)) {
- outliner_add_element(soops, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, mb, te, TSE_ANIM_DATA, 0);
}
for (a = 0; a < mb->totcol; a++) {
- outliner_add_element(soops, &te->subtree, mb->mat[a], te, 0, a);
+ outliner_add_element(space_outliner, &te->subtree, mb->mat[a], te, 0, a);
}
break;
}
@@ -606,7 +645,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
Material *ma = (Material *)id;
if (outliner_animdata_test(ma->adt)) {
- outliner_add_element(soops, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, ma, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -614,16 +653,16 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
Tex *tex = (Tex *)id;
if (outliner_animdata_test(tex->adt)) {
- outliner_add_element(soops, &te->subtree, tex, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, tex, te, TSE_ANIM_DATA, 0);
}
- outliner_add_element(soops, &te->subtree, tex->ima, te, 0, 0);
+ outliner_add_element(space_outliner, &te->subtree, tex->ima, te, 0, 0);
break;
}
case ID_CA: {
Camera *ca = (Camera *)id;
if (outliner_animdata_test(ca->adt)) {
- outliner_add_element(soops, &te->subtree, ca, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, ca, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -631,7 +670,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
CacheFile *cache_file = (CacheFile *)id;
if (outliner_animdata_test(cache_file->adt)) {
- outliner_add_element(soops, &te->subtree, cache_file, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, cache_file, te, TSE_ANIM_DATA, 0);
}
break;
@@ -640,7 +679,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
Light *la = (Light *)id;
if (outliner_animdata_test(la->adt)) {
- outliner_add_element(soops, &te->subtree, la, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, la, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -648,7 +687,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
Speaker *spk = (Speaker *)id;
if (outliner_animdata_test(spk->adt)) {
- outliner_add_element(soops, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, spk, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -656,7 +695,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
LightProbe *prb = (LightProbe *)id;
if (outliner_animdata_test(prb->adt)) {
- outliner_add_element(soops, &te->subtree, prb, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, prb, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -664,7 +703,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
World *wrld = (World *)id;
if (outliner_animdata_test(wrld->adt)) {
- outliner_add_element(soops, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, wrld, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -672,7 +711,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
Key *key = (Key *)id;
if (outliner_animdata_test(key->adt)) {
- outliner_add_element(soops, &te->subtree, key, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, key, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -686,7 +725,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
int a = 0;
if (outliner_animdata_test(arm->adt)) {
- outliner_add_element(soops, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, arm, te, TSE_ANIM_DATA, 0);
}
if (arm->edbo) {
@@ -694,7 +733,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
TreeElement *ten;
for (ebone = arm->edbo->first; ebone; ebone = ebone->next, a++) {
- ten = outliner_add_element(soops, &te->subtree, id, te, TSE_EBONE, a);
+ ten = outliner_add_element(space_outliner, &te->subtree, id, te, TSE_EBONE, a);
ten->directdata = ebone;
ten->name = ebone->name;
ebone->temp.p = ten;
@@ -722,7 +761,7 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
else {
Bone *curBone;
for (curBone = arm->bonebase.first; curBone; curBone = curBone->next) {
- outliner_add_bone(soops, &te->subtree, id, curBone, te, &a);
+ outliner_add_bone(space_outliner, &te->subtree, id, curBone, te, &a);
}
}
}
@@ -733,12 +772,12 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
int a;
if (outliner_animdata_test(linestyle->adt)) {
- outliner_add_element(soops, &te->subtree, linestyle, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, linestyle, te, TSE_ANIM_DATA, 0);
}
for (a = 0; a < MAX_MTEX; a++) {
if (linestyle->mtex[a]) {
- outliner_add_element(soops, &te->subtree, linestyle->mtex[a]->tex, te, 0, a);
+ outliner_add_element(space_outliner, &te->subtree, linestyle->mtex[a]->tex, te, 0, a);
}
}
break;
@@ -749,12 +788,12 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
int a = 0;
if (outliner_animdata_test(gpd->adt)) {
- outliner_add_element(soops, &te->subtree, gpd, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, gpd, te, TSE_ANIM_DATA, 0);
}
/* TODO: base element for layers? */
for (gpl = gpd->layers.last; gpl; gpl = gpl->prev) {
- outliner_add_element(soops, &te->subtree, gpl, te, TSE_GP_LAYER, a);
+ outliner_add_element(space_outliner, &te->subtree, gpl, te, TSE_GP_LAYER, a);
a++;
}
break;
@@ -763,35 +802,35 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
/* Don't expand for instances, creates too many elements. */
if (!(te->parent && te->parent->idcode == ID_OB)) {
Collection *collection = (Collection *)id;
- outliner_add_collection_recursive(soops, collection, te);
+ outliner_add_collection_recursive(space_outliner, collection, te);
}
break;
}
case ID_HA: {
Hair *hair = (Hair *)id;
if (outliner_animdata_test(hair->adt)) {
- outliner_add_element(soops, &te->subtree, hair, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, hair, te, TSE_ANIM_DATA, 0);
}
break;
}
case ID_PT: {
PointCloud *pointcloud = (PointCloud *)id;
if (outliner_animdata_test(pointcloud->adt)) {
- outliner_add_element(soops, &te->subtree, pointcloud, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, pointcloud, te, TSE_ANIM_DATA, 0);
}
break;
}
case ID_VO: {
Volume *volume = (Volume *)id;
if (outliner_animdata_test(volume->adt)) {
- outliner_add_element(soops, &te->subtree, volume, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, volume, te, TSE_ANIM_DATA, 0);
}
break;
}
case ID_SIM: {
Simulation *simulation = (Simulation *)id;
if (outliner_animdata_test(simulation->adt)) {
- outliner_add_element(soops, &te->subtree, simulation, te, TSE_ANIM_DATA, 0);
+ outliner_add_element(space_outliner, &te->subtree, simulation, te, TSE_ANIM_DATA, 0);
}
break;
}
@@ -807,8 +846,12 @@ static void outliner_add_id_contents(SpaceOutliner *soops,
* \note: If child items are only added to the tree if the item is open, the TSE_ type _must_ be
* added to #outliner_element_needs_rebuild_on_open_change().
*/
-static TreeElement *outliner_add_element(
- SpaceOutliner *soops, ListBase *lb, void *idv, TreeElement *parent, short type, short index)
+static TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
+ ListBase *lb,
+ void *idv,
+ TreeElement *parent,
+ short type,
+ short index)
{
TreeElement *te;
TreeStoreElem *tselem;
@@ -842,11 +885,11 @@ static TreeElement *outliner_add_element(
/* add to the visual tree */
BLI_addtail(lb, te);
/* add to the storage */
- check_persistent(soops, te, id, type, index);
+ check_persistent(space_outliner, te, id, type, index);
tselem = TREESTORE(te);
/* if we are searching for something expand to see child elements */
- if (SEARCHING_OUTLINER(soops)) {
+ if (SEARCHING_OUTLINER(space_outliner)) {
tselem->flag |= TSE_CHILDSEARCH;
}
@@ -885,8 +928,8 @@ static TreeElement *outliner_add_element(
TreeStoreElem *tsepar = parent ? TREESTORE(parent) : NULL;
/* ID data-block. */
- if (tsepar == NULL || tsepar->type != TSE_ID_BASE || soops->filter_id_type) {
- outliner_add_id_contents(soops, te, tselem, id);
+ if (tsepar == NULL || tsepar->type != TSE_ID_BASE || space_outliner->filter_id_type) {
+ outliner_add_id_contents(space_outliner, te, tselem, id);
}
}
else if (type == TSE_ANIM_DATA) {
@@ -898,11 +941,12 @@ static TreeElement *outliner_add_element(
te->directdata = adt;
/* Action */
- outliner_add_element(soops, &te->subtree, adt->action, te, 0, 0);
+ outliner_add_element(space_outliner, &te->subtree, adt->action, te, 0, 0);
/* Drivers */
if (adt->drivers.first) {
- TreeElement *ted = outliner_add_element(soops, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
+ TreeElement *ted = outliner_add_element(
+ space_outliner, &te->subtree, adt, te, TSE_DRIVER_BASE, 0);
ID *lastadded = NULL;
FCurve *fcu;
@@ -918,7 +962,8 @@ static TreeElement *outliner_add_element(
DRIVER_TARGETS_USED_LOOPER_BEGIN (dvar) {
if (lastadded != dtar->id) {
/* XXX this lastadded check is rather lame, and also fails quite badly... */
- outliner_add_element(soops, &ted->subtree, dtar->id, ted, TSE_LINKED_OB, 0);
+ outliner_add_element(
+ space_outliner, &ted->subtree, dtar->id, ted, TSE_LINKED_OB, 0);
lastadded = dtar->id;
}
}
@@ -930,7 +975,7 @@ static TreeElement *outliner_add_element(
/* NLA Data */
if (adt->nla_tracks.first) {
- TreeElement *tenla = outliner_add_element(soops, &te->subtree, adt, te, TSE_NLA, 0);
+ TreeElement *tenla = outliner_add_element(space_outliner, &te->subtree, adt, te, TSE_NLA, 0);
NlaTrack *nlt;
int a = 0;
@@ -938,7 +983,7 @@ static TreeElement *outliner_add_element(
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
TreeElement *tenlt = outliner_add_element(
- soops, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
+ space_outliner, &tenla->subtree, nlt, tenla, TSE_NLA_TRACK, a);
NlaStrip *strip;
TreeElement *ten;
int b = 0;
@@ -946,7 +991,8 @@ static TreeElement *outliner_add_element(
tenlt->name = nlt->name;
for (strip = nlt->strips.first; strip; strip = strip->next, b++) {
- ten = outliner_add_element(soops, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
+ ten = outliner_add_element(
+ space_outliner, &tenlt->subtree, strip->act, tenlt, TSE_NLA_ACTION, b);
if (ten) {
ten->directdata = strip;
}
@@ -983,12 +1029,13 @@ static TreeElement *outliner_add_element(
if (seq->type == SEQ_TYPE_META) {
p = seq->seqbase.first;
while (p) {
- outliner_add_element(soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
+ outliner_add_element(space_outliner, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
p = p->next;
}
}
else {
- outliner_add_element(soops, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
+ outliner_add_element(
+ space_outliner, &te->subtree, (void *)seq->strip, te, TSE_SEQ_STRIP, index);
}
}
}
@@ -1039,7 +1086,7 @@ static TreeElement *outliner_add_element(
}
/* If searching don't expand RNA entries */
- if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name) == 0) {
+ if (SEARCHING_OUTLINER(space_outliner) && BLI_strcasecmp("RNA", te->name) == 0) {
tselem->flag &= ~TSE_CHILDSEARCH;
}
@@ -1054,11 +1101,12 @@ static TreeElement *outliner_add_element(
}
}
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
for (a = 0; a < tot; a++) {
RNA_property_collection_lookup_int(ptr, iterprop, a, &propptr);
if (!(RNA_property_flag(propptr.data) & PROP_HIDDEN)) {
- outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_PROPERTY, a);
+ outliner_add_element(
+ space_outliner, &te->subtree, (void *)ptr, te, TSE_RNA_PROPERTY, a);
}
}
}
@@ -1081,7 +1129,7 @@ static TreeElement *outliner_add_element(
te->rnaptr = *ptr;
/* If searching don't expand RNA entries */
- if (SEARCHING_OUTLINER(soops) && BLI_strcasecmp("RNA", te->name) == 0) {
+ if (SEARCHING_OUTLINER(space_outliner) && BLI_strcasecmp("RNA", te->name) == 0) {
tselem->flag &= ~TSE_CHILDSEARCH;
}
@@ -1089,8 +1137,9 @@ static TreeElement *outliner_add_element(
pptr = RNA_property_pointer_get(ptr, prop);
if (pptr.data) {
- if (TSELEM_OPEN(tselem, soops)) {
- outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, -1);
+ if (TSELEM_OPEN(tselem, space_outliner)) {
+ outliner_add_element(
+ space_outliner, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, -1);
}
else {
te->flag |= TE_LAZY_CLOSED;
@@ -1101,10 +1150,11 @@ static TreeElement *outliner_add_element(
tot = RNA_property_collection_length(ptr, prop);
CLAMP_MAX(tot, tot_limit);
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
for (a = 0; a < tot; a++) {
RNA_property_collection_lookup_int(ptr, prop, a, &pptr);
- outliner_add_element(soops, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, a);
+ outliner_add_element(
+ space_outliner, &te->subtree, (void *)&pptr, te, TSE_RNA_STRUCT, a);
}
}
else if (tot) {
@@ -1115,9 +1165,10 @@ static TreeElement *outliner_add_element(
tot = RNA_property_array_length(ptr, prop);
CLAMP_MAX(tot, tot_limit);
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
for (a = 0; a < tot; a++) {
- outliner_add_element(soops, &te->subtree, (void *)ptr, te, TSE_RNA_ARRAY_ELEM, a);
+ outliner_add_element(
+ space_outliner, &te->subtree, (void *)ptr, te, TSE_RNA_ARRAY_ELEM, a);
}
}
else if (tot) {
@@ -1154,7 +1205,7 @@ static TreeElement *outliner_add_element(
te->directdata = idv;
te->name = km->idname;
- if (TSELEM_OPEN(tselem, soops)) {
+ if (TSELEM_OPEN(tselem, space_outliner)) {
int a = 0;
for (kmi = km->items.first; kmi; kmi = kmi->next, a++) {
@@ -1172,7 +1223,7 @@ static TreeElement *outliner_add_element(
if (ot || kmi->propvalue) {
TreeElement *ten = outliner_add_element(
- soops, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
+ space_outliner, &te->subtree, kmi, te, TSE_KEYMAP_ITEM, a);
ten->directdata = kmi;
@@ -1240,7 +1291,10 @@ static int need_add_seq_dup(Sequence *seq)
return (1);
}
-static void outliner_add_seq_dup(SpaceOutliner *soops, Sequence *seq, TreeElement *te, short index)
+static void outliner_add_seq_dup(SpaceOutliner *space_outliner,
+ Sequence *seq,
+ TreeElement *te,
+ short index)
{
/* TreeElement *ch; */ /* UNUSED */
Sequence *p;
@@ -1254,7 +1308,7 @@ static void outliner_add_seq_dup(SpaceOutliner *soops, Sequence *seq, TreeElemen
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
/* ch = */ /* UNUSED */ outliner_add_element(
- soops, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
+ space_outliner, &te->subtree, (void *)p, te, TSE_SEQUENCE, index);
}
p = p->next;
}
@@ -1296,17 +1350,19 @@ static bool outliner_library_id_show(Library *lib, ID *id, short filter_id_type)
}
static TreeElement *outliner_add_library_contents(Main *mainvar,
- SpaceOutliner *soops,
+ SpaceOutliner *space_outliner,
ListBase *lb,
Library *lib)
{
TreeElement *ten, *tenlib = NULL;
ListBase *lbarray[MAX_LIBARRAY];
int a, tot;
- short filter_id_type = (soops->filter & SO_FILTER_ID_TYPE) ? soops->filter_id_type : 0;
+ short filter_id_type = (space_outliner->filter & SO_FILTER_ID_TYPE) ?
+ space_outliner->filter_id_type :
+ 0;
if (filter_id_type) {
- lbarray[0] = which_libbase(mainvar, soops->filter_id_type);
+ lbarray[0] = which_libbase(mainvar, space_outliner->filter_id_type);
tot = 1;
}
else {
@@ -1331,10 +1387,10 @@ static TreeElement *outliner_add_library_contents(Main *mainvar,
if (!tenlib) {
/* Create library tree element on demand, depending if there are any data-blocks. */
if (lib) {
- tenlib = outliner_add_element(soops, lb, lib, NULL, 0, 0);
+ tenlib = outliner_add_element(space_outliner, lb, lib, NULL, 0, 0);
}
else {
- tenlib = outliner_add_element(soops, lb, mainvar, NULL, TSE_ID_BASE, 0);
+ tenlib = outliner_add_element(space_outliner, lb, mainvar, NULL, TSE_ID_BASE, 0);
tenlib->name = IFACE_("Current File");
}
}
@@ -1345,14 +1401,15 @@ static TreeElement *outliner_add_library_contents(Main *mainvar,
ten = tenlib;
}
else {
- ten = outliner_add_element(soops, &tenlib->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
+ ten = outliner_add_element(
+ space_outliner, &tenlib->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
ten->directdata = lbarray[a];
ten->name = outliner_idcode_to_plural(GS(id->name));
}
for (id = lbarray[a]->first; id; id = id->next) {
if (outliner_library_id_show(lib, id, filter_id_type)) {
- outliner_add_element(soops, &ten->subtree, id, ten, 0, 0);
+ outliner_add_element(space_outliner, &ten->subtree, id, ten, 0, 0);
}
}
}
@@ -1363,15 +1420,17 @@ static TreeElement *outliner_add_library_contents(Main *mainvar,
return tenlib;
}
-static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *soops)
+static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *space_outliner)
{
TreeElement *ten;
ListBase *lbarray[MAX_LIBARRAY];
int a, tot;
- short filter_id_type = (soops->filter & SO_FILTER_ID_TYPE) ? soops->filter_id_type : 0;
+ short filter_id_type = (space_outliner->filter & SO_FILTER_ID_TYPE) ?
+ space_outliner->filter_id_type :
+ 0;
if (filter_id_type) {
- lbarray[0] = which_libbase(mainvar, soops->filter_id_type);
+ lbarray[0] = which_libbase(mainvar, space_outliner->filter_id_type);
tot = 1;
}
else {
@@ -1395,7 +1454,8 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *soops
ten = NULL;
}
else {
- ten = outliner_add_element(soops, &soops->tree, lbarray[a], NULL, TSE_ID_BASE, 0);
+ ten = outliner_add_element(
+ space_outliner, &space_outliner->tree, lbarray[a], NULL, TSE_ID_BASE, 0);
ten->directdata = lbarray[a];
ten->name = outliner_idcode_to_plural(GS(id->name));
}
@@ -1403,7 +1463,8 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *soops
/* add the orphaned data-blocks - these will not be added with any subtrees attached */
for (id = lbarray[a]->first; id; id = id->next) {
if (ID_REAL_USERS(id) <= 0) {
- outliner_add_element(soops, (ten) ? &ten->subtree : &soops->tree, id, ten, 0, 0);
+ outliner_add_element(
+ space_outliner, (ten) ? &ten->subtree : &space_outliner->tree, id, ten, 0, 0);
}
}
}
@@ -1411,12 +1472,15 @@ static void outliner_add_orphaned_datablocks(Main *mainvar, SpaceOutliner *soops
}
}
-static void outliner_add_layer_collection_objects(
- SpaceOutliner *soops, ListBase *tree, ViewLayer *layer, LayerCollection *lc, TreeElement *ten)
+static void outliner_add_layer_collection_objects(SpaceOutliner *space_outliner,
+ ListBase *tree,
+ ViewLayer *layer,
+ LayerCollection *lc,
+ TreeElement *ten)
{
LISTBASE_FOREACH (CollectionObject *, cob, &lc->collection->gobject) {
Base *base = BKE_view_layer_base_find(layer, cob->ob);
- TreeElement *te_object = outliner_add_element(soops, tree, base->object, ten, 0, 0);
+ TreeElement *te_object = outliner_add_element(space_outliner, tree, base->object, ten, 0, 0);
te_object->directdata = base;
if (!(base->flag & BASE_VISIBLE_DEPSGRAPH)) {
@@ -1425,7 +1489,7 @@ static void outliner_add_layer_collection_objects(
}
}
-static void outliner_add_layer_collections_recursive(SpaceOutliner *soops,
+static void outliner_add_layer_collections_recursive(SpaceOutliner *space_outliner,
ListBase *tree,
ViewLayer *layer,
ListBase *layer_collections,
@@ -1436,12 +1500,12 @@ static void outliner_add_layer_collections_recursive(SpaceOutliner *soops,
const bool exclude = (lc->flag & LAYER_COLLECTION_EXCLUDE) != 0;
TreeElement *ten;
- if (exclude && ((soops->show_restrict_flags & SO_RESTRICT_ENABLE) == 0)) {
+ if (exclude && ((space_outliner->show_restrict_flags & SO_RESTRICT_ENABLE) == 0)) {
ten = parent_ten;
}
else {
ID *id = &lc->collection->id;
- ten = outliner_add_element(soops, tree, id, parent_ten, TSE_LAYER_COLLECTION, 0);
+ ten = outliner_add_element(space_outliner, tree, id, parent_ten, TSE_LAYER_COLLECTION, 0);
ten->name = id->name + 2;
ten->directdata = lc;
@@ -1458,14 +1522,14 @@ static void outliner_add_layer_collections_recursive(SpaceOutliner *soops,
}
outliner_add_layer_collections_recursive(
- soops, &ten->subtree, layer, &lc->layer_collections, ten, show_objects);
+ space_outliner, &ten->subtree, layer, &lc->layer_collections, ten, show_objects);
if (!exclude && show_objects) {
- outliner_add_layer_collection_objects(soops, &ten->subtree, layer, lc, ten);
+ outliner_add_layer_collection_objects(space_outliner, &ten->subtree, layer, lc, ten);
}
}
}
-static void outliner_add_view_layer(SpaceOutliner *soops,
+static void outliner_add_view_layer(SpaceOutliner *space_outliner,
ListBase *tree,
TreeElement *parent,
ViewLayer *layer,
@@ -1478,9 +1542,9 @@ static void outliner_add_view_layer(SpaceOutliner *soops,
}
outliner_add_layer_collections_recursive(
- soops, tree, layer, &lc->layer_collections, parent, show_objects);
+ space_outliner, tree, layer, &lc->layer_collections, parent, show_objects);
if (show_objects) {
- outliner_add_layer_collection_objects(soops, tree, layer, lc, parent);
+ outliner_add_layer_collection_objects(space_outliner, tree, layer, lc, parent);
}
}
@@ -1490,28 +1554,28 @@ BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection *collec
te->directdata = collection;
}
-BLI_INLINE void outliner_add_collection_objects(SpaceOutliner *soops,
+BLI_INLINE void outliner_add_collection_objects(SpaceOutliner *space_outliner,
ListBase *tree,
Collection *collection,
TreeElement *parent)
{
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
- outliner_add_element(soops, tree, cob->ob, parent, 0, 0);
+ outliner_add_element(space_outliner, tree, cob->ob, parent, 0, 0);
}
}
-static TreeElement *outliner_add_collection_recursive(SpaceOutliner *soops,
+static TreeElement *outliner_add_collection_recursive(SpaceOutliner *space_outliner,
Collection *collection,
TreeElement *ten)
{
outliner_add_collection_init(ten, collection);
LISTBASE_FOREACH (CollectionChild *, child, &collection->children) {
- outliner_add_element(soops, &ten->subtree, &child->collection->id, ten, 0, 0);
+ outliner_add_element(space_outliner, &ten->subtree, &child->collection->id, ten, 0, 0);
}
- if (soops->outlinevis != SO_SCENES) {
- outliner_add_collection_objects(soops, &ten->subtree, collection, ten);
+ if (space_outliner->outlinevis != SO_SCENES) {
+ outliner_add_collection_objects(space_outliner, &ten->subtree, collection, ten);
}
return ten;
@@ -1552,7 +1616,7 @@ static void outliner_make_object_parent_hierarchy(ListBase *lb)
* For all objects in the tree, lookup the parent in this map,
* and move or add tree elements as needed.
*/
-static void outliner_make_object_parent_hierarchy_collections(SpaceOutliner *soops,
+static void outliner_make_object_parent_hierarchy_collections(SpaceOutliner *space_outliner,
GHash *object_tree_elements_hash)
{
GHashIterator gh_iter;
@@ -1600,7 +1664,7 @@ static void outliner_make_object_parent_hierarchy_collections(SpaceOutliner *soo
/* We add the child in the tree even if it is not in the collection.
* We deliberately clear its sub-tree though, to make it less prominent. */
TreeElement *child_ob_tree_element = outliner_add_element(
- soops, &parent_ob_tree_element->subtree, child, parent_ob_tree_element, 0, 0);
+ space_outliner, &parent_ob_tree_element->subtree, child, parent_ob_tree_element, 0, 0);
outliner_free_tree(&child_ob_tree_element->subtree);
child_ob_tree_element->flag |= TE_CHILD_NOT_IN_COLLECTION;
BLI_addtail(child_ob_tree_elements, BLI_genericNodeN(child_ob_tree_element));
@@ -1889,16 +1953,16 @@ typedef struct OutlinerTreeElementFocus {
* Bring the outliner scrolling back to where it was in relation to the original focus element
* Caller is expected to handle redrawing of ARegion.
*/
-static void outliner_restore_scrolling_position(SpaceOutliner *soops,
+static void outliner_restore_scrolling_position(SpaceOutliner *space_outliner,
ARegion *region,
OutlinerTreeElementFocus *focus)
{
View2D *v2d = &region->v2d;
if (focus->tselem != NULL) {
- outliner_set_coordinates(region, soops);
+ outliner_set_coordinates(region, space_outliner);
- TreeElement *te_new = outliner_find_tree_element(&soops->tree, focus->tselem);
+ TreeElement *te_new = outliner_find_tree_element(&space_outliner->tree, focus->tselem);
if (te_new != NULL) {
int ys_new = te_new->ys;
@@ -1928,7 +1992,7 @@ static bool test_object_callback(TreeElement *te)
* See if TreeElement or any of its children pass the callback_test.
*/
static TreeElement *outliner_find_first_desired_element_at_y_recursive(
- const SpaceOutliner *soops,
+ const SpaceOutliner *space_outliner,
TreeElement *te,
const float limit,
bool (*callback_test)(TreeElement *))
@@ -1937,11 +2001,11 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive(
return te;
}
- if (TSELEM_OPEN(te->store_elem, soops)) {
+ if (TSELEM_OPEN(te->store_elem, space_outliner)) {
TreeElement *te_iter, *te_sub;
for (te_iter = te->subtree.first; te_iter; te_iter = te_iter->next) {
te_sub = outliner_find_first_desired_element_at_y_recursive(
- soops, te_iter, limit, callback_test);
+ space_outliner, te_iter, limit, callback_test);
if (te_sub != NULL) {
return te_sub;
}
@@ -1961,15 +2025,16 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive(
* what we are looking for. If we are past the visible range and we can't find a valid element
* we return NULL.
*/
-static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner *soops,
+static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner *space_outliner,
const float view_co,
const float view_co_limit)
{
TreeElement *te, *te_sub;
- te = outliner_find_item_at_y(soops, &soops->tree, view_co);
+ te = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_co);
bool (*callback_test)(TreeElement *);
- if ((soops->outlinevis == SO_VIEW_LAYER) && (soops->filter & SO_FILTER_NO_COLLECTION)) {
+ if ((space_outliner->outlinevis == SO_VIEW_LAYER) &&
+ (space_outliner->filter & SO_FILTER_NO_COLLECTION)) {
callback_test = test_object_callback;
}
else {
@@ -1978,7 +2043,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner
while (te != NULL) {
te_sub = outliner_find_first_desired_element_at_y_recursive(
- soops, te, view_co_limit, callback_test);
+ space_outliner, te, view_co_limit, callback_test);
if (te_sub != NULL) {
/* Skip the element if it was not visible to start with. */
if (te->ys + UI_UNIT_Y > view_co_limit) {
@@ -2015,16 +2080,16 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner
* #OutlinerTreeElementFocus struct to retrieve this element later to make sure it is in the same
* original position as before filtering.
*/
-static void outliner_store_scrolling_position(SpaceOutliner *soops,
+static void outliner_store_scrolling_position(SpaceOutliner *space_outliner,
ARegion *region,
OutlinerTreeElementFocus *focus)
{
TreeElement *te;
float limit = region->v2d.cur.ymin;
- outliner_set_coordinates(region, soops);
+ outliner_set_coordinates(region, space_outliner);
- te = outliner_find_first_desired_element_at_y(soops, region->v2d.cur.ymax, limit);
+ te = outliner_find_first_desired_element_at_y(space_outliner, region->v2d.cur.ymax, limit);
if (te != NULL) {
focus->tselem = TREESTORE(te);
@@ -2035,11 +2100,11 @@ static void outliner_store_scrolling_position(SpaceOutliner *soops,
}
}
-static int outliner_exclude_filter_get(SpaceOutliner *soops)
+static int outliner_exclude_filter_get(SpaceOutliner *space_outliner)
{
- int exclude_filter = soops->filter & ~SO_FILTER_OB_STATE;
+ int exclude_filter = space_outliner->filter & ~SO_FILTER_OB_STATE;
- if (soops->search_string[0] != 0) {
+ if (space_outliner->search_string[0] != 0) {
exclude_filter |= SO_FILTER_SEARCH;
}
else {
@@ -2047,15 +2112,15 @@ static int outliner_exclude_filter_get(SpaceOutliner *soops)
}
/* Let's have this for the collection options at first. */
- if (!SUPPORT_FILTER_OUTLINER(soops)) {
+ if (!SUPPORT_FILTER_OUTLINER(space_outliner)) {
return (exclude_filter & SO_FILTER_SEARCH);
}
- if (soops->filter & SO_FILTER_NO_OBJECT) {
+ if (space_outliner->filter & SO_FILTER_NO_OBJECT) {
exclude_filter |= SO_FILTER_OB_TYPE;
}
- switch (soops->filter_state) {
+ switch (space_outliner->filter_state) {
case SO_FILTER_OB_VISIBLE:
exclude_filter |= SO_FILTER_OB_STATE_VISIBLE;
break;
@@ -2226,7 +2291,7 @@ static TreeElement *outliner_extract_children_from_subtree(TreeElement *element,
return te_next;
}
-static int outliner_filter_subtree(SpaceOutliner *soops,
+static int outliner_filter_subtree(SpaceOutliner *space_outliner,
ViewLayer *view_layer,
ListBase *lb,
const char *search_string,
@@ -2240,17 +2305,19 @@ static int outliner_filter_subtree(SpaceOutliner *soops,
if ((outliner_element_visible_get(view_layer, te, exclude_filter) == false)) {
/* Don't free the tree, but extract the children from the parent and add to this tree. */
/* This also needs filtering the subtree prior (see T69246). */
- outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter);
+ outliner_filter_subtree(
+ space_outliner, view_layer, &te->subtree, search_string, exclude_filter);
te_next = outliner_extract_children_from_subtree(te, lb);
continue;
}
if ((exclude_filter & SO_FILTER_SEARCH) == 0) {
/* Filter subtree too. */
- outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter);
+ outliner_filter_subtree(
+ space_outliner, view_layer, &te->subtree, search_string, exclude_filter);
continue;
}
- if (!outliner_filter_has_name(te, search_string, soops->search_flags)) {
+ if (!outliner_filter_has_name(te, search_string, space_outliner->search_flags)) {
/* item isn't something we're looking for, but...
* - if the subtree is expanded, check if there are any matches that can be easily found
* so that searching for "cu" in the default scene will still match the Cube
@@ -2262,9 +2329,9 @@ static int outliner_filter_subtree(SpaceOutliner *soops,
/* flag as not a found item */
tselem->flag &= ~TSE_SEARCHMATCH;
- if ((!TSELEM_OPEN(tselem, soops)) ||
+ if ((!TSELEM_OPEN(tselem, space_outliner)) ||
outliner_filter_subtree(
- soops, view_layer, &te->subtree, search_string, exclude_filter) == 0) {
+ space_outliner, view_layer, &te->subtree, search_string, exclude_filter) == 0) {
outliner_free_tree_element(te, lb);
}
}
@@ -2275,7 +2342,8 @@ static int outliner_filter_subtree(SpaceOutliner *soops,
tselem->flag |= TSE_SEARCHMATCH;
/* filter subtree too */
- outliner_filter_subtree(soops, view_layer, &te->subtree, search_string, exclude_filter);
+ outliner_filter_subtree(
+ space_outliner, view_layer, &te->subtree, search_string, exclude_filter);
}
}
@@ -2283,27 +2351,28 @@ static int outliner_filter_subtree(SpaceOutliner *soops,
return (BLI_listbase_is_empty(lb) == false);
}
-static void outliner_filter_tree(SpaceOutliner *soops, ViewLayer *view_layer)
+static void outliner_filter_tree(SpaceOutliner *space_outliner, ViewLayer *view_layer)
{
char search_buff[sizeof(((struct SpaceOutliner *)NULL)->search_string) + 2];
char *search_string;
- const int exclude_filter = outliner_exclude_filter_get(soops);
+ const int exclude_filter = outliner_exclude_filter_get(space_outliner);
if (exclude_filter == 0) {
return;
}
- if (soops->search_flags & SO_FIND_COMPLETE) {
- search_string = soops->search_string;
+ if (space_outliner->search_flags & SO_FIND_COMPLETE) {
+ search_string = space_outliner->search_string;
}
else {
/* Implicitly add heading/trailing wildcards if needed. */
- BLI_strncpy_ensure_pad(search_buff, soops->search_string, '*', sizeof(search_buff));
+ BLI_strncpy_ensure_pad(search_buff, space_outliner->search_string, '*', sizeof(search_buff));
search_string = search_buff;
}
- outliner_filter_subtree(soops, view_layer, &soops->tree, search_string, exclude_filter);
+ outliner_filter_subtree(
+ space_outliner, view_layer, &space_outliner->tree, search_string, exclude_filter);
}
/* ======================================================= */
@@ -2311,27 +2380,32 @@ static void outliner_filter_tree(SpaceOutliner *soops, ViewLayer *view_layer)
/* Main entry point for building the tree data-structure that the outliner represents. */
/* TODO: split each mode into its own function? */
-void outliner_build_tree(
- Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *soops, ARegion *region)
+void outliner_build_tree(Main *mainvar,
+ Scene *scene,
+ ViewLayer *view_layer,
+ SpaceOutliner *space_outliner,
+ ARegion *region)
{
TreeElement *te = NULL, *ten;
TreeStoreElem *tselem;
/* on first view, we open scenes */
- int show_opened = !soops->treestore || !BLI_mempool_len(soops->treestore);
+ int show_opened = !space_outliner->treestore || !BLI_mempool_len(space_outliner->treestore);
/* Are we looking for something - we want to tag parents to filter child matches
* - NOT in data-blocks view - searching all data-blocks takes way too long to be useful
* - this variable is only set once per tree build */
- if (soops->search_string[0] != 0 && soops->outlinevis != SO_DATA_API) {
- soops->search_flags |= SO_SEARCH_RECURSIVE;
+ if (space_outliner->search_string[0] != 0 && space_outliner->outlinevis != SO_DATA_API) {
+ space_outliner->search_flags |= SO_SEARCH_RECURSIVE;
}
else {
- soops->search_flags &= ~SO_SEARCH_RECURSIVE;
+ space_outliner->search_flags &= ~SO_SEARCH_RECURSIVE;
}
- if (soops->treehash && (soops->storeflag & SO_TREESTORE_REBUILD) && soops->treestore) {
- soops->storeflag &= ~SO_TREESTORE_REBUILD;
- BKE_outliner_treehash_rebuild_from_treestore(soops->treehash, soops->treestore);
+ if (space_outliner->treehash && (space_outliner->storeflag & SO_TREESTORE_REBUILD) &&
+ space_outliner->treestore) {
+ space_outliner->storeflag &= ~SO_TREESTORE_REBUILD;
+ BKE_outliner_treehash_rebuild_from_treestore(space_outliner->treehash,
+ space_outliner->treestore);
}
if (region->do_draw & RGN_DRAW_NO_REBUILD) {
@@ -2339,17 +2413,17 @@ void outliner_build_tree(
}
OutlinerTreeElementFocus focus;
- outliner_store_scrolling_position(soops, region, &focus);
+ outliner_store_scrolling_position(space_outliner, region, &focus);
- outliner_free_tree(&soops->tree);
- outliner_storage_cleanup(soops);
+ outliner_free_tree(&space_outliner->tree);
+ outliner_storage_cleanup(space_outliner);
/* options */
- if (soops->outlinevis == SO_LIBRARIES) {
+ if (space_outliner->outlinevis == SO_LIBRARIES) {
Library *lib;
/* current file first - mainvar provides tselem with unique pointer - not used */
- ten = outliner_add_library_contents(mainvar, soops, &soops->tree, NULL);
+ ten = outliner_add_library_contents(mainvar, space_outliner, &space_outliner->tree, NULL);
if (ten) {
tselem = TREESTORE(ten);
if (!tselem->used) {
@@ -2358,14 +2432,14 @@ void outliner_build_tree(
}
for (lib = mainvar->libraries.first; lib; lib = lib->id.next) {
- ten = outliner_add_library_contents(mainvar, soops, &soops->tree, lib);
+ ten = outliner_add_library_contents(mainvar, space_outliner, &space_outliner->tree, lib);
/* NULL-check matters, due to filtering there may not be a new element. */
if (ten) {
lib->id.newid = (ID *)ten;
}
}
/* make hierarchy */
- ten = soops->tree.first;
+ ten = space_outliner->tree.first;
if (ten != NULL) {
ten = ten->next; /* first one is main */
while (ten) {
@@ -2376,14 +2450,14 @@ void outliner_build_tree(
par = (TreeElement *)lib->parent->id.newid;
if (tselem->id->tag & LIB_TAG_INDIRECT) {
/* Only remove from 'first level' if lib is not also directly used. */
- BLI_remlink(&soops->tree, ten);
+ BLI_remlink(&space_outliner->tree, ten);
BLI_addtail(&par->subtree, ten);
ten->parent = par;
}
else {
/* Else, make a new copy of the libtree for our parent. */
TreeElement *dupten = outliner_add_library_contents(
- mainvar, soops, &par->subtree, lib);
+ mainvar, space_outliner, &par->subtree, lib);
if (dupten) {
dupten->parent = par;
}
@@ -2397,10 +2471,10 @@ void outliner_build_tree(
lib->id.newid = NULL;
}
}
- else if (soops->outlinevis == SO_SCENES) {
+ else if (space_outliner->outlinevis == SO_SCENES) {
Scene *sce;
for (sce = mainvar->scenes.first; sce; sce = sce->id.next) {
- te = outliner_add_element(soops, &soops->tree, sce, NULL, 0, 0);
+ te = outliner_add_element(space_outliner, &space_outliner->tree, sce, NULL, 0, 0);
tselem = TREESTORE(te);
/* New scene elements open by default */
@@ -2411,7 +2485,7 @@ void outliner_build_tree(
outliner_make_object_parent_hierarchy(&te->subtree);
}
}
- else if (soops->outlinevis == SO_SEQUENCE) {
+ else if (space_outliner->outlinevis == SO_SEQUENCE) {
Sequence *seq;
Editing *ed = BKE_sequencer_editing_get(scene, false);
int op;
@@ -2428,76 +2502,81 @@ void outliner_build_tree(
while (seq) {
op = need_add_seq_dup(seq);
if (op == 1) {
- /* ten = */ outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
+ /* ten = */ outliner_add_element(
+ space_outliner, &space_outliner->tree, (void *)seq, NULL, TSE_SEQUENCE, 0);
}
else if (op == 0) {
- ten = outliner_add_element(soops, &soops->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0);
- outliner_add_seq_dup(soops, seq, ten, 0);
+ ten = outliner_add_element(
+ space_outliner, &space_outliner->tree, (void *)seq, NULL, TSE_SEQUENCE_DUP, 0);
+ outliner_add_seq_dup(space_outliner, seq, ten, 0);
}
seq = seq->next;
}
}
- else if (soops->outlinevis == SO_DATA_API) {
+ else if (space_outliner->outlinevis == SO_DATA_API) {
PointerRNA mainptr;
RNA_main_pointer_create(mainvar, &mainptr);
- ten = outliner_add_element(soops, &soops->tree, (void *)&mainptr, NULL, TSE_RNA_STRUCT, -1);
+ ten = outliner_add_element(
+ space_outliner, &space_outliner->tree, (void *)&mainptr, NULL, TSE_RNA_STRUCT, -1);
if (show_opened) {
tselem = TREESTORE(ten);
tselem->flag &= ~TSE_CLOSED;
}
}
- else if (soops->outlinevis == SO_ID_ORPHANS) {
- outliner_add_orphaned_datablocks(mainvar, soops);
+ else if (space_outliner->outlinevis == SO_ID_ORPHANS) {
+ outliner_add_orphaned_datablocks(mainvar, space_outliner);
}
- else if (soops->outlinevis == SO_VIEW_LAYER) {
- if (soops->filter & SO_FILTER_NO_COLLECTION) {
+ else if (space_outliner->outlinevis == SO_VIEW_LAYER) {
+ if (space_outliner->filter & SO_FILTER_NO_COLLECTION) {
/* Show objects in the view layer. */
LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) {
TreeElement *te_object = outliner_add_element(
- soops, &soops->tree, base->object, NULL, 0, 0);
+ space_outliner, &space_outliner->tree, base->object, NULL, 0, 0);
te_object->directdata = base;
}
- if ((soops->filter & SO_FILTER_NO_CHILDREN) == 0) {
- outliner_make_object_parent_hierarchy(&soops->tree);
+ if ((space_outliner->filter & SO_FILTER_NO_CHILDREN) == 0) {
+ outliner_make_object_parent_hierarchy(&space_outliner->tree);
}
}
else {
/* Show collections in the view layer. */
- ten = outliner_add_element(soops, &soops->tree, scene, NULL, TSE_VIEW_COLLECTION_BASE, 0);
+ ten = outliner_add_element(
+ space_outliner, &space_outliner->tree, scene, NULL, TSE_VIEW_COLLECTION_BASE, 0);
ten->name = IFACE_("Scene Collection");
TREESTORE(ten)->flag &= ~TSE_CLOSED;
- bool show_objects = !(soops->filter & SO_FILTER_NO_OBJECT);
- outliner_add_view_layer(soops, &ten->subtree, ten, view_layer, show_objects);
+ bool show_objects = !(space_outliner->filter & SO_FILTER_NO_OBJECT);
+ outliner_add_view_layer(space_outliner, &ten->subtree, ten, view_layer, show_objects);
- if ((soops->filter & SO_FILTER_NO_CHILDREN) == 0) {
+ if ((space_outliner->filter & SO_FILTER_NO_CHILDREN) == 0) {
GHash *object_tree_elements_hash = BLI_ghash_new(
BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__);
outliner_object_tree_elements_lookup_create_recursive(object_tree_elements_hash, ten);
- outliner_make_object_parent_hierarchy_collections(soops, object_tree_elements_hash);
+ outliner_make_object_parent_hierarchy_collections(space_outliner,
+ object_tree_elements_hash);
outliner_object_tree_elements_lookup_free(object_tree_elements_hash);
BLI_ghash_free(object_tree_elements_hash, NULL, NULL);
}
}
}
- if ((soops->flag & SO_SKIP_SORT_ALPHA) == 0) {
- outliner_sort(&soops->tree);
+ if ((space_outliner->flag & SO_SKIP_SORT_ALPHA) == 0) {
+ outliner_sort(&space_outliner->tree);
}
- else if ((soops->filter & SO_FILTER_NO_CHILDREN) == 0) {
+ else if ((space_outliner->filter & SO_FILTER_NO_CHILDREN) == 0) {
/* We group the children that are in the collection before the ones that are not.
* This way we can try to draw them in a different style altogether.
* We also have to respect the original order of the elements in case alphabetical
* sorting is not enabled. This keep object data and modifiers before its children. */
- outliner_collections_children_sort(&soops->tree);
+ outliner_collections_children_sort(&space_outliner->tree);
}
- outliner_filter_tree(soops, view_layer);
- outliner_restore_scrolling_position(soops, region, &focus);
+ outliner_filter_tree(space_outliner, view_layer);
+ outliner_restore_scrolling_position(space_outliner, region, &focus);
BKE_main_id_clear_newpoins(mainvar);
}
diff --git a/source/blender/editors/space_outliner/outliner_utils.c b/source/blender/editors/space_outliner/outliner_utils.c
index 9accf35784a..1da44b5e51e 100644
--- a/source/blender/editors/space_outliner/outliner_utils.c
+++ b/source/blender/editors/space_outliner/outliner_utils.c
@@ -74,7 +74,7 @@ void outliner_viewcontext_init(const bContext *C, TreeViewContext *tvc)
* Try to find an item under y-coordinate \a view_co_y (view-space).
* \note Recursive
*/
-TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops,
+TreeElement *outliner_find_item_at_y(const SpaceOutliner *space_outliner,
const ListBase *tree,
float view_co_y)
{
@@ -85,7 +85,8 @@ TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops,
return te_iter;
}
- if (BLI_listbase_is_empty(&te_iter->subtree) || !TSELEM_OPEN(TREESTORE(te_iter), soops)) {
+ if (BLI_listbase_is_empty(&te_iter->subtree) ||
+ !TSELEM_OPEN(TREESTORE(te_iter), space_outliner)) {
/* No need for recursion. */
continue;
}
@@ -99,7 +100,7 @@ TreeElement *outliner_find_item_at_y(const SpaceOutliner *soops,
/* co_y is lower than current element (but not lower than the next one), possibly inside
* children */
- TreeElement *te_sub = outliner_find_item_at_y(soops, &te_iter->subtree, view_co_y);
+ TreeElement *te_sub = outliner_find_item_at_y(space_outliner, &te_iter->subtree, view_co_y);
if (te_sub) {
return te_sub;
}
@@ -147,13 +148,13 @@ static TreeElement *outliner_find_item_at_x_in_row_recursive(const TreeElement *
*
* \return a hovered child item or \a parent_te (if no hovered child found).
*/
-TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *soops,
+TreeElement *outliner_find_item_at_x_in_row(const SpaceOutliner *space_outliner,
const TreeElement *parent_te,
float view_co_x,
bool *r_merged)
{
/* if parent_te is opened, it doesn't show children in row */
- if (!TSELEM_OPEN(TREESTORE(parent_te), soops)) {
+ if (!TSELEM_OPEN(TREESTORE(parent_te), space_outliner)) {
return outliner_find_item_at_x_in_row_recursive(parent_te, view_co_x, r_merged);
}
@@ -196,7 +197,7 @@ TreeElement *outliner_find_parent_element(ListBase *lb,
}
/* tse is not in the treestore, we use its contents to find a match */
-TreeElement *outliner_find_tse(SpaceOutliner *soops, const TreeStoreElem *tse)
+TreeElement *outliner_find_tse(SpaceOutliner *space_outliner, const TreeStoreElem *tse)
{
TreeStoreElem *tselem;
@@ -205,16 +206,16 @@ TreeElement *outliner_find_tse(SpaceOutliner *soops, const TreeStoreElem *tse)
}
/* check if 'tse' is in treestore */
- tselem = BKE_outliner_treehash_lookup_any(soops->treehash, tse->type, tse->nr, tse->id);
+ tselem = BKE_outliner_treehash_lookup_any(space_outliner->treehash, tse->type, tse->nr, tse->id);
if (tselem) {
- return outliner_find_tree_element(&soops->tree, tselem);
+ return outliner_find_tree_element(&space_outliner->tree, tselem);
}
return NULL;
}
/* Find treestore that refers to given ID */
-TreeElement *outliner_find_id(SpaceOutliner *soops, ListBase *lb, const ID *id)
+TreeElement *outliner_find_id(SpaceOutliner *space_outliner, ListBase *lb, const ID *id)
{
LISTBASE_FOREACH (TreeElement *, te, lb) {
TreeStoreElem *tselem = TREESTORE(te);
@@ -224,7 +225,7 @@ TreeElement *outliner_find_id(SpaceOutliner *soops, ListBase *lb, const ID *id)
}
}
- TreeElement *tes = outliner_find_id(soops, &te->subtree, id);
+ TreeElement *tes = outliner_find_id(space_outliner, &te->subtree, id);
if (tes) {
return tes;
}
@@ -304,7 +305,7 @@ ID *outliner_search_back(TreeElement *te, short idcode)
* \param filter_tselem_flag: Same as \a filter_te_flag, but for the TreeStoreElem.
* \param func: Custom callback to execute for each visited item.
*/
-bool outliner_tree_traverse(const SpaceOutliner *soops,
+bool outliner_tree_traverse(const SpaceOutliner *space_outliner,
ListBase *tree,
int filter_te_flag,
int filter_tselem_flag,
@@ -337,7 +338,7 @@ bool outliner_tree_traverse(const SpaceOutliner *soops,
/* skip */
}
else if (!outliner_tree_traverse(
- soops, &subtree, filter_te_flag, filter_tselem_flag, func, customdata)) {
+ space_outliner, &subtree, filter_te_flag, filter_tselem_flag, func, customdata)) {
return false;
}
}
@@ -345,11 +346,11 @@ bool outliner_tree_traverse(const SpaceOutliner *soops,
return true;
}
-float outliner_restrict_columns_width(const SpaceOutliner *soops)
+float outliner_restrict_columns_width(const SpaceOutliner *space_outliner)
{
int num_columns = 0;
- switch (soops->outlinevis) {
+ switch (space_outliner->outlinevis) {
case SO_DATA_API:
case SO_SEQUENCE:
case SO_LIBRARIES:
@@ -358,24 +359,24 @@ float outliner_restrict_columns_width(const SpaceOutliner *soops)
num_columns = 3;
break;
case SO_VIEW_LAYER:
- if (soops->show_restrict_flags & SO_RESTRICT_HOLDOUT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HOLDOUT) {
num_columns++;
}
- if (soops->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) {
num_columns++;
}
ATTR_FALLTHROUGH;
case SO_SCENES:
- if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) {
num_columns++;
}
- if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) {
num_columns++;
}
- if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) {
num_columns++;
}
- if (soops->show_restrict_flags & SO_RESTRICT_RENDER) {
+ if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) {
num_columns++;
}
break;
@@ -459,14 +460,14 @@ Base *ED_outliner_give_base_under_cursor(bContext *C, const int mval[2])
{
ARegion *region = CTX_wm_region(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceOutliner *soops = CTX_wm_space_outliner(C);
+ SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te;
Base *base = NULL;
float view_mval[2];
UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);
- te = outliner_find_item_at_y(soops, &soops->tree, view_mval[1]);
+ te = outliner_find_item_at_y(space_outliner, &space_outliner->tree, view_mval[1]);
if (te) {
TreeStoreElem *tselem = TREESTORE(te);
if (tselem->type == 0) {
diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c
index 63abc22f367..b14afed81dd 100644
--- a/source/blender/editors/space_outliner/space_outliner.c
+++ b/source/blender/editors/space_outliner/space_outliner.c
@@ -242,14 +242,14 @@ static void outliner_main_region_message_subscribe(const struct bContext *UNUSED
struct ARegion *region,
struct wmMsgBus *mbus)
{
- SpaceOutliner *soops = area->spacedata.first;
+ SpaceOutliner *space_outliner = area->spacedata.first;
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
.owner = region,
.user_data = region,
.notify = ED_region_do_msg_notify_tag_redraw,
};
- if (ELEM(soops->outlinevis, SO_VIEW_LAYER, SO_SCENES)) {
+ if (ELEM(space_outliner->outlinevis, SO_VIEW_LAYER, SO_SCENES)) {
WM_msg_subscribe_rna_anon_prop(mbus, Window, view_layer, &msg_sub_value_region_tag_redraw);
}
}
@@ -297,43 +297,43 @@ static void outliner_header_region_listener(wmWindow *UNUSED(win),
static SpaceLink *outliner_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene))
{
ARegion *region;
- SpaceOutliner *soutliner;
+ SpaceOutliner *space_outliner;
- soutliner = MEM_callocN(sizeof(SpaceOutliner), "initoutliner");
- soutliner->spacetype = SPACE_OUTLINER;
- soutliner->filter_id_type = ID_GR;
- soutliner->show_restrict_flags = SO_RESTRICT_ENABLE | SO_RESTRICT_HIDE;
- soutliner->outlinevis = SO_VIEW_LAYER;
- soutliner->sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL;
- soutliner->flag |= SO_SYNC_SELECT;
+ space_outliner = MEM_callocN(sizeof(SpaceOutliner), "initoutliner");
+ space_outliner->spacetype = SPACE_OUTLINER;
+ space_outliner->filter_id_type = ID_GR;
+ space_outliner->show_restrict_flags = SO_RESTRICT_ENABLE | SO_RESTRICT_HIDE;
+ space_outliner->outlinevis = SO_VIEW_LAYER;
+ space_outliner->sync_select_dirty |= WM_OUTLINER_SYNC_SELECT_FROM_ALL;
+ space_outliner->flag |= SO_SYNC_SELECT;
/* header */
region = MEM_callocN(sizeof(ARegion), "header for outliner");
- BLI_addtail(&soutliner->regionbase, region);
+ BLI_addtail(&space_outliner->regionbase, region);
region->regiontype = RGN_TYPE_HEADER;
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
/* main region */
region = MEM_callocN(sizeof(ARegion), "main region for outliner");
- BLI_addtail(&soutliner->regionbase, region);
+ BLI_addtail(&space_outliner->regionbase, region);
region->regiontype = RGN_TYPE_WINDOW;
- return (SpaceLink *)soutliner;
+ return (SpaceLink *)space_outliner;
}
/* not spacelink itself */
static void outliner_free(SpaceLink *sl)
{
- SpaceOutliner *soutliner = (SpaceOutliner *)sl;
+ SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
- outliner_free_tree(&soutliner->tree);
- if (soutliner->treestore) {
- BLI_mempool_destroy(soutliner->treestore);
+ outliner_free_tree(&space_outliner->tree);
+ if (space_outliner->treestore) {
+ BLI_mempool_destroy(space_outliner->treestore);
}
- if (soutliner->treehash) {
- BKE_outliner_treehash_free(soutliner->treehash);
+ if (space_outliner->treehash) {
+ BKE_outliner_treehash_free(space_outliner->treehash);
}
}
@@ -344,47 +344,47 @@ static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *UNUSED(area))
static SpaceLink *outliner_duplicate(SpaceLink *sl)
{
- SpaceOutliner *soutliner = (SpaceOutliner *)sl;
- SpaceOutliner *soutlinern = MEM_dupallocN(soutliner);
+ SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
+ SpaceOutliner *space_outliner_new = MEM_dupallocN(space_outliner);
- BLI_listbase_clear(&soutlinern->tree);
- soutlinern->treestore = NULL;
- soutlinern->treehash = NULL;
+ BLI_listbase_clear(&space_outliner_new->tree);
+ space_outliner_new->treestore = NULL;
+ space_outliner_new->treehash = NULL;
- soutlinern->sync_select_dirty = WM_OUTLINER_SYNC_SELECT_FROM_ALL;
+ space_outliner_new->sync_select_dirty = WM_OUTLINER_SYNC_SELECT_FROM_ALL;
- return (SpaceLink *)soutlinern;
+ return (SpaceLink *)space_outliner_new;
}
static void outliner_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_id, ID *new_id)
{
- SpaceOutliner *so = (SpaceOutliner *)slink;
+ SpaceOutliner *space_outliner = (SpaceOutliner *)slink;
/* Some early out checks. */
if (!TREESTORE_ID_TYPE(old_id)) {
return; /* ID type is not used by outilner... */
}
- if (so->search_tse.id == old_id) {
- so->search_tse.id = new_id;
+ if (space_outliner->search_tse.id == old_id) {
+ space_outliner->search_tse.id = new_id;
}
- if (so->treestore) {
+ if (space_outliner->treestore) {
TreeStoreElem *tselem;
BLI_mempool_iter iter;
bool changed = false;
- BLI_mempool_iternew(so->treestore, &iter);
+ BLI_mempool_iternew(space_outliner->treestore, &iter);
while ((tselem = BLI_mempool_iterstep(&iter))) {
if (tselem->id == old_id) {
tselem->id = new_id;
changed = true;
}
}
- if (so->treehash && changed) {
+ if (space_outliner->treehash && changed) {
/* rebuild hash table, because it depends on ids too */
/* postpone a full rebuild because this can be called many times on-free */
- so->storeflag |= SO_TREESTORE_REBUILD;
+ space_outliner->storeflag |= SO_TREESTORE_REBUILD;
}
}
}
@@ -392,8 +392,8 @@ static void outliner_id_remap(ScrArea *UNUSED(area), SpaceLink *slink, ID *old_i
static void outliner_deactivate(struct ScrArea *area)
{
/* Remove hover highlights */
- SpaceOutliner *soops = area->spacedata.first;
- outliner_flag_set(&soops->tree, TSE_HIGHLIGHTED, false);
+ SpaceOutliner *space_outliner = area->spacedata.first;
+ outliner_flag_set(&space_outliner->tree, TSE_HIGHLIGHTED, false);
ED_region_tag_redraw_no_rebuild(BKE_area_find_region_type(area, RGN_TYPE_WINDOW));
}