Blender V5.0
BKE_workspace.hh File Reference
#include <string>
#include "DNA_listBase.h"
#include "BLI_compiler_attrs.h"
#include "BLI_vector.hh"

Go to the source code of this file.

Classes

struct  blender::bke::WorkSpaceStatusItem
struct  blender::bke::WorkSpaceRuntime

Namespaces

namespace  blender
namespace  blender::bke

Functions

Create, Delete, Initialize
WorkSpaceBKE_workspace_add (Main *bmain, const char *name)
void BKE_workspace_remove (Main *bmain, WorkSpace *workspace)
WorkSpaceInstanceHookBKE_workspace_instance_hook_create (const Main *bmain, int winid)
void BKE_workspace_instance_hook_free (const Main *bmain, WorkSpaceInstanceHook *hook)
WorkSpaceLayoutBKE_workspace_layout_add (Main *bmain, WorkSpace *workspace, bScreen *screen, const char *name) ATTR_NONNULL()
void BKE_workspace_layout_remove (Main *bmain, WorkSpace *workspace, WorkSpaceLayout *layout) ATTR_NONNULL()
void BKE_workspace_relations_free (ListBase *relation_list)
General Utilities
WorkSpaceLayoutBKE_workspace_layout_find (const WorkSpace *workspace, const bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
WorkSpaceLayoutBKE_workspace_layout_find_global (const Main *bmain, const bScreen *screen, WorkSpace **r_workspace) ATTR_NONNULL(1
WorkSpaceLayout WorkSpaceLayoutBKE_workspace_layout_iter_circular (const WorkSpace *workspace, WorkSpaceLayout *start, bool(*callback)(const WorkSpaceLayout *layout, void *arg), void *arg, bool iter_backward)
void BKE_workspace_tool_remove (WorkSpace *workspace, bToolRef *tref) ATTR_NONNULL(1
void void BKE_workspace_tool_id_replace_table (WorkSpace *workspace, const int space_type, const int mode, const char *idname_prefix_skip, const char *replace_table[][2], int replace_table_num) ATTR_NONNULL(1

Getters/Setters

#define GETTER_ATTRS   ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
#define SETTER_ATTRS   ATTR_NONNULL(1)
WorkSpaceBKE_workspace_active_get (WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BKE_workspace_active_set (WorkSpaceInstanceHook *hook, WorkSpace *workspace) SETTER_ATTRS
WorkSpaceLayoutBKE_workspace_active_layout_get (const WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BKE_workspace_active_layout_set (WorkSpaceInstanceHook *hook, int winid, WorkSpace *workspace, WorkSpaceLayout *layout) SETTER_ATTRS
 Activate a layout.
bScreenBKE_workspace_active_screen_get (const WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BKE_workspace_active_screen_set (WorkSpaceInstanceHook *hook, int winid, WorkSpace *workspace, bScreen *screen) SETTER_ATTRS
const char * BKE_workspace_layout_name_get (const WorkSpaceLayout *layout) GETTER_ATTRS
void BKE_workspace_layout_name_set (WorkSpace *workspace, WorkSpaceLayout *layout, const char *new_name) ATTR_NONNULL()
bScreenBKE_workspace_layout_screen_get (const WorkSpaceLayout *layout) GETTER_ATTRS
WorkSpaceLayoutBKE_workspace_active_layout_for_workspace_get (const WorkSpaceInstanceHook *hook, const WorkSpace *workspace) GETTER_ATTRS
bool BKE_workspace_owner_id_check (const WorkSpace *workspace, const char *owner_id) ATTR_NONNULL()
void BKE_workspace_id_tag_all_visible (Main *bmain, int tag) ATTR_NONNULL()
void BKE_workspace_status_clear (WorkSpace *workspace)

Macro Definition Documentation

◆ GETTER_ATTRS

#define GETTER_ATTRS   ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT

Definition at line 130 of file BKE_workspace.hh.

◆ SETTER_ATTRS

#define SETTER_ATTRS   ATTR_NONNULL(1)

Definition at line 131 of file BKE_workspace.hh.

Function Documentation

◆ BKE_workspace_active_get()

◆ BKE_workspace_active_layout_for_workspace_get()

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

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

Definition at line 592 of file workspace.cc.

References WorkSpaceInstanceHook::act_layout, WorkSpaceInstanceHook::active, WorkSpace::hook_layout_relations, and workspace_relation_get_data_matching_parent().

Referenced by BLO_update_defaults_startup_blend(), and workspace_change_get_new_layout().

◆ BKE_workspace_active_layout_get()

WorkSpaceLayout * BKE_workspace_active_layout_get ( const WorkSpaceInstanceHook * hook)

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

Definition at line 587 of file workspace.cc.

References WorkSpaceInstanceHook::act_layout.

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 ( WorkSpaceInstanceHook * hook,
int winid,
WorkSpace * workspace,
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 605 of file workspace.cc.

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

◆ BKE_workspace_active_screen_set()

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

◆ BKE_workspace_active_set()

◆ BKE_workspace_add()

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

◆ BKE_workspace_id_tag_all_visible()

◆ BKE_workspace_instance_hook_create()

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

◆ BKE_workspace_instance_hook_free()

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

◆ BKE_workspace_layout_add()

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

◆ BKE_workspace_layout_find()

◆ BKE_workspace_layout_find_global()

WorkSpaceLayout * BKE_workspace_layout_find_global ( const Main * bmain,
const bScreen * screen,
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).

References ATTR_NONNULL, BKE_workspace_layout_find_global(), and BKE_workspace_layout_iter_circular().

Referenced by BKE_workspace_layout_find_global(), bpy_rna_context_temp_override_enter_ok_or_error(), bpy_rna_context_temp_set_screen_for_window(), wm_add_default(), and wm_file_read_setup_wm_keep_old().

◆ BKE_workspace_layout_iter_circular()

WorkSpaceLayout WorkSpaceLayout * BKE_workspace_layout_iter_circular ( const WorkSpace * workspace,
WorkSpaceLayout * start,
bool(* callback )(const WorkSpaceLayout *layout, void *arg),
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.

Definition at line 470 of file workspace.cc.

References WorkSpace::layouts, LISTBASE_CIRCULAR_BACKWARD_BEGIN, LISTBASE_CIRCULAR_BACKWARD_END, LISTBASE_CIRCULAR_FORWARD_BEGIN, and LISTBASE_CIRCULAR_FORWARD_END.

Referenced by BKE_workspace_layout_find_global(), 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 WorkSpaceLayout * layout)

Definition at line 628 of file workspace.cc.

References WorkSpaceLayout::name.

Referenced by ED_workspace_layout_duplicate().

◆ BKE_workspace_layout_name_set()

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

Definition at line 632 of file workspace.cc.

References workspace_layout_name_set().

◆ BKE_workspace_layout_remove()

◆ BKE_workspace_layout_screen_get()

◆ BKE_workspace_owner_id_check()

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

◆ BKE_workspace_relations_free()

void BKE_workspace_relations_free ( ListBase * relation_list)

Definition at line 410 of file workspace.cc.

References ListBase::first, and workspace_relation_remove().

Referenced by workspace_free_data().

◆ BKE_workspace_remove()

void BKE_workspace_remove ( Main * bmain,
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 326 of file workspace.cc.

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

◆ BKE_workspace_status_clear()

void BKE_workspace_status_clear ( WorkSpace * workspace)

Empty the Workspace status items to clear the status bar.

Definition at line 650 of file workspace.cc.

References WorkSpace::runtime.

Referenced by mesh_bisect_modal(), blender::ed::transform::viewRedrawPost(), workspace_free_data(), and WorkspaceStatus::WorkspaceStatus().

◆ BKE_workspace_tool_id_replace_table()

void void BKE_workspace_tool_id_replace_table ( WorkSpace * workspace,
const int space_type,
const int mode,
const char * idname_prefix_skip,
const char * replace_table[][2],
int replace_table_num )

Replace tools ID's, intended for use in versioning code.

Parameters
space_typeThe space-type to match bToolRef::space_type.
modeThe space-type to match bToolRef::mode.
idname_prefix_skipIgnore when NULL, otherwise only operate on tools that have this text as the bToolRef::idname prefix, which is skipped before the replacement runs. This avoids having to duplicate a common prefix in the replacement text.
replace_tableAn array of (source, destination) pairs.
replace_table_numThe number of items in replace_table.

References ATTR_NONNULL, and BKE_workspace_tool_id_replace_table().

Referenced by BKE_workspace_tool_id_replace_table(), and blo_do_versions_300().

◆ BKE_workspace_tool_remove()

void BKE_workspace_tool_remove ( WorkSpace * workspace,
bToolRef * tref )