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
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-05-18 20:01:20 +0300
committerBastien Montagne <bastien@blender.org>2020-05-18 20:01:20 +0300
commit06c57d3e7ae36efd07becb653ef81be4c5c9e64e (patch)
tree678a2739345a851b8a70a347d06c5df0a424d019 /source
parent8f10f9d5dc7657b6e35d7cb108660db19034c049 (diff)
Refactor: Move workspace foreach_id to new IDTypeInfo structure.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/lib_query.c14
-rw-r--r--source/blender/blenkernel/intern/workspace.c19
2 files changed, 20 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 4f6d5eba689..1fcae6a3072 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -856,19 +856,7 @@ static void library_foreach_ID_link(Main *bmain,
}
case ID_WS: {
- WorkSpace *workspace = (WorkSpace *)id;
- ListBase *layouts = BKE_workspace_layouts_get(workspace);
-
- LISTBASE_FOREACH (WorkSpaceLayout *, layout, layouts) {
- bScreen *screen = BKE_workspace_layout_screen_get(layout);
-
- /* CALLBACK_INVOKE expects an actual pointer, not a variable holding the pointer.
- * However we can't access layout->screen here
- * since we are outside the workspace project. */
- CALLBACK_INVOKE(screen, IDWALK_CB_USER);
- /* allow callback to set a different screen */
- BKE_workspace_layout_screen_set(layout, screen);
- }
+ BLI_assert(0);
break;
}
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index c65d55785c1..3a69b95c114 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -32,6 +32,7 @@
#include "BKE_idprop.h"
#include "BKE_idtype.h"
#include "BKE_lib_id.h"
+#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_object.h"
#include "BKE_scene.h"
@@ -65,6 +66,23 @@ static void workspace_free_data(ID *id)
MEM_SAFE_FREE(workspace->status_text);
}
+static void workspace_foreach_id(ID *id, LibraryForeachIDData *data)
+{
+ WorkSpace *workspace = (WorkSpace *)id;
+ ListBase *layouts = BKE_workspace_layouts_get(workspace);
+
+ LISTBASE_FOREACH (WorkSpaceLayout *, layout, layouts) {
+ bScreen *screen = BKE_workspace_layout_screen_get(layout);
+
+ /* CALLBACK_INVOKE expects an actual pointer, not a variable holding the pointer.
+ * However we can't access layout->screen here
+ * since we are outside the workspace project. */
+ BKE_LIB_FOREACHID_PROCESS(data, screen, IDWALK_CB_USER);
+ /* allow callback to set a different screen */
+ BKE_workspace_layout_screen_set(layout, screen);
+ }
+}
+
IDTypeInfo IDType_ID_WS = {
.id_code = ID_WS,
.id_filter = FILTER_ID_WS,
@@ -79,6 +97,7 @@ IDTypeInfo IDType_ID_WS = {
.copy_data = NULL,
.free_data = workspace_free_data,
.make_local = NULL,
+ .foreach_id = workspace_foreach_id,
};
/** \name Internal Utils