diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_lib_query.h | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 40 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_query.c | 29 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_remap.c | 15 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/main.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_convert.c | 13 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 9 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc | 16 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 6 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 9 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna_id_collection.c | 9 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 11 |
12 files changed, 89 insertions, 90 deletions
diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h index 36aa69bf795..4d1b924b0d3 100644 --- a/source/blender/blenkernel/BKE_lib_query.h +++ b/source/blender/blenkernel/BKE_lib_query.h @@ -83,15 +83,19 @@ enum { IDWALK_RET_STOP_RECURSION = 1 << 1, }; +typedef struct LibraryIDLinkCallbackData { + void *user_data; + struct ID *id_self; + struct ID **id_pointer; + int cb_flag; +} LibraryIDLinkCallbackData; + /** * Call a callback for each ID link which the given ID uses. * * \return a set of flags to control further iteration (0 to keep going). */ -typedef int (*LibraryIDLinkCallback)(void *user_data, - struct ID *id_self, - struct ID **id_pointer, - int cb_flag); +typedef int (*LibraryIDLinkCallback)(LibraryIDLinkCallbackData *cb_data); /* Flags for the foreach function itself. */ enum { diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 18faf00d60f..1cb5905cc94 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -294,11 +294,11 @@ void BKE_id_clear_newpoin(ID *id) id->newid = NULL; } -static int id_expand_local_callback(void *UNUSED(user_data), - struct ID *id_self, - struct ID **id_pointer, - int cb_flag) +static int id_expand_local_callback(LibraryIDLinkCallbackData *cb_data) { + ID *id_self = cb_data->id_self; + ID **id_pointer = cb_data->id_pointer; + int const cb_flag = cb_data->cb_flag; if (cb_flag & IDWALK_CB_PRIVATE) { return IDWALK_RET_NOP; } @@ -581,13 +581,12 @@ struct IDCopyLibManagementData { }; /* Increases usercount as required, and remap self ID pointers. */ -static int id_copy_libmanagement_cb(void *user_data, - ID *UNUSED(id_self), - ID **id_pointer, - int cb_flag) +static int id_copy_libmanagement_cb(LibraryIDLinkCallbackData *cb_data) { - struct IDCopyLibManagementData *data = user_data; + ID **id_pointer = cb_data->id_pointer; ID *id = *id_pointer; + const int cb_flag = cb_data->cb_flag; + struct IDCopyLibManagementData *data = cb_data->user_data; /* Remap self-references to new copied ID. */ if (id == data->id_src) { @@ -900,11 +899,10 @@ bool id_single_user(bContext *C, ID *id, PointerRNA *ptr, PropertyRNA *prop) return false; } -static int libblock_management_us_plus(void *UNUSED(user_data), - ID *UNUSED(id_self), - ID **id_pointer, - int cb_flag) +static int libblock_management_us_plus(LibraryIDLinkCallbackData *cb_data) { + ID **id_pointer = cb_data->id_pointer; + const int cb_flag = cb_data->cb_flag; if (cb_flag & IDWALK_CB_USER) { id_us_plus(*id_pointer); } @@ -915,11 +913,10 @@ static int libblock_management_us_plus(void *UNUSED(user_data), return IDWALK_RET_NOP; } -static int libblock_management_us_min(void *UNUSED(user_data), - ID *UNUSED(id_self), - ID **id_pointer, - int cb_flag) +static int libblock_management_us_min(LibraryIDLinkCallbackData *cb_data) { + ID **id_pointer = cb_data->id_pointer; + const int cb_flag = cb_data->cb_flag; if (cb_flag & IDWALK_CB_USER) { id_us_min(*id_pointer); } @@ -1978,12 +1975,11 @@ void BKE_main_id_clear_newpoins(Main *bmain) FOREACH_MAIN_ID_END; } -static int id_refcount_recompute_callback(void *user_data, - struct ID *UNUSED(id_self), - struct ID **id_pointer, - int cb_flag) +static int id_refcount_recompute_callback(LibraryIDLinkCallbackData *cb_data) { - const bool do_linked_only = (bool)POINTER_AS_INT(user_data); + ID **id_pointer = cb_data->id_pointer; + const int cb_flag = cb_data->cb_flag; + const bool do_linked_only = (bool)POINTER_AS_INT(cb_data->user_data); if (*id_pointer == NULL) { return IDWALK_RET_NOP; diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index cf4c96a70e9..44a8647fceb 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -88,11 +88,11 @@ if (!((_data)->status & IDWALK_STOP)) { \ const int _flag = (_data)->flag; \ ID *old_id = *(id_pp); \ - const int callback_return = (_data)->callback((_data)->user_data, \ - (_data)->self_id, \ - id_pp, \ - (_cb_flag | (_data)->cb_flag) & \ - ~(_data)->cb_flag_clear); \ + const int callback_return = (_data)->callback(&(struct LibraryIDLinkCallbackData){ \ + .user_data = (_data)->user_data, \ + .id_self = (_data)->self_id, \ + .id_pointer = id_pp, \ + .cb_flag = ((_cb_flag | (_data)->cb_flag) & ~(_data)->cb_flag_clear)}); \ if (_flag & IDWALK_READONLY) { \ BLI_assert(*(id_pp) == old_id); \ } \ @@ -1226,12 +1226,11 @@ typedef struct IDUsersIter { int count_direct, count_indirect; /* Set by callback. */ } IDUsersIter; -static int foreach_libblock_id_users_callback(void *user_data, - ID *UNUSED(self_id), - ID **id_p, - int cb_flag) +static int foreach_libblock_id_users_callback(LibraryIDLinkCallbackData *cb_data) { - IDUsersIter *iter = user_data; + ID **id_p = cb_data->id_pointer; + const int cb_flag = cb_data->cb_flag; + IDUsersIter *iter = cb_data->user_data; if (*id_p) { /* 'Loopback' ID pointers (the ugly 'from' ones, Object->proxy_from and Key->from). @@ -1379,12 +1378,12 @@ void BKE_library_ID_test_usages(Main *bmain, void *idv, bool *is_used_local, boo } /* ***** IDs usages.checking/tagging. ***** */ -static int foreach_libblock_used_linked_data_tag_clear_cb(void *user_data, - ID *self_id, - ID **id_p, - int cb_flag) +static int foreach_libblock_used_linked_data_tag_clear_cb(LibraryIDLinkCallbackData *cb_data) { - bool *is_changed = user_data; + ID *self_id = cb_data->id_self; + ID **id_p = cb_data->id_pointer; + const int cb_flag = cb_data->cb_flag; + bool *is_changed = cb_data->user_data; if (*id_p) { /* The infamous 'from' pointers (Key.from, Object.proxy_from, ...). diff --git a/source/blender/blenkernel/intern/lib_remap.c b/source/blender/blenkernel/intern/lib_remap.c index 9b6d62a87aa..d8b32b6e04c 100644 --- a/source/blender/blenkernel/intern/lib_remap.c +++ b/source/blender/blenkernel/intern/lib_remap.c @@ -97,13 +97,17 @@ enum { ID_REMAP_IS_USER_ONE_SKIPPED = 1 << 1, /* There was some skipped 'user_one' usages of old_id. */ }; -static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id_p, int cb_flag) +static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data) { + const int cb_flag = cb_data->cb_flag; + if (cb_flag & IDWALK_CB_PRIVATE) { return IDWALK_RET_NOP; } - IDRemap *id_remap_data = user_data; + ID *id_self = cb_data->id_self; + ID **id_p = cb_data->id_pointer; + IDRemap *id_remap_data = cb_data->user_data; ID *old_id = id_remap_data->old_id; ID *new_id = id_remap_data->new_id; ID *id = id_remap_data->id; @@ -642,15 +646,14 @@ void BKE_libblock_relink_ex( DEG_relations_tag_update(bmain); } -static int id_relink_to_newid_looper(void *UNUSED(user_data), - ID *UNUSED(self_id), - ID **id_pointer, - const int cb_flag) +static int id_relink_to_newid_looper(LibraryIDLinkCallbackData *cb_data) { + const int cb_flag = cb_data->cb_flag; if (cb_flag & IDWALK_CB_PRIVATE) { return IDWALK_RET_NOP; } + ID **id_pointer = cb_data->id_pointer; ID *id = *id_pointer; if (id) { /* See: NEW_ID macro */ diff --git a/source/blender/blenkernel/intern/main.c b/source/blender/blenkernel/intern/main.c index 0c17a2c0856..75bf74f63bf 100644 --- a/source/blender/blenkernel/intern/main.c +++ b/source/blender/blenkernel/intern/main.c @@ -209,12 +209,12 @@ void BKE_main_unlock(struct Main *bmain) BLI_spin_unlock((SpinLock *)bmain->lock); } -static int main_relations_create_idlink_cb(void *user_data, - ID *id_self, - ID **id_pointer, - int cb_flag) +static int main_relations_create_idlink_cb(LibraryIDLinkCallbackData *cb_data) { - MainIDRelations *rel = user_data; + MainIDRelations *rel = cb_data->user_data; + ID *id_self = cb_data->id_self; + ID **id_pointer = cb_data->id_pointer; + const int cb_flag = cb_data->cb_flag; if (*id_pointer) { MainIDRelationsEntry *entry, **entry_p; diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 68d535e6405..014ccdb913e 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -1167,11 +1167,9 @@ Mesh *BKE_mesh_new_from_object(Depsgraph *depsgraph, Object *object, bool preser return new_mesh; } -static int foreach_libblock_make_original_callback(void *UNUSED(user_data_v), - ID *UNUSED(id_self), - ID **id_p, - int UNUSED(cb_flag)) +static int foreach_libblock_make_original_callback(LibraryIDLinkCallbackData *cb_data) { + ID **id_p = cb_data->id_pointer; if (*id_p == NULL) { return IDWALK_RET_NOP; } @@ -1180,15 +1178,14 @@ static int foreach_libblock_make_original_callback(void *UNUSED(user_data_v), return IDWALK_RET_NOP; } -static int foreach_libblock_make_usercounts_callback(void *UNUSED(user_data_v), - ID *UNUSED(id_self), - ID **id_p, - int cb_flag) +static int foreach_libblock_make_usercounts_callback(LibraryIDLinkCallbackData *cb_data) { + ID **id_p = cb_data->id_pointer; if (*id_p == NULL) { return IDWALK_RET_NOP; } + const int cb_flag = cb_data->cb_flag; if (cb_flag & IDWALK_CB_USER) { id_us_plus(*id_p); } diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index d9849cfa770..b06571e5f40 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7744,11 +7744,10 @@ static void lib_link_clipboard_restore(struct IDNameLib_Map *id_map) BKE_sequencer_base_recursive_apply(&seqbase_clipboard, lib_link_seq_clipboard_cb, id_map); } -static int lib_link_main_data_restore_cb(void *user_data, - ID *UNUSED(id_self), - ID **id_pointer, - int cb_flag) +static int lib_link_main_data_restore_cb(LibraryIDLinkCallbackData *cb_data) { + const int cb_flag = cb_data->cb_flag; + ID **id_pointer = cb_data->id_pointer; if (cb_flag & IDWALK_CB_PRIVATE || *id_pointer == NULL) { return IDWALK_RET_NOP; } @@ -7763,7 +7762,7 @@ static int lib_link_main_data_restore_cb(void *user_data, } } - struct IDNameLib_Map *id_map = user_data; + struct IDNameLib_Map *id_map = cb_data->user_data; /* Note: Handling of usercount here is really bad, defining its own system... * Will have to be refactored at some point, but that is not top priority task for now. diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc index c2222bfcbce..edb02ee331f 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc @@ -513,12 +513,15 @@ struct RemapCallbackUserData { bool create_placeholders; }; -int foreach_libblock_remap_callback(void *user_data_v, ID *id_self, ID **id_p, int /*cb_flag*/) +int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data) { + ID **id_p = cb_data->id_pointer; if (*id_p == nullptr) { return IDWALK_RET_NOP; } - RemapCallbackUserData *user_data = (RemapCallbackUserData *)user_data_v; + + ID *id_self = cb_data->id_self; + RemapCallbackUserData *user_data = (RemapCallbackUserData *)cb_data->user_data; const Depsgraph *depsgraph = user_data->depsgraph; ID *id_orig = *id_p; if (deg_copy_on_write_is_needed(id_orig)) { @@ -813,12 +816,11 @@ void update_id_after_copy(const Depsgraph *depsgraph, /* This callback is used to validate that all nested ID data-blocks are * properly expanded. */ -int foreach_libblock_validate_callback(void *user_data, - ID * /*id_self*/, - ID **id_p, - int /*cb_flag*/) +int foreach_libblock_validate_callback(LibraryIDLinkCallbackData *cb_data) { - ValidateData *data = (ValidateData *)user_data; + ValidateData *data = (ValidateData *)cb_data->user_data; + ID **id_p = cb_data->id_pointer; + if (*id_p != nullptr) { if (!check_datablock_expanded(*id_p)) { data->is_valid = false; diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 8ee061efc08..b1e3e4b64f2 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2087,11 +2087,9 @@ enum { MAKE_LOCAL_ALL = 4, }; -static int tag_localizable_looper(void *UNUSED(user_data), - ID *UNUSED(self_id), - ID **id_pointer, - const int UNUSED(cb_flag)) +static int tag_localizable_looper(LibraryIDLinkCallbackData *cb_data) { + ID **id_pointer = cb_data->id_pointer; if (*id_pointer) { (*id_pointer)->tag &= ~LIB_TAG_DOIT; } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 26fd9f14c64..a434ecad48d 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -584,20 +584,23 @@ static void gather_frames_to_render_for_grease_pencil(const OGLRender *oglrender } } -static int gather_frames_to_render_for_id(void *user_data_v, ID *id_self, ID **id_p, int cb_flag) +static int gather_frames_to_render_for_id(LibraryIDLinkCallbackData *cb_data) { - if (id_p == NULL || *id_p == NULL) { + ID **id_p = cb_data->id_pointer; + if (*id_p == NULL) { return IDWALK_RET_NOP; } ID *id = *id_p; + ID *id_self = cb_data->id_self; + const int cb_flag = cb_data->cb_flag; if (cb_flag == IDWALK_CB_LOOPBACK || id == id_self) { /* IDs may end up referencing themselves one way or the other, and those * (the id_self ones) have always already been processed. */ return IDWALK_RET_STOP_RECURSION; } - OGLRender *oglrender = user_data_v; + OGLRender *oglrender = cb_data->user_data; /* Whitelist of datablocks to follow pointers into. */ const ID_Type id_type = GS(id->name); diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index 68e1678027e..6084f3f3ad9 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -82,12 +82,11 @@ static bool id_check_type(const ID *id, const BLI_bitmap *types_bitmap) return BLI_BITMAP_TEST_BOOL(types_bitmap, id_code_as_index(GS(id->name))); } -static int foreach_libblock_id_user_map_callback(void *user_data, - ID *self_id, - ID **id_p, - int UNUSED(cb_flag)) +static int foreach_libblock_id_user_map_callback(LibraryIDLinkCallbackData *cb_data) { - IDUserMapData *data = user_data; + IDUserMapData *data = cb_data->user_data; + ID *self_id = cb_data->id_self; + ID **id_p = cb_data->id_pointer; if (*id_p) { diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 7dc5f1d7917..d50bbf49dae 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3334,17 +3334,16 @@ static void previews_id_ensure(bContext *C, Scene *scene, ID *id) } } -static int previews_id_ensure_callback(void *userdata, - ID *UNUSED(self_id), - ID **idptr, - int cb_flag) +static int previews_id_ensure_callback(LibraryIDLinkCallbackData *cb_data) { + const int cb_flag = cb_data->cb_flag; + if (cb_flag & IDWALK_CB_PRIVATE) { return IDWALK_RET_NOP; } - PreviewsIDEnsureData *data = userdata; - ID *id = *idptr; + PreviewsIDEnsureData *data = cb_data->user_data; + ID *id = *cb_data->id_pointer; if (id && (id->tag & LIB_TAG_DOIT)) { BLI_assert(ELEM(GS(id->name), ID_MA, ID_TE, ID_IM, ID_WO, ID_LA)); |