Blender  V3.3
Classes | Namespaces | Functions
outliner_tree.cc File Reference
#include <cmath>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_cachefile_types.h"
#include "DNA_camera_types.h"
#include "DNA_collection_types.h"
#include "DNA_constraint_types.h"
#include "DNA_curves_types.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_key_types.h"
#include "DNA_light_types.h"
#include "DNA_lightprobe_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_pointcloud_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_shader_fx_types.h"
#include "DNA_simulation_types.h"
#include "DNA_speaker_types.h"
#include "DNA_volume_types.h"
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
#include "BLI_fnmatch.h"
#include "BLI_listbase.h"
#include "BLI_mempool.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_armature.h"
#include "BKE_deform.h"
#include "BKE_layer.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
#include "BKE_outliner_treehash.h"
#include "ED_screen.h"
#include "RNA_access.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "outliner_intern.hh"
#include "tree/common.hh"
#include "tree/tree_display.hh"
#include "tree/tree_element.hh"

Go to the source code of this file.

Classes

struct  tTreeSort
 
struct  OutlinerTreeElementFocus
 

Namespaces

 blender
 
 blender::ed
 
 blender::ed::outliner
 

Functions

TreeElement * blender::ed::outliner::outliner_add_element (SpaceOutliner *space_outliner, ListBase *lb, void *idv, TreeElement *parent, short type, short index, const bool expand)
 
Tree Filtering Helper
static int outliner_exclude_filter_get (const SpaceOutliner *space_outliner)
 
static void outliner_restore_scrolling_position (SpaceOutliner *space_outliner, ARegion *region, OutlinerTreeElementFocus *focus)
 
static bool test_collection_callback (TreeElement *te)
 
static bool test_object_callback (TreeElement *te)
 
static TreeElement * outliner_find_first_desired_element_at_y_recursive (const SpaceOutliner *space_outliner, TreeElement *te, const float limit, bool(*callback_test)(TreeElement *))
 
static TreeElement * outliner_find_first_desired_element_at_y (const SpaceOutliner *space_outliner, const float view_co, const float view_co_limit)
 
static void outliner_store_scrolling_position (SpaceOutliner *space_outliner, ARegion *region, OutlinerTreeElementFocus *focus)
 
static bool outliner_element_visible_get (ViewLayer *view_layer, TreeElement *te, const int exclude_filter)
 
static bool outliner_filter_has_name (TreeElement *te, const char *name, int flags)
 
static bool outliner_element_is_collection_or_object (TreeElement *te)
 
static TreeElement * outliner_extract_children_from_subtree (TreeElement *element, ListBase *parent_subtree)
 
static int outliner_filter_subtree (SpaceOutliner *space_outliner, ViewLayer *view_layer, ListBase *lb, const char *search_string, const int exclude_filter)
 
static void outliner_filter_tree (SpaceOutliner *space_outliner, ViewLayer *view_layer)
 
static void outliner_clear_newid_from_main (Main *bmain)
 
Persistent Data
static void outliner_storage_cleanup (SpaceOutliner *space_outliner)
 
static void check_persistent (SpaceOutliner *space_outliner, TreeElement *te, ID *id, short type, short nr)
 
Tree Management
void outliner_free_tree (ListBase *tree)
 
void outliner_cleanup_tree (SpaceOutliner *space_outliner)
 
void outliner_free_tree_element (TreeElement *element, ListBase *parent_subtree)
 
bool outliner_requires_rebuild_on_select_or_active_change (const SpaceOutliner *space_outliner)
 
static void outliner_add_bone (SpaceOutliner *space_outliner, ListBase *lb, ID *id, Bone *curBone, TreeElement *parent, int *a)
 
static void outliner_add_object_contents (SpaceOutliner *space_outliner, TreeElement *te, TreeStoreElem *tselem, Object *ob)
 
static void outliner_add_id_contents (SpaceOutliner *space_outliner, TreeElement *te, TreeStoreElem *tselem, ID *id)
 
BLI_INLINE void outliner_add_collection_init (TreeElement *te, Collection *collection)
 
BLI_INLINE void outliner_add_collection_objects (SpaceOutliner *space_outliner, ListBase *tree, Collection *collection, TreeElement *parent)
 
TreeElement * outliner_add_collection_recursive (SpaceOutliner *space_outliner, Collection *collection, TreeElement *ten)
 
Tree Sorting Helper
static int treesort_alpha_ob (const void *v1, const void *v2)
 
