Cleanup: Remove unused Outliner search element storage

This is old code to keep track of an active search element, so you could
step through the search results. This isn't used anymore, and not needed
since searching now filters the tree to only show matches. If we ever
wanted to have support for stepping through elements again, that should be
done via the active element instead.
This commit is contained in:
Julian Eisel 2022-08-17 16:11:50 +02:00
parent db054b447d
commit 71f091a631
5 changed files with 0 additions and 132 deletions

View File

@ -148,7 +148,6 @@ void BKE_screen_foreach_id_screen_area(LibraryForeachIDData *data, ScrArea *area
}
case SPACE_OUTLINER: {
SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
BKE_LIB_FOREACHID_PROCESS_ID(data, space_outliner->search_tse.id, IDWALK_CB_NOP);
if (space_outliner->treestore != NULL) {
TreeStoreElem *tselem;
BLI_mempool_iter iter;
@ -1873,7 +1872,6 @@ void BKE_screen_area_blend_read_lib(BlendLibReader *reader, ID *parent_id, ScrAr
}
case SPACE_OUTLINER: {
SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
BLO_read_id_address(reader, NULL, &space_outliner->search_tse.id);
if (space_outliner->treestore) {
TreeStoreElem *tselem;

View File

@ -2631,9 +2631,6 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map,
else if (sl->spacetype == SPACE_OUTLINER) {
SpaceOutliner *space_outliner = (SpaceOutliner *)sl;
space_outliner->search_tse.id = restore_pointer_by_name(
id_map, space_outliner->search_tse.id, USER_IGNORE);
if (space_outliner->treestore) {
TreeStoreElem *tselem;
BLI_mempool_iter iter;

View File

@ -1410,129 +1410,6 @@ void OUTLINER_OT_scroll_page(wmOperatorType *ot)
/** \} */
#if 0 /* TODO: probably obsolete now with filtering? */
/* -------------------------------------------------------------------- */
/** \name Search
* \{ */
/* find next element that has this name */
static TreeElement *outliner_find_name(
SpaceOutliner *space_outliner, ListBase *lb, char *name, int flags, TreeElement *prev, int *prevFound)
{
TreeElement *te, *tes;
for (te = lb->first; te; te = te->next) {
int found = outliner_filter_has_name(te, name, flags);
if (found) {
/* name is right, but is element the previous one? */
if (prev) {
if ((te != prev) && (*prevFound)) {
return te;
}
if (te == prev) {
*prevFound = 1;
}
}
else {
return te;
}
}
tes = outliner_find_name(space_outliner, &te->subtree, name, flags, prev, prevFound);
if (tes) {
return tes;
}
}
/* nothing valid found */
return nullptr;
}
static void outliner_find_panel(
Scene *UNUSED(scene), ARegion *region, SpaceOutliner *space_outliner, int again, int flags)
{
ReportList *reports = nullptr; /* CTX_wm_reports(C); */
TreeElement *te = nullptr;
TreeElement *last_find;
TreeStoreElem *tselem;
int ytop, xdelta, prevFound = 0;
char name[sizeof(space_outliner->search_string)];
/* get last found tree-element based on stored 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, space_outliner->search_string, sizeof(name));
flags = space_outliner->search_flags;
/* try to find matching element */
te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, last_find, &prevFound);
if (te == nullptr) {
/* no more matches after previous, start from beginning again */
prevFound = 1;
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(space_outliner, &space_outliner->tree, name, flags, nullptr, &prevFound);
// }
// else return; XXX RETURN! XXX
}
/* do selection and reveal */
if (te) {
tselem = TREESTORE(te);
if (tselem) {
/* expand branches so that it will be visible, we need to get correct coordinates */
if (outliner_open_back(space_outliner, te)) {
outliner_set_coordinates(region, space_outliner);
}
/* deselect all visible, and select found element */
outliner_flag_set(space_outliner, &space_outliner->tree, TSE_SELECTED, 0);
tselem->flag |= TSE_SELECTED;
/* Make `te->ys` center of view. */
ytop = (int)(te->ys + BLI_rctf_size_y(&region->v2d.mask) / 2);
if (ytop > 0) {
ytop = 0;
}
region->v2d.cur.ymax = (float)ytop;
region->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&region->v2d.mask));
/* Make `te->xs` ==> `te->xend` center of view. */
xdelta = (int)(te->xs - region->v2d.cur.xmin);
region->v2d.cur.xmin += xdelta;
region->v2d.cur.xmax += xdelta;
/* store selection */
space_outliner->search_tse = *tselem;
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);
}
}
else {
/* no tree-element found */
BKE_reportf(reports, RPT_WARNING, "Not found: %s", name);
}
}
/** \} */
#endif /* if 0 */
/* -------------------------------------------------------------------- */
/** \name Show One Level Operator
* \{ */

View File

@ -391,8 +391,6 @@ static void outliner_id_remap(ScrArea *area, SpaceLink *slink, const struct IDRe
{
SpaceOutliner *space_outliner = (SpaceOutliner *)slink;
BKE_id_remapper_apply(mappings, (ID **)&space_outliner->search_tse.id, ID_REMAP_APPLY_DEFAULT);
if (!space_outliner->treestore) {
return;
}

View File

@ -278,9 +278,7 @@ typedef struct SpaceOutliner {
*/
struct BLI_mempool *treestore;
/* search stuff */
char search_string[64];
struct TreeStoreElem search_tse;
short flag;
short outlinevis;