Blender V5.0
workspace_edit.cc File Reference
#include <cstdlib>
#include <cstring>
#include <fmt/format.h>
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_utils.hh"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_appdir.hh"
#include "BKE_blendfile.hh"
#include "BKE_context.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_screen.hh"
#include "BKE_workspace.hh"
#include "BLO_readfile.hh"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "ED_datafiles.h"
#include "ED_object.hh"
#include "ED_screen.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "UI_interface.hh"
#include "UI_interface_layout.hh"
#include "UI_resources.hh"
#include "BLT_translation.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "screen_intern.hh"

Go to the source code of this file.

Functions

Workspace API

API for managing workspaces and their data.

WorkSpaceED_workspace_add (Main *bmain, const char *name)
static void workspace_exit (WorkSpace *workspace, wmWindow *win)
static void workspace_scene_pinning_update (WorkSpace *workspace_new, const WorkSpace *workspace_old, bContext *C)
static void workspace_change_update (WorkSpace *workspace_new, WorkSpace *workspace_old, bContext *C, wmWindowManager *wm)
static WorkSpaceLayoutworkspace_change_get_new_layout (Main *bmain, WorkSpace *workspace_new, wmWindow *win)
bool ED_workspace_change (WorkSpace *workspace_new, bContext *C, wmWindowManager *wm, wmWindow *win)
 Change the active workspace.
WorkSpaceED_workspace_duplicate (WorkSpace *workspace_old, Main *bmain, wmWindow *win)
bool ED_workspace_delete (WorkSpace *workspace, Main *bmain, bContext *C, wmWindowManager *wm)
void ED_workspace_scene_data_sync (WorkSpaceInstanceHook *hook, Scene *scene)
Workspace Operators
static WorkSpaceworkspace_context_get (bContext *C)
static bool workspace_context_poll (bContext *C)
static wmOperatorStatus workspace_new_exec (bContext *C, wmOperator *)
static void WORKSPACE_OT_duplicate (wmOperatorType *ot)
static wmOperatorStatus workspace_delete_exec (bContext *C, wmOperator *)
static void WORKSPACE_OT_delete (wmOperatorType *ot)
static wmOperatorStatus workspace_delete_all_others_exec (bContext *C, wmOperator *)
static void WORKSPACE_OT_delete_all_others (wmOperatorType *ot)
static wmOperatorStatus workspace_append_activate_exec (bContext *C, wmOperator *op)
static void WORKSPACE_OT_append_activate (wmOperatorType *ot)
static WorkspaceConfigFileDataworkspace_config_file_read (const char *app_template)
static WorkspaceConfigFileDataworkspace_system_file_read (const char *app_template)
static void workspace_append_button (uiLayout *layout, wmOperatorType *ot_append, const WorkSpace *workspace, const Main *from_main)
static void workspace_add_menu (bContext *, uiLayout *layout, void *template_v)
static wmOperatorStatus workspace_add_invoke (bContext *C, wmOperator *op, const wmEvent *)
static void WORKSPACE_OT_add (wmOperatorType *ot)
static wmOperatorStatus workspace_reorder_to_back_exec (bContext *C, wmOperator *)
static void WORKSPACE_OT_reorder_to_back (wmOperatorType *ot)
static wmOperatorStatus workspace_reorder_to_front_exec (bContext *C, wmOperator *)
static void WORKSPACE_OT_reorder_to_front (wmOperatorType *ot)
static wmOperatorStatus workspace_scene_pin_toggle_exec (bContext *C, wmOperator *)
static void WORKSPACE_OT_scene_pin_toggle (wmOperatorType *ot)
void ED_operatortypes_workspace ()

Function Documentation

◆ ED_operatortypes_workspace()

◆ ED_workspace_add()

WorkSpace * ED_workspace_add ( Main * bmain,
const char * name )

Definition at line 61 of file workspace_edit.cc.

References BKE_workspace_add(), and name.

Referenced by ED_workspace_duplicate().

◆ ED_workspace_change()

◆ ED_workspace_delete()

◆ ED_workspace_duplicate()

WorkSpace * ED_workspace_duplicate ( WorkSpace * workspace_old,
Main * bmain,
wmWindow * win )

◆ ED_workspace_scene_data_sync()

void ED_workspace_scene_data_sync ( WorkSpaceInstanceHook * hook,
Scene * scene )

