[Bf-blender-cvs] [e6edec4e4a4] temp-workspace-multi-window: Completely get rid of per-window data duplicates from workspaces
Julian Eisel
noreply at git.blender.org
Wed Mar 8 18:06:36 CET 2017
Commit: e6edec4e4a4b80efd60b83e8556be3da0b112215
Author: Julian Eisel
Date: Wed Mar 8 18:05:34 2017 +0100
Branches: temp-workspace-multi-window
https://developer.blender.org/rBe6edec4e4a4b80efd60b83e8556be3da0b112215
Completely get rid of per-window data duplicates from workspaces
===================================================================
M source/blender/blenkernel/BKE_workspace.h
M source/blender/blenkernel/intern/library_query.c
M source/blender/blenkernel/intern/workspace.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/versioning_280.c
M source/blender/blenloader/intern/versioning_defaults.c
M source/blender/editors/transform/transform_orientations.c
M source/blender/editors/workspace/workspace_layout_edit.c
M source/blender/makesdna/dna_workspace_types.h
M source/blender/windowmanager/intern/wm_window.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h
index 660fa69ecbd..0b58b587d65 100644
--- a/source/blender/blenkernel/BKE_workspace.h
+++ b/source/blender/blenkernel/BKE_workspace.h
@@ -58,8 +58,8 @@ WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name);
void BKE_workspace_free(WorkSpace *ws);
void BKE_workspace_remove(WorkSpace *workspace, struct Main *bmain);
-WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpace *workspace, WorkSpaceLayoutType *type,
- struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
+WorkSpaceLayout *BKE_workspace_layout_add_from_type(
+ WorkSpaceHook *hook, WorkSpaceLayoutType *type, struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
void BKE_workspace_layout_remove(WorkSpace *workspace, WorkSpaceLayout *layout, struct Main *bmain) ATTR_NONNULL();
WorkSpaceLayoutType *BKE_workspace_layout_type_add(WorkSpace *workspace, const char *name,
struct ScreenLayoutData layout_blueprint) ATTR_NONNULL();
@@ -79,8 +79,7 @@ void BKE_workspace_hook_delete(struct Main *bmain, WorkSpaceHook *hook) ATTR_NON
WorkSpaceLayout *BKE_workspace_change_prepare(
struct Main *bmain, WorkSpaceHook *workspace_hook, WorkSpace *workspace_new) ATTR_NONNULL();
-void BKE_workspaces_transform_orientation_remove(const struct ListBase *workspaces,
- const struct TransformOrientation *orientation) ATTR_NONNULL();
+void BKE_workspaces_transform_orientation_remove(const struct TransformOrientation *orientation) ATTR_NONNULL();
WorkSpaceLayout *BKE_workspace_layout_find(const WorkSpaceHook *hook, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
WorkSpaceLayout *BKE_workspace_layout_find_from_type(const WorkSpaceHook *hook, const WorkSpaceLayoutType *type) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
@@ -94,10 +93,6 @@ struct bScreen *BKE_workspace_layout_screen_find_from_type(const WorkSpaceHook
_layout##_prev = BKE_workspace_layout_prev_get(_layout); /* support removing layout from list */
#define BKE_workspace_layout_iter_end } (void)0
-WorkSpaceLayout *BKE_workspace_layout_iter_circular(const WorkSpace *workspace, WorkSpaceLayout *start,
- bool (*callback)(const WorkSpaceLayout *layout, void *arg),
- void *arg, const bool iter_backward);
-
#define BKE_workspace_layout_type_iter_begin(_layout_type, _start_layout_type) \
for (WorkSpaceLayoutType *_layout_type = _start_layout_type, *_layout_type##_next; \
_layout_type; \
@@ -115,12 +110,10 @@ WorkSpaceLayout *BKE_workspace_layout_iter_circular(const WorkSpace *workspace,
struct ID *BKE_workspace_id_get(WorkSpace *workspace) GETTER_ATTRS;
const char *BKE_workspace_name_get(const WorkSpace *workspace) GETTER_ATTRS;
-WorkSpaceLayout *BKE_workspace_active_layout_get(const struct WorkSpace *ws) GETTER_ATTRS;
-void BKE_workspace_active_layout_set(WorkSpace *ws, WorkSpaceLayout *layout) SETTER_ATTRS;
WorkSpaceLayout *BKE_workspace_hook_active_layout_get(const WorkSpaceHook *hook) GETTER_ATTRS;
void BKE_workspace_hook_active_layout_set(WorkSpaceHook *hook, WorkSpaceLayout *layout) SETTER_ATTRS;
struct bScreen *BKE_workspace_active_screen_get(const WorkSpace *ws) GETTER_ATTRS;
-void BKE_workspace_active_screen_set(WorkSpaceHook *hook, struct bScreen *screen) SETTER_ATTRS;
+void BKE_workspace_hook_active_screen_set(WorkSpaceHook *hook, struct bScreen *screen) SETTER_ATTRS;
struct bScreen *BKE_workspace_hook_active_screen_get(const WorkSpaceHook *hook) GETTER_ATTRS;
enum ObjectMode BKE_workspace_object_mode_get(const WorkSpace *workspace) GETTER_ATTRS;
#ifdef USE_WORKSPACE_MODE
@@ -128,7 +121,6 @@ void BKE_workspace_object_mode_set(WorkSpace *workspace, const enum O
#endif
struct SceneLayer *BKE_workspace_render_layer_get(const WorkSpace *workspace) GETTER_ATTRS;
void BKE_workspace_render_layer_set(WorkSpace *workspace, struct SceneLayer *layer) SETTER_ATTRS;
-struct ListBase *BKE_workspace_layouts_get(WorkSpace *workspace) GETTER_ATTRS;
WorkSpaceLayoutType *BKE_workspace_active_layout_type_get(const WorkSpace *workspace) GETTER_ATTRS;
void BKE_workspace_active_layout_type_set(WorkSpace *workspace, WorkSpaceLayoutType *layout_type) SETTER_ATTRS;
WorkSpaceLayoutType *BKE_workspace_layout_type_get(const WorkSpaceLayout *layout) GETTER_ATTRS;
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 5371ef7b9a1..c5b112972f7 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -936,24 +936,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
break;
}
- case ID_WS:
- {
- WorkSpace *workspace = (WorkSpace *)id;
- ListBase *layouts = BKE_workspace_layouts_get(workspace);
-
- BKE_workspace_layout_iter_begin(layout, layouts->first);
- {
- bScreen *screen = BKE_workspace_layout_screen_get(layout);
-
- CALLBACK_INVOKE(screen, IDWALK_CB_NOP);
- /* allow callback to set a different screen */
- BKE_workspace_layout_screen_set(layout, screen);
- }
- BKE_workspace_layout_iter_end;
-
- break;
- }
-
/* Nothing needed for those... */
case ID_SCR:
case ID_IM:
@@ -965,6 +947,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
case ID_PAL:
case ID_PC:
case ID_CF:
+ case ID_WS:
break;
/* Deprecated. */
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index e66923bd543..98b5a3c037a 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -96,7 +96,7 @@ void BKE_workspace_remove(WorkSpace *workspace, Main *bmain)
}
-WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpace *workspace, WorkSpaceLayoutType *type, bScreen *screen)
+WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpaceHook *hook, WorkSpaceLayoutType *type, bScreen *screen)
{
WorkSpaceLayout *layout = MEM_mallocN(sizeof(*layout), __func__);
@@ -104,7 +104,7 @@ WorkSpaceLayout *BKE_workspace_layout_add_from_type(WorkSpace *workspace, WorkSp
layout->type = type;
layout->screen = screen;
- BLI_addhead(&workspace->layouts, layout);
+ BLI_addtail(&hook->layouts, layout);
return layout;
}
@@ -180,9 +180,7 @@ WorkSpaceLayout *BKE_workspace_change_prepare(Main *bmain, WorkSpaceHook *worksp
for (WorkSpaceLayoutType *type = workspace_new->layout_types.first; type; type = type->next) {
bScreen *screen = BKE_screen_create_from_layout_data(bmain, &type->layout_blueprint, type->name);
- WorkSpaceLayout *layout = BKE_workspace_layout_add_from_type(workspace_new, type, screen);
-
- BLI_addtail(&workspace_hook->layouts, layout);
+ WorkSpaceLayout *layout = BKE_workspace_layout_add_from_type(workspace_hook, type, screen);
/* XXX Just setting the active layout matching the active type stored in workspace */
if (type == workspace_new->act_layout_type) {
@@ -193,17 +191,15 @@ WorkSpaceLayout *BKE_workspace_change_prepare(Main *bmain, WorkSpaceHook *worksp
return act_layout;
}
-void BKE_workspaces_transform_orientation_remove(const ListBase *workspaces, const TransformOrientation *orientation)
+void BKE_workspaces_transform_orientation_remove(const TransformOrientation *orientation)
{
- BKE_workspace_iter_begin(workspace, workspaces->first)
- {
- BKE_workspace_layout_iter_begin(layout, workspace->layouts.first)
+ for (WorkSpaceHook *hook = hooks_all.first; hook; hook = hook->next) {
+ BKE_workspace_layout_iter_begin(layout, hook->layouts.first)
{
BKE_screen_transform_orientation_remove(BKE_workspace_layout_screen_get(layout), orientation);
}
BKE_workspace_layout_iter_end;
}
- BKE_workspace_iter_end;
}
/**
@@ -268,35 +264,6 @@ bScreen *BKE_workspace_layout_screen_find_from_type(const WorkSpaceHook *hook, c
return layout->screen;
}
-/* XXX UNUSED */
-WorkSpaceLayout *BKE_workspace_layout_iter_circular(const WorkSpace *workspace, WorkSpaceLayout *start,
- bool (*callback)(const WorkSpaceLayout *layout, void *arg),
- void *arg, const bool iter_backward)
-{
- WorkSpaceLayout *iter_layout;
-
- if (iter_backward) {
- BLI_LISTBASE_CIRCULAR_BACKWARD_BEGIN(&workspace->layouts, iter_layout, start)
- {
- if (!callback(iter_layout, arg)) {
- return iter_layout;
- }
- }
- BLI_LISTBASE_CIRCULAR_BACKWARD_END(&workspace->layouts, iter_layout, start);
- }
- else {
- BLI_LISTBASE_CIRCULAR_FORWARD_BEGIN(&workspace->layouts, iter_layout, start)
- {
- if (!callback(iter_layout, arg)) {
- return iter_layout;
- }
- }
- BLI_LISTBASE_CIRCULAR_FORWARD_END(&workspace->layouts, iter_layout, start)
- }
-
- return NULL;
-}
-
/* -------------------------------------------------------------------- */
/* Getters/Setters */
@@ -311,17 +278,6 @@ const char *BKE_workspace_name_get(const WorkSpace *workspace)
return workspace->id.name + 2;
}
-/* DEPRECATED */
-WorkSpaceLayout *BKE_workspace_active_layout_get(const WorkSpace *workspace)
-{
- return workspace->act_layout;
-}
-/* DEPRECATED */
-void BKE_workspace_active_layout_set(WorkSpace *workspace, WorkSpaceLayout *layout)
-{
- workspace->act_layout = layout;
- workspace->act_layout_type = layout->type;
-}
WorkSpaceLayout *BKE_workspace_hook_active_layout_get(const WorkSpaceHook *hook)
{
return hook->act_layout;
@@ -341,11 +297,7 @@ void BKE_workspace_new_layout_set(WorkSpaceHook *hook, WorkSpaceLayout *layout)
hook->new_layout = layout;
}
-bScreen *BKE_workspace_active_screen_get(const WorkSpace *ws)
-{
- return ws->act_layout->screen;
-}
-void BKE_workspace_active_screen_set(WorkSpaceHook *hook, bScreen *screen)
+void BKE_workspace_hook_active_screen_set(WorkSpaceHook *hook,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list