Blender V4.3
BKE_lib_query.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
22#include "DNA_ID.h"
23
24#include "BLI_function_ref.hh"
25#include "BLI_sys_types.h"
26
27#include <array>
28
29struct IDTypeInfo;
31struct Main;
32
33/* Tips for the callback for cases it's gonna to modify the pointer. */
34enum {
38
55
70
76
83
94
99 IDWALK_CB_USER = (1 << 11),
106
109
112
115
116};
117
118enum {
132};
133
151
158
159/* Flags for the foreach function itself. */
160enum {
167 IDWALK_READONLY = (1 << 0),
178 IDWALK_RECURSE = (1 << 1),
183
217
231};
232
238void BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, int cb_flag);
242 int cb_flag,
243 bool do_replace);
244
246#define BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data_, id_, cb_flag_) \
247 { \
248 BKE_lib_query_foreachid_process((data_), (ID **)&(id_), (cb_flag_)); \
249 if (BKE_lib_query_foreachid_iter_stop((data_))) { \
250 return; \
251 } \
252 } \
253 ((void)0)
254
255#define BKE_LIB_FOREACHID_PROCESS_ID(data_, id_, cb_flag_) \
256 { \
257 CHECK_TYPE_ANY((id_), ID *, void *); \
258 BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data_, id_, cb_flag_); \
259 } \
260 ((void)0)
261
262#define BKE_LIB_FOREACHID_PROCESS_IDSUPER_P(data_, id_super_p_, cb_flag_) \
263 { \
264 CHECK_TYPE(&((*(id_super_p_))->id), ID *); \
265 BKE_lib_query_foreachid_process((data_), (ID **)(id_super_p_), (cb_flag_)); \
266 if (BKE_lib_query_foreachid_iter_stop((data_))) { \
267 return; \
268 } \
269 } \
270 ((void)0)
271
272#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_) \
273 { \
274 BKE_LIB_FOREACHID_PROCESS_IDSUPER_P(data_, &(id_super_), cb_flag_); \
275 } \
276 ((void)0)
277
278#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_) \
279 { \
280 func_call_; \
281 if (BKE_lib_query_foreachid_iter_stop((data_))) { \
282 return; \
283 } \
284 } \
285 ((void)0)
286
295
307 ID *id,
309 void *user_data,
310 int flag);
311
342 Main *bmain,
343 ID *owner_id,
344 ID *self_id,
345 blender::FunctionRef<void(LibraryForeachIDData *data)> subdata_foreach_id,
347 void *user_data,
348 const int flag);
349
353void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, int cb_flag);
354
365int BKE_library_ID_use_ID(ID *id_user, ID *id_used);
366
373bool BKE_library_id_can_use_idtype(ID *owner_id, short id_type_used);
374
379 const bool include_ui,
380 const IDTypeInfo *owner_id_type = nullptr);
381
385bool BKE_library_ID_is_locally_used(Main *bmain, void *idv);
389bool BKE_library_ID_is_indirectly_used(Main *bmain, void *idv);
395 void *idv,
396 bool *r_is_used_local,
397 bool *r_is_used_linked);
398
402 bool do_local_ids = false;
404 bool do_linked_ids = false;
410 bool do_recursive = false;
411
419 blender::FunctionRef<bool(ID *id)> filter_fn = nullptr;
420
427 std::array<int, INDEX_ID_MAX> num_total;
434 std::array<int, INDEX_ID_MAX> num_local;
441 std::array<int, INDEX_ID_MAX> num_linked;
442};
443
483
493void BKE_library_unused_linked_data_set_tag(Main *bmain, bool do_init_tag);
void BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, int cb_flag)
Definition lib_query.cc:71
void BKE_library_ID_test_usages(Main *bmain, void *idv, bool *r_is_used_local, bool *r_is_used_linked)
Definition lib_query.cc:618
@ IDWALK_RET_STOP_RECURSION
@ IDWALK_RET_STOP_ITER
@ IDWALK_RET_NOP
void BKE_lib_query_unused_ids_tag(Main *bmain, int tag, LibQueryUnusedIDsData &parameters)
Definition lib_query.cc:962
void BKE_library_update_ID_link_user(ID *id_dst, ID *id_src, int cb_flag)
Definition lib_query.cc:425
bool BKE_library_ID_is_indirectly_used(Main *bmain, void *idv)
Definition lib_query.cc:613
void BKE_library_foreach_ID_embedded(LibraryForeachIDData *data, ID **id_pp)
Definition lib_query.cc:163
@ IDWALK_CB_LOOPBACK
@ IDWALK_CB_OVERRIDE_LIBRARY_NOT_OVERRIDABLE
@ IDWALK_CB_NEVER_SELF
@ IDWALK_CB_USER_ONE
@ IDWALK_CB_USER
@ IDWALK_CB_INTERNAL
@ IDWALK_CB_EMBEDDED_NOT_OWNING
@ IDWALK_CB_EMBEDDED
@ IDWALK_CB_DIRECT_WEAK_LINK
@ IDWALK_CB_OVERRIDE_LIBRARY_HIERARCHY_DEFAULT
@ IDWALK_CB_NEVER_NULL
@ IDWALK_CB_READFILE_IGNORE
@ IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE
@ IDWALK_CB_NOP
@ IDWALK_CB_INDIRECT_USAGE
int(LibraryIDLinkCallbackData *cb_data) LibraryIDLinkCallback
int BKE_lib_query_foreachid_process_callback_flag_override(LibraryForeachIDData *data, int cb_flag, bool do_replace)
Definition lib_query.cc:130
int BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
Definition lib_query.cc:120
Main * BKE_lib_query_foreachid_process_main_get(const LibraryForeachIDData *data)
Definition lib_query.cc:125
void BKE_library_foreach_subdata_id(Main *bmain, ID *owner_id, ID *self_id, blender::FunctionRef< void(LibraryForeachIDData *data)> subdata_foreach_id, blender::FunctionRef< LibraryIDLinkCallback > callback, void *user_data, const int flag)
Definition lib_query.cc:436
void BKE_lib_query_unused_ids_amounts(Main *bmain, LibQueryUnusedIDsData &parameters)
Definition lib_query.cc:904
bool BKE_library_id_can_use_idtype(ID *owner_id, short id_type_used)
Definition lib_query.cc:502
void BKE_library_foreach_ID_link(Main *bmain, ID *id, blender::FunctionRef< LibraryIDLinkCallback > callback, void *user_data, int flag)
Definition lib_query.cc:416
@ IDWALK_DO_DEPRECATED_POINTERS
@ IDWALK_RECURSE
@ IDWALK_INCLUDE_UI
@ IDWALK_IGNORE_MISSING_OWNER_ID
@ IDWALK_DO_LIBRARY_POINTER
@ IDWALK_NOP
@ IDWALK_READONLY
@ IDWALK_DO_INTERNAL_RUNTIME_POINTERS
@ IDWALK_NO_ORIG_POINTERS_ACCESS
@ IDWALK_IGNORE_EMBEDDED_ID
int BKE_library_ID_use_ID(ID *id_user, ID *id_used)
Definition lib_query.cc:560
void BKE_lib_query_idpropertiesForeachIDLink_callback(IDProperty *id_prop, void *user_data)
Definition lib_query.cc:152
bool BKE_lib_query_foreachid_iter_stop(const LibraryForeachIDData *data)
Definition lib_query.cc:66
void BKE_library_unused_linked_data_set_tag(Main *bmain, bool do_init_tag)
void BKE_library_indirectly_used_data_tag_clear(Main *bmain)
uint64_t BKE_library_id_can_use_filter_id(const ID *owner_id, const bool include_ui, const IDTypeInfo *owner_id_type=nullptr)
Definition lib_query.cc:461
bool BKE_library_ID_is_locally_used(Main *bmain, void *idv)
Definition lib_query.cc:608
ID and Library types, which are fundamental for SDNA.
DEGForeachIDComponentCallback callback
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
double parameters[NUM_PARAMETERS]
unsigned __int64 uint64_t
Definition stdint.h:90
Definition DNA_ID.h:413
std::array< int, INDEX_ID_MAX > num_total
std::array< int, INDEX_ID_MAX > num_linked
std::array< int, INDEX_ID_MAX > num_local
blender::FunctionRef< bool(ID *id)> filter_fn
uint8_t flag
Definition wm_window.cc:138