IDManagement: libquery: Add macro taking pointer to ID pointers as parameters.

Needed to simplify upcomming fix in Scene undo_preserve code.

NOTE: also renamed 'private' macro parameter names to follow C++ classes
convention (one trailing `_`, instead of one or two leading `_` - the
two `__` leading ones are triggering complains from IDE regarding reserved
identifier names when the relevant macros are used in C++ files).

No expected behavior changes with this commit.
This commit is contained in:
Bastien Montagne 2023-06-21 15:03:57 +02:00
parent d9da86dd15
commit 6d1f34a15f
1 changed files with 17 additions and 11 deletions

View File

@ -202,30 +202,36 @@ int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeach
int cb_flag,
bool do_replace);
#define BKE_LIB_FOREACHID_PROCESS_ID(_data, _id, _cb_flag) \
#define BKE_LIB_FOREACHID_PROCESS_ID(data_, id_, cb_flag_) \
{ \
CHECK_TYPE_ANY((_id), ID *, void *); \
BKE_lib_query_foreachid_process((_data), (ID **)&(_id), (_cb_flag)); \
if (BKE_lib_query_foreachid_iter_stop((_data))) { \
CHECK_TYPE_ANY((id_), ID *, void *); \
BKE_lib_query_foreachid_process((data_), (ID **)&(id_), (cb_flag_)); \
if (BKE_lib_query_foreachid_iter_stop((data_))) { \
return; \
} \
} \
((void)0)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(_data, _id_super, _cb_flag) \
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER_P(data_, id_super_p_, cb_flag_) \
{ \
CHECK_TYPE(&((_id_super)->id), ID *); \
BKE_lib_query_foreachid_process((_data), (ID **)&(_id_super), (_cb_flag)); \
if (BKE_lib_query_foreachid_iter_stop((_data))) { \
CHECK_TYPE(&((*(id_super_p_))->id), ID *); \
BKE_lib_query_foreachid_process((data_), (ID **)(id_super_p_), (cb_flag_)); \
if (BKE_lib_query_foreachid_iter_stop((data_))) { \
return; \
} \
} \
((void)0)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(_data, _func_call) \
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_) \
{ \
_func_call; \
if (BKE_lib_query_foreachid_iter_stop((_data))) { \
BKE_LIB_FOREACHID_PROCESS_IDSUPER_P(data_, &(id_super_), cb_flag_); \
} \
((void)0)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_) \
{ \
func_call_; \
if (BKE_lib_query_foreachid_iter_stop((data_))) { \
return; \
} \
} \