Blender  V3.3
workspace_edit.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <stdlib.h>
8 #include <string.h>
9 
10 #include "BLI_fileops.h"
11 #include "BLI_listbase.h"
12 #include "BLI_path_util.h"
13 #include "BLI_utildefines.h"
14 
15 #include "BKE_appdir.h"
16 #include "BKE_blendfile.h"
17 #include "BKE_context.h"
18 #include "BKE_lib_id.h"
19 #include "BKE_main.h"
20 #include "BKE_screen.h"
21 #include "BKE_workspace.h"
22 
23 #include "BLO_readfile.h"
24 
25 #include "DNA_screen_types.h"
27 #include "DNA_workspace_types.h"
28 
29 #include "ED_datafiles.h"
30 #include "ED_object.h"
31 #include "ED_screen.h"
32 
33 #include "RNA_access.h"
34 #include "RNA_define.h"
35 
36 #include "UI_interface.h"
37 #include "UI_resources.h"
38 
39 #include "BLT_translation.h"
40 
41 #include "WM_api.h"
42 #include "WM_types.h"
43 
44 #include "screen_intern.h"
45 
46 /* -------------------------------------------------------------------- */
52 WorkSpace *ED_workspace_add(Main *bmain, const char *name)
53 {
54  return BKE_workspace_add(bmain, name);
55 }
56 
57 static void workspace_exit(WorkSpace *workspace, wmWindow *win)
58 {
59  /* Scene pinning: Store whatever scene was active when leaving the workspace. It's reactivated
60  * when the workspace gets reactivated as well. */
61  if (workspace->flags & WORKSPACE_USE_PIN_SCENE) {
62  workspace->pin_scene = WM_window_get_active_scene(win);
63  }
64  else {
65  /* The active scene may have been changed. So also always update the unpinned scene to the
66  * latest when leaving a workspace that has no scene pinning. */
68  }
69 }
70 
86 static void workspace_scene_pinning_update(WorkSpace *workspace_new,
87  const WorkSpace *workspace_old,
88  bContext *C)
89 {
90  wmWindow *win = CTX_wm_window(C);
91  Main *bmain = CTX_data_main(C);
92  Scene *active_scene = WM_window_get_active_scene(win);
93 
94  const bool is_new_pinned = (workspace_new->flags & WORKSPACE_USE_PIN_SCENE);
95  const bool is_old_pinned = (workspace_old->flags & WORKSPACE_USE_PIN_SCENE);
96 
97  /* State changes 1 and 2. */
98  if (is_new_pinned) {
99  if (workspace_new->pin_scene && (workspace_new->pin_scene != active_scene)) {
100  WM_window_set_active_scene(bmain, C, win, workspace_new->pin_scene);
101  workspace_new->pin_scene = NULL;
102  }
103  }
104  /* State change 3 - Changing from workspace with pinned scene to unpinned scene. */
105  else if (is_old_pinned) {
106  if (win->unpinned_scene) {
107  WM_window_set_active_scene(bmain, C, win, win->unpinned_scene);
108  }
109  else {
110  /* When leaving a workspace where the pinning was just enabled, the unpinned scene wasn't set
111  * yet. */
112  win->unpinned_scene = active_scene;
113  }
114  }
115  else {
116  /* When leaving a workspace where the pinning was just disabled, we still want to restore the
117  * unpinned scene. */
118  if (win->unpinned_scene) {
119  WM_window_set_active_scene(bmain, C, win, win->unpinned_scene);
120  }
121  }
122 
124 }
125 
130 static void workspace_change_update(WorkSpace *workspace_new,
131  WorkSpace *workspace_old,
132  bContext *C,
133  wmWindowManager *wm)
134 {
135  workspace_scene_pinning_update(workspace_new, workspace_old, C);
136  /* needs to be done before changing mode! (to ensure right context) */
137  UNUSED_VARS(wm);
138 #if 0
139  Object *ob_act = CTX_data_active_object(C) eObjectMode mode_old = workspace_old->object_mode;
140  eObjectMode mode_new = workspace_new->object_mode;
141 
142  if (mode_old != mode_new) {
143  ED_object_mode_set(C, mode_new);
144  }
145 #endif
146 }
147 
149  WorkSpace *workspace_new,
150  wmWindow *win)
151 {
152  WorkSpaceLayout *layout_old = WM_window_get_active_layout(win);
153  WorkSpaceLayout *layout_new;
154 
155  /* ED_workspace_duplicate may have stored a layout to activate
156  * once the workspace gets activated. */
158  layout_new = win->workspace_hook->temp_layout_store;
159  }
160  else {
161  layout_new = BKE_workspace_active_layout_for_workspace_get(win->workspace_hook, workspace_new);
162  if (!layout_new) {
163  layout_new = workspace_new->layouts.first;
164  }
165  }
166 
168  bmain, workspace_new, layout_new, layout_old, win);
169 }
170 
172 {
173  Main *bmain = CTX_data_main(C);
174  WorkSpace *workspace_old = WM_window_get_active_workspace(win);
175  WorkSpaceLayout *layout_new = workspace_change_get_new_layout(bmain, workspace_new, win);
176  bScreen *screen_new = BKE_workspace_layout_screen_get(layout_new);
178 
180  if (workspace_old == workspace_new) {
181  /* Could also return true, everything that needs to be done was done (nothing :P),
182  * but nothing changed */
183  return false;
184  }
185 
186  workspace_exit(workspace_old, win);
187 
188  screen_change_prepare(screen_old, screen_new, bmain, C, win);
189 
190  if (screen_new == NULL) {
191  return false;
192  }
193 
194  BKE_workspace_active_layout_set(win->workspace_hook, win->winid, workspace_new, layout_new);
195  BKE_workspace_active_set(win->workspace_hook, workspace_new);
196 
197  /* update screen *after* changing workspace - which also causes the
198  * actual screen change and updates context (including CTX_wm_workspace) */
199  screen_change_update(C, win, screen_new);
200  workspace_change_update(workspace_new, workspace_old, C, wm);
201 
202  BLI_assert(CTX_wm_workspace(C) == workspace_new);
203 
204  /* Automatic mode switching. */
205  if (workspace_new->object_mode != workspace_old->object_mode) {
206  ED_object_mode_set(C, workspace_new->object_mode);
207  }
208 
209  return true;
210 }
211 
213 {
215  WorkSpace *workspace_new = ED_workspace_add(bmain, workspace_old->id.name + 2);
216 
217  workspace_new->flags = workspace_old->flags;
218  workspace_new->pin_scene = workspace_old->pin_scene;
219  workspace_new->object_mode = workspace_old->object_mode;
220  workspace_new->order = workspace_old->order;
221  BLI_duplicatelist(&workspace_new->owner_ids, &workspace_old->owner_ids);
222 
223  /* TODO(campbell): tools */
224 
225  LISTBASE_FOREACH (WorkSpaceLayout *, layout_old, &workspace_old->layouts) {
227  bmain, workspace_new, layout_old, win);
228 
229  if (layout_active_old == layout_old) {
230  win->workspace_hook->temp_layout_store = layout_new;
231  }
232  }
233  return workspace_new;
234 }
235 
237 {
238  if (BLI_listbase_is_single(&bmain->workspaces)) {
239  return false;
240  }
241 
242  ListBase ordered;
243  BKE_id_ordered_list(&ordered, &bmain->workspaces);
244  WorkSpace *prev = NULL, *next = NULL;
245  LISTBASE_FOREACH (LinkData *, link, &ordered) {
246  if (link->data == workspace) {
247  prev = link->prev ? link->prev->data : NULL;
248  next = link->next ? link->next->data : NULL;
249  break;
250  }
251  }
252  BLI_freelistN(&ordered);
253  BLI_assert((prev != NULL) || (next != NULL));
254 
255  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
256  WorkSpace *workspace_active = WM_window_get_active_workspace(win);
257  if (workspace_active == workspace) {
258  ED_workspace_change((prev != NULL) ? prev : next, C, wm, win);
259  }
260  }
261 
262  BKE_id_free(bmain, &workspace->id);
263  return true;
264 }
265 
267 {
270 }
271 
274 /* -------------------------------------------------------------------- */
279 {
281  if (id && GS(id->name) == ID_WS) {
282  return (WorkSpace *)id;
283  }
284 
285  return CTX_wm_workspace(C);
286 }
287 
289 {
290  return workspace_context_get(C) != NULL;
291 }
292 
294 {
295  Main *bmain = CTX_data_main(C);
296  wmWindow *win = CTX_wm_window(C);
297  WorkSpace *workspace = workspace_context_get(C);
298 
299  workspace = ED_workspace_duplicate(workspace, bmain, win);
300 
302 
303  return OPERATOR_FINISHED;
304 }
305 
307 {
308  /* identifiers */
309  ot->name = "New Workspace";
310  ot->description = "Add a new workspace";
311  ot->idname = "WORKSPACE_OT_duplicate";
312 
313  /* api callbacks */
316 }
317 
319 {
320  WorkSpace *workspace = workspace_context_get(C);
323 
324  return OPERATOR_FINISHED;
325 }
326 
328 {
329  /* identifiers */
330  ot->name = "Delete Workspace";
331  ot->description = "Delete the active workspace";
332  ot->idname = "WORKSPACE_OT_delete";
333 
334  /* api callbacks */
337 }
338 
340 {
341  Main *bmain = CTX_data_main(C);
342  char idname[MAX_ID_NAME - 2], filepath[FILE_MAX];
343 
344  if (!RNA_struct_property_is_set(op->ptr, "idname") ||
345  !RNA_struct_property_is_set(op->ptr, "filepath")) {
346  return OPERATOR_CANCELLED;
347  }
348  RNA_string_get(op->ptr, "idname", idname);
349  RNA_string_get(op->ptr, "filepath", filepath);
350 
351  WorkSpace *appended_workspace = (WorkSpace *)WM_file_append_datablock(
352  bmain,
353  CTX_data_scene(C),
355  CTX_wm_view3d(C),
356  filepath,
357  ID_WS,
358  idname,
360 
361  if (appended_workspace) {
362  /* Set defaults. */
363  BLO_update_defaults_workspace(appended_workspace, NULL);
364 
365  /* Reorder to last position. */
366  BKE_id_reorder(&bmain->workspaces, &appended_workspace->id, NULL, true);
367 
368  /* Changing workspace changes context. Do delayed! */
369  WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
370 
371  return OPERATOR_FINISHED;
372  }
373 
374  return OPERATOR_CANCELLED;
375 }
376 
378 {
379  /* identifiers */
380  ot->name = "Append and Activate Workspace";
381  ot->description = "Append a workspace and make it the active one in the current window";
382  ot->idname = "WORKSPACE_OT_append_activate";
383 
384  /* api callbacks */
386 
388  "idname",
389  NULL,
390  MAX_ID_NAME - 2,
391  "Identifier",
392  "Name of the workspace to append and activate");
393  RNA_def_string(ot->srna, "filepath", NULL, FILE_MAX, "Filepath", "Path to the library");
394 }
395 
397 {
399  char startup_file_path[FILE_MAX] = {0};
400 
401  if (cfgdir) {
402  BLI_join_dirfile(startup_file_path, sizeof(startup_file_path), cfgdir, BLENDER_STARTUP_FILE);
403  }
404 
405  bool has_path = BLI_exists(startup_file_path);
406  return (has_path) ? BKE_blendfile_workspace_config_read(startup_file_path, NULL, 0, NULL) : NULL;
407 }
408 
410 {
411  if (app_template == NULL) {
414  }
415 
416  char template_dir[FILE_MAX];
417  if (!BKE_appdir_app_template_id_search(app_template, template_dir, sizeof(template_dir))) {
418  return NULL;
419  }
420 
421  char startup_file_path[FILE_MAX];
423  startup_file_path, sizeof(startup_file_path), template_dir, BLENDER_STARTUP_FILE);
424 
425  bool has_path = BLI_exists(startup_file_path);
426  return (has_path) ? BKE_blendfile_workspace_config_read(startup_file_path, NULL, 0, NULL) : NULL;
427 }
428 
429 static void workspace_append_button(uiLayout *layout,
430  wmOperatorType *ot_append,
431  const WorkSpace *workspace,
432  const Main *from_main)
433 {
434  const ID *id = (ID *)workspace;
435  const char *filepath = from_main->filepath;
436 
437  if (strlen(filepath) == 0) {
438  filepath = BLO_EMBEDDED_STARTUP_BLEND;
439  }
440 
441  BLI_assert(STREQ(ot_append->idname, "WORKSPACE_OT_append_activate"));
442 
443  PointerRNA opptr;
445  layout, ot_append, workspace->id.name + 2, ICON_NONE, NULL, WM_OP_EXEC_DEFAULT, 0, &opptr);
446  RNA_string_set(&opptr, "idname", id->name + 2);
447  RNA_string_set(&opptr, "filepath", filepath);
448 }
449 
450 static void workspace_add_menu(bContext *UNUSED(C), uiLayout *layout, void *template_v)
451 {
452  const char *app_template = template_v;
453  bool has_startup_items = false;
454 
455  wmOperatorType *ot_append = WM_operatortype_find("WORKSPACE_OT_append_activate", true);
458 
460 
461  if (startup_config) {
462  LISTBASE_FOREACH (WorkSpace *, workspace, &startup_config->workspaces) {
463  uiLayout *row = uiLayoutRow(layout, false);
464  workspace_append_button(row, ot_append, workspace, startup_config->main);
465  has_startup_items = true;
466  }
467  }
468 
469  if (builtin_config) {
470  bool has_title = false;
471 
472  LISTBASE_FOREACH (WorkSpace *, workspace, &builtin_config->workspaces) {
473  if (startup_config &&
474  BLI_findstring(&startup_config->workspaces, workspace->id.name, offsetof(ID, name))) {
475  continue;
476  }
477 
478  if (!has_title) {
479  if (has_startup_items) {
480  uiItemS(layout);
481  }
482  has_title = true;
483  }
484 
485  uiLayout *row = uiLayoutRow(layout, false);
486  workspace_append_button(row, ot_append, workspace, builtin_config->main);
487  }
488  }
489 
490  if (startup_config) {
492  }
493  if (builtin_config) {
495  }
496 }
497 
498 static int workspace_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
499 {
500  uiPopupMenu *pup = UI_popup_menu_begin(C, op->type->name, ICON_ADD);
501  uiLayout *layout = UI_popup_menu_layout(pup);
502 
503  uiItemMenuF(layout, IFACE_("General"), ICON_NONE, workspace_add_menu, NULL);
504 
505  ListBase templates;
506  BKE_appdir_app_templates(&templates);
507 
508  LISTBASE_FOREACH (LinkData *, link, &templates) {
509  char *template = link->data;
510  char display_name[FILE_MAX];
511 
512  BLI_path_to_display_name(display_name, sizeof(display_name), template);
513 
514  /* Steals ownership of link data string. */
515  uiItemMenuFN(layout, display_name, ICON_NONE, workspace_add_menu, template);
516  }
517 
518  BLI_freelistN(&templates);
519 
520  uiItemS(layout);
521  uiItemO(layout,
522  CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate Current"),
523  ICON_DUPLICATE,
524  "WORKSPACE_OT_duplicate");
525 
526  UI_popup_menu_end(C, pup);
527 
528  return OPERATOR_INTERFACE;
529 }
530 
532 {
533  /* identifiers */
534  ot->name = "Add Workspace";
535  ot->description =
536  "Add a new workspace by duplicating the current one or appending one "
537  "from the user configuration";
538  ot->idname = "WORKSPACE_OT_add";
539 
540  /* api callbacks */
542 }
543 
545 {
546  Main *bmain = CTX_data_main(C);
547  WorkSpace *workspace = workspace_context_get(C);
548 
549  BKE_id_reorder(&bmain->workspaces, &workspace->id, NULL, true);
551 
552  return OPERATOR_INTERFACE;
553 }
554 
556 {
557  /* identifiers */
558  ot->name = "Workspace Reorder to Back";
559  ot->description = "Reorder workspace to be last in the list";
560  ot->idname = "WORKSPACE_OT_reorder_to_back";
561 
562  /* api callbacks */
565 }
566 
568 {
569  Main *bmain = CTX_data_main(C);
570  WorkSpace *workspace = workspace_context_get(C);
571 
572  BKE_id_reorder(&bmain->workspaces, &workspace->id, NULL, false);
574 
575  return OPERATOR_INTERFACE;
576 }
577 
579 {
580  /* identifiers */
581  ot->name = "Workspace Reorder to Front";
582  ot->description = "Reorder workspace to be first in the list";
583  ot->idname = "WORKSPACE_OT_reorder_to_front";
584 
585  /* api callbacks */
588 }
589 
591 {
592  WorkSpace *workspace = workspace_context_get(C);
593 
594  /* Trivial. The operator is only needed to display a superimposed extra icon, which
595  * requires an operator. */
596  workspace->flags ^= WORKSPACE_USE_PIN_SCENE;
597 
599 
600  return OPERATOR_FINISHED;
601 }
602 
604 {
605  /* identifiers */
606  ot->name = "Pin Scene to Workspace";
607  ot->description =
608  "Remember the last used scene for the current workspace and switch to it whenever this "
609  "workspace is activated again";
610  ot->idname = "WORKSPACE_OT_scene_pin_toggle";
611 
612  /* api callbacks */
615 
617 }
618 
620 {
628 }
629 
const char * BKE_appdir_folder_id(int folder_id, const char *subfolder)
Definition: appdir.c:672
void BKE_appdir_app_templates(struct ListBase *templates)
Definition: appdir.c:1012
#define BLENDER_STARTUP_FILE
Definition: BKE_appdir.h:175
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len)
Definition: appdir.c:980
@ BLENDER_USER_CONFIG
Definition: BKE_appdir.h:157
struct WorkspaceConfigFileData * BKE_blendfile_workspace_config_read(const char *filepath, const void *filebuf, int filelength, struct ReportList *reports)
Definition: blendfile.c:807
void BKE_blendfile_workspace_config_data_free(struct WorkspaceConfigFileData *workspace_config)
Definition: blendfile.c:860
struct WorkSpace * CTX_wm_workspace(const bContext *C)
Definition: context.c:728
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1100
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
void BKE_id_reorder(const struct ListBase *lb, struct ID *id, struct ID *relative, bool after)
void BKE_id_free(struct Main *bmain, void *idv)
void BKE_id_ordered_list(struct ListBase *ordered_lb, const struct ListBase *lb)
void BKE_screen_view3d_scene_sync(struct bScreen *screen, struct Scene *scene)
Definition: screen.c:994
struct WorkSpaceLayout * BKE_workspace_active_layout_for_workspace_get(const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS
struct WorkSpace * BKE_workspace_add(struct Main *bmain, const char *name)
Definition: workspace.c:314
struct bScreen * BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *hook, int winid, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) SETTER_ATTRS
Activate a layout.
Definition: workspace.c:557
void BKE_workspace_active_set(struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace) SETTER_ATTRS
Definition: workspace.c:520
struct WorkSpaceLayout * BKE_workspace_active_layout_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
struct bScreen * BKE_workspace_layout_screen_get(const struct WorkSpaceLayout *layout) GETTER_ATTRS
#define BLI_assert(a)
Definition: BLI_assert.h:46
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: storage.c:314
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
void void BLI_INLINE bool BLI_listbase_is_single(const struct ListBase *lb)
Definition: BLI_listbase.h:265
void * BLI_findstring(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_path_to_display_name(char *display_name, int maxlen, const char *name) ATTR_NONNULL()
Definition: path_util.c:859
#define FILE_MAX
void BLI_join_dirfile(char *__restrict dst, size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
Definition: path_util.c:1531
#define UNUSED_VARS(...)
#define UNUSED(x)
#define STREQ(a, b)
external readfile function prototypes.
void BLO_update_defaults_workspace(struct WorkSpace *workspace, const char *app_template)
@ BLO_LIBLINK_APPEND_RECURSIVE
Definition: BLO_readfile.h:339
#define BLO_EMBEDDED_STARTUP_BLEND
Definition: BLO_readfile.h:297
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define IFACE_(msgid)
#define MAX_ID_NAME
Definition: DNA_ID.h:337
@ ID_WS
Definition: DNA_ID_enums.h:79
eObjectMode
@ OPERATOR_CANCELLED
@ OPERATOR_INTERFACE
@ OPERATOR_FINISHED
@ WORKSPACE_USE_PIN_SCENE
int datatoc_startup_blend_size
const char datatoc_startup_blend[]
bool ED_object_mode_set(struct bContext *C, eObjectMode mode)
Definition: object_modes.c:231
struct WorkSpaceLayout * ED_workspace_screen_change_ensure_unused_layout(struct Main *bmain, struct WorkSpace *workspace, struct WorkSpaceLayout *layout_new, const struct WorkSpaceLayout *layout_fallback_base, struct wmWindow *win) ATTR_NONNULL()
struct WorkSpaceLayout * ED_workspace_layout_duplicate(struct Main *bmain, struct WorkSpace *workspace, const struct WorkSpaceLayout *layout_old, struct wmWindow *win) ATTR_NONNULL()
#define C
Definition: RandGen.cpp:25
uiBlock * uiLayoutGetBlock(uiLayout *layout)
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemS(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemFullO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, struct IDProperty *properties, wmOperatorCallContext context, int flag, struct PointerRNA *r_opptr)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup)
void uiItemMenuF(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *arg)
void UI_block_flag_enable(uiBlock *block, int flag)
Definition: interface.cc:5848
struct ID * UI_context_active_but_get_tab_ID(struct bContext *C)
void uiItemMenuFN(uiLayout *layout, const char *name, int icon, uiMenuCreateFunc func, void *argN)
uiPopupMenu * UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL()
@ UI_BLOCK_IS_FLIP
Definition: UI_interface.h:136
@ OPTYPE_INTERNAL
Definition: WM_types.h:168
#define NC_WINDOW
Definition: WM_types.h:325
#define NC_SCREEN
Definition: WM_types.h:327
#define ND_WORKSPACE_DELETE
Definition: WM_types.h:377
#define NC_WORKSPACE
Definition: WM_types.h:326
@ WM_OP_EXEC_DEFAULT
Definition: WM_types.h:208
#define ND_WORKSPACE_SET
Definition: WM_types.h:376
Scene scene
#define GS(x)
Definition: iris.c:225
static ulong * next
SymEdge< T > * prev(const SymEdge< T > *se)
Definition: delaunay_2d.cc:105
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void screen_change_prepare(bScreen *screen_old, bScreen *screen_new, Main *bmain, bContext *C, wmWindow *win)
Definition: screen_edit.c:1089
void screen_change_update(bContext *C, wmWindow *win, bScreen *screen)
Definition: screen_edit.c:1117
Definition: DNA_ID.h:368
char name[66]
Definition: DNA_ID.h:378
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
char filepath[1024]
Definition: BKE_main.h:124
ListBase workspaces
Definition: BKE_main.h:203
struct WorkSpaceLayout * temp_layout_store
Wrapper for bScreen.
ListBase owner_ids
struct Scene * pin_scene
struct ListBase workspaces
Definition: BLO_readfile.h:40
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct wmOperatorType * type
struct PointerRNA * ptr
struct Scene * unpinned_scene
struct WorkSpaceInstanceHook * workspace_hook
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
char app_template[64]
Definition: wm_files.c:1021
wmOperatorType * ot
Definition: wm_files.c:3479
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void WM_window_set_active_scene(Main *bmain, bContext *C, wmWindow *win, Scene *scene)
Definition: wm_window.c:2188
WorkSpaceLayout * WM_window_get_active_layout(const wmWindow *win)
Definition: wm_window.c:2290
WorkSpace * WM_window_get_active_workspace(const wmWindow *win)
Definition: wm_window.c:2266
Scene * WM_window_get_active_scene(const wmWindow *win)
Definition: wm_window.c:2183
static void workspace_append_button(uiLayout *layout, wmOperatorType *ot_append, const WorkSpace *workspace, const Main *from_main)
static int workspace_new_exec(bContext *C, wmOperator *UNUSED(op))
static WorkSpace * workspace_context_get(bContext *C)
static void WORKSPACE_OT_add(wmOperatorType *ot)
static void WORKSPACE_OT_scene_pin_toggle(wmOperatorType *ot)
static void workspace_scene_pinning_update(WorkSpace *workspace_new, const WorkSpace *workspace_old, bContext *C)
void ED_operatortypes_workspace(void)
static void workspace_change_update(WorkSpace *workspace_new, WorkSpace *workspace_old, bContext *C, wmWindowManager *wm)
static WorkspaceConfigFileData * workspace_system_file_read(const char *app_template)
static WorkSpaceLayout * workspace_change_get_new_layout(Main *bmain, WorkSpace *workspace_new, wmWindow *win)
static WorkspaceConfigFileData * workspace_config_file_read(const char *app_template)
static int workspace_scene_pin_toggle(bContext *C, wmOperator *UNUSED(op))
WorkSpace * ED_workspace_duplicate(WorkSpace *workspace_old, Main *bmain, wmWindow *win)
static int workspace_append_activate_exec(bContext *C, wmOperator *op)
static void workspace_exit(WorkSpace *workspace, wmWindow *win)
static int workspace_reorder_to_front_exec(bContext *C, wmOperator *UNUSED(op))
static void WORKSPACE_OT_delete(wmOperatorType *ot)
static void WORKSPACE_OT_append_activate(wmOperatorType *ot)
static void WORKSPACE_OT_reorder_to_back(wmOperatorType *ot)
bool ED_workspace_change(WorkSpace *workspace_new, bContext *C, wmWindowManager *wm, wmWindow *win)
Change the active workspace.
static int workspace_add_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void WORKSPACE_OT_duplicate(wmOperatorType *ot)
void ED_workspace_scene_data_sync(WorkSpaceInstanceHook *hook, Scene *scene)
static int workspace_delete_exec(bContext *C, wmOperator *UNUSED(op))
WorkSpace * ED_workspace_add(Main *bmain, const char *name)
bool ED_workspace_delete(WorkSpace *workspace, Main *bmain, bContext *C, wmWindowManager *wm)
static void WORKSPACE_OT_reorder_to_front(wmOperatorType *ot)
static bool workspace_context_poll(bContext *C)
static int workspace_reorder_to_back_exec(bContext *C, wmOperator *UNUSED(op))
static void workspace_add_menu(bContext *UNUSED(C), uiLayout *layout, void *template_v)