Blender V4.3
workspace.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include <cstdio>
10#include <cstdlib>
11#include <cstring>
12
13#include "BLI_listbase.h"
14#include "BLI_string.h"
15#include "BLI_string_utils.hh"
16#include "BLI_utildefines.h"
17
18#include "BLT_translation.hh"
19
20#include "BKE_asset.hh"
21#include "BKE_global.hh"
22#include "BKE_idprop.hh"
23#include "BKE_idtype.hh"
24#include "BKE_lib_id.hh"
25#include "BKE_lib_query.hh"
26#include "BKE_main.hh"
27#include "BKE_viewer_path.hh"
28#include "BKE_workspace.hh"
29
30#include "DNA_scene_types.h"
31#include "DNA_screen_types.h"
33#include "DNA_workspace_types.h"
34
35#include "MEM_guardedalloc.h"
36
37#include "BLO_read_write.hh"
38
39/* -------------------------------------------------------------------- */
40
41static void workspace_init_data(ID *id)
42{
43 WorkSpace *workspace = (WorkSpace *)id;
44
45 workspace->runtime = MEM_new<blender::bke::WorkSpaceRuntime>(__func__);
46
48}
49
50static void workspace_free_data(ID *id)
51{
52 WorkSpace *workspace = (WorkSpace *)id;
53
55
56 BLI_freelistN(&workspace->owner_ids);
57 BLI_freelistN(&workspace->layouts);
58
59 while (!BLI_listbase_is_empty(&workspace->tools)) {
60 BKE_workspace_tool_remove(workspace, static_cast<bToolRef *>(workspace->tools.first));
61 }
62
64 MEM_delete(workspace->runtime);
65
67}
68
70{
71 WorkSpace *workspace = (WorkSpace *)id;
72
74
75 LISTBASE_FOREACH (WorkSpaceLayout *, layout, &workspace->layouts) {
77 }
78
79 BKE_viewer_path_foreach_id(data, &workspace->viewer_path);
80}
81
82static void workspace_blend_write(BlendWriter *writer, ID *id, const void *id_address)
83{
84 WorkSpace *workspace = (WorkSpace *)id;
85
86 BLO_write_id_struct(writer, WorkSpace, id_address, &workspace->id);
87 BKE_id_blend_write(writer, &workspace->id);
88 BLO_write_struct_list(writer, WorkSpaceLayout, &workspace->layouts);
90 BLO_write_struct_list(writer, wmOwnerID, &workspace->owner_ids);
91 BLO_write_struct_list(writer, bToolRef, &workspace->tools);
92 LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
93 if (tref->properties) {
94 IDP_BlendWrite(writer, tref->properties);
95 }
96 }
97
98 BKE_viewer_path_blend_write(writer, &workspace->viewer_path);
99}
100
102{
103 WorkSpace *workspace = (WorkSpace *)id;
104
105 BLO_read_struct_list(reader, WorkSpaceLayout, &workspace->layouts);
107 BLO_read_struct_list(reader, wmOwnerID, &workspace->owner_ids);
108 BLO_read_struct_list(reader, bToolRef, &workspace->tools);
109
111 /* Parent pointer does not belong to workspace data and is therefore restored in lib_link step
112 * of window manager. */
113 /* FIXME: Should not use that untyped #BLO_read_data_address call, especially since it's
114 * reference-counting the matching data in readfile code. Problem currently is that there is no
115 * type info available for this void pointer (_should_ be pointing to a #WorkSpaceLayout ?), so
116 * #BLO_read_get_new_data_address_no_us cannot be used here. */
117 BLO_read_data_address(reader, &relation->value);
118 }
119
120 LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
121 tref->runtime = nullptr;
122 BLO_read_struct(reader, IDProperty, &tref->properties);
123 IDP_BlendDataRead(reader, &tref->properties);
124 }
125
126 workspace->runtime = MEM_new<blender::bke::WorkSpaceRuntime>(__func__);
127
128 /* Do not keep the scene reference when appending a workspace. Setting a scene for a workspace is
129 * a convenience feature, but the workspace should never truly depend on scene data. */
130 if (ID_IS_LINKED(workspace)) {
131 workspace->pin_scene = nullptr;
132 }
133
134 id_us_ensure_real(&workspace->id);
135
136 BKE_viewer_path_blend_read_data(reader, &workspace->viewer_path);
137}
138
140{
141 WorkSpace *workspace = reinterpret_cast<WorkSpace *>(id);
142 Main *bmain = BLO_read_lib_get_main(reader);
143
144 /* Restore proper 'parent' pointers to relevant data, and clean up unused/invalid entries. */
146 relation->parent = nullptr;
147 LISTBASE_FOREACH (wmWindowManager *, wm, &bmain->wm) {
148 LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
149 if (win->winid == relation->parentid) {
150 relation->parent = win->workspace_hook;
151 }
152 }
153 }
154 if (relation->parent == nullptr) {
155 BLI_freelinkN(&workspace->hook_layout_relations, relation);
156 }
157 }
158
159 LISTBASE_FOREACH_MUTABLE (WorkSpaceLayout *, layout, &workspace->layouts) {
160 if (layout->screen) {
161 if (ID_IS_LINKED(id)) {
162 layout->screen->winid = 0;
163 if (layout->screen->temp) {
164 /* delete temp layouts when appending */
165 BKE_workspace_layout_remove(bmain, workspace, layout);
166 }
167 }
168 }
169 else {
170 /* If we're reading a layout without screen stored, it's useless and we shouldn't keep it
171 * around. */
172 BKE_workspace_layout_remove(bmain, workspace, layout);
173 }
174 }
175}
176
178 /*id_code*/ ID_WS,
179 /*id_filter*/ FILTER_ID_WS,
180 /*dependencies_id_types*/ FILTER_ID_SCE,
181 /*main_listbase_index*/ INDEX_ID_WS,
182 /*struct_size*/ sizeof(WorkSpace),
183 /*name*/ "WorkSpace",
184 /*name_plural*/ N_("workspaces"),
185 /*translation_context*/ BLT_I18NCONTEXT_ID_WORKSPACE,
188 /*asset_type_info*/ nullptr,
189
190 /*init_data*/ workspace_init_data,
191 /*copy_data*/ nullptr,
192 /*free_data*/ workspace_free_data,
193 /*make_local*/ nullptr,
194 /*foreach_id*/ workspace_foreach_id,
195 /*foreach_cache*/ nullptr,
196 /*foreach_path*/ nullptr,
197 /*owner_pointer_get*/ nullptr,
198
199 /*blend_write*/ workspace_blend_write,
200 /*blend_read_data*/ workspace_blend_read_data,
201 /*blend_read_after_liblink*/ workspace_blend_read_after_liblink,
202
203 /*blend_read_undo_preserve*/ nullptr,
204
205 /*lib_override_apply_post*/ nullptr,
206};
207
208/* -------------------------------------------------------------------- */
213 WorkSpaceLayout *layout,
214 const char *new_name)
215{
216 STRNCPY(layout->name, new_name);
217 BLI_uniquename(&workspace->layouts,
218 layout,
219 "Layout",
220 '.',
222 sizeof(layout->name));
223}
224
231 const bScreen *screen)
232{
233 return static_cast<WorkSpaceLayout *>(
234 BLI_findptr(&workspace->layouts, screen, offsetof(WorkSpaceLayout, screen)));
235}
236
237static void workspace_relation_add(ListBase *relation_list,
238 void *parent,
239 const int parentid,
240 void *data)
241{
242 WorkSpaceDataRelation *relation = MEM_cnew<WorkSpaceDataRelation>(__func__);
243 relation->parent = parent;
244 relation->parentid = parentid;
245 relation->value = data;
246 /* add to head, if we switch back to it soon we find it faster. */
247 BLI_addhead(relation_list, relation);
248}
249static void workspace_relation_remove(ListBase *relation_list, WorkSpaceDataRelation *relation)
250{
251 BLI_remlink(relation_list, relation);
252 MEM_freeN(relation);
253}
254
256 void *parent,
257 const int parentid,
258 void *data)
259{
261 relation_list, &parentid, sizeof(parentid), offsetof(WorkSpaceDataRelation, parentid)));
262 if (relation != nullptr) {
263 relation->parent = parent;
264 relation->value = data;
265 /* reinsert at the head of the list, so that more commonly used relations are found faster. */
266 BLI_remlink(relation_list, relation);
267 BLI_addhead(relation_list, relation);
268 }
269 else {
270 /* no matching relation found, add new one */
271 workspace_relation_add(relation_list, parent, parentid, data);
272 }
273}
274
276 const void *parent)
277{
278 WorkSpaceDataRelation *relation = static_cast<WorkSpaceDataRelation *>(
279 BLI_findptr(relation_list, parent, offsetof(WorkSpaceDataRelation, parent)));
280 if (relation != nullptr) {
281 return relation->value;
282 }
283
284 return nullptr;
285}
286
293#ifndef NDEBUG
295#else
297#endif
298 (const Main *bmain, bScreen *screen)
299{
300 for (WorkSpace *workspace = static_cast<WorkSpace *>(bmain->workspaces.first); workspace;
301 workspace = static_cast<WorkSpace *>(workspace->id.next))
302 {
303 if (workspace_layout_find_exec(workspace, screen)) {
304 return true;
305 }
306 }
307
308 return false;
309}
310
313/* -------------------------------------------------------------------- */
317WorkSpace *BKE_workspace_add(Main *bmain, const char *name)
318{
319 WorkSpace *new_workspace = static_cast<WorkSpace *>(BKE_id_new(bmain, ID_WS, name));
320 id_us_ensure_real(&new_workspace->id);
321 return new_workspace;
322}
323
324void BKE_workspace_remove(Main *bmain, WorkSpace *workspace)
325{
326 for (WorkSpaceLayout *layout = static_cast<WorkSpaceLayout *>(workspace->layouts.first),
327 *layout_next;
328 layout;
329 layout = layout_next)
330 {
331 layout_next = layout->next;
332 BKE_workspace_layout_remove(bmain, workspace, layout);
333 }
334 BKE_id_free(bmain, workspace);
335}
336
338{
339 WorkSpaceInstanceHook *hook = MEM_cnew<WorkSpaceInstanceHook>(__func__);
340
341 /* set an active screen-layout for each possible window/workspace combination */
342 for (WorkSpace *workspace = static_cast<WorkSpace *>(bmain->workspaces.first); workspace;
343 workspace = static_cast<WorkSpace *>(workspace->id.next))
344 {
346 hook, winid, workspace, static_cast<WorkSpaceLayout *>(workspace->layouts.first));
347 }
348
349 return hook;
350}
352{
353 /* workspaces should never be freed before wm (during which we call this function).
354 * However, when running in background mode, loading a blend file may allocate windows (that need
355 * to be freed) without creating workspaces. This happens in BlendfileLoadingBaseTest. */
356 BLI_assert(!BLI_listbase_is_empty(&bmain->workspaces) || G.background);
357
358 /* Free relations for this hook */
359 for (WorkSpace *workspace = static_cast<WorkSpace *>(bmain->workspaces.first); workspace;
360 workspace = static_cast<WorkSpace *>(workspace->id.next))
361 {
362 for (WorkSpaceDataRelation *relation = static_cast<WorkSpaceDataRelation *>(
363 workspace->hook_layout_relations.first),
364 *relation_next;
365 relation;
366 relation = relation_next)
367 {
368 relation_next = relation->next;
369 if (relation->parent == hook) {
370 workspace_relation_remove(&workspace->hook_layout_relations, relation);
371 }
372 }
373 }
374
375 MEM_freeN(hook);
376}
377
379 WorkSpace *workspace,
380 bScreen *screen,
381 const char *name)
382{
383 WorkSpaceLayout *layout = MEM_cnew<WorkSpaceLayout>(__func__);
384
385 BLI_assert(!workspaces_is_screen_used(bmain, screen));
386#ifdef NDEBUG
387 UNUSED_VARS(bmain);
388#endif
389 layout->screen = screen;
390 id_us_plus(&layout->screen->id);
391 workspace_layout_name_set(workspace, layout, name);
392 BLI_addtail(&workspace->layouts, layout);
393
394 return layout;
395}
396
398{
399 /* Screen should usually be set, but we call this from file reading to get rid of invalid
400 * layouts. */
401 if (layout->screen) {
402 id_us_min(&layout->screen->id);
403 BKE_id_free(bmain, layout->screen);
404 }
405 BLI_freelinkN(&workspace->layouts, layout);
406}
407
409{
411 relation = static_cast<WorkSpaceDataRelation *>(relation_list->first),
412 *relation_next;
413 relation;
414 relation = relation_next)
415 {
416 relation_next = relation->next;
417 workspace_relation_remove(relation_list, relation);
418 }
419}
420
423/* -------------------------------------------------------------------- */
428{
429 WorkSpaceLayout *layout = workspace_layout_find_exec(workspace, screen);
430 if (layout) {
431 return layout;
432 }
433
434 printf(
435 "%s: Couldn't find layout in this workspace: '%s' screen: '%s'. "
436 "This should not happen!\n",
437 __func__,
438 workspace->id.name + 2,
439 screen->id.name + 2);
440
441 return nullptr;
442}
443
445 const bScreen *screen,
446 WorkSpace **r_workspace)
447{
448 WorkSpaceLayout *layout;
449
450 if (r_workspace) {
451 *r_workspace = nullptr;
452 }
453
454 for (WorkSpace *workspace = static_cast<WorkSpace *>(bmain->workspaces.first); workspace;
455 workspace = static_cast<WorkSpace *>(workspace->id.next))
456 {
457 if ((layout = workspace_layout_find_exec(workspace, screen))) {
458 if (r_workspace) {
459 *r_workspace = workspace;
460 }
461
462 return layout;
463 }
464 }
465
466 return nullptr;
467}
468
470 WorkSpaceLayout *start,
471 bool (*callback)(const WorkSpaceLayout *layout,
472 void *arg),
473 void *arg,
474 const bool iter_backward)
475{
476 WorkSpaceLayout *iter_layout;
477
478 if (iter_backward) {
479 LISTBASE_CIRCULAR_BACKWARD_BEGIN (WorkSpaceLayout *, &workspace->layouts, iter_layout, start) {
480 if (!callback(iter_layout, arg)) {
481 return iter_layout;
482 }
483 }
484 LISTBASE_CIRCULAR_BACKWARD_END(WorkSpaceLayout *, &workspace->layouts, iter_layout, start);
485 }
486 else {
487 LISTBASE_CIRCULAR_FORWARD_BEGIN (WorkSpaceLayout *, &workspace->layouts, iter_layout, start) {
488 if (!callback(iter_layout, arg)) {
489 return iter_layout;
490 }
491 }
492 LISTBASE_CIRCULAR_FORWARD_END(WorkSpaceLayout *, &workspace->layouts, iter_layout, start);
493 }
494
495 return nullptr;
496}
497
499{
500 if (tref->runtime) {
501 MEM_freeN(tref->runtime);
502 }
503 if (tref->properties) {
505 }
506 BLI_remlink(&workspace->tools, tref);
507 MEM_freeN(tref);
508}
509
511 const int space_type,
512 const int mode,
513 const char *idname_prefix_skip,
514 const char *replace_table[][2],
515 int replace_table_num)
516{
517 const size_t idname_prefix_len = idname_prefix_skip ? strlen(idname_prefix_skip) : 0;
518 const size_t idname_suffix_len = sizeof(bToolRef::idname) - idname_prefix_len;
519
520 LISTBASE_FOREACH (bToolRef *, tref, &workspace->tools) {
521 if (!(tref->space_type == space_type && tref->mode == mode)) {
522 continue;
523 }
524 char *idname_suffix = tref->idname;
525 if (idname_prefix_skip) {
526 if (!STRPREFIX(idname_suffix, idname_prefix_skip)) {
527 continue;
528 }
529 idname_suffix += idname_prefix_len;
530 }
532 idname_suffix, idname_suffix_len, replace_table, replace_table_num);
533 }
534}
535
536bool BKE_workspace_owner_id_check(const WorkSpace *workspace, const char *owner_id)
537{
538 if ((*owner_id == '\0') || ((workspace->flags & WORKSPACE_USE_FILTER_BY_ORIGIN) == 0)) {
539 return true;
540 }
541
542 /* We could use hash lookup, for now this list is highly likely under < ~16 items. */
543 return BLI_findstring(&workspace->owner_ids, owner_id, offsetof(wmOwnerID, name)) != nullptr;
544}
545
547{
548 BKE_main_id_tag_listbase(&bmain->workspaces, tag, false);
549 wmWindowManager *wm = static_cast<wmWindowManager *>(bmain->wm.first);
550 LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
551 WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
552 workspace->id.tag |= tag;
553 }
554}
555
558/* -------------------------------------------------------------------- */
567{
568 /* DO NOT check for `hook->active == workspace` here. Caller code is supposed to do it if
569 * that optimization is possible and needed.
570 * This code can be called from places where we might have this equality, but still want to
571 * ensure/update the active layout below.
572 * Known case where this is buggy and will crash later due to nullptr active layout: reading
573 * a blend file, when the new read workspace ID happens to have the exact same memory address
574 * as when it was saved in the blend file (extremely unlikely, but possible). */
575
576 hook->active = workspace;
577 if (workspace) {
578 WorkSpaceLayout *layout = static_cast<WorkSpaceLayout *>(
580 if (layout) {
581 hook->act_layout = layout;
582 }
583 }
584}
585
590
592 const WorkSpace *workspace)
593{
594 /* If the workspace is active, the active layout can be returned, no need for a lookup. */
595 if (hook->active == workspace) {
596 return hook->act_layout;
597 }
598
599 /* Inactive workspace */
600 return static_cast<WorkSpaceLayout *>(
602}
603
605 const int winid,
606 WorkSpace *workspace,
607 WorkSpaceLayout *layout)
608{
609 hook->act_layout = layout;
611}
612
618 const int winid,
619 WorkSpace *workspace,
620 bScreen *screen)
621{
622 /* we need to find the WorkspaceLayout that wraps this screen */
623 WorkSpaceLayout *layout = BKE_workspace_layout_find(hook->active, screen);
624 BKE_workspace_active_layout_set(hook, winid, workspace, layout);
625}
626
628{
629 return layout->name;
630}
632 WorkSpaceLayout *layout,
633 const char *new_name)
634{
635 workspace_layout_name_set(workspace, layout, new_name);
636}
637
639{
640 return layout->screen;
641}
642
645/* -------------------------------------------------------------------- */
650{
651 workspace->runtime->status.clear_and_shrink();
652}
653
void BKE_asset_library_reference_init_default(AssetLibraryReference *library_ref)
Definition asset.cc:149
#define IDP_BlendDataRead(reader, prop)
void IDP_FreeProperty(IDProperty *prop)
Definition idprop.cc:1227
void IDP_BlendWrite(BlendWriter *writer, const IDProperty *prop)
Definition idprop.cc:1437
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition BKE_idtype.hh:41
@ IDTYPE_FLAGS_ONLY_APPEND
Definition BKE_idtype.hh:36
@ IDTYPE_FLAGS_NO_COPY
Definition BKE_idtype.hh:30
@ IDTYPE_FLAGS_NO_MEMFILE_UNDO
Definition BKE_idtype.hh:50
@ IDTYPE_FLAGS_NEVER_UNUSED
Definition BKE_idtype.hh:64
void BKE_id_free(Main *bmain, void *idv)
void id_us_plus(ID *id)
Definition lib_id.cc:351
void id_us_ensure_real(ID *id)
Definition lib_id.cc:306
void * BKE_id_new(Main *bmain, short type, const char *name)
Definition lib_id.cc:1482
void id_us_min(ID *id)
Definition lib_id.cc:359
void BKE_main_id_tag_listbase(ListBase *lb, int tag, bool value)
Definition lib_id.cc:1175
void BKE_id_blend_write(BlendWriter *writer, ID *id)
Definition lib_id.cc:2560
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
@ IDWALK_CB_USER
@ IDWALK_CB_NOP
void BKE_viewer_path_foreach_id(LibraryForeachIDData *data, ViewerPath *viewer_path)
void BKE_viewer_path_clear(ViewerPath *viewer_path)
void BKE_viewer_path_blend_read_data(BlendDataReader *reader, ViewerPath *viewer_path)
void BKE_viewer_path_blend_write(BlendWriter *writer, const ViewerPath *viewer_path)
#define BLI_assert(a)
Definition BLI_assert.h:50
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:90
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:269
#define LISTBASE_CIRCULAR_BACKWARD_END(type, lb, lb_iter, lb_init)
#define LISTBASE_CIRCULAR_FORWARD_BEGIN(type, lb, lb_iter, lb_init)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:496
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:130
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_CIRCULAR_BACKWARD_BEGIN(type, lb, lb_iter, lb_init)
void * BLI_listbase_bytes_find(const ListBase *listbase, const void *bytes, size_t bytes_size, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
#define LISTBASE_CIRCULAR_FORWARD_END(type, lb, lb_iter, lb_init)
#define STRNCPY(dst, src)
Definition BLI_string.h:593
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
bool BLI_string_replace_table_exact(char *string, size_t string_len, const char *replace_table[][2], int replace_table_len)
#define UNUSED_FUNCTION(x)
#define STRPREFIX(a, b)
#define UNUSED_VARS(...)
#define BLO_read_data_address(reader, ptr_p)
Main * BLO_read_lib_get_main(BlendLibReader *reader)
Definition readfile.cc:5160
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_write_struct_list(writer, struct_name, list_ptr)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_WORKSPACE
#define FILTER_ID_WS
Definition DNA_ID.h:1193
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:654
@ INDEX_ID_WS
Definition DNA_ID.h:1321
#define FILTER_ID_SCE
Definition DNA_ID.h:1184
@ ID_WS
@ WORKSPACE_USE_FILTER_BY_ORIGIN
struct WorkSpace WorkSpace
Read Guarded memory(de)allocation.
#define printf
DEGForeachIDComponentCallback callback
#define offsetof(t, d)
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
#define G(x, y, z)
Definition DNA_ID.h:413
int tag
Definition DNA_ID.h:434
char name[66]
Definition DNA_ID.h:425
void * first
ListBase wm
Definition BKE_main.hh:239
ListBase workspaces
Definition BKE_main.hh:246
struct WorkSpaceLayout * act_layout
Wrapper for bScreen.
struct bScreen * screen
AssetLibraryReference asset_library_ref
WorkSpaceRuntimeHandle * runtime
ListBase hook_layout_relations
ViewerPath viewer_path
struct Scene * pin_scene
IDProperty * properties
bToolRef_Runtime * runtime
#define N_(msgid)
int winid
Definition wm_draw.cc:169
static void workspace_relation_ensure_updated(ListBase *relation_list, void *parent, const int parentid, void *data)
Definition workspace.cc:255
IDTypeInfo IDType_ID_WS
Definition workspace.cc:177
static void workspace_relation_remove(ListBase *relation_list, WorkSpaceDataRelation *relation)
Definition workspace.cc:249
static void workspace_free_data(ID *id)
Definition workspace.cc:50
static void workspace_layout_name_set(WorkSpace *workspace, WorkSpaceLayout *layout, const char *new_name)
Definition workspace.cc:212
static void workspace_blend_read_after_liblink(BlendLibReader *reader, ID *id)
Definition workspace.cc:139
static void workspace_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition workspace.cc:82
const char * BKE_workspace_layout_name_get(const WorkSpaceLayout *layout)
Definition workspace.cc:627
static bool workspaces_is_screen_used(const Main *bmain, bScreen *screen)
Definition workspace.cc:298
WorkSpace * BKE_workspace_add(Main *bmain, const char *name)
Definition workspace.cc:317
void BKE_workspace_layout_remove(Main *bmain, WorkSpace *workspace, WorkSpaceLayout *layout)
Definition workspace.cc:397
static void workspace_foreach_id(ID *id, LibraryForeachIDData *data)
Definition workspace.cc:69
bool BKE_workspace_owner_id_check(const WorkSpace *workspace, const char *owner_id)
Definition workspace.cc:536
bScreen * BKE_workspace_layout_screen_get(const WorkSpaceLayout *layout)
Definition workspace.cc:638
void BKE_workspace_active_screen_set(WorkSpaceInstanceHook *hook, const int winid, WorkSpace *workspace, bScreen *screen)
Definition workspace.cc:617
WorkSpaceLayout * BKE_workspace_layout_find(const WorkSpace *workspace, const bScreen *screen)
Definition workspace.cc:427
void BKE_workspace_status_clear(WorkSpace *workspace)
Definition workspace.cc:649
WorkSpaceLayout * BKE_workspace_layout_add(Main *bmain, WorkSpace *workspace, bScreen *screen, const char *name)
Definition workspace.cc:378
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook)
Definition workspace.cc:613
static void workspace_relation_add(ListBase *relation_list, void *parent, const int parentid, void *data)
Definition workspace.cc:237
void BKE_workspace_instance_hook_free(const Main *bmain, WorkSpaceInstanceHook *hook)
Definition workspace.cc:351
WorkSpaceLayout * BKE_workspace_active_layout_for_workspace_get(const WorkSpaceInstanceHook *hook, const WorkSpace *workspace)
Definition workspace.cc:591
static void workspace_init_data(ID *id)
Definition workspace.cc:41
void BKE_workspace_active_set(WorkSpaceInstanceHook *hook, WorkSpace *workspace)
Definition workspace.cc:566
WorkSpaceLayout * BKE_workspace_layout_find_global(const Main *bmain, const bScreen *screen, WorkSpace **r_workspace)
Definition workspace.cc:444
WorkSpaceLayout * BKE_workspace_layout_iter_circular(const WorkSpace *workspace, WorkSpaceLayout *start, bool(*callback)(const WorkSpaceLayout *layout, void *arg), void *arg, const bool iter_backward)
Definition workspace.cc:469
void BKE_workspace_id_tag_all_visible(Main *bmain, int tag)
Definition workspace.cc:546
void BKE_workspace_relations_free(ListBase *relation_list)
Definition workspace.cc:408
void BKE_workspace_remove(Main *bmain, WorkSpace *workspace)
Definition workspace.cc:324
void BKE_workspace_active_layout_set(WorkSpaceInstanceHook *hook, const int winid, WorkSpace *workspace, WorkSpaceLayout *layout)
Activate a layout.
Definition workspace.cc:604
void BKE_workspace_tool_id_replace_table(WorkSpace *workspace, const int space_type, const int mode, const char *idname_prefix_skip, const char *replace_table[][2], int replace_table_num)
Definition workspace.cc:510
static void workspace_blend_read_data(BlendDataReader *reader, ID *id)
Definition workspace.cc:101
WorkSpaceInstanceHook * BKE_workspace_instance_hook_create(const Main *bmain, const int winid)
Definition workspace.cc:337
void BKE_workspace_layout_name_set(WorkSpace *workspace, WorkSpaceLayout *layout, const char *new_name)
Definition workspace.cc:631
WorkSpace * BKE_workspace_active_get(WorkSpaceInstanceHook *hook)
Definition workspace.cc:562
static WorkSpaceLayout * workspace_layout_find_exec(const WorkSpace *workspace, const bScreen *screen)
Definition workspace.cc:230
WorkSpaceLayout * BKE_workspace_active_layout_get(const WorkSpaceInstanceHook *hook)
Definition workspace.cc:586
static void * workspace_relation_get_data_matching_parent(const ListBase *relation_list, const void *parent)
Definition workspace.cc:275
void BKE_workspace_tool_remove(WorkSpace *workspace, bToolRef *tref)
Definition workspace.cc:498