Blender  V2.93
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.

WorkSpaceED_workspace_add (Main *bmain, const char *name)
 
static void workspace_change_update (WorkSpace *workspace_new, const 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. More...
 
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 *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 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 *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)
 
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 66 of file workspace_edit.c.

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 
)

Change the active workspace.

Operator call, WM + Window + screen already existed before Pretty similar to ED_screen_change since changing workspace also changes screen.

Warning
Do NOT call in area/region queues!
Returns
if workspace changing was successful.

Definition at line 124 of file workspace_edit.c.

References BKE_workspace_active_layout_set(), BKE_workspace_active_screen_get(), BKE_workspace_active_set(), BKE_workspace_layout_screen_get(), BLI_assert, C, CTX_data_main(), CTX_wm_workspace(), ED_object_mode_set(), NULL, WorkSpace::object_mode, screen_change_prepare(), screen_change_update(), WorkSpaceInstanceHook::temp_layout_store, wmWindow::winid, WM_window_get_active_workspace(), workspace_change_get_new_layout(), workspace_change_update(), and wmWindow::workspace_hook.

Referenced by ED_workspace_delete(), and WM_window_set_active_workspace().

◆ ED_workspace_delete()

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

◆ 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 167 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, 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 227 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,
const 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 75 of file workspace_edit.c.

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

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_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_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_system_file_read()

static WorkspaceConfigFileData* workspace_system_file_read ( const char *  app_template)
static