static int treesort_child_not_in_collection (const void *v1, const void *v2)
 
static int treesort_alpha (const void *v1, const void *v2)
 
static void outliner_sort (ListBase *lb)
 
static void outliner_collections_children_sort (ListBase *lb)
 
Main Tree Building API
void outliner_build_tree (Main *mainvar, Scene *scene, ViewLayer *view_layer, SpaceOutliner *space_outliner, ARegion *region)
 

Function Documentation

◆ check_persistent()

static void check_persistent ( SpaceOutliner *  space_outliner,
TreeElement *  te,
ID *  id,
short  type,
short  nr 
)
static

◆ outliner_add_bone()

static void outliner_add_bone ( SpaceOutliner *  space_outliner,
ListBase *  lb,
ID *  id,
Bone *  curBone,
TreeElement *  parent,
int *  a 
)
static

◆ outliner_add_collection_init()

BLI_INLINE void outliner_add_collection_init ( TreeElement *  te,
Collection *  collection 
)

◆ outliner_add_collection_objects()

BLI_INLINE void outliner_add_collection_objects ( SpaceOutliner *  space_outliner,
ListBase *  tree,
Collection *  collection,
TreeElement *  parent 
)

◆ outliner_add_collection_recursive()

TreeElement* outliner_add_collection_recursive ( SpaceOutliner *  space_outliner,
Collection *  collection,
TreeElement *  ten 
)

◆ outliner_add_id_contents()

static void outliner_add_id_contents ( SpaceOutliner *  space_outliner,
TreeElement *  te,
TreeStoreElem *  tselem,
ID *  id 
)
static

◆ outliner_add_object_contents()

static void outliner_add_object_contents ( SpaceOutliner *  space_outliner,
TreeElement *  te,
TreeStoreElem *  tselem,
Object *  ob 
)
static

◆ outliner_build_tree()

void outliner_build_tree ( struct Main *  mainvar,
struct Scene *  scene,
struct ViewLayer *  view_layer,
struct SpaceOutliner *  space_outliner,
struct ARegion *  region 
)

◆ outliner_cleanup_tree()

void outliner_cleanup_tree ( SpaceOutliner *  space_outliner)

◆ outliner_clear_newid_from_main()

static void outliner_clear_newid_from_main ( Main *  bmain)
static

Definition at line 1652 of file outliner_tree.cc.

References FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, and ID::newid.

Referenced by outliner_build_tree().

◆ outliner_collections_children_sort()

static void outliner_collections_children_sort ( ListBase *  lb)
static

◆ outliner_element_is_collection_or_object()

static bool outliner_element_is_collection_or_object ( TreeElement *  te)
static

◆ outliner_element_visible_get()

static bool outliner_element_visible_get ( ViewLayer *  view_layer,
TreeElement *  te,
const int  exclude_filter 
)
static

◆ outliner_exclude_filter_get()

static int outliner_exclude_filter_get ( const SpaceOutliner *  space_outliner)
static

◆ outliner_extract_children_from_subtree()

static TreeElement* outliner_extract_children_from_subtree ( TreeElement *  element,
ListBase *  parent_subtree 
)
static

◆ outliner_filter_has_name()

static bool outliner_filter_has_name ( TreeElement *  te,
const char *  name,
int  flags 
)
static

Definition at line 1515 of file outliner_tree.cc.

References TreeElement::name, and SO_FIND_CASE_SENSITIVE.

Referenced by outliner_filter_subtree().

◆ outliner_filter_subtree()

static int outliner_filter_subtree ( SpaceOutliner *  space_outliner,
ViewLayer *  view_layer,
ListBase *  lb,
const char *  search_string,
const int  exclude_filter 
)
static

◆ outliner_filter_tree()

static void outliner_filter_tree ( SpaceOutliner *  space_outliner,
ViewLayer *  view_layer 
)
static

◆ outliner_find_first_desired_element_at_y()

static TreeElement* outliner_find_first_desired_element_at_y ( const SpaceOutliner *  space_outliner,
const float  view_co,
const float  view_co_limit 
)
static

Find the first element that passes a test starting from a reference vertical coordinate

If the element that is in the position is not what we are looking for, keep looking for its children, siblings, and eventually, aunts, cousins, distant families, ... etc.

Basically we keep going up and down the outliner tree from that point forward, until we find what we are looking for. If we are past the visible range and we can't find a valid element we return nullptr.

Definition at line 1294 of file outliner_tree.cc.

