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