Cleanup: Rename soops to space_outliner
No functional changes. Rename soops, soutliner, and so to space_outliner.
This commit is contained in:
parent
2597c12b0c
commit
915cc956ba
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -270,9 +270,9 @@ static void area_add_window_regions(ScrArea *area, SpaceLink *sl, ListBase *lb)
|
|||
break;
|
||||
|
||||
case SPACE_OUTLINER: {
|
||||
SpaceOutliner *soops = (SpaceOutliner *)sl;
|
||||
SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
|
||||
|
||||
memcpy(®ion->v2d, &soops->v2d, sizeof(View2D));
|
||||
memcpy(®ion->v2d, &space_outliner->v2d, sizeof(View2D));
|
||||
|
||||
region->v2d.scroll &= ~V2D_SCROLL_LEFT;
|
||||
region->v2d.scroll |= (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
|
||||
|
|
|
@ -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;
|
||||
SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
|
||||
|
||||
if (!ELEM(so->outlinevis, SO_SCENES, SO_LIBRARIES, SO_SEQUENCE, SO_DATA_API)) {
|
||||
so->outlinevis = SO_SCENES;
|
||||
if (!ELEM(space_outliner->outlinevis,
|
||||
SO_SCENES,
|
||||
SO_LIBRARIES,
|
||||
SO_SEQUENCE,
|
||||
SO_DATA_API)) {
|
||||
space_outliner->outlinevis = SO_SCENES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(®ion->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(
|
||||
®ion->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(®ion->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) {
|
||||
|
|
|
@ -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 = ®ion->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);
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
®ion->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(
|
||||
®ion->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(
|
||||
®ion->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(®ion->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(®ion->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(®ion->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(®ion->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(®ion->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 = ®ion->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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(®ion->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(®ion->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
|
|||
®ion->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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(®ion->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;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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(®ion->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) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue