Cleanup: Select sync from outliner

Move the condition to check if selection syncing is enabled to inside
the syncing function rather than before each time it is called.
This commit is contained in:
Nathan Craddock 2020-04-24 20:22:46 -06:00
parent 5d14463e1a
commit 4ab85a3380
4 changed files with 8 additions and 17 deletions

View File

@ -1176,9 +1176,7 @@ static int outliner_select_all_exec(bContext *C, wmOperator *op)
break;
}
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);

View File

@ -1417,9 +1417,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
ED_region_tag_redraw_no_rebuild(region);
}
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
}
return OPERATOR_FINISHED;
@ -1509,9 +1507,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_region_tag_redraw(region);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
return OPERATOR_FINISHED;
}
@ -1749,9 +1745,7 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven
/* Scroll outliner to focus on walk element */
outliner_walk_scroll(region, walk_element);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
ED_region_tag_redraw(region);
return OPERATOR_FINISHED;

View File

@ -351,8 +351,9 @@ 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)
{
/* Don't sync in certain outliner display modes */
if (ELEM(soops->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS)) {
/* 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)) {
return;
}

View File

@ -564,9 +564,7 @@ static void merged_element_search_call_cb(struct bContext *C, void *UNUSED(arg1)
outliner_item_select(soops, te, false, false);
outliner_item_do_activate_from_tree_element(C, te, te->store_elem, false, false);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
}
/**