Blender  V3.3
workspace_edit.c File Reference
#include <stdlib.h>
#include <string.h>
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_utildefines.h"
#include "BKE_appdir.h"
#include "BKE_blendfile.h"
#include "BKE_context.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_screen.h"
#include "BKE_workspace.h"
#include "BLO_readfile.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "ED_datafiles.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "BLT_translation.h"
#include "WM_api.h"
#include "WM_types.h"
#include "screen_intern.h"

Go to the source code of this file.

Functions

Workspace API

API for managing workspaces and their data.

WorkSpace * ED_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 WorkSpaceLayout * workspace_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. More...
 
WorkSpace * ED_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 WorkSpace * workspace_context_get (bContext *C)
 
static bool workspace_context_poll (bContext *C)
 
static int workspace_new_exec (bContext *C, wmOperator *UNUSED(op))
 
static void WORKSPACE_OT_duplicate (wmOperatorType *ot)
 
static int workspace_delete_exec (bContext *C, wmOperator *UNUSED(op))
 
static void WORKSPACE_OT_delete (wmOperatorType *ot)
 
static int workspace_append_activate_exec (bContext *C, wmOperator *op)
 
static void WORKSPACE_OT_append_activate (wmOperatorType *ot)
 
static WorkspaceConfigFileData * workspace_config_file_read (const char *app_template)
 
static WorkspaceConfigFileData * workspace_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 *UNUSED(C), uiLayout *layout, void *template_v)
 
static int workspace_add_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
static void WORKSPACE_OT_add (wmOperatorType *ot)
 
static int workspace_reorder_to_back_exec (bContext *C, wmOperator *UNUSED(op))
 
static void WORKSPACE_OT_reorder_to_back (wmOperatorType *ot)
 
static int workspace_reorder_to_front_exec (bContext *C, wmOperator *UNUSED(op))
 
static void WORKSPACE_OT_reorder_to_front (wmOperatorType *ot)
 
static int workspace_scene_pin_toggle (bContext *C, wmOperator *UNUSED(op))
 
static void WORKSPACE_OT_scene_pin_toggle (wmOperatorType *ot)
 
void ED_operatortypes_workspace (void)
 

Function Documentation

◆ ED_operatortypes_workspace()

void ED_operatortypes_workspace ( void  )

◆ ED_workspace_add()

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

Definition at line 52 of file workspace_edit.c.

References BKE_workspace_add().

Referenced by ED_workspace_duplicate().

◆ ED_workspace_change()

bool ED_workspace_change ( struct WorkSpace *  workspace_new,
struct bContext *  C,
struct wmWindowManager *  wm,
struct wmWindow *  win 
)

◆ ED_workspace_delete()

bool ED_workspace_delete ( struct WorkSpace *  workspace,
struct Main *  bmain,
struct bContext *  C,
struct wmWindowManager *  wm 
)

◆ ED_workspace_duplicate()

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

Duplicate a workspace including its layouts. Does not activate the workspace, but it stores the screen-layout to be activated (BKE_workspace_temp_layout_store)

Definition at line 212 of file workspace_edit.c.

References BKE_workspace_active_layout_get(), BLI_duplicatelist(), ED_workspace_add(), ED_workspace_layout_duplicate(), WorkSpace::flags, WorkSpace::id, WorkSpace::layouts, LISTBASE_FOREACH, ID::name, WorkSpace::object_mode, WorkSpace::order, WorkSpace::owner_ids, WorkSpace::pin_scene, WorkSpaceInstanceHook::temp_layout_store, and wmWindow::workspace_hook.

Referenced by workspace_new_exec().

◆ ED_workspace_scene_data_sync()

void ED_workspace_scene_data_sync ( struct 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 266 of file workspace_edit.c.

References BKE_screen_view3d_scene_sync(), BKE_workspace_active_screen_get(), and scene.

Referenced by WM_windows_scene_data_sync().

◆ workspace_add_invoke()

static int workspace_add_invoke ( bContext *  C,
wmOperator *  op,
const wmEvent *  UNUSEDevent 
)
static

◆ workspace_add_menu()

static void workspace_add_menu ( bContext *  UNUSEDC,
uiLayout *  layout,
void *  template_v 
)
static

◆ workspace_append_activate_exec()

static int workspace_append_activate_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ workspace_append_button()

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

◆ workspace_change_get_new_layout()

static WorkSpaceLayout* workspace_change_get_new_layout ( Main *  bmain,
WorkSpace *  workspace_new,
wmWindow *  win 
)
static

◆ workspace_change_update()

static 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 130 of file workspace_edit.c.

References C, CTX_data_active_object(), ED_object_mode_set(), WorkSpace::object_mode, UNUSED_VARS, and workspace_scene_pinning_update().

Referenced by ED_workspace_change().

◆ workspace_config_file_read()

static WorkspaceConfigFileData* workspace_config_file_read ( const char *  app_template)
static

◆ workspace_context_get()

static WorkSpace* workspace_context_get ( bContext *  C)
static

◆ workspace_context_poll()

static bool workspace_context_poll ( bContext *  C)
static

◆ workspace_delete_exec()

static int workspace_delete_exec ( bContext *  C,
wmOperator *  UNUSEDop 
)
static

◆ workspace_exit()

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

◆ workspace_new_exec()

static int workspace_new_exec ( bContext *  C,
wmOperator *  UNUSEDop 
)
static

◆ WORKSPACE_OT_add()

static void WORKSPACE_OT_add ( wmOperatorType *  ot)
static

◆ WORKSPACE_OT_append_activate()

static void WORKSPACE_OT_append_activate ( wmOperatorType *  ot)
static

◆ WORKSPACE_OT_delete()

static void WORKSPACE_OT_delete ( wmOperatorType *  ot)
static

◆ WORKSPACE_OT_duplicate()

static void WORKSPACE_OT_duplicate ( wmOperatorType *  ot)
static

◆ WORKSPACE_OT_reorder_to_back()

static void WORKSPACE_OT_reorder_to_back ( wmOperatorType *  ot)
static

◆ WORKSPACE_OT_reorder_to_front()

static void WORKSPACE_OT_reorder_to_front ( wmOperatorType *  ot)
static

◆ WORKSPACE_OT_scene_pin_toggle()

static void WORKSPACE_OT_scene_pin_toggle ( wmOperatorType *  ot)
static

◆ workspace_reorder_to_back_exec()

static int workspace_reorder_to_back_exec ( bContext *  C,
wmOperator *  UNUSEDop 
)
static

◆ workspace_reorder_to_front_exec()

static int workspace_reorder_to_front_exec ( bContext *  C,
wmOperator *  UNUSEDop 
)
static

◆ workspace_scene_pin_toggle()

static int workspace_scene_pin_toggle ( bContext *  C,
wmOperator *  UNUSEDop 
)
static

◆ workspace_scene_pinning_update()

static 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 86 of file workspace_edit.c.

References BLI_assert, C, CTX_data_main(), CTX_wm_window(), WorkSpace::flags, NULL, 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()

static WorkspaceConfigFileData* workspace_system_file_read ( const char *  app_template)
static