Blender V5.0
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 270 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 24 of file lib_id_remapper.cc.

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

Referenced by swap_old_bmain_data_for_blendfile().

◆ apply()

◆ 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()

IDRemapperApplyResult blender::bke::id::IDRemapper::get_mapping_result ( ID * id,
IDRemapperApplyOptions options,
const ID * id_self ) const

◆ 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 337 of file BKE_lib_remap.hh.

Referenced by BKE_libblock_relink_multiple(), BKE_libblock_remap_multiple_locked(), libblock_remap_data(), blender::ed::space_node::node_id_remap(), print(), and 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 326 of file BKE_lib_remap.hh.

Referenced by 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 110 of file lib_id_remapper.cc.

References iter(), ID::name, and printf.

◆ result_to_string()

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

Return a readable string for the given result. Can be used for debugging purposes.

Definition at line 94 of file lib_id_remapper.cc.

References BLI_assert_unreachable, ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE, ID_REMAP_RESULT_SOURCE_REMAPPED, ID_REMAP_RESULT_SOURCE_UNASSIGNED, ID_REMAP_RESULT_SOURCE_UNAVAILABLE, and result.

Referenced by foreach_libblock_remap_callback().

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 285 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: