Blender V5.3
blender::UnusedIDsData Class Reference

Public Types

enum class  Status : int8_t { Unknown , Used , Unused }

Public Member Functions

 UnusedIDsData (Main *bmain, const int id_tag, LibQueryUnusedIDsData &parameters)
void reset (const bool do_local_ids, const bool do_linked_ids, const bool do_recursive, std::array< int, INDEX_ID_MAX > &num_total, std::array< int, INDEX_ID_MAX > &num_local, std::array< int, INDEX_ID_MAX > &num_linked)
void set_id_status (ID &id, Status status)
Status get_id_status (ID &id) const
void tag_ids () const

Public Attributes

Main * bmain
const int id_tag
bool do_local_ids
bool do_linked_ids
bool do_recursive
FunctionRef< bool(ID *id)> filter_fn
std::array< int, INDEX_ID_MAX > * num_total
std::array< int, INDEX_ID_MAX > * num_local
std::array< int, INDEX_ID_MAX > * num_linked

Detailed Description

Internal data for the common processing of the 'unused IDs' query functions.

While LibQueryUnusedIDsData is a subset of this internal struct, they need to be kept separate, since this struct is used with partially 'enforced' values for some parameters by the BKE_lib_query_unused_ids_amounts code. This allows the computation of predictive amounts for user feedback ('what would be the amounts of IDs detected as unused if this option was enabled').

Definition at line 705 of file lib_query.cc.

Member Enumeration Documentation

◆ Status

Possible statuses for an ID.

Enumerator
Unknown 
Used 
Unused 

Definition at line 722 of file lib_query.cc.

Constructor & Destructor Documentation

◆ UnusedIDsData()

blender::UnusedIDsData::UnusedIDsData ( Main * bmain,
const int id_tag,
LibQueryUnusedIDsData & parameters )
inline

Member Function Documentation

◆ get_id_status()

Status blender::UnusedIDsData::get_id_status ( ID & id) const
inline

Return the current status of the given ID.

Definition at line 785 of file lib_query.cc.

References Unknown.

◆ reset()

void blender::UnusedIDsData::reset ( const bool do_local_ids,
const bool do_linked_ids,
const bool do_recursive,
std::array< int, INDEX_ID_MAX > & num_total,
std::array< int, INDEX_ID_MAX > & num_local,
std::array< int, INDEX_ID_MAX > & num_linked )
inline

Reset all internal states, and update parameters.

Definition at line 746 of file lib_query.cc.

References do_linked_ids, do_local_ids, do_recursive, num_linked, num_local, and num_total.

◆ set_id_status()

void blender::UnusedIDsData::set_id_status ( ID & id,
Status status )
inline

Define the current status of the given ID.

Definition at line 763 of file lib_query.cc.

References blender::ID_FLAG_EMBEDDED_DATA, Unknown, Unused, and Used.

◆ tag_ids()

void blender::UnusedIDsData::tag_ids ( ) const
inline

Tag all IDs in Main according to their current status.

Warning
Must typically be called as final step of the process.

Definition at line 795 of file lib_query.cc.

References blender::BKE_idtype_idcode_to_index(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, ID_IS_LINKED, blender::INDEX_ID_NULL, Unknown, and Unused.

Member Data Documentation

◆ bmain

Main* blender::UnusedIDsData::bmain

Definition at line 707 of file lib_query.cc.

Referenced by UnusedIDsData().

◆ do_linked_ids

bool blender::UnusedIDsData::do_linked_ids

Definition at line 712 of file lib_query.cc.

Referenced by reset(), and UnusedIDsData().

◆ do_local_ids

bool blender::UnusedIDsData::do_local_ids

Definition at line 711 of file lib_query.cc.

Referenced by reset(), and UnusedIDsData().

◆ do_recursive

bool blender::UnusedIDsData::do_recursive

Definition at line 713 of file lib_query.cc.

Referenced by reset(), and UnusedIDsData().

◆ filter_fn

FunctionRef<bool(ID *id)> blender::UnusedIDsData::filter_fn

Definition at line 715 of file lib_query.cc.

Referenced by UnusedIDsData().

◆ id_tag

const int blender::UnusedIDsData::id_tag

Definition at line 709 of file lib_query.cc.

Referenced by UnusedIDsData().

◆ num_linked

std::array<int, INDEX_ID_MAX>* blender::UnusedIDsData::num_linked

Definition at line 719 of file lib_query.cc.

Referenced by reset(), and UnusedIDsData().

◆ num_local

std::array<int, INDEX_ID_MAX>* blender::UnusedIDsData::num_local

Definition at line 718 of file lib_query.cc.

Referenced by reset(), and UnusedIDsData().

◆ num_total

std::array<int, INDEX_ID_MAX>* blender::UnusedIDsData::num_total

Definition at line 717 of file lib_query.cc.

Referenced by reset(), and UnusedIDsData().


The documentation for this class was generated from the following file: