Blender V5.3
workspace_edit.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
8
9#include <cstdlib>
10#include <cstring>
11
12#include <fmt/format.h>
13
14#include "BLI_fileops.hh"
15#include "BLI_listbase.hh"
16#include "BLI_path_utils.hh"
17#include "BLI_string.hh"
18#include "BLI_string_utf8.hh"
19#include "BLI_utildefines.hh"
20
21#include "BKE_appdir.hh"
22#include "BKE_blendfile.hh"
23#include "BKE_context.hh"
24#include "BKE_layer.hh"
25#include "BKE_lib_id.hh"
26#include "BKE_main.hh"
27#include "BKE_screen.hh"
28#include "BKE_workspace.hh"
29
30#include "BLO_readfile.hh"
31
32#include "DNA_screen_types.h"
34#include "DNA_workspace_types.h"
35
36#include "ED_datafiles.h"
37#include "ED_object.hh"
38#include "ED_screen.hh"
39
40#include "RNA_access.hh"
41#include "RNA_define.hh"
42
43#include "UI_interface.hh"
45#include "UI_resources.hh"
46
47#include "BLT_translation.hh"
48
49#include "WM_api.hh"
50#include "WM_types.hh"
51
52#include "screen_intern.hh"
53
54namespace blender {
55
56/* -------------------------------------------------------------------- */
61
62WorkSpace *ED_workspace_add(Main *bmain, const char *name)
63{
64 return BKE_workspace_add(bmain, name);
65}
66
67static void workspace_exit(WorkSpace *workspace, wmWindow *win)
68{
69 /* Scene pinning: Store whatever scene was active when leaving the workspace. It's reactivated
70 * when the workspace gets reactivated as well. */
71 if (workspace->flags & WORKSPACE_USE_PIN_SCENE) {
72 workspace->pin_scene = WM_window_get_active_scene(win);
73 }
74 else {
75 /* The active scene may have been changed. So also always update the unpinned scene to the
76 * latest when leaving a workspace that has no scene pinning. */
78 }
79}
80
96static void workspace_scene_pinning_update(WorkSpace *workspace_new,
97 const WorkSpace *workspace_old,
98 bContext *C)
99{
100 wmWindow *win = CTX_wm_window(C);
101 Main *bmain = CTX_data_main(C);
102 Scene *active_scene = WM_window_get_active_scene(win);
103
104 const bool is_new_pinned = (workspace_new->flags & WORKSPACE_USE_PIN_SCENE);
105 const bool is_old_pinned = (workspace_old->flags & WORKSPACE_USE_PIN_SCENE);
106
107 /* State changes 1 and 2. */
108 if (is_new_pinned) {
109 if (workspace_new->pin_scene && (workspace_new->pin_scene != active_scene)) {
110 WM_window_set_active_scene(bmain, C, win, workspace_new->pin_scene);
111 workspace_new->pin_scene = nullptr;
112 }
113 }
114 /* State change 3 - Changing from workspace with pinned scene to unpinned scene. */
115 else if (is_old_pinned) {
116 if (win->unpinned_scene) {
118 }
119 else {
120 /* When leaving a workspace where the pinning was just enabled, the unpinned scene wasn't set
121 * yet. */
122 win->unpinned_scene = active_scene;
123 }
124 }
125 else {
126 /* When leaving a workspace where the pinning was just disabled, we still want to restore the
127 * unpinned scene. */
128 if (win->unpinned_scene) {
130 }
131 }
132
134}
135
140static void workspace_change_update(WorkSpace *workspace_new,
141 WorkSpace *workspace_old,
142 bContext *C,
144{
145 workspace_scene_pinning_update(workspace_new, workspace_old, C);
146 /* needs to be done before changing mode! (to ensure right context) */
148#if 0
150 eObjectMode mode_old = workspace_old->object_mode;
151 eObjectMode mode_new = workspace_new->object_mode;
152
153 if (mode_old != mode_new) {
154 ed::object::mode_set(C, mode_new);
155 }
156#endif
157}
158
160 WorkSpace *workspace_new,
161 wmWindow *win)
162{
164 WorkSpaceLayout *layout_new;
165
166 /* ED_workspace_duplicate may have stored a layout to activate
167 * once the workspace gets activated. */
169 layout_new = win->workspace_hook->temp_layout_store;
170 }
171 else {
172 layout_new = BKE_workspace_active_layout_for_workspace_get(win->workspace_hook, workspace_new);
173 if (!layout_new) {
174 layout_new = workspace_new->layouts.first();
175 }
176 }
177
179 bmain, workspace_new, layout_new, layout_old, win);
180}
181
183{
184 Main *bmain = CTX_data_main(C);
185 WorkSpace *workspace_old = WM_window_get_active_workspace(win);
186 WorkSpaceLayout *layout_new = workspace_change_get_new_layout(bmain, workspace_new, win);
187 bScreen *screen_new = BKE_workspace_layout_screen_get(layout_new);
189
190 win->workspace_hook->temp_layout_store = nullptr;
191 if (workspace_old == workspace_new) {
192 /* Could also return true, everything that needs to be done was done (nothing :P),
193 * but nothing changed */
194 return false;
195 }
196
197 workspace_exit(workspace_old, win);
198
199 screen_change_prepare(screen_old, screen_new, bmain, C, win);
200
201 if (screen_new == nullptr) {
202 return false;
203 }
204
205 BKE_workspace_active_layout_set(win->workspace_hook, win->winid, workspace_new, layout_new);
206 BKE_workspace_active_set(win->workspace_hook, workspace_new);
207
208 /* update screen *after* changing workspace - which also causes the
209 * actual screen change and updates context (including CTX_wm_workspace) */
210 screen_change_update(C, win, screen_new);
211 workspace_change_update(workspace_new, workspace_old, C, wm);
212
213 BLI_assert(CTX_wm_workspace(C) == workspace_new);
214
215 /* Automatic mode switching. */
216 if (workspace_new->object_mode != workspace_old->object_mode) {
217 const Object *object = nullptr;
218 if (const Base *base = CTX_data_active_base(C)) {
219 object = base->object;
220 /* Behavior that depends on the active area is not expected in the context of workspace
221 * switching, ignore the view-port even if it's available. */
222 const View3D *v3d = nullptr;
223
224 const bool base_visible = BKE_base_is_visible(v3d, base);
225 if (!base_visible && object->mode == OB_MODE_OBJECT) {
226 /* Set this to nullptr to indicate that the mode should not be switched. This matches
227 * CTX_data_active_object behavior in the 3D Viewport. See `view3d_context` for more
228 * details. */
229 object = nullptr;
230 }
231 }
232
233 if (object) {
235 }
236 }
237
238 return true;
239}
240
242{
244 WorkSpace *workspace_new = id_cast<WorkSpace *>(BKE_id_copy(bmain, &workspace_old->id));
245
246 /* Try to keep active the layout from the new workspace matching the current active one from
247 * the old workspace. */
248 WorkSpaceLayout *layout_old = workspace_old->layouts.first();
249 WorkSpaceLayout *layout_new = workspace_new->layouts.first();
250 for (; layout_old && layout_new; layout_old = layout_old->next, layout_new = layout_new->next) {
251 if (layout_old == layout_active_old) {
252 win->workspace_hook->temp_layout_store = layout_new;
253 }
254 }
255 return workspace_new;
256}
257
259{
260 if (bmain->workspaces.is_single()) {
261 return false;
262 }
263
265 reinterpret_cast<const ListBaseT<ID> *>(&bmain->workspaces));
266 const int index = ordered.first_index_of(&workspace->id);
267
268 WorkSpace *new_active = reinterpret_cast<WorkSpace *>(index == 0 ? ordered[1] :
269 ordered[index - 1]);
270
271 for (wmWindow &win : wm->windows) {
272 WorkSpace *workspace_active = WM_window_get_active_workspace(&win);
273 if (workspace_active == workspace) {
274 ED_workspace_change(new_active, C, wm, &win);
275 }
276 }
277
278 /* Also delete managed screens if they have no other users. */
279 for (WorkSpaceLayout &layout : workspace->layouts) {
280 BKE_id_free_us(bmain, layout.screen);
281 layout.screen = nullptr;
282 }
283
284 BKE_id_free(bmain, &workspace->id);
285 return true;
286}
287
293
295
296/* -------------------------------------------------------------------- */
299
301{
303 if (id && GS(id->name) == ID_WS) {
304 return id_cast<WorkSpace *>(id);
305 }
306
307 return CTX_wm_workspace(C);
308}
309
311{
312 return workspace_context_get(C) != nullptr;
313}
314
316{
317 Main *bmain = CTX_data_main(C);
318 wmWindow *win = CTX_wm_window(C);
319 WorkSpace *workspace = workspace_context_get(C);
320
321 workspace = ED_workspace_duplicate(workspace, bmain, win);
322
324
325 return OPERATOR_FINISHED;
326}
327
329{
330 /* identifiers */
331 ot->name = "New Workspace";
332 ot->description = "Add a new workspace";
333 ot->idname = "WORKSPACE_OT_duplicate";
334
335 /* API callbacks. */
338}
339
348
350{
351 /* identifiers */
352 ot->name = "Delete Workspace";
353 ot->description = "Delete the active workspace";
354 ot->idname = "WORKSPACE_OT_delete";
355
356 /* API callbacks. */
359}
360
362{
363 Main *bmain = CTX_data_main(C);
364 WorkSpace *workspace = workspace_context_get(C);
365
366 for (WorkSpace &ws : bmain->workspaces) {
367 if (&ws != workspace) {
370 }
371 }
372
373 return OPERATOR_FINISHED;
374}
375
377{
378 /* identifiers */
379 ot->name = "Delete Other Workspaces";
380 ot->description = "Delete all workspaces except this one";
381 ot->idname = "WORKSPACE_OT_delete_all_others";
382
383 /* api callbacks */
386}
387
389{
390 Main *bmain = CTX_data_main(C);
391 char idname[MAX_ID_NAME - 2], filepath[FILE_MAX];
392
393 if (!RNA_struct_property_is_set(op->ptr, "idname") ||
394 !RNA_struct_property_is_set(op->ptr, "filepath"))
395 {
396 return OPERATOR_CANCELLED;
397 }
398 RNA_string_get(op->ptr, "idname", idname);
399 RNA_string_get(op->ptr, "filepath", filepath);
400 /* Not expected, but a blank filename causes an assert
401 * (trips up the "importing from self" assert as both paths are blank). */
402 if (idname[0] == '\0' || filepath[0] == '\0') {
403 return OPERATOR_CANCELLED;
404 }
405
406 WorkSpace *appended_workspace = nullptr;
407 /* NOTE: Need to check `filepath`, in the rare case where the usual source of work-spaces
408 * (the startup blend-file) is the one currently open (see #144305). */
409 const char *blendfile_path = BKE_main_blendfile_path(bmain);
410 if ((blendfile_path[0] != '\0') && (BLI_path_cmp(blendfile_path, filepath) == 0)) {
411 appended_workspace = reinterpret_cast<WorkSpace *>(
412 BKE_libblock_find_name(bmain, ID_WS, idname, nullptr));
413 if (appended_workspace) {
414 /* Copy, to mimic behavior when appending from another file (which always creates a new copy
415 * of the data). */
416 appended_workspace = ED_workspace_duplicate(appended_workspace, bmain, CTX_wm_window(C));
417 }
418 }
419 else {
420 appended_workspace = reinterpret_cast<WorkSpace *>(
425 filepath,
426 ID_WS,
427 idname,
429 }
430
431 if (appended_workspace) {
432 /* Translate workspace name, unless it was taken from current blendfile. */
435 *bmain, appended_workspace->id, CTX_DATA_(BLT_I18NCONTEXT_ID_WORKSPACE, idname));
436 }
437
438 /* Set defaults. */
439 BLO_update_defaults_workspace(appended_workspace, nullptr);
440
441 /* Reorder to last position. */
442 BKE_id_reorder(reinterpret_cast<const ListBaseT<ID> *>(&bmain->workspaces),
443 &appended_workspace->id,
444 nullptr,
445 true);
446
447 /* Changing workspace changes context. Do delayed! */
448 WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, appended_workspace);
449
450 return OPERATOR_FINISHED;
451 }
452
453 return OPERATOR_CANCELLED;
454}
455
457{
458 /* identifiers */
459 ot->name = "Append and Activate Workspace";
460 ot->description = "Append a workspace and make it the active one in the current window";
461 ot->idname = "WORKSPACE_OT_append_activate";
462
463 /* API callbacks. */
465
466 PropertyRNA *prop;
468 "idname",
469 nullptr,
470 MAX_ID_NAME - 2,
471 "Identifier",
472 "Name of the workspace to append and activate");
473 prop = RNA_def_string(
474 ot->srna, "filepath", nullptr, FILE_MAX, "Filepath", "Path to the library");
477}
478
480{
481 const std::optional<std::string> cfgdir = BKE_appdir_folder_id(BLENDER_USER_CONFIG,
482 app_template);
483 char startup_file_path[FILE_MAX] = {0};
484
485 if (cfgdir.has_value()) {
487 startup_file_path, sizeof(startup_file_path), cfgdir->c_str(), BLENDER_STARTUP_FILE);
488 }
489
490 bool has_path = BLI_exists(startup_file_path);
491 return (has_path) ? BKE_blendfile_workspace_config_read(startup_file_path, nullptr, 0, nullptr) :
492 nullptr;
493}
494
496{
497 if (app_template == nullptr) {
500 }
501
502 char template_dir[FILE_MAX];
503 if (!BKE_appdir_app_template_id_search(app_template, template_dir, sizeof(template_dir))) {
504 return nullptr;
505 }
506
507 char startup_file_path[FILE_MAX];
508 BLI_path_join(startup_file_path, sizeof(startup_file_path), template_dir, BLENDER_STARTUP_FILE);
509
510 bool has_path = BLI_exists(startup_file_path);
511 return (has_path) ? BKE_blendfile_workspace_config_read(startup_file_path, nullptr, 0, nullptr) :
512 nullptr;
513}
514
516 wmOperatorType *ot_append,
517 const WorkSpace *workspace,
518 const Main *from_main)
519{
520 const ID *id = id_cast<ID *>(const_cast<WorkSpace *>(workspace));
521 const char *filepath = from_main->filepath;
522
523 if (filepath[0] == '\0') {
525 }
526
527 BLI_assert(STREQ(ot_append->idname, "WORKSPACE_OT_append_activate"));
528
529 PointerRNA opptr;
530 opptr = layout.op(ot_append,
532 ICON_NONE,
535 RNA_string_set(&opptr, "idname", id->name + 2);
536 RNA_string_set(&opptr, "filepath", filepath);
537}
538
539static void workspace_add_menu(bContext * /*C*/, ui::Layout *layout, void *template_v)
540{
541 const char *app_template = static_cast<const char *>(template_v);
542 bool has_startup_items = false;
543
544 wmOperatorType *ot_append = WM_operatortype_find("WORKSPACE_OT_append_activate", true);
545 WorkspaceConfigFileData *startup_config = workspace_config_file_read(app_template);
546 WorkspaceConfigFileData *builtin_config = workspace_system_file_read(app_template);
547
548 if (startup_config) {
549 for (WorkSpace &workspace : startup_config->workspaces) {
550 ui::Layout &row = layout->row(false);
551 workspace_append_button(row, ot_append, &workspace, startup_config->main);
552 has_startup_items = true;
553 }
554 }
555
556 if (builtin_config) {
557 bool has_title = false;
558
559 for (WorkSpace &workspace : builtin_config->workspaces) {
560 if (startup_config &&
561 BLI_findstring(&startup_config->workspaces, workspace.id.name, offsetof(ID, name)))
562 {
563 continue;
564 }
565
566 if (!has_title) {
567 if (has_startup_items) {
568 layout->separator();
569 }
570 has_title = true;
571 }
572
573 ui::Layout &row = layout->row(false);
574 workspace_append_button(row, ot_append, &workspace, builtin_config->main);
575 }
576 }
577
578 if (startup_config) {
580 }
581 if (builtin_config) {
583 }
584}
585
587{
588 {
589 PointerRNA props = layout.op("WM_OT_search_single_menu",
590 "Search...",
591 ICON_VIEWZOOM,
594 RNA_string_set(&props, "menu_idname", "WORKSPACE_MT_add");
595 }
596 layout.separator();
597
598 layout.menu_fn(IFACE_("General"), ICON_NONE, workspace_add_menu, nullptr);
599
600 ListBaseT<LinkData> templates;
601 BKE_appdir_app_templates(&templates);
602
603 for (LinkData &link : templates) {
604 char *app_template = static_cast<char *>(link.data);
605 char display_name[FILE_MAX];
606
607 BLI_path_to_display_name(display_name, sizeof(display_name), IFACE_(app_template));
608
609 /* Steals ownership of link data string. */
610 layout.menu_fn_argN_free(display_name, ICON_NONE, workspace_add_menu, app_template);
611 }
612
613 templates.free_no_destruct();
614
615 layout.separator();
616 layout.op("WORKSPACE_OT_duplicate",
617 CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate Current"),
618 ICON_DUPLICATE);
619}
620
622{
623 MenuType *mt = MEM_new_zeroed<MenuType>("workspace_add_invoke");
624 STRNCPY_UTF8(mt->idname, "WORKSPACE_MT_add");
625 STRNCPY_UTF8(mt->label, N_("Add Workspace"));
627 mt->draw = [](const bContext * /*C*/, Menu *menu) {
628 ui::Layout &layout = *menu->layout;
630 };
631
632 WM_menutype_add(mt);
633}
634
636 wmOperator * /*op*/,
637 const wmEvent * /*event*/)
638{
640 return OPERATOR_INTERFACE;
641}
642
644{
645 /* identifiers */
646 ot->name = "Add Workspace";
647 ot->description =
648 "Add a new workspace by duplicating the current one or appending one "
649 "from the user configuration";
650 ot->idname = "WORKSPACE_OT_add";
651
652 /* API callbacks. */
654}
655
657{
658 Main *bmain = CTX_data_main(C);
659 WorkSpace *workspace = workspace_context_get(C);
660
662 reinterpret_cast<const ListBaseT<ID> *>(&bmain->workspaces), &workspace->id, nullptr, true);
664
665 return OPERATOR_INTERFACE;
666}
667
669{
670 /* identifiers */
671 ot->name = "Workspace Reorder to Back";
672 ot->description = "Reorder workspace to be last in the list";
673 ot->idname = "WORKSPACE_OT_reorder_to_back";
674
675 /* API callbacks. */
678}
679
681{
682 Main *bmain = CTX_data_main(C);
683 WorkSpace *workspace = workspace_context_get(C);
684
686 reinterpret_cast<const ListBaseT<ID> *>(&bmain->workspaces), &workspace->id, nullptr, false);
688
689 return OPERATOR_INTERFACE;
690}
691
693{
694 /* identifiers */
695 ot->name = "Workspace Reorder to Front";
696 ot->description = "Reorder workspace to be first in the list";
697 ot->idname = "WORKSPACE_OT_reorder_to_front";
698
699 /* API callbacks. */
702}
703
705{
706 WorkSpace *workspace = workspace_context_get(C);
707
708 /* Trivial. The operator is only needed to display a superimposed extra icon, which
709 * requires an operator. */
710 workspace->flags ^= WORKSPACE_USE_PIN_SCENE;
711
713
714 return OPERATOR_FINISHED;
715}
716
718{
719 /* identifiers */
720 ot->name = "Pin Scene to Workspace";
721 ot->description =
722 "Remember the last used scene for the current workspace and switch to it whenever this "
723 "workspace is activated again";
724 ot->idname = "WORKSPACE_OT_scene_pin_toggle";
725
726 /* API callbacks. */
729
730 ot->flag = OPTYPE_INTERNAL;
731}
732
746
748
749} // namespace blender
#define BLENDER_STARTUP_FILE
File and directory operations.
#define FILE_MAX
#define BLI_path_join(...)
#define BLI_path_cmp
#define STRNCPY_UTF8(dst, src)
external readfile function prototypes.
#define BLO_EMBEDDED_STARTUP_BLEND
#define BLT_I18NCONTEXT_ID_WORKSPACE
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define CTX_DATA_(context, msgid)
#define IFACE_(msgid)
#define MAX_ID_NAME
Definition DNA_ID.h:367
int datatoc_startup_blend_size
const char datatoc_startup_blend[]
#define C
Definition RandGen.cpp:29
#define UI_ITEM_NONE
#define NC_WINDOW
Definition WM_types.hh:388
#define NC_SCREEN
Definition WM_types.hh:390
#define ND_WORKSPACE_DELETE
Definition WM_types.hh:446
#define NC_WORKSPACE
Definition WM_types.hh:389
#define ND_WORKSPACE_SET
Definition WM_types.hh:445
#define UNUSED_VARS(...)
#define STREQ(a, b)
int64_t first_index_of(const T &value) const
#define offsetof(t, d)
bool mode_set(bContext *C, eObjectMode mode)
ID * context_active_but_get_tab_ID(bContext *C)
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BKE_appdir_app_templates(ListBaseT< LinkData > *templates) ATTR_NONNULL(1)
Definition appdir.cc:1161
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void WM_window_set_active_scene(Main *bmain, bContext *C, wmWindow *win, Scene *scene)
static wmOperatorStatus workspace_delete_all_others_exec(bContext *C, wmOperator *)
void BKE_workspace_active_set(WorkSpaceInstanceHook *hook, WorkSpace *workspace) SETTER_ATTRS
Definition workspace.cc:637
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
ID * BKE_libblock_find_name(Main *bmain, short type, const char *name, const std::optional< Library * > lib=std::nullopt) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition lib_id.cc:1808
void BKE_blendfile_workspace_config_data_free(WorkspaceConfigFileData *workspace_config)
static void workspace_add_menu_draw(ui::Layout &layout)
static wmOperatorStatus workspace_append_activate_exec(bContext *C, wmOperator *op)
void BKE_id_free_us(Main *bmain, void *idv) ATTR_NONNULL()
static void WORKSPACE_OT_reorder_to_front(wmOperatorType *ot)
WorkSpace * CTX_wm_workspace(const bContext *C)
bool BKE_base_is_visible(const View3D *v3d, const Base *base)
static void WORKSPACE_OT_delete(wmOperatorType *ot)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition storage.cc:404
WorkSpaceLayout * WM_window_get_active_layout(const wmWindow *win)
static wmOperatorStatus workspace_reorder_to_back_exec(bContext *C, wmOperator *)
static void WORKSPACE_OT_delete_all_others(wmOperatorType *ot)
void BLO_update_defaults_workspace(WorkSpace *workspace, const char *app_template)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:615
void screen_change_prepare(bScreen *screen_old, bScreen *screen_new, Main *bmain, bContext *C, wmWindow *win)
wmWindow * CTX_wm_window(const bContext *C)
WorkspaceConfigFileData * BKE_blendfile_workspace_config_read(const char *filepath, const void *file_buf, int file_buf_size, ReportList *reports)
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition workspace.cc:684
@ BLO_LIBLINK_APPEND_RECURSIVE
static void WORKSPACE_OT_duplicate(wmOperatorType *ot)
Base * CTX_data_active_base(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void ED_operatortypes_workspace()
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
Definition main.cc:1058
static wmOperatorStatus workspace_new_exec(bContext *C, wmOperator *)
WorkSpaceLayout * BKE_workspace_active_layout_for_workspace_get(const WorkSpaceInstanceHook *hook, const WorkSpace *workspace) GETTER_ATTRS
Definition workspace.cc:662
std::optional< std::string > BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
Definition appdir.cc:762
static void workspace_add_menu(bContext *, ui::Layout *layout, void *template_v)
Scene * WM_window_get_active_scene(const wmWindow *win)
bool ED_workspace_delete(WorkSpace *workspace, Main *bmain, bContext *C, wmWindowManager *wm) ATTR_NONNULL()
bool BLT_translate_new_dataname()
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static void WORKSPACE_OT_add(wmOperatorType *ot)
static WorkspaceConfigFileData * workspace_config_file_read(const char *app_template)
WorkSpace * BKE_workspace_add(Main *bmain, const char *name)
Definition workspace.cc:369
static wmOperatorStatus workspace_reorder_to_front_exec(bContext *C, wmOperator *)
void BKE_workspace_active_layout_set(WorkSpaceInstanceHook *hook, int winid, WorkSpace *workspace, WorkSpaceLayout *layout) SETTER_ATTRS
Activate a layout.
Definition workspace.cc:675
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_maxncpy) ATTR_NONNULL(1)
Definition appdir.cc:1127
WorkSpaceLayout * ED_workspace_screen_change_ensure_unused_layout(Main *bmain, WorkSpace *workspace, WorkSpaceLayout *layout_new, const WorkSpaceLayout *layout_fallback_base, wmWindow *win) ATTR_NONNULL()
void WM_menu_name_call(bContext *C, const char *menu_name, wm::OpCallContext context)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
static bool workspace_context_poll(bContext *C)
static WorkSpaceLayout * workspace_change_get_new_layout(Main *bmain, WorkSpace *workspace_new, wmWindow *win)
static void WORKSPACE_OT_scene_pin_toggle(wmOperatorType *ot)
WorkSpace * WM_window_get_active_workspace(const wmWindow *win)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool ED_workspace_change(WorkSpace *workspace_new, bContext *C, wmWindowManager *wm, wmWindow *win) ATTR_NONNULL()
Change the active workspace.
Vector< ID * > BKE_id_ordered_list(const ListBaseT< ID > *lb)
Definition lib_id.cc:2835
static void workspace_scene_pinning_update(WorkSpace *workspace_new, const WorkSpace *workspace_old, bContext *C)
void BKE_id_free(Main *bmain, void *idv)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
static wmOperatorStatus workspace_scene_pin_toggle_exec(bContext *C, wmOperator *)
void BLI_path_to_display_name(char *display_name, int display_name_maxncpy, const char *name) ATTR_NONNULL(1
WorkSpace * ED_workspace_duplicate(WorkSpace *workspace_old, Main *bmain, wmWindow *win)
ID * WM_file_append_datablock(Main *bmain, Scene *scene, ViewLayer *view_layer, View3D *v3d, const char *filepath, const short id_code, const char *id_name, int flag, ReportList *reports)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
IDNewNameResult BKE_libblock_rename(Main &bmain, ID &id, StringRefNull name, const IDNewNameMode mode=IDNewNameMode::RenameExistingNever)
Definition lib_id.cc:2632
void BKE_id_reorder(const ListBaseT< ID > *lb, ID *id, ID *relative, bool after)
Definition lib_id.cc:2854
static void WORKSPACE_OT_append_activate(wmOperatorType *ot)
void BKE_screen_view3d_scene_sync(bScreen *screen, Scene *scene)
Definition screen.cc:1249
WorkSpace * ED_workspace_add(Main *bmain, const char *name) ATTR_NONNULL()
Main * CTX_data_main(const bContext *C)
static void workspace_change_update(WorkSpace *workspace_new, WorkSpace *workspace_old, bContext *C, wmWindowManager *wm)
bool WM_menutype_add(MenuType *mt)
bScreen * BKE_workspace_layout_screen_get(const WorkSpaceLayout *layout) GETTER_ATTRS
Definition workspace.cc:709
ID_Type GS(const char *name)
Definition DNA_ID.h:410
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:526
static void workspace_append_button(ui::Layout &layout, wmOperatorType *ot_append, const WorkSpace *workspace, const Main *from_main)
static void workspace_exit(WorkSpace *workspace, wmWindow *win)
WorkSpaceLayout * BKE_workspace_active_layout_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition workspace.cc:657
Scene * CTX_data_scene(const bContext *C)
static WorkspaceConfigFileData * workspace_system_file_read(const char *app_template)
@ OPTYPE_INTERNAL
Definition WM_types.hh:210
std::string RNA_string_get(PointerRNA *ptr, const char *name)
void screen_change_update(bContext *C, wmWindow *win, bScreen *screen)
@ BLENDER_USER_CONFIG
@ PROP_FILEPATH
Definition RNA_types.hh:284
static wmOperatorStatus workspace_delete_exec(bContext *C, wmOperator *)
static WorkSpace * workspace_context_get(bContext *C)
static wmOperatorStatus workspace_add_invoke(bContext *C, wmOperator *, const wmEvent *)
ID * BKE_id_copy(Main *bmain, const ID *id)
Definition lib_id.cc:856
void ED_workspace_scene_data_sync(WorkSpaceInstanceHook *hook, Scene *scene) ATTR_NONNULL()
Object * CTX_data_active_object(const bContext *C)
static void WORKSPACE_OT_reorder_to_back(wmOperatorType *ot)
View3D * CTX_wm_view3d(const bContext *C)
static void workspace_add_menu_register()
char name[258]
Definition DNA_ID.h:433
char filepath[1024]
Definition BKE_main.hh:267
ListBaseT< WorkSpace > workspaces
Definition BKE_main.hh:423
char idname[BKE_ST_MAXNAME]
char label[BKE_ST_MAXNAME]
MenuTypeFlag flag
void(*) draw(const bContext *C, Menu *menu)
struct WorkSpaceLayout * temp_layout_store
struct WorkSpaceLayout * next
ListBaseT< WorkSpaceLayout > layouts
ListBaseT< WorkSpace > workspaces
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
Layout & row(bool align)
void menu_fn_argN_free(StringRefNull name, int icon, MenuCreateFunc func, void *argN)
void menu_fn(StringRefNull name, int icon, MenuCreateFunc func, void *arg)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
struct WorkSpaceInstanceHook * workspace_hook
#define N_(msgid)