Blender  V3.3
BKE_lib_remap.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #pragma once
3 
21 #include "BLI_compiler_attrs.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 struct ID;
28 struct IDRemapper;
29 struct LinkNode;
30 
31 /* BKE_libblock_free, delete are declared in BKE_lib_id.h for convenience. */
32 
33 /* Also IDRemap->flag. */
34 enum {
81 };
82 
83 typedef enum eIDRemapType {
86 
90 
96 void BKE_libblock_remap_multiple_locked(struct Main *bmain,
97  struct IDRemapper *mappings,
98  short remap_flags);
99 
100 void BKE_libblock_remap_multiple(struct Main *bmain,
101  struct IDRemapper *mappings,
102  short remap_flags);
103 
111 void BKE_libblock_remap_locked(struct Main *bmain, void *old_idv, void *new_idv, short remap_flags)
112  ATTR_NONNULL(1, 2);
113 void BKE_libblock_remap(struct Main *bmain, void *old_idv, void *new_idv, short remap_flags)
114  ATTR_NONNULL(1, 2);
115 
123 void BKE_libblock_unlink(struct Main *bmain,
124  void *idv,
125  bool do_flag_never_null,
126  bool do_skip_indirect) ATTR_NONNULL();
127 
134 void BKE_libblock_relink_ex(struct Main *bmain,
135  void *idv,
136  void *old_idv,
137  void *new_idv,
138  short remap_flags) ATTR_NONNULL(1, 2);
143 void BKE_libblock_relink_multiple(struct Main *bmain,
144  struct LinkNode *ids,
145  eIDRemapType remap_type,
146  struct IDRemapper *id_remapper,
147  short remap_flags);
148 
158 void BKE_libblock_relink_to_newid(struct Main *bmain, struct ID *id, int remap_flag)
159  ATTR_NONNULL();
160 
162 typedef void (*BKE_library_remap_editor_id_reference_cb)(const struct IDRemapper *mappings);
163 
167 
168 /* IDRemapper */
169 struct IDRemapper;
170 typedef enum IDRemapperApplyResult {
180 
194 
201 
208 
211 
212 typedef void (*IDRemapperIterFunction)(struct ID *old_id, struct ID *new_id, void *user_data);
213 
219 struct IDRemapper *BKE_id_remapper_create(void);
220 
221 void BKE_id_remapper_clear(struct IDRemapper *id_remapper);
222 bool BKE_id_remapper_is_empty(const struct IDRemapper *id_remapper);
224 void BKE_id_remapper_free(struct IDRemapper *id_remapper);
226 void BKE_id_remapper_add(struct IDRemapper *id_remapper, struct ID *old_id, struct ID *new_id);
227 
233 IDRemapperApplyResult BKE_id_remapper_apply(const struct IDRemapper *id_remapper,
234  struct ID **r_id_ptr,
245 IDRemapperApplyResult BKE_id_remapper_apply_ex(const struct IDRemapper *id_remapper,
246  struct ID **r_id_ptr,
248  struct ID *id_self);
249 bool BKE_id_remapper_has_mapping_for(const struct IDRemapper *id_remapper, uint64_t type_filter);
250 
254 IDRemapperApplyResult BKE_id_remapper_get_mapping_result(const struct IDRemapper *id_remapper,
255  struct ID *id,
257  const struct ID *id_self);
258 void BKE_id_remapper_iter(const struct IDRemapper *id_remapper,
260  void *user_data);
261 
265 void BKE_id_remapper_print(const struct IDRemapper *id_remapper);
266 
267 #ifdef __cplusplus
268 }
269 #endif
void(* BKE_library_remap_editor_id_reference_cb)(const struct IDRemapper *mappings)
void BKE_library_callback_remap_editor_id_reference_set(BKE_library_remap_editor_id_reference_cb func)
Definition: lib_remap.c:48
void(* BKE_library_free_notifier_reference_cb)(const void *)
IDRemapperApplyResult BKE_id_remapper_apply_ex(const struct IDRemapper *id_remapper, struct ID **r_id_ptr, IDRemapperApplyOptions options, struct ID *id_self)
@ ID_REMAP_SKIP_USER_CLEAR
Definition: BKE_lib_remap.h:63
@ ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS
Definition: BKE_lib_remap.h:70
@ ID_REMAP_SKIP_OVERRIDE_LIBRARY
Definition: BKE_lib_remap.h:59
@ ID_REMAP_FORCE_USER_REFCOUNT
Definition: BKE_lib_remap.h:74
@ ID_REMAP_SKIP_NEVER_NULL_USAGE
Definition: BKE_lib_remap.h:45
@ ID_REMAP_FLAG_NEVER_NULL_USAGE
Definition: BKE_lib_remap.h:50
@ ID_REMAP_FORCE_OBDATA_IN_EDITMODE
Definition: BKE_lib_remap.h:80
@ ID_REMAP_SKIP_INDIRECT_USAGE
Definition: BKE_lib_remap.h:36
@ ID_REMAP_FORCE_NEVER_NULL_USAGE
Definition: BKE_lib_remap.h:57
void BKE_libblock_remap_multiple_locked(struct Main *bmain, struct IDRemapper *mappings, short remap_flags)
Definition: lib_remap.c:614
IDRemapperApplyResult
@ ID_REMAP_RESULT_SOURCE_REMAPPED
@ ID_REMAP_RESULT_SOURCE_UNASSIGNED
@ ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE
@ ID_REMAP_RESULT_SOURCE_UNAVAILABLE
bool BKE_id_remapper_has_mapping_for(const struct IDRemapper *id_remapper, uint64_t type_filter)
IDRemapperApplyResult BKE_id_remapper_get_mapping_result(const struct IDRemapper *id_remapper, struct ID *id, IDRemapperApplyOptions options, const struct ID *id_self)
void void BKE_libblock_remap(struct Main *bmain, void *old_idv, void *new_idv, short remap_flags) ATTR_NONNULL(1
void BKE_id_remapper_add(struct IDRemapper *id_remapper, struct ID *old_id, struct ID *new_id)
void BKE_id_remapper_clear(struct IDRemapper *id_remapper)
IDRemapperApplyOptions
@ ID_REMAP_APPLY_UPDATE_REFCOUNT
@ ID_REMAP_APPLY_UNMAP_WHEN_REMAPPING_TO_SELF
@ ID_REMAP_APPLY_ENSURE_REAL
@ ID_REMAP_APPLY_DEFAULT
void BKE_library_callback_free_notifier_reference_set(BKE_library_free_notifier_reference_cb func)
Definition: lib_remap.c:41
eIDRemapType
Definition: BKE_lib_remap.h:83
@ ID_REMAP_TYPE_REMAP
Definition: BKE_lib_remap.h:85
@ ID_REMAP_TYPE_CLEANUP
Definition: BKE_lib_remap.h:88
void(* IDRemapperIterFunction)(struct ID *old_id, struct ID *new_id, void *user_data)
const char * BKE_id_remapper_result_string(const IDRemapperApplyResult result)
void void void BKE_libblock_unlink(struct Main *bmain, void *idv, bool do_flag_never_null, bool do_skip_indirect) ATTR_NONNULL()
Definition: lib_remap.c:670
void BKE_libblock_relink_to_newid(struct Main *bmain, struct ID *id, int remap_flag) ATTR_NONNULL()
Definition: lib_remap.c:894
void BKE_id_remapper_print(const struct IDRemapper *id_remapper)
void BKE_libblock_remap_locked(struct Main *bmain, void *old_idv, void *new_idv, short remap_flags) ATTR_NONNULL(1
void BKE_libblock_relink_ex(struct Main *bmain, void *idv, void *old_idv, void *new_idv, short remap_flags) ATTR_NONNULL(1
IDRemapperApplyResult BKE_id_remapper_apply(const struct IDRemapper *id_remapper, struct ID **r_id_ptr, IDRemapperApplyOptions options)
bool BKE_id_remapper_is_empty(const struct IDRemapper *id_remapper)
struct IDRemapper * BKE_id_remapper_create(void)
void BKE_id_remapper_iter(const struct IDRemapper *id_remapper, IDRemapperIterFunction func, void *user_data)
void BKE_id_remapper_free(struct IDRemapper *id_remapper)
void void BKE_libblock_relink_multiple(struct Main *bmain, struct LinkNode *ids, eIDRemapType remap_type, struct IDRemapper *id_remapper, short remap_flags)
Definition: lib_remap.c:754
void BKE_libblock_remap_multiple(struct Main *bmain, struct IDRemapper *mappings, short remap_flags)
Definition: lib_remap.c:661
#define ATTR_NONNULL(...)
CCL_NAMESPACE_BEGIN struct Options options
void * user_data
SyclQueue void void size_t num_bytes void
unsigned __int64 uint64_t
Definition: stdint.h:90
Definition: DNA_ID.h:368
Definition: BKE_main.h:121