Blender V5.3
outliner_tree.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2004 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <algorithm>
10#include <climits>
11#include <cstring>
12#include <optional>
13#include <utility>
14
15#include "MEM_guardedalloc.h"
16
18
19#include "BLI_fnmatch.hh"
20#include "BLI_listbase.hh"
21#include "BLI_map.hh"
22#include "BLI_mempool.hh"
23#include "BLI_rect.hh"
24#include "BLI_set.hh"
25#include "BLI_string.hh"
26#include "BLI_utildefines.hh"
27
28#include "BKE_collection.hh"
29#include "BKE_layer.hh"
30#include "BKE_main.hh"
31#include "BKE_modifier.hh"
33#include "BKE_screen.hh"
34
35#include "ED_outliner.hh"
36#include "ED_screen.hh"
37
38#include "UI_interface.hh"
39
40#include "outliner_intern.hh"
41#include "tree/tree_display.hh"
42#include "tree/tree_element.hh"
44
45#ifdef WIN32
46# include "BLI_math_base_c.hh" /* M_PI */
47#endif
48
49namespace blender::ed::outliner {
50
51/* prototypes */
52static eSpaceOutliner_Filter outliner_exclude_filter_get(const SpaceOutliner *space_outliner);
53
54/* -------------------------------------------------------------------- */
57
58static void outliner_storage_cleanup(SpaceOutliner *space_outliner)
59{
60 BLI_mempool *ts = space_outliner->treestore;
61
62 if (ts) {
63 TreeStoreElem *tselem;
64 int unused = 0;
65
66 /* each element used once, for ID blocks with more users to have each a treestore */
68
69 BLI_mempool_iternew(ts, &iter);
70 while ((tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
71 tselem->used = 0;
72 }
73
74 /* cleanup only after reading file or undo step, and always for
75 * RNA data-blocks view in order to save memory */
76 if (space_outliner->storeflag & SO_TREESTORE_CLEANUP) {
77 space_outliner->storeflag &= ~SO_TREESTORE_CLEANUP;
78
79 BLI_mempool_iternew(ts, &iter);
80 while ((tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
81 if (tselem->id == nullptr) {
82 unused++;
83 }
84 }
85
86 if (unused) {
87 if (BLI_mempool_len(ts) == unused) {
89 space_outliner->treestore = nullptr;
90 space_outliner->runtime->tree_hash = nullptr;
91 }
92 else {
93 TreeStoreElem *tsenew;
95 sizeof(TreeStoreElem), BLI_mempool_len(ts) - unused, 512, BLI_MEMPOOL_ALLOW_ITER);
96 BLI_mempool_iternew(ts, &iter);
97 while ((tselem = static_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
98 if (tselem->id) {
99 tsenew = static_cast<TreeStoreElem *>(BLI_mempool_alloc(new_ts));
100 *tsenew = *tselem;
101 }
102 }
104 space_outliner->treestore = new_ts;
105 if (space_outliner->runtime->tree_hash) {
106 /* update hash table to fix broken pointers */
107 space_outliner->runtime->tree_hash->rebuild_from_treestore(*space_outliner->treestore);
108 }
109 }
110 }
111 }
112 else if (space_outliner->runtime->tree_hash) {
113 space_outliner->runtime->tree_hash->clear_used();
114 }
115 }
116}
117
119 SpaceOutliner *space_outliner, TreeElement *te, ID *id, short type, short nr)
120{
121 if (space_outliner->treestore == nullptr) {
122 /* If treestore was not created in `readfile.cc`, create it here. */
123 space_outliner->treestore = BLI_mempool_create(
124 sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
125 }
126 if (space_outliner->runtime->tree_hash == nullptr) {
127 space_outliner->runtime->tree_hash = treehash::TreeHash::create_from_treestore(
128 *space_outliner->treestore);
129 }
130
131 /* find any unused tree element in treestore and mark it as used
132 * (note that there may be multiple unused elements in case of linked objects) */
133 TreeStoreElem *tselem = space_outliner->runtime->tree_hash->lookup_unused(type, nr, id);
134 if (tselem) {
135 te->store_elem = tselem;
136 tselem->used = 1;
137 return;
138 }
139
140 /* add 1 element to treestore */
141 tselem = static_cast<TreeStoreElem *>(BLI_mempool_alloc(space_outliner->treestore));
142 tselem->type = eTreeStoreElemType(type);
143 tselem->nr = type ? nr : 0;
144 tselem->id = id;
145 tselem->used = 0;
146 tselem->flag = TSE_CLOSED;
147 te->store_elem = tselem;
148 space_outliner->runtime->tree_hash->add_element(*tselem);
149}
150
152
153/* -------------------------------------------------------------------- */
156
157void outliner_free_tree(ListBaseT<TreeElement> *tree)
158{
159 for (TreeElement &element : tree->items_mutable()) {
161 }
162}
163
165{
166 outliner_free_tree(&space_outliner->runtime->tree);
167 outliner_storage_cleanup(space_outliner);
168}
169
170void outliner_free_tree_element(TreeElement *element, ListBaseT<TreeElement> *parent_subtree)
171{
172 BLI_assert(BLI_findindex(parent_subtree, element) > -1);
173 BLI_remlink(parent_subtree, element);
174
175 outliner_free_tree(&element->subtree);
176
177 if (element->flag & TE_FREE_NAME) {
178 MEM_delete(element->name);
179 }
180 element->abstract_element = nullptr;
181 MEM_delete(element);
182}
183
185{
186 eSpaceOutliner_Filter exclude_flags = outliner_exclude_filter_get(space_outliner);
187 /* Need to rebuild tree to re-apply filter if select/active changed while filtering based on
188 * select/active. */
190}
191
193{
194 if (id == nullptr) {
195 return nullptr;
196 }
197 /* Real ID, ensure we do not get non-outliner ID types here... */
199
201 params,
203 id,
204 nullptr,
205 false,
206 [&](TreeElement &legacy_te) -> std::unique_ptr<AbstractTreeElement> {
207 return TreeElementID::create_from_id(legacy_te, *id);
208 });
209 BLI_assert_msg(te->abstract_element != nullptr,
210 "Expected this ID type to be ported to new Outliner tree-element design");
211 return te;
212}
213
215 const TreeElementAddParams &params,
216 const short type,
217 ID *owner_id,
218 const void *persistent_ptr,
219 const bool allow_null_identity,
220 FunctionRef<std::unique_ptr<AbstractTreeElement>(TreeElement &)> construct_fn)
221{
222 ListBaseT<TreeElement> *lb = params.lb ? params.lb :
223 (params.parent ? &params.parent->subtree : nullptr);
224 BLI_assert_msg(lb != nullptr, "Either a sub-tree or a parent to add the element to is required");
225
226 /* Pointer to store in #TreeStoreElem.id to identify the element over rebuilds and reconstruct it
227 * on file read. This is never an arbitrary pointer that happens to be reinterpreted as an ID: it
228 * is either an actual ID, or a pointer the element type explicitly nominated for identification
229 * purposes only. */
230 ID *persistent_dataptr = owner_id ? owner_id :
231 static_cast<ID *>(const_cast<void *>(persistent_ptr));
232 if (persistent_dataptr == nullptr && !allow_null_identity) {
233 /* Nothing to identify the element by, so it could not be recognized over rebuilds. Matches the
234 * behavior of the `void *` #add_element(), which skips such elements entirely. */
235 return nullptr;
236 }
237
238 const short index = short(params.index);
239
240 TreeElement *te = MEM_new<TreeElement>(__func__);
241 /* add to the visual tree */
242 BLI_addtail(lb, te);
243 /* add to the storage */
244 check_persistent(&space_outliner_, te, persistent_dataptr, type, index);
245
246 /* if we are searching for something expand to see child elements */
248 TREESTORE(te)->flag |= TSE_CHILDSEARCH;
249 }
250
251 te->parent = params.parent;
252 te->index = index; /* For data arrays. */
253
254 /* Note that this may fail, #TreeElementID::create_from_id() returns null for ID types the
255 * Outliner doesn't build elements for (e.g. deprecated ones). */
256 te->abstract_element = construct_fn(*te);
257 if (te->abstract_element == nullptr) {
258 return te;
259 }
260 /* Let the new element inherit the tree display that creates this current tree. */
261 te->abstract_element->display_ = this;
262
263 /* Element types are expected to have their name set at this point! */
264 BLI_assert(te->name != nullptr);
265
266 if (params.expand) {
268 }
269
270 return te;
271}
272
274{
275 te->name = BKE_collection_ui_name_get(collection);
276 te->directdata = collection;
277}
278
280 ListBaseT<TreeElement> *tree,
281 Collection *collection,
282 TreeElement *parent)
283{
284 for (CollectionObject &cob : collection->gobject) {
285 tree_display.add_id_element({.lb = tree, .parent = parent}, reinterpret_cast<ID *>(cob.ob));
286 }
287}
288
290 SpaceOutliner *space_outliner,
291 Collection *collection,
292 TreeElement *ten)
293{
294 outliner_add_collection_init(ten, collection);
295
296 for (CollectionChild &child : collection->children) {
297 tree_display.add_id_element({.lb = &ten->subtree, .parent = ten}, &child.collection->id);
298 }
299
300 if (space_outliner->outlinevis != SO_SCENES) {
301 outliner_add_collection_objects(tree_display, &ten->subtree, collection, ten);
302 }
303
304 return ten;
305}
306
308
309/* -------------------------------------------------------------------- */
314
315struct tTreeSort {
318 const char *name;
319 short idcode;
320};
321
322/* Move children that are not in the collection to the end of the list. */
323static std::optional<bool> treesort_child_not_in_collection(const tTreeSort &x1,
324 const tTreeSort &x2)
325{
326 /* Among objects first come the ones in the collection, followed by the ones not on it.
327 * This way we can have the dashed lines in a separate style connecting the former. */
329 return (x2.te->flag & TE_CHILD_NOT_IN_COLLECTION) != 0;
330 }
331 return std::nullopt;
332}
333
334static bool treesort_alpha(const tTreeSort &x1, const tTreeSort &x2)
335{
336 const int comp = BLI_strcasecmp_natural(x1.name, x2.name);
337
338 return comp < 0;
339}
340
341static bool treesort_alpha_ob(const tTreeSort &x1, const tTreeSort &x2)
342{
343 const bool a_is_ob = (x1.idcode == ID_OB);
344 const bool b_is_ob = (x2.idcode == ID_OB);
345
346 if (a_is_ob && b_is_ob) {
347 if (std::optional<bool> comp = treesort_child_not_in_collection(x1, x2)) {
348 return *comp;
349 }
350 }
351
352 return outliner_treesort_tiebreak(a_is_ob, x1.name, b_is_ob, x2.name);
353}
354
359
360static int get_sort_index(const tTreeSort &x,
361 const OutlinerSortMaps &sort_maps,
362 const Map<Collection *, CollectionChild *> &collection_map,
363 Collection *collection,
364 const bool is_parented_object)
365{
366 if (x.idcode == ID_OB) {
367 Object *ob = reinterpret_cast<Object *>(x.id);
368 CollectionObject *cob = sort_maps.collection_and_object_to_cob_map.lookup_default(
369 {collection, ob}, nullptr);
370 if (cob == nullptr) {
371 cob = sort_maps.object_to_any_cob_map.lookup_default(ob, nullptr);
372 }
373 if (cob) {
374 int sort_idx = is_parented_object ? cob->parented_sort_index : cob->sort_index;
375 if (sort_idx >= 0) {
376 return sort_idx;
377 }
378 }
379 }
380 else {
382 if (child_col != nullptr) {
383 CollectionChild *cc = collection_map.lookup_default(child_col, nullptr);
384 if (cc && cc->sort_index >= 0) {
385 return cc->sort_index;
386 }
387 }
388 }
389 return INT_MAX;
390}
391/* Sort object/collection entries in a parent collection by their `sort_index`,
392 * using natural-name order only as a tie-breaker. Non-object/non-collection entries
393 * keep their existing relative order. */
394static bool treesort_custom(const tTreeSort &x1,
395 const tTreeSort &x2,
396 const OutlinerSortMaps &sort_maps,
397 const Map<Collection *, CollectionChild *> &collection_child_map,
398 Collection *collection,
399 const bool is_parented_object)
400{
401 const bool x1_valid = (x1.idcode == ID_OB) || outliner_is_collection_tree_element(x1.te);
402 const bool x2_valid = (x2.idcode == ID_OB) || outliner_is_collection_tree_element(x2.te);
403
404 if (!x1_valid || !x2_valid) {
405 return false;
406 }
407
408 int x1_sort_index = get_sort_index(
409 x1, sort_maps, collection_child_map, collection, is_parented_object);
410 int x2_sort_index = get_sort_index(
411 x2, sort_maps, collection_child_map, collection, is_parented_object);
412 if (x1_sort_index == x2_sort_index) {
413 return treesort_alpha_ob(x1, x2);
414 }
415
416 return x1_sort_index < x2_sort_index;
417}
418
419/* this is nice option for later? doesn't look too useful... */
420#if 0
421static int treesort_obtype_alpha(const void *v1, const void *v2)
422{
423 const tTreeSort *x1 = v1, *x2 = v2;
424
425 /* first put objects last (hierarchy) */
426 if (x1->idcode == ID_OB && x2->idcode != ID_OB) {
427 return 1;
428 }
429 else if (x2->idcode == ID_OB && x1->idcode != ID_OB) {
430 return -1;
431 }
432 else {
433 /* 2nd we check ob type */
434 if (x1->idcode == ID_OB && x2->idcode == ID_OB) {
435 if (((Object *)x1->id)->type > ((Object *)x2->id)->type) {
436 return 1;
437 }
438 else if (((Object *)x1->id)->type > ((Object *)x2->id)->type) {
439 return -1;
440 }
441 else {
442 return 0;
443 }
444 }
445 else {
446 int comp = BLI_strcasecmp_natural(x1->name, x2->name);
447
448 if (comp > 0) {
449 return 1;
450 }
451 else if (comp < 0) {
452 return -1;
453 }
454 return 0;
455 }
456 }
457}
458#endif
459
460/* sort happens on each subtree individual */
461static void outliner_sort(ListBaseT<TreeElement> *lb)
462{
463 /* Sorting trying to handle these cases:
464 * - contents of collections (where contained collections
465 * come first, stay first and are not sorted, followed by
466 * objects etc - which ARE sorted).
467 * - contents of "Vertex Groups" (these ARE all sorted, nothing
468 * else in there).
469 * - contents of armature data (where optional contained bone
470 * collections [editmode] come last, stay last and are not sorted)
471 * with bones coming first (and ARE sorted).
472 */
473
474 TreeElement *last_te = lb->last();
475 if (last_te == nullptr) {
476 return;
477 }
478 TreeStoreElem *last_tselem = TREESTORE(last_te);
479
480 /* Check if we are expanding Armature data and if there are bone collections. */
481 const TreeElement *first_te = lb->first();
482 const TreeStoreElem *first_tselem = TREESTORE(first_te);
483 const bool inside_armature_data = ELEM(
484 first_tselem->type, TSE_BONE, TSE_EBONE, TSE_POSE_CHANNEL);
485 const bool has_armature_data_bone_collections = ELEM(last_tselem->type,
487
488 /* Sorting rules; only object lists, ID lists, bones or deform-groups. */
489 if (inside_armature_data || ELEM(last_tselem->type, TSE_DEFGROUP, TSE_ID_BASE) ||
490 ((last_tselem->type == TSE_SOME_ID) && (last_te->idcode == ID_OB)))
491 {
492 int totelem = lb->count();
493
494 if (totelem > 1) {
495 Vector<tTreeSort> tear_vec(totelem);
496 tTreeSort *tear = tear_vec.data();
497 tTreeSort *tp = tear;
498
499 for (TreeElement &te : *lb) {
500 TreeStoreElem *tselem = TREESTORE(&te);
501 tp->te = &te;
502 tp->name = te.name;
503 tp->idcode = te.idcode;
504
506 {
507 tp->idcode = 0; /* Don't sort this. */
508 }
510 tp->idcode = 1; /* Do sort this. */
511 }
512 tp++;
513 }
514
515 /* Just sort alphabetically (but keep bone collections last when inside armature data). */
516 if (tear->idcode == 1) {
517 const int skip_back = has_armature_data_bone_collections ? 1 : 0;
518 std::sort(tear, tear + totelem - skip_back, treesort_alpha);
519 }
520 else {
521 /* keep beginning of list */
522 int skip_front = 0;
523 for (tp = tear, skip_front = 0; skip_front < totelem; skip_front++, tp++) {
524 if (tp->idcode) {
525 break;
526 }
527 }
528
529 if (skip_front < totelem) {
530 std::stable_sort(tear + skip_front, tear + totelem, treesort_alpha_ob);
531 }
532 }
533
534 lb->clear_no_delete();
535 tp = tear;
536 for (int i = 0; i < totelem; i++, tp++) {
537 BLI_addtail(lb, tp->te);
538 }
539 }
540 }
541
542 for (TreeElement &te_iter : *lb) {
543 outliner_sort(&te_iter.subtree);
544 }
545}
546
547static void outliner_sort_custom(Main *bmain,
548 Scene *scene,
549 ListBaseT<TreeElement> *lb,
550 const OutlinerSortMaps &sort_maps)
551{
552 TreeElement *last_te = lb->last();
553 if (last_te == nullptr) {
554 return;
555 }
556
557 Collection *collection = nullptr;
558 bool is_parented_object = false;
559 if (last_te->parent != nullptr) {
560 collection = outliner_collection_from_tree_element(last_te->parent);
561 if (collection == nullptr) {
562 for (TreeElement *te_parent = last_te->parent; te_parent != nullptr;
563 te_parent = te_parent->parent)
564 {
565 collection = outliner_collection_from_tree_element(te_parent);
566 if (collection != nullptr) {
567 break;
568 }
569 }
570 if (last_te->parent->idcode == ID_OB) {
571 is_parented_object = true;
572 }
573 }
574 }
575
576 Map<Collection *, CollectionChild *> collection_child_map;
577 if (collection != nullptr) {
578 int totelem = lb->count();
579
580 if (totelem >= 1) {
581 Vector<tTreeSort> tear_vec(totelem);
582 tTreeSort *tear = tear_vec.data();
583 tTreeSort *tp = tear;
584
585 for (TreeElement &te : *lb) {
586 TreeStoreElem *tselem = TREESTORE(&te);
587 tp->te = &te;
588 tp->name = te.name;
589 tp->idcode = te.idcode;
590 tp->id = tselem->id;
591
594 if (child_col != nullptr) {
595 CollectionChild *cc = BKE_collection_child_find(collection, child_col);
596 if (cc != nullptr) {
597 collection_child_map.add_new(child_col, cc);
598 }
599 }
600 }
601 tp++;
602 }
603
604 auto treesort_custom_fn =
605 [&sort_maps, &collection_child_map, collection, is_parented_object](const tTreeSort &a,
606 const tTreeSort &b) {
607 return treesort_custom(
608 a, b, sort_maps, collection_child_map, collection, is_parented_object);
609 };
610
611 std::stable_sort(tear, tear + totelem, treesort_custom_fn);
612 int index = 0;
613 for (tTreeSort element : tear_vec) {
614 if (element.idcode == ID_OB) {
615 Object *ob = reinterpret_cast<Object *>(element.id);
616 CollectionObject *cob = sort_maps.collection_and_object_to_cob_map.lookup_default(
617 {collection, ob}, nullptr);
618 if (cob == nullptr) {
619 cob = sort_maps.object_to_any_cob_map.lookup_default(ob, nullptr);
620 }
621 if (cob != nullptr) {
622 if (is_parented_object) {
623 cob->parented_sort_index = index++;
624 }
625 else {
626 cob->sort_index = index++;
627 }
628 }
629 }
630 else {
632 if (child_col != nullptr) {
633 CollectionChild *cc = collection_child_map.lookup_default(child_col, nullptr);
634 if (cc != nullptr) {
635 cc->sort_index = index++;
636 }
637 }
638 }
639 }
640
641 lb->clear_no_delete();
642 tp = tear;
643 for (int i = 0; i < totelem; i++, tp++) {
644 BLI_addtail(lb, tp->te);
645 }
646 }
647 }
648
649 for (TreeElement &te_iter : *lb) {
650 outliner_sort_custom(bmain, scene, &te_iter.subtree, sort_maps);
651 }
652}
653
655{
656 for (CollectionObject &cob : collection->gobject) {
657 sort_maps.collection_and_object_to_cob_map.add_overwrite({collection, cob.ob}, &cob);
658 sort_maps.object_to_any_cob_map.add_overwrite(cob.ob, &cob);
659 }
660 for (CollectionChild &child : collection->children) {
662 }
663}
664static void outliner_sort_custom(Main *bmain, Scene *scene, ListBaseT<TreeElement> *lb)
665{
666 OutlinerSortMaps sort_maps;
667 if (scene != nullptr) {
669 }
670
671 outliner_sort_custom(bmain, scene, lb, sort_maps);
672}
673
674
675/* -------------------------------------------------------------------- */
678
683
689 ARegion *region,
691{
692 View2D *v2d = &region->v2d;
693
694 if (focus->tselem != nullptr) {
695 outliner_set_coordinates(region, space_outliner);
696
697 TreeElement *te_new = outliner_find_tree_element(&space_outliner->runtime->tree,
698 focus->tselem);
699
700 if (te_new != nullptr) {
701 int ys_new = te_new->ys;
702 int ys_old = focus->ys;
703
704 float y_move = std::min(float(ys_new - ys_old), -v2d->cur.ymax);
705 BLI_rctf_translate(&v2d->cur, 0, y_move);
706 }
707 else {
708 return;
709 }
710 }
711}
712
717
719{
720 TreeStoreElem *tselem = TREESTORE(te);
721 return ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB));
722}
723
728 const SpaceOutliner *space_outliner,
729 TreeElement *te,
730 const float limit,
731 bool (*callback_test)(TreeElement *))
732{
733 if (callback_test(te)) {
734 return te;
735 }
736
737 if (TSELEM_OPEN(te->store_elem, space_outliner)) {
738 for (TreeElement &te_iter : te->subtree) {
740 space_outliner, &te_iter, limit, callback_test);
741 if (te_sub != nullptr) {
742 return te_sub;
743 }
744 }
745 }
746
747 return nullptr;
748}
749
761 const float view_co,
762 const float view_co_limit)
763{
765 space_outliner, &space_outliner->runtime->tree, view_co);
766
767 bool (*callback_test)(TreeElement *);
768 if ((space_outliner->outlinevis == SO_VIEW_LAYER) &&
769 (space_outliner->filter & SO_FILTER_NO_COLLECTION))
770 {
771 callback_test = test_object_callback;
772 }
773 else {
774 callback_test = test_collection_callback;
775 }
776
777 while (te != nullptr) {
779 space_outliner, te, view_co_limit, callback_test);
780 if (te_sub != nullptr) {
781 /* Skip the element if it was not visible to start with. */
782 if (te->ys + UI_UNIT_Y > view_co_limit) {
783 return te_sub;
784 }
785 return nullptr;
786 }
787
788 if (te->next) {
789 te = te->next;
790 continue;
791 }
792
793 if (te->parent == nullptr) {
794 break;
795 }
796
797 while (te->parent) {
798 if (te->parent->next) {
799 te = te->parent->next;
800 break;
801 }
802 te = te->parent;
803 }
804 }
805
806 return nullptr;
807}
808
817 ARegion *region,
819{
820 float limit = region->v2d.cur.ymin;
821
822 outliner_set_coordinates(region, space_outliner);
823
825 space_outliner, region->v2d.cur.ymax, limit);
826
827 if (te != nullptr) {
828 focus->tselem = TREESTORE(te);
829 focus->ys = te->ys;
830 }
831 else {
832 focus->tselem = nullptr;
833 }
834}
835
837{
838 eSpaceOutliner_Filter exclude_filter = space_outliner->filter & ~SO_FILTER_OB_STATE;
839
840 if ((space_outliner->search_string[0] != 0) && ED_outliner_support_searching(space_outliner)) {
841 exclude_filter |= SO_FILTER_SEARCH;
842 }
843 else {
844 exclude_filter &= ~SO_FILTER_SEARCH;
845 }
846
847 /* Let's have this for the collection options at first. */
848 if (!SUPPORT_FILTER_OUTLINER(space_outliner)) {
849 return (exclude_filter & SO_FILTER_SEARCH);
850 }
851
852 if (space_outliner->filter & SO_FILTER_NO_OBJECT) {
853 exclude_filter |= SO_FILTER_OB_TYPE;
854 }
855
856 switch (space_outliner->filter_state) {
858 exclude_filter |= SO_FILTER_OB_STATE_VISIBLE;
859 break;
861 exclude_filter |= SO_FILTER_OB_STATE_SELECTED;
862 break;
864 exclude_filter |= SO_FILTER_OB_STATE_ACTIVE;
865 break;
867 exclude_filter |= SO_FILTER_OB_STATE_SELECTABLE;
868 break;
869 case SO_FILTER_OB_ALL:
871 break;
872 }
873
874 return exclude_filter;
875}
876
877static bool outliner_element_visible_get(const Main &bmain,
878 const Scene *scene,
879 ViewLayer *view_layer,
880 TreeElement *te,
881 const eSpaceOutliner_Filter exclude_filter)
882{
883 if ((exclude_filter & SO_FILTER_ANY) == 0) {
884 return true;
885 }
886
887 TreeStoreElem *tselem = TREESTORE(te);
888 if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) {
889 if ((exclude_filter & SO_FILTER_OB_TYPE) == SO_FILTER_OB_TYPE) {
890 return false;
891 }
892
893 Object *ob = id_cast<Object *>(tselem->id);
894 Base *base = static_cast<Base *>(te->directdata);
895 BLI_assert((base == nullptr) || (base->object == ob));
896
897 if (exclude_filter & SO_FILTER_OB_TYPE) {
898 switch (ob->type) {
899 case OB_MESH:
900 if (exclude_filter & SO_FILTER_NO_OB_MESH) {
901 return false;
902 }
903 break;
904 case OB_ARMATURE:
905 if (exclude_filter & SO_FILTER_NO_OB_ARMATURE) {
906 return false;
907 }
908 break;
909 case OB_EMPTY:
910 if (exclude_filter & SO_FILTER_NO_OB_EMPTY) {
911 return false;
912 }
913 break;
914 case OB_LAMP:
915 if (exclude_filter & SO_FILTER_NO_OB_LAMP) {
916 return false;
917 }
918 break;
919 case OB_CAMERA:
920 if (exclude_filter & SO_FILTER_NO_OB_CAMERA) {
921 return false;
922 }
923 break;
924 case OB_GREASE_PENCIL:
925 if (exclude_filter & SO_FILTER_NO_OB_GREASE_PENCIL) {
926 return false;
927 }
928 break;
929 default:
930 if (exclude_filter & SO_FILTER_NO_OB_OTHERS) {
931 return false;
932 }
933 break;
934 }
935 }
936
937 if (exclude_filter & SO_FILTER_OB_STATE) {
938 if (base == nullptr) {
939 BKE_view_layer_synced_ensure(bmain, scene, view_layer);
940 base = BKE_view_layer_base_find(view_layer, ob);
941
942 if (base == nullptr) {
943 return false;
944 }
945 }
946
947 bool is_visible = true;
948 if (exclude_filter & SO_FILTER_OB_STATE_VISIBLE) {
950 is_visible = false;
951 }
952 }
953 else if (exclude_filter & SO_FILTER_OB_STATE_SELECTED) {
954 if ((base->flag & BASE_SELECTED) == 0) {
955 is_visible = false;
956 }
957 }
958 else if (exclude_filter & SO_FILTER_OB_STATE_SELECTABLE) {
959 if ((base->flag & BASE_SELECTABLE) == 0) {
960 is_visible = false;
961 }
962 }
963 else {
964 BLI_assert(exclude_filter & SO_FILTER_OB_STATE_ACTIVE);
965 BKE_view_layer_synced_ensure(bmain, scene, view_layer);
966 if (base != BKE_view_layer_active_base_get(view_layer)) {
967 is_visible = false;
968 }
969 }
970
971 if (exclude_filter & SO_FILTER_OB_STATE_INVERSE) {
972 is_visible = !is_visible;
973 }
974
975 return is_visible;
976 }
977
978 if ((te->parent != nullptr) && (TREESTORE(te->parent)->type == TSE_SOME_ID) &&
979 (te->parent->idcode == ID_OB))
980 {
981 if (exclude_filter & SO_FILTER_NO_CHILDREN) {
982 return false;
983 }
984 }
985 }
986 else if ((te->idcode == ID_MA) && (exclude_filter & SO_FILTER_NO_OB_MATERIAL)) {
987 return false;
988 }
989 else if ((te->idcode == ID_KE) && (exclude_filter & SO_FILTER_NO_OB_SHAPE_KEYS)) {
990 return false;
991 }
992 else if ((TREESTORE(te)->type == TSE_BONE_COLLECTION_BASE) &&
993 (exclude_filter & SO_FILTER_NO_ARMATURE_BONE_COLLECTION))
994 {
995 return false;
996 }
997 else if ((te->parent != nullptr) && (TREESTORE(te->parent)->type == TSE_SOME_ID) &&
998 (te->parent->idcode == ID_OB))
999 {
1000 if (exclude_filter & SO_FILTER_NO_OB_CONTENT) {
1001 return false;
1002 }
1003 const eTreeStoreElemType type = eTreeStoreElemType(TREESTORE(te)->type);
1004 const Object *parent_ob = id_cast<Object *>(TREESTORE(te->parent)->id);
1005 if (type == TSE_SOME_ID && (TREESTORE(te)->id == parent_ob->data)) {
1006 if (exclude_filter & SO_FILTER_NO_OB_DATA) {
1007 return false;
1008 }
1009 }
1010 else if ((type == TSE_ANIM_DATA) && (exclude_filter & SO_FILTER_NO_OB_ANIMATION)) {
1011 return false;
1012 }
1013 else if ((type == TSE_CONSTRAINT_BASE) && (exclude_filter & SO_FILTER_NO_OB_CONSTRAINTS)) {
1014 return false;
1015 }
1016 else if ((type == TSE_MODIFIER_BASE) && (exclude_filter & SO_FILTER_NO_OB_MODIFIERS)) {
1017 return false;
1018 }
1019 else if ((type == TSE_DEFGROUP_BASE) && (exclude_filter & SO_FILTER_NO_OB_DEFGROUP)) {
1020 return false;
1021 }
1022 else if ((type == TSE_GPENCIL_EFFECT_BASE) &&
1023 (exclude_filter & SO_FILTER_NO_GREASE_PENCIL_EFFECTS))
1024 {
1025 return false;
1026 }
1027 else if ((type == TSE_POSE_BASE) && (exclude_filter & SO_FILTER_NO_POSE_BONES)) {
1028 return false;
1029 }
1030 }
1031
1032 return true;
1033}
1034
1035static bool outliner_filter_has_name(TreeElement *te, const char *name, int flags)
1036{
1037 /* Use `fnmatch` for shell-style globing.
1038 * - Case-insensitive (optionally).
1039 * - Don't handle escape characters as "special" characters are not expected in names.
1040 * Unlike shell input - `\` should be treated like any other character.
1041 */
1042 int fn_flag = FNM_NOESCAPE;
1043
1044 if ((flags & SO_FIND_CASE_SENSITIVE) == 0) {
1045 fn_flag |= FNM_CASEFOLD;
1046 }
1047
1048 return fnmatch(name, te->name, fn_flag) == 0;
1049}
1050
1052{
1053 TreeStoreElem *tselem = TREESTORE(te);
1054
1055 if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) {
1056 return true;
1057 }
1058
1059 /* Collection instance datablocks should not be extracted. */
1060 if (outliner_is_collection_tree_element(te) && !(te->parent && te->parent->idcode == ID_OB)) {
1061 return true;
1062 }
1063
1064 return false;
1065}
1066
1068 ListBaseT<TreeElement> *parent_subtree)
1069{
1070 TreeElement *te_next = element->next;
1071
1073 TreeElement *te_prev = nullptr;
1074 for (TreeElement *te = element->subtree.last(); te; te = te_prev) {
1075 te_prev = te->prev;
1076
1078 continue;
1079 }
1080
1081 te_next = te;
1082 BLI_remlink(&element->subtree, te);
1083 BLI_insertlinkafter(parent_subtree, element->prev, te);
1084 te->parent = element->parent;
1085 }
1086 }
1087
1088 outliner_free_tree_element(element, parent_subtree);
1089 return te_next;
1090}
1091
1092static int outliner_filter_subtree(SpaceOutliner *space_outliner,
1093 const Main &bmain,
1094 const Scene *scene,
1095 ViewLayer *view_layer,
1096 ListBaseT<TreeElement> *lb,
1097 const char *search_string,
1098 const eSpaceOutliner_Filter exclude_filter)
1099{
1100 TreeElement *te, *te_next;
1101 TreeStoreElem *tselem;
1102
1103 for (te = lb->first(); te; te = te_next) {
1104 te_next = te->next;
1105 if (outliner_element_visible_get(bmain, scene, view_layer, te, exclude_filter) == false) {
1106 /* Don't free the tree, but extract the children from the parent and add to this tree. */
1107 /* This also needs filtering the subtree prior (see #69246). */
1109 space_outliner, bmain, scene, view_layer, &te->subtree, search_string, exclude_filter);
1111 continue;
1112 }
1113 if ((exclude_filter & SO_FILTER_SEARCH) == 0) {
1114 /* Filter subtree too. */
1116 space_outliner, bmain, scene, view_layer, &te->subtree, search_string, exclude_filter);
1117 continue;
1118 }
1119
1120 if (!outliner_filter_has_name(te, search_string, space_outliner->search_flags)) {
1121 /* item isn't something we're looking for, but...
1122 * - if the subtree is expanded, check if there are any matches that can be easily found
1123 * so that searching for "cu" in the default scene will still match the Cube
1124 * - otherwise, we can't see within the subtree and the item doesn't match,
1125 * so these can be safely ignored (i.e. the subtree can get freed)
1126 */
1127 tselem = TREESTORE(te);
1128
1129 /* flag as not a found item */
1130 tselem->flag &= ~TSE_SEARCHMATCH;
1131
1132 if (!TSELEM_OPEN(tselem, space_outliner) || outliner_filter_subtree(space_outliner,
1133 bmain,
1134 scene,
1135 view_layer,
1136 &te->subtree,
1137 search_string,
1138 exclude_filter) == 0)
1139 {
1141 }
1142 }
1143 else {
1144 tselem = TREESTORE(te);
1145
1146 /* flag as a found item - we can then highlight it */
1147 tselem->flag |= TSE_SEARCHMATCH;
1148
1149 /* filter subtree too */
1151 space_outliner, bmain, scene, view_layer, &te->subtree, search_string, exclude_filter);
1152 }
1153 }
1154
1155 /* if there are still items in the list, that means that there were still some matches */
1156 return (lb->is_empty() == false);
1157}
1158
1159static void outliner_filter_tree(const Main &bmain,
1160 SpaceOutliner *space_outliner,
1161 const Scene *scene,
1162 ViewLayer *view_layer)
1163{
1164 char search_buff[sizeof(SpaceOutliner::search_string) + 2];
1165 const char *search_string;
1166
1167 const eSpaceOutliner_Filter exclude_filter = outliner_exclude_filter_get(space_outliner);
1168
1169 if (exclude_filter == 0) {
1170 return;
1171 }
1172
1173 if (space_outliner->search_flags & SO_FIND_COMPLETE) {
1174 search_string = space_outliner->search_string;
1175 }
1176 else {
1177 /* Implicitly add heading/trailing wildcards if needed. */
1178 BLI_strncpy_ensure_pad(search_buff, space_outliner->search_string, '*', sizeof(search_buff));
1179 search_string = search_buff;
1180 }
1181
1182 outliner_filter_subtree(space_outliner,
1183 bmain,
1184 scene,
1185 view_layer,
1186 &space_outliner->runtime->tree,
1187 search_string,
1188 exclude_filter);
1189}
1190
1192{
1193 ID *id_iter;
1194 FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
1195 id_iter->newid = nullptr;
1196 }
1198}
1199
1201
1202/* -------------------------------------------------------------------- */
1205
1207 WorkSpace *workspace,
1208 Scene *scene,
1209 ViewLayer *view_layer,
1210 SpaceOutliner *space_outliner,
1211 ARegion *region)
1212{
1213 /* Are we looking for something - we want to tag parents to filter child matches
1214 * - NOT in data-blocks view - searching all data-blocks takes way too long to be useful
1215 * - this variable is only set once per tree build */
1216 if (space_outliner->search_string[0] != 0 && space_outliner->outlinevis != SO_DATA_API &&
1217 ED_outliner_support_searching(space_outliner))
1218 {
1219 space_outliner->search_flags |= SO_SEARCH_RECURSIVE;
1220 }
1221 else {
1222 space_outliner->search_flags &= ~SO_SEARCH_RECURSIVE;
1223 }
1224
1225 if (space_outliner->runtime->tree_hash && (space_outliner->storeflag & SO_TREESTORE_REBUILD) &&
1226 space_outliner->treestore)
1227 {
1228 space_outliner->runtime->tree_hash->rebuild_from_treestore(*space_outliner->treestore);
1229 }
1230 space_outliner->storeflag &= ~SO_TREESTORE_REBUILD;
1231
1232 if (region->runtime->do_draw & RGN_DRAW_NO_REBUILD) {
1233 BLI_assert_msg(space_outliner->runtime->tree_display != nullptr,
1234 "Skipping rebuild before tree was built properly, a full redraw should be "
1235 "triggered instead");
1236 return;
1237 }
1238
1239 /* Enable for benchmarking. Starts a timer, results will be printed on function exit. */
1240 // SCOPED_TIMER("Outliner Rebuild");
1241 // SCOPED_TIMER_AVERAGED("Outliner Rebuild");
1242
1244 outliner_store_scrolling_position(space_outliner, region, &focus);
1245
1246 outliner_free_tree(&space_outliner->runtime->tree);
1247 outliner_storage_cleanup(space_outliner);
1248
1250 space_outliner->outlinevis, *space_outliner);
1251
1252 /* All tree displays should be created as sub-classes of AbstractTreeDisplay. */
1253 BLI_assert(space_outliner->runtime->tree_display != nullptr);
1254
1255 TreeSourceData source_data{*mainvar, *workspace, *scene, *view_layer};
1256 space_outliner->runtime->tree = ListBaseT<TreeElement>{
1257 space_outliner->runtime->tree_display->build_tree(source_data)};
1258
1259 switch (space_outliner->sort_method) {
1260 case SO_SORT_ALPHA:
1261 outliner_sort(&space_outliner->runtime->tree);
1262 break;
1263
1264 case SO_SORT_CUSTOM:
1265 outliner_sort_custom(mainvar, scene, &space_outliner->runtime->tree);
1266 break;
1267
1268 case SO_SORT_NONE:
1269 break;
1270
1271 default:
1273 break;
1274 }
1275
1276 outliner_filter_tree(*mainvar, space_outliner, scene, view_layer);
1277 outliner_restore_scrolling_position(space_outliner, region, &focus);
1278
1279 /* `ID.newid` pointer is abused when building tree, DO NOT call #BKE_main_id_newptr_and_tag_clear
1280 * as this expects valid IDs in this pointer, not random unknown data. */
1282}
1283
1285
1286} // namespace blender::ed::outliner
#define FOREACH_MAIN_ID_END
Definition BKE_main.hh:735
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
Definition BKE_main.hh:729
Object groups, one object can be in many groups at once.
#define SO_FILTER_OB_STATE
#define SO_FILTER_OB_TYPE
#define SO_FILTER_ANY
Read Blender memory allocation and freeing.
#define UI_UNIT_Y
#define BLI_assert_unreachable()
#define BLI_INLINE
#define ELEM(...)
#define BLI_assert_msg(a, msg)
Value lookup_default(const Key &key, const Value &default_value) const
Definition BLI_map.hh:570
void add_new(const Key &key, const Value &value)
Definition BLI_map.hh:265
TreeElement * add_id_element(const TreeElementAddParams &params, ID *id)
TreeElement * add_element_impl(const TreeElementAddParams &params, short type, ID *owner_id, const void *persistent_ptr, bool allow_null_identity, FunctionRef< std::unique_ptr< AbstractTreeElement >(TreeElement &)> construct_fn)
static std::unique_ptr< AbstractTreeDisplay > create_from_display_mode(int mode, SpaceOutliner &space_outliner)
static std::unique_ptr< TreeElementID > create_from_id(TreeElement &legacy_te, ID &id)
#define INT_MAX
static TreeElement * outliner_find_first_desired_element_at_y_recursive(const SpaceOutliner *space_outliner, TreeElement *te, const float limit, bool(*callback_test)(TreeElement *))
static std::optional< bool > treesort_child_not_in_collection(const tTreeSort &x1, const tTreeSort &x2)
static bool treesort_alpha_ob(const tTreeSort &x1, const tTreeSort &x2)
TreeElement * outliner_find_item_at_y(const SpaceOutliner *space_outliner, const ListBaseT< TreeElement > *tree, float view_co_y)
static eSpaceOutliner_Filter outliner_exclude_filter_get(const SpaceOutliner *space_outliner)
static TreeElement * outliner_extract_children_from_subtree(TreeElement *element, ListBaseT< TreeElement > *parent_subtree)
static void outliner_restore_scrolling_position(SpaceOutliner *space_outliner, ARegion *region, OutlinerTreeElementFocus *focus)
bool outliner_is_collection_tree_element(const TreeElement *te)
static bool outliner_element_is_collection_or_object(TreeElement *te)
void tree_element_expand(const AbstractTreeElement &tree_element, SpaceOutliner &space_outliner)
static bool test_object_callback(TreeElement *te)
static bool outliner_element_visible_get(const Main &bmain, const Scene *scene, ViewLayer *view_layer, TreeElement *te, const eSpaceOutliner_Filter exclude_filter)
static void outliner_storage_cleanup(SpaceOutliner *space_outliner)
BLI_INLINE void outliner_add_collection_objects(AbstractTreeDisplay &tree_display, ListBaseT< TreeElement > *tree, Collection *collection, TreeElement *parent)
static bool treesort_alpha(const tTreeSort &x1, const tTreeSort &x2)
bool outliner_requires_rebuild_on_select_or_active_change(const SpaceOutliner *space_outliner)
static bool outliner_filter_has_name(TreeElement *te, const char *name, int flags)
static void outliner_sort_custom(Main *bmain, Scene *scene, ListBaseT< TreeElement > *lb, const OutlinerSortMaps &sort_maps)
Collection * outliner_collection_from_tree_element(const TreeElement *te)
static bool treesort_custom(const tTreeSort &x1, const tTreeSort &x2, const OutlinerSortMaps &sort_maps, const Map< Collection *, CollectionChild * > &collection_child_map, Collection *collection, const bool is_parented_object)
static int get_sort_index(const tTreeSort &x, const OutlinerSortMaps &sort_maps, const Map< Collection *, CollectionChild * > &collection_map, Collection *collection, const bool is_parented_object)
static void map_all_objects_to_collection(Collection *collection, OutlinerSortMaps &sort_maps)
void outliner_free_tree_element(TreeElement *element, ListBaseT< TreeElement > *parent_subtree)
bool outliner_treesort_tiebreak(bool a_is_object, const char *a_name, bool b_is_object, const char *b_name)
static void check_persistent(SpaceOutliner *space_outliner, TreeElement *te, ID *id, short type, short nr)
void outliner_cleanup_tree(SpaceOutliner *space_outliner)
static void outliner_sort(ListBaseT< TreeElement > *lb)
TreeElement * outliner_find_tree_element(ListBaseT< TreeElement > *lb, const TreeStoreElem *store_elem)
void outliner_free_tree(ListBaseT< TreeElement > *tree)
TreeElement * outliner_add_collection_recursive(AbstractTreeDisplay &tree_display, SpaceOutliner *space_outliner, Collection *collection, TreeElement *ten)
static void outliner_clear_newid_from_main(Main *bmain)
static TreeElement * outliner_find_first_desired_element_at_y(const SpaceOutliner *space_outliner, const float view_co, const float view_co_limit)
void outliner_set_coordinates(const ARegion *region, SpaceOutliner *space_outliner)
BLI_INLINE void outliner_add_collection_init(TreeElement *te, Collection *collection)
static int outliner_filter_subtree(SpaceOutliner *space_outliner, const Main &bmain, const Scene *scene, ViewLayer *view_layer, ListBaseT< TreeElement > *lb, const char *search_string, const eSpaceOutliner_Filter exclude_filter)
void outliner_build_tree(Main *mainvar, WorkSpace *workspace, Scene *scene, ViewLayer *view_layer, SpaceOutliner *space_outliner, ARegion *region)
static void outliner_store_scrolling_position(SpaceOutliner *space_outliner, ARegion *region, OutlinerTreeElementFocus *focus)
static void outliner_filter_tree(const Main &bmain, SpaceOutliner *space_outliner, const Scene *scene, ViewLayer *view_layer)
static bool test_collection_callback(TreeElement *te)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ SO_FILTER_NO_OB_EMPTY
@ SO_FILTER_NO_OB_MATERIAL
@ SO_FILTER_NO_OB_CONSTRAINTS
@ SO_FILTER_NO_OB_SHAPE_KEYS
@ SO_FILTER_NO_ARMATURE_BONE_COLLECTION
@ SO_FILTER_NO_OB_ARMATURE
@ SO_FILTER_NO_CHILDREN
@ SO_FILTER_OB_STATE_SELECTED
@ SO_FILTER_NO_OB_OTHERS
@ SO_FILTER_OB_STATE_ACTIVE
@ SO_FILTER_NO_OB_MODIFIERS
@ SO_FILTER_NO_OB_GREASE_PENCIL
@ SO_FILTER_OB_STATE_INVERSE
@ SO_FILTER_NO_GREASE_PENCIL_EFFECTS
@ SO_FILTER_NO_POSE_BONES
@ SO_FILTER_NO_OB_CONTENT
@ SO_FILTER_NO_OB_DEFGROUP
@ SO_FILTER_NO_COLLECTION
@ SO_FILTER_OB_STATE_VISIBLE
@ SO_FILTER_OB_STATE_SELECTABLE
@ SO_FILTER_NO_OB_CAMERA
@ SO_FILTER_NO_OB_ANIMATION
bool ED_outliner_support_searching(const SpaceOutliner *space_outliner)
int char char int int int BLI_strcasecmp_natural(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
const char * BKE_collection_ui_name_get(Collection *collection)
@ BASE_ENABLED_AND_VISIBLE_IN_DEFAULT_VIEWPORT
@ SO_FIND_CASE_SENSITIVE
Base * BKE_view_layer_active_base_get(ViewLayer *view_layer)
char char * BLI_strncpy_ensure_pad(char *__restrict dst, const char *__restrict src, char pad, size_t dst_maxncpy) ATTR_NONNULL(1
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:593
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:138
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
Definition listbase.cc:339
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
CollectionChild * BKE_collection_child_find(Collection *parent, Collection *collection)
@ SO_FILTER_OB_SELECTED
@ SO_FILTER_OB_SELECTABLE
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL()
void * BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
ATTR_WARN_UNUSED_RESULT const BMVert * v2
@ BLI_MEMPOOL_ALLOW_ITER
Base * BKE_view_layer_base_find(ViewLayer *view_layer, Object *ob)
void BLI_rctf_translate(struct rctf *rect, float x, float y)
Definition rct.cc:587
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
int BLI_mempool_len(const BLI_mempool *pool) ATTR_NONNULL(1)
ATTR_WARN_UNUSED_RESULT const void * element
PipelineCompute comp(comp_main)
#define TREESTORE_ID_TYPE(_id)
#define SEARCHING_OUTLINER(sov)
#define SUPPORT_FILTER_OUTLINER(space_outliner_)
#define TREESTORE(a)
#define TSELEM_OPEN(telm, sv)
bke::ARegionRuntime * runtime
struct Object * object
ListBaseT< CollectionChild > children
ListBaseT< CollectionObject > gobject
struct ID * newid
Definition DNA_ID.h:419
struct Collection * master_collection
eSpaceOutliner_Mode outlinevis
eSpaceOutliner_SortMethod sort_method
ed::outliner::SpaceOutliner_Runtime * runtime
eSpaceOutliner_Search_Flags search_flags
eSpaceOutliner_Filter filter
eSpaceOutliner_StoreFlag storeflag
eSpaceOutliner_StateFilter filter_state
struct BLI_mempool * treestore
eTreeStoreElem_Flag flag
Map< Object *, CollectionObject * > object_to_any_cob_map
Map< std::pair< Collection *, Object * >, CollectionObject * > collection_and_object_to_cob_map
std::unique_ptr< treehash::TreeHash > tree_hash
ListBaseT< ed::outliner::TreeElement > tree
std::unique_ptr< AbstractTreeDisplay > tree_display
std::unique_ptr< AbstractTreeElement > abstract_element
The data to build the tree from.
Establish and manage Outliner trees for different display modes.