Blender V4.3
workspace_edit.cc File Reference
#include <cstdlib>
#include <cstring>
#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_utils.hh"
#include "BLI_utildefines.h"
#include "BKE_appdir.hh"
#include "BKE_blendfile.hh"
#include "BKE_context.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_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 int workspace_new_exec (bContext *C, wmOperator *)
 
static void WORKSPACE_OT_duplicate (wmOperatorType *ot)
 
static int workspace_delete_exec (bContext *C, wmOperator *)
 
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 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 int workspace_add_invoke (bContext *C, wmOperator *op, const wmEvent *)
 
static void WORKSPACE_OT_add (wmOperatorType *ot)
 
static int workspace_reorder_to_back_exec (bContext *C, wmOperator *)
 
static void WORKSPACE_OT_reorder_to_back (wmOperatorType *ot)
 
static int workspace_reorder_to_front_exec (bContext *C, wmOperator *)
 
static void WORKSPACE_OT_reorder_to_front (wmOperatorType *ot)
 
static int 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 56 of file workspace_edit.cc.

References BKE_workspace_add().

Referenced by ED_workspace_duplicate().

◆ ED_workspace_change()

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

◆ ED_workspace_delete()

◆ ED_workspace_duplicate()

WorkSpace * ED_workspace_duplicate ( WorkSpace * workspace_old,
Main * bmain,
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 217 of file workspace_edit.cc.

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 ( 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 270 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()

static 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()

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 134 of file workspace_edit.cc.

References 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()

static WorkspaceConfigFileData * workspace_config_file_read ( const char * app_template)
static

◆ workspace_context_get()

◆ workspace_context_poll()

◆ workspace_delete_exec()

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

◆ workspace_exit()

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

◆ workspace_new_exec()

◆ WORKSPACE_OT_add()

static void WORKSPACE_OT_add ( wmOperatorType * ot)
static

◆ WORKSPACE_OT_append_activate()

◆ WORKSPACE_OT_delete()

◆ WORKSPACE_OT_duplicate()

◆ WORKSPACE_OT_reorder_to_back()

◆ WORKSPACE_OT_reorder_to_front()

◆ WORKSPACE_OT_scene_pin_toggle()

◆ workspace_reorder_to_back_exec()

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

◆ workspace_reorder_to_front_exec()

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

◆ workspace_scene_pin_toggle_exec()

static int workspace_scene_pin_toggle_exec ( bContext * C,
wmOperator *  )
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 90 of file workspace_edit.cc.

References BLI_assert, 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()