References bool, SpaceOutliner::filter, TreeElement::next, outliner_find_first_desired_element_at_y_recursive(), outliner_find_item_at_y(), SpaceOutliner::outlinevis, TreeElement::parent, SO_FILTER_NO_COLLECTION, SO_VIEW_LAYER, test_collection_callback(), test_object_callback(), SpaceOutliner::tree, UI_UNIT_Y, and TreeElement::ys.

Referenced by outliner_store_scrolling_position().

◆ outliner_find_first_desired_element_at_y_recursive()

static TreeElement* outliner_find_first_desired_element_at_y_recursive ( const SpaceOutliner *  space_outliner,
TreeElement *  te,
const float  limit,
bool(*)(TreeElement *)  callback_test 
)
static

See if TreeElement or any of its children pass the callback_test.

Definition at line 1261 of file outliner_tree.cc.

References LISTBASE_FOREACH, TreeElement::store_elem, TreeElement::subtree, and TSELEM_OPEN.

Referenced by outliner_find_first_desired_element_at_y().

◆ outliner_free_tree()

void outliner_free_tree ( ListBase *  tree)

◆ outliner_free_tree_element()

void outliner_free_tree_element ( TreeElement *  element,
ListBase *  parent_subtree 
)

Free element and its sub-tree and remove its link in parent_subtree.

Note
Does not remove the TreeStoreElem of element!
Parameters
parent_subtreeSub-tree of the parent element, so the list containing element.

Definition at line 198 of file outliner_tree.cc.

References BLI_assert, BLI_findindex(), BLI_remlink(), element, MEM_freeN, outliner_free_tree(), and TE_FREE_NAME.

Referenced by blender::ed::outliner::TreeDisplayOverrideLibraryHierarchies::buildTree(), outliner_extract_children_from_subtree(), outliner_filter_subtree(), and outliner_free_tree().

◆ outliner_requires_rebuild_on_select_or_active_change()

bool outliner_requires_rebuild_on_select_or_active_change ( const SpaceOutliner *  space_outliner)

◆ outliner_restore_scrolling_position()

static void outliner_restore_scrolling_position ( SpaceOutliner *  space_outliner,
ARegion *  region,
OutlinerTreeElementFocus *  focus 
)
static

Bring the outliner scrolling back to where it was in relation to the original focus element Caller is expected to handle redrawing of ARegion.

Definition at line 1223 of file outliner_tree.cc.

References BLI_rctf_translate(), View2D::cur, MIN2, outliner_find_tree_element(), outliner_set_coordinates(), SpaceOutliner::tree, OutlinerTreeElementFocus::tselem, ARegion::v2d, rctf::ymax, TreeElement::ys, and OutlinerTreeElementFocus::ys.

Referenced by outliner_build_tree().

◆ outliner_sort()

static void outliner_sort ( ListBase *  lb)
static

◆ outliner_storage_cleanup()

static void outliner_storage_cleanup ( SpaceOutliner *  space_outliner)
static

◆ outliner_store_scrolling_position()

static void outliner_store_scrolling_position ( SpaceOutliner *  space_outliner,
ARegion *  region,
OutlinerTreeElementFocus *  focus 
)
static

Store information of current outliner scrolling status to be restored later.

Finds the top-most collection visible in the outliner and populates the OutlinerTreeElementFocus struct to retrieve this element later to make sure it is in the same original position as before filtering.

Definition at line 1348 of file outliner_tree.cc.

References View2D::cur, outliner_find_first_desired_element_at_y(), outliner_set_coordinates(), TREESTORE, OutlinerTreeElementFocus::tselem, ARegion::v2d, rctf::ymax, rctf::ymin, TreeElement::ys, and OutlinerTreeElementFocus::ys.

Referenced by outliner_build_tree().

◆ test_collection_callback()

static bool test_collection_callback ( TreeElement *  te)
static

◆ test_object_callback()

static bool test_object_callback ( TreeElement *  te)
static

◆ treesort_alpha()

static int treesort_alpha ( const void *  v1,
const void *  v2 
)
static

Definition at line 1039 of file outliner_tree.cc.

References BLI_strcasecmp_natural(), tTreeSort::name, v1, v2, and x2.

Referenced by outliner_sort().

◆ treesort_alpha_ob()

static int treesort_alpha_ob ( const void *  v1,
const void *  v2 
)
static

◆ treesort_child_not_in_collection()

static int treesort_child_not_in_collection ( const void *  v1,
const void *  v2 
)
static