Blender  V3.3
BKE_workspace.h File Reference
#include "BLI_compiler_attrs.h"

Go to the source code of this file.

Functions

Create, Delete, Initialize
struct WorkSpace * BKE_workspace_add (struct Main *bmain, const char *name)
 
void BKE_workspace_remove (struct Main *bmain, struct WorkSpace *workspace)
 
struct WorkSpaceInstanceHook * BKE_workspace_instance_hook_create (const struct Main *bmain, int winid)
 
void BKE_workspace_instance_hook_free (const struct Main *bmain, struct WorkSpaceInstanceHook *hook)
 
struct WorkSpaceLayout * BKE_workspace_layout_add (struct Main *bmain, struct WorkSpace *workspace, struct bScreen *screen, const char *name) ATTR_NONNULL()
 
void BKE_workspace_layout_remove (struct Main *bmain, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) ATTR_NONNULL()
 
void BKE_workspace_relations_free (ListBase *relation_list)
 
General Utilities
struct WorkSpaceLayout * BKE_workspace_layout_find (const struct WorkSpace *workspace, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
 
struct WorkSpaceLayout * BKE_workspace_layout_find_global (const struct Main *bmain, const struct bScreen *screen, struct WorkSpace **r_workspace) ATTR_NONNULL(1
 
struct WorkSpaceLayout struct WorkSpaceLayout * BKE_workspace_layout_iter_circular (const struct WorkSpace *workspace, struct WorkSpaceLayout *start, bool(*callback)(const struct WorkSpaceLayout *layout, void *arg), void *arg, bool iter_backward)
 
void BKE_workspace_tool_remove (struct WorkSpace *workspace, struct bToolRef *tref) ATTR_NONNULL(1
 

Getters/Setters

#define GETTER_ATTRS   ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
 
#define SETTER_ATTRS   ATTR_NONNULL(1)
 
struct WorkSpace * BKE_workspace_active_get (struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
 
void BKE_workspace_active_set (struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace) SETTER_ATTRS
 
struct WorkSpaceLayout * BKE_workspace_active_layout_get (const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
 
void BKE_workspace_active_layout_set (struct WorkSpaceInstanceHook *hook, int winid, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) SETTER_ATTRS
 Activate a layout. More...
 
struct bScreen * BKE_workspace_active_screen_get (const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
 
void BKE_workspace_active_screen_set (struct WorkSpaceInstanceHook *hook, int winid, struct WorkSpace *workspace, struct bScreen *screen) SETTER_ATTRS
 
const char * BKE_workspace_layout_name_get (const struct WorkSpaceLayout *layout) GETTER_ATTRS
 
void BKE_workspace_layout_name_set (struct WorkSpace *workspace, struct WorkSpaceLayout *layout, const char *new_name) ATTR_NONNULL()
 
struct bScreen * BKE_workspace_layout_screen_get (const struct WorkSpaceLayout *layout) GETTER_ATTRS
 
struct WorkSpaceLayout * BKE_workspace_active_layout_for_workspace_get (const struct WorkSpaceInstanceHook *hook, const struct WorkSpace *workspace) GETTER_ATTRS
 
bool BKE_workspace_owner_id_check (const struct WorkSpace *workspace, const char *owner_id) ATTR_NONNULL()
 
void BKE_workspace_id_tag_all_visible (struct Main *bmain, int tag) ATTR_NONNULL()
 

Macro Definition Documentation

◆ GETTER_ATTRS

Definition at line 97 of file BKE_workspace.h.

◆ SETTER_ATTRS

#define SETTER_ATTRS   ATTR_NONNULL(1)

Definition at line 98 of file BKE_workspace.h.

Function Documentation

◆ BKE_workspace_active_get()

struct WorkSpace* BKE_workspace_active_get ( struct WorkSpaceInstanceHook *  hook)

◆ BKE_workspace_active_layout_for_workspace_get()

struct WorkSpaceLayout* BKE_workspace_active_layout_for_workspace_get ( const struct WorkSpaceInstanceHook *  hook,
const struct WorkSpace *  workspace 
)

Get the layout to be activated should workspace become or be the active workspace in hook.

Referenced by BLO_update_defaults_startup_blend(), and workspace_change_get_new_layout().

◆ BKE_workspace_active_layout_get()

struct WorkSpaceLayout* BKE_workspace_active_layout_get ( const struct WorkSpaceInstanceHook *  hook)

Get the layout that is active for hook (which is the visible layout for the active workspace in hook).

Referenced by ED_workspace_duplicate(), ED_workspace_layout_cycle(), screen_new_exec(), wm_window_close(), WM_window_get_active_layout(), and workspace_layout_delete_doit().

◆ BKE_workspace_active_layout_set()

void BKE_workspace_active_layout_set ( struct WorkSpaceInstanceHook *  hook,
int  winid,
struct WorkSpace *  workspace,
struct WorkSpaceLayout *  layout 
)

Activate a layout.

Sets layout as active for workspace when activated through or already active in hook. So when the active workspace of hook is workspace, layout becomes the active layout of hook too. See BKE_workspace_active_set().

workspace does not need to be active for this.

WorkSpaceInstanceHook.act_layout should only be modified directly to update the layout pointer.

Definition at line 557 of file workspace.c.

References WorkSpaceInstanceHook::act_layout, WorkSpace::hook_layout_relations, winid, and workspace_relation_ensure_updated().

Referenced by BKE_workspace_active_screen_set(), BKE_workspace_instance_hook_create(), do_version_workspaces_after_lib_link(), ED_workspace_change(), wm_add_default(), wm_window_copy(), and WM_window_set_active_layout().

◆ BKE_workspace_active_screen_get()

struct bScreen* BKE_workspace_active_screen_get ( const struct WorkSpaceInstanceHook *  hook)

◆ BKE_workspace_active_screen_set()

void BKE_workspace_active_screen_set ( struct WorkSpaceInstanceHook *  hook,
int  winid,
struct WorkSpace *  workspace,
struct bScreen *  screen 
)

◆ BKE_workspace_active_set()

void BKE_workspace_active_set ( struct WorkSpaceInstanceHook *  hook,
struct WorkSpace *  workspace 
)

◆ BKE_workspace_add()

struct WorkSpace* BKE_workspace_add ( struct Main *  bmain,
const char *  name 
)

◆ BKE_workspace_id_tag_all_visible()

void BKE_workspace_id_tag_all_visible ( struct Main *  bmain,
int  tag 
)

◆ BKE_workspace_instance_hook_create()

struct WorkSpaceInstanceHook* BKE_workspace_instance_hook_create ( const struct Main *  bmain,
int  winid 
)

◆ BKE_workspace_instance_hook_free()

void BKE_workspace_instance_hook_free ( const struct Main *  bmain,
struct WorkSpaceInstanceHook *  hook 
)

Referenced by wm_window_free().

◆ BKE_workspace_layout_add()

struct WorkSpaceLayout* BKE_workspace_layout_add ( struct Main *  bmain,
struct WorkSpace *  workspace,
struct bScreen *  screen,
const char *  name 
)

◆ BKE_workspace_layout_find()

struct WorkSpaceLayout* BKE_workspace_layout_find ( const struct WorkSpace *  workspace,
const struct bScreen *  screen 
)

◆ BKE_workspace_layout_find_global()

struct WorkSpaceLayout* BKE_workspace_layout_find_global ( const struct Main *  bmain,
const struct bScreen *  screen,
struct WorkSpace **  r_workspace 
)

Find the layout for screen without knowing which workspace to look in. Can also be used to find the workspace that contains screen.

Parameters
r_workspaceOptionally return the workspace that contains the looked up layout (if found).

Referenced by wm_add_default(), and wm_window_match_keep_current_wm().

◆ BKE_workspace_layout_iter_circular()

struct WorkSpaceLayout struct WorkSpaceLayout* BKE_workspace_layout_iter_circular ( const struct WorkSpace *  workspace,
struct WorkSpaceLayout *  start,
bool(*)(const struct WorkSpaceLayout *layout, void *arg)  callback,
void *  arg,
bool  iter_backward 
)

Circular workspace layout iterator.

Parameters
callbackCustom function which gets executed for each layout. Can return false to stop iterating.
argCustom data passed to each callback call.
Returns
the layout at which callback returned false.

Referenced by ED_workspace_layout_cycle(), and ED_workspace_screen_change_ensure_unused_layout().

◆ BKE_workspace_layout_name_get()

const char* BKE_workspace_layout_name_get ( const struct WorkSpaceLayout *  layout)

◆ BKE_workspace_layout_name_set()

void BKE_workspace_layout_name_set ( struct WorkSpace *  workspace,
struct WorkSpaceLayout *  layout,
const char *  new_name 
)

Definition at line 584 of file workspace.c.

References workspace_layout_name_set().

◆ BKE_workspace_layout_remove()

void BKE_workspace_layout_remove ( struct Main *  bmain,
struct WorkSpace *  workspace,
struct WorkSpaceLayout *  layout 
)

◆ BKE_workspace_layout_screen_get()

struct bScreen* BKE_workspace_layout_screen_get ( const struct WorkSpaceLayout *  layout)

◆ BKE_workspace_owner_id_check()

bool BKE_workspace_owner_id_check ( const struct WorkSpace *  workspace,
const char *  owner_id 
)

◆ BKE_workspace_relations_free()

void BKE_workspace_relations_free ( ListBase *  relation_list)

Definition at line 394 of file workspace.c.

References ListBase::first, and workspace_relation_remove().

Referenced by workspace_free_data().

◆ BKE_workspace_remove()

void BKE_workspace_remove ( struct Main *  bmain,
struct WorkSpace *  workspace 
)

Remove workspace by freeing itself and its data. This is a higher-level wrapper that calls workspace_free_data (through BKE_id_free) to free the workspace data, and frees other data-blocks owned by workspace and its layouts (currently that is screens only).

Always use this to remove (and free) workspaces. Don't free non-ID workspace members here.

Definition at line 321 of file workspace.c.

References BKE_id_free(), BKE_workspace_layout_remove(), ListBase::first, and WorkSpace::layouts.

◆ BKE_workspace_tool_remove()

void BKE_workspace_tool_remove ( struct WorkSpace *  workspace,
struct bToolRef *  tref 
)