Some editor data may need to be synced with scene data (3D View camera and layers). This function ensures data is synced for editors in active layout of workspace.

Definition at line 294 of file workspace_edit.cc.

References BKE_screen_view3d_scene_sync(), and BKE_workspace_active_screen_get().

Referenced by WM_windows_scene_data_sync().

◆ workspace_add_invoke()

◆ workspace_add_menu()

◆ workspace_append_activate_exec()

◆ workspace_append_button()

void workspace_append_button ( uiLayout * layout,
wmOperatorType * ot_append,
const WorkSpace * workspace,
const Main * from_main )
static

◆ workspace_change_get_new_layout()

◆ workspace_change_update()

void workspace_change_update ( WorkSpace * workspace_new,
WorkSpace * workspace_old,
bContext * C,
wmWindowManager * wm )
static

Changes the object mode (if needed) to the one set in workspace_new. Object mode is still stored on object level. In future it should all be workspace level instead.

Definition at line 139 of file workspace_edit.cc.

References C, CTX_data_active_object(), blender::ed::object::mode_set(), WorkSpace::object_mode, UNUSED_VARS, and workspace_scene_pinning_update().

Referenced by ED_workspace_change().

◆ workspace_config_file_read()

WorkspaceConfigFileData * workspace_config_file_read ( const char * app_template)
static

◆ workspace_context_get()

◆ workspace_context_poll()

◆ workspace_delete_all_others_exec()

◆ workspace_delete_exec()

wmOperatorStatus workspace_delete_exec ( bContext * C,
wmOperator *  )
static

◆ workspace_exit()

void workspace_exit ( WorkSpace * workspace,
wmWindow * win )
static

◆ workspace_new_exec()

◆ WORKSPACE_OT_add()

void WORKSPACE_OT_add ( wmOperatorType * ot)
static

Definition at line 619 of file workspace_edit.cc.

References ot, and workspace_add_invoke().

Referenced by ED_operatortypes_workspace().

◆ WORKSPACE_OT_append_activate()

◆ WORKSPACE_OT_delete()

void WORKSPACE_OT_delete ( wmOperatorType * ot)
static

Definition at line 355 of file workspace_edit.cc.

References ot, workspace_context_poll(), and workspace_delete_exec().

Referenced by ED_operatortypes_workspace().

◆ WORKSPACE_OT_delete_all_others()

void WORKSPACE_OT_delete_all_others ( wmOperatorType * ot)
static

◆ WORKSPACE_OT_duplicate()

void WORKSPACE_OT_duplicate ( wmOperatorType * ot)
static

Definition at line 334 of file workspace_edit.cc.

References ot, workspace_context_poll(), and workspace_new_exec().

Referenced by ED_operatortypes_workspace().

◆ WORKSPACE_OT_reorder_to_back()

void WORKSPACE_OT_reorder_to_back ( wmOperatorType * ot)
static

◆ WORKSPACE_OT_reorder_to_front()

void WORKSPACE_OT_reorder_to_front ( wmOperatorType * ot)
static

◆ WORKSPACE_OT_scene_pin_toggle()

void WORKSPACE_OT_scene_pin_toggle ( wmOperatorType * ot)
static

◆ workspace_reorder_to_back_exec()

◆ workspace_reorder_to_front_exec()

◆ workspace_scene_pin_toggle_exec()

◆ workspace_scene_pinning_update()

void workspace_scene_pinning_update ( WorkSpace * workspace_new,
const WorkSpace * workspace_old,
bContext * C )
static

State changes (old workspace to new workspace): 1) unpinned -> pinned

  • Store current scene as the unpinned one (done in workspace_exit()).
  • Change the current scene to the pinned one. 2) pinned -> pinned
  • Change the current scene to the new pinned one. 3) pinned -> unpinned
  • Change current scene back to the unpinned one 4) unpinned -> unpinned
  • Make sure the unpinned scene is active.

Note that the pin scene must also be updated when leaving a workspace with a pinned scene. That's done separately via workspace_exit() above.

Definition at line 95 of file workspace_edit.cc.

References BLI_assert, C, CTX_data_main(), CTX_wm_window(), WorkSpace::flags, WorkSpace::pin_scene, wmWindow::unpinned_scene, WM_window_get_active_scene(), WM_window_set_active_scene(), and WORKSPACE_USE_PIN_SCENE.

Referenced by workspace_change_update().

◆ workspace_system_file_read()