Depsgraph: remove EvaluationContext, pass Depsgraph instead.
[blender.git] / source / blender / blenkernel / BKE_workspace.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * ***** END GPL LICENSE BLOCK *****
19  */
20
21 /** \file BKE_workspace.h
22  *  \ingroup bke
23  */
24
25 #ifndef __BKE_WORKSPACE_H__
26 #define __BKE_WORKSPACE_H__
27
28 #include "BLI_compiler_attrs.h"
29
30 struct bScreen;
31 struct Main;
32 struct Scene;
33 struct TransformOrientation;
34 struct ViewLayer;
35
36 /* -------------------------------------------------------------------- */
37 /* Create, delete, init */
38
39 struct WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name);
40 void BKE_workspace_free(struct WorkSpace *workspace);
41 void BKE_workspace_remove(struct Main *bmain, struct WorkSpace *workspace);
42
43 struct WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const struct Main *bmain);
44 void BKE_workspace_instance_hook_free(const struct Main *bmain, struct WorkSpaceInstanceHook *hook);
45
46 struct WorkSpaceLayout *BKE_workspace_layout_add(
47         struct WorkSpace *workspace,
48         struct bScreen *screen,
49         const char *name) ATTR_NONNULL();
50 void BKE_workspace_layout_remove(
51         struct Main *bmain,
52         struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL();
53
54 void BKE_workspace_relations_free(
55         ListBase *relation_list);
56
57
58 /* -------------------------------------------------------------------- */
59 /* General Utils */
60
61 void BKE_workspace_view_layer_remove_references(
62         const struct Main *bmain,
63         const struct ViewLayer *view_layer) ATTR_NONNULL();
64
65 void BKE_workspace_transform_orientation_remove(
66         struct WorkSpace *workspace, struct TransformOrientation *orientation) ATTR_NONNULL();
67 struct TransformOrientation *BKE_workspace_transform_orientation_find(
68         const struct WorkSpace *workspace, const int index) ATTR_NONNULL();
69 int BKE_workspace_transform_orientation_get_index(
70         const struct WorkSpace *workspace, const struct TransformOrientation *orientation) ATTR_NONNULL();
71
72 struct WorkSpaceLayout *BKE_workspace_layout_find(
73         const struct WorkSpace *workspace, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
74 struct WorkSpaceLayout *BKE_workspace_layout_find_global(
75         const struct Main *bmain, const struct bScreen *screen,
76         struct WorkSpace **r_workspace) ATTR_NONNULL(1, 2);
77
78 struct WorkSpaceLayout *BKE_workspace_layout_iter_circular(
79         const struct WorkSpace *workspace, struct WorkSpaceLayout *start,
80         bool (*callback)(const struct WorkSpaceLayout *layout, void *arg),
81         void *arg, const bool iter_backward);
82
83
84 /* -------------------------------------------------------------------- */
85 /* Getters/Setters */
86
87 #define GETTER_ATTRS ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
88 #define SETTER_ATTRS ATTR_NONNULL(1)
89
90 struct WorkSpace *BKE_workspace_active_get(struct WorkSpaceInstanceHook *hook) GETTER_ATTRS;
91 void       BKE_workspace_active_set(struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace) SETTER_ATTRS;
92 struct WorkSpaceLayout *BKE_workspace_active_layout_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS;
93 void             BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *hook, struct WorkSpaceLayout *layout) SETTER_ATTRS;
94 struct bScreen *BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS;
95 void            BKE_workspace_active_screen_set(
96         struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct bScreen *screen) SETTER_ATTRS;
97
98 struct Base *BKE_workspace_active_base_get(const struct WorkSpace *workspace, const struct Scene *scene);
99 struct ListBase *BKE_workspace_transform_orientations_get(struct WorkSpace *workspace) GETTER_ATTRS;
100 struct ViewLayer *BKE_workspace_view_layer_get(
101         const struct WorkSpace *workspace,
102         const struct Scene *scene) GETTER_ATTRS;
103 void BKE_workspace_view_layer_set(
104         struct WorkSpace *workspace,
105         struct ViewLayer *layer,
106         struct Scene *scene) SETTER_ATTRS;
107 struct ListBase *BKE_workspace_layouts_get(struct WorkSpace *workspace) GETTER_ATTRS;
108
109 const char *BKE_workspace_layout_name_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS;
110 void        BKE_workspace_layout_name_set(
111         struct WorkSpace *workspace, struct WorkSpaceLayout *layout, const char *new_name) ATTR_NONNULL();
112 struct bScreen *BKE_workspace_layout_screen_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS;
113 void            BKE_workspace_layout_screen_set(struct WorkSpaceLayout *layout, struct bScreen *screen) SETTER_ATTRS;
114
115 struct WorkSpaceLayout *BKE_workspace_hook_layout_for_workspace_get(
116         const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS;
117 void             BKE_workspace_hook_layout_for_workspace_set(
118         struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL();
119
120 struct ViewRender *BKE_workspace_view_render_get(struct WorkSpace *workspace) GETTER_ATTRS;
121
122 /* flags */
123 bool BKE_workspace_use_scene_settings_get(const struct WorkSpace *workspace) GETTER_ATTRS;
124 void BKE_workspace_use_scene_settings_set(struct WorkSpace *workspace, bool value) SETTER_ATTRS;
125
126 /* Update / evaluate */
127 void BKE_workspace_update_tagged(struct Main *bmain,
128                                  struct WorkSpace *workspace,
129                                  struct Scene *scene);
130
131 bool BKE_workspace_owner_id_check(
132         const struct WorkSpace *workspace, const char *owner_id) ATTR_NONNULL();
133
134 #undef GETTER_ATTRS
135 #undef SETTER_ATTRS
136
137 #endif /* __BKE_WORKSPACE_H__ */