Blender V5.3
blender::bke::id::IDRemapper Class Reference

#include <BKE_lib_remap.hh>

Public Member Functions

void clear ()
bool is_empty () const
bool contains_mappings_for_any (IDTypeFilter filter) const
void add (ID *old_id, ID *new_id)
void add_overwrite (ID *old_id, ID *new_id)
IDRemapperApplyResult get_mapping_result (ID *id, IDRemapperApplyOptions options, const ID *id_self) const
IDRemapperApplyResult apply (ID **r_id_ptr, IDRemapperApplyOptions options, ID *id_self=nullptr) const
void never_null_users_add (ID *id)
const Set< ID * > & never_null_users () const
void iter (FunctionRef< void(ID *old_id, ID *new_id)> func) const
void print () const

Static Public Member Functions

static StringRefNull result_to_string (const IDRemapperApplyResult result)

Public Attributes

bool allow_idtype_mismatch = false

Detailed Description

Definition at line 273 of file BKE_lib_remap.hh.

Member Function Documentation

◆ add()

◆ add_overwrite()

void blender::bke::id::IDRemapper::add_overwrite ( ID * old_id,
ID * new_id )

Add a new remapping, replacing a potential already existing mapping of old_id.

Definition at line 28 of file lib_id_remapper.cc.

References allow_idtype_mismatch, blender::BKE_idtype_idcode_to_idfilter(), blender::BLI_assert(), blender::GS(), and blender::ID::name.

Referenced by blender::swap_old_bmain_data_for_blendfile().

◆ apply()

IDRemapperApplyResult blender::bke::id::IDRemapper::apply ( ID ** r_id_ptr,
IDRemapperApplyOptions options,
ID * id_self = nullptr ) const

◆ clear()

void blender::bke::id::IDRemapper::clear ( )
inline

◆ contains_mappings_for_any()

bool blender::bke::id::IDRemapper::contains_mappings_for_any ( IDTypeFilter filter) const
inline

◆ get_mapping_result()

◆ is_empty()

bool blender::bke::id::IDRemapper::is_empty ( ) const
inline

◆ iter()

void blender::bke::id::IDRemapper::iter ( FunctionRef< void(ID *old_id, ID *new_id)> func) const
inline

Iterate over all remapping pairs in the remapper, and call the callback function on them.

Definition at line 340 of file BKE_lib_remap.hh.

Referenced by blender::BKE_libblock_relink_multiple(), blender::BKE_libblock_remap_multiple_locked(), blender::libblock_remap_data(), blender::ed::space_node::node_id_remap(), print(), and blender::WM_main_remap_editor_id_reference().

◆ never_null_users()

const Set< ID * > & blender::bke::id::IDRemapper::never_null_users ( ) const
inline

◆ never_null_users_add()

void blender::bke::id::IDRemapper::never_null_users_add ( ID * id)
inline

Definition at line 329 of file BKE_lib_remap.hh.

Referenced by blender::foreach_libblock_remap_callback().

◆ print()

void blender::bke::id::IDRemapper::print ( ) const

Print out the rules inside the given id_remapper. Can be used for debugging purposes.

Definition at line 114 of file lib_id_remapper.cc.

References iter(), blender::ID::name, and blender::gpu::shader::metadata::printf.

◆ result_to_string()

StringRefNull blender::bke::id::IDRemapper::result_to_string ( const IDRemapperApplyResult result)
static

Member Data Documentation

◆ allow_idtype_mismatch

bool blender::bke::id::IDRemapper::allow_idtype_mismatch = false

In almost all cases, the original pointer and its new replacement should be of the same type. however, there are some rare exceptions, e.g. when converting from one ID type to another.

Definition at line 288 of file BKE_lib_remap.hh.

Referenced by add(), add_overwrite(), and blender::bke::greasepencil::convert::legacy_main().


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