Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/BKE_lib_query.h')
-rw-r--r--source/blender/blenkernel/BKE_lib_query.h44
1 files changed, 41 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h
index f3e15529f77..c5a25e8e7af 100644
--- a/source/blender/blenkernel/BKE_lib_query.h
+++ b/source/blender/blenkernel/BKE_lib_query.h
@@ -40,6 +40,7 @@ extern "C" {
#endif
struct ID;
+struct IDProperty;
struct Main;
/* Tips for the callback for cases it's gonna to modify the pointer. */
@@ -71,11 +72,15 @@ enum {
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE = (1 << 5),
/**
- * Adjusts #ID.us reference-count.
- * \note keep in sync with 'newlibadr_us' use in readfile.c
+ * This ID usage is fully refcounted.
+ * Callback is responsible to deal accordingly with #ID.us if needed.
*/
IDWALK_CB_USER = (1 << 8),
- /** Ensure #ID.us is at least 1 on use. */
+ /**
+ * This ID usage is not refcounted, but at least one user should be generated by it (to avoid
+ * e.g. loosing the used ID on save/reload).
+ * Callback is responsible to deal accordingly with #ID.us if needed.
+ */
IDWALK_CB_USER_ONE = (1 << 9),
};
@@ -89,6 +94,8 @@ enum {
typedef struct LibraryIDLinkCallbackData {
void *user_data;
+ /** Main database used to call `BKE_library_foreach_ID_link()`. */
+ struct Main *bmain;
/**
* 'Real' ID, the one that might be in bmain, only differs from self_id when the later is an
* embedded one.
@@ -122,6 +129,37 @@ enum {
IDWALK_NO_INDIRECT_PROXY_DATA_USAGE = (1 << 8), /* Ugly special case :(((( */
};
+typedef struct LibraryForeachIDData LibraryForeachIDData;
+
+bool BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data,
+ struct ID **id_pp,
+ int cb_flag);
+int BKE_lib_query_foreachid_process_flags_get(struct LibraryForeachIDData *data);
+int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeachIDData *data,
+ const int cb_flag,
+ const bool do_replace);
+
+#define BKE_LIB_FOREACHID_PROCESS_ID(_data, _id, _cb_flag) \
+ { \
+ CHECK_TYPE_ANY((_id), ID *, void *); \
+ if (!BKE_lib_query_foreachid_process((_data), (ID **)&(_id), (_cb_flag))) { \
+ return; \
+ } \
+ } \
+ ((void)0)
+
+#define BKE_LIB_FOREACHID_PROCESS(_data, _id_super, _cb_flag) \
+ { \
+ CHECK_TYPE(&((_id_super)->id), ID *); \
+ if (!BKE_lib_query_foreachid_process((_data), (ID **)&(_id_super), (_cb_flag))) { \
+ return; \
+ } \
+ } \
+ ((void)0)
+
+bool BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct ID **id_pp);
+void BKE_lib_query_idpropertiesForeachIDLink_callback(struct IDProperty *id_prop, void *user_data);
+
/* Loop over all of the ID's this datablock links to. */
void BKE_library_foreach_ID_link(
struct Main *bmain, struct ID *id, LibraryIDLinkCallback callback, void *user_data, int flag);