Blender  V2.93
Functions
wm_toolsystem.c File Reference
#include <string.h>
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_ID.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_idprop.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_paint.h"
#include "BKE_workspace.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"

Go to the source code of this file.

Functions

static void toolsystem_reinit_with_toolref (bContext *C, WorkSpace *UNUSED(workspace), bToolRef *tref)
 
static bToolRef * toolsystem_reinit_ensure_toolref (bContext *C, WorkSpace *workspace, const bToolKey *tkey, const char *default_tool)
 
static void toolsystem_refresh_screen_from_active_tool (Main *bmain, WorkSpace *workspace, bToolRef *tref)
 
static void toolsystem_unlink_ref (bContext *C, WorkSpace *UNUSED(workspace), bToolRef *tref)
 
void WM_toolsystem_unlink (bContext *C, WorkSpace *workspace, const bToolKey *tkey)
 
static void toolsystem_ref_link (bContext *C, WorkSpace *workspace, bToolRef *tref)
 
static void toolsystem_refresh_ref (bContext *C, WorkSpace *workspace, bToolRef *tref)
 
void WM_toolsystem_refresh (bContext *C, WorkSpace *workspace, const bToolKey *tkey)
 
static void toolsystem_reinit_ref (bContext *C, WorkSpace *workspace, bToolRef *tref)
 
void WM_toolsystem_reinit (bContext *C, WorkSpace *workspace, const bToolKey *tkey)
 
void WM_toolsystem_unlink_all (struct bContext *C, struct WorkSpace *workspace)
 
void WM_toolsystem_refresh_all (struct bContext *C, struct WorkSpace *workspace)
 
void WM_toolsystem_reinit_all (struct bContext *C, wmWindow *win)
 
void WM_toolsystem_ref_set_from_runtime (struct bContext *C, struct WorkSpace *workspace, bToolRef *tref, const bToolRef_Runtime *tref_rt, const char *idname)
 
void WM_toolsystem_ref_sync_from_context (Main *bmain, WorkSpace *workspace, bToolRef *tref)
 
void WM_toolsystem_init (bContext *C)
 
static bool toolsystem_key_ensure_check (const bToolKey *tkey)
 
int WM_toolsystem_mode_from_spacetype (ViewLayer *view_layer, ScrArea *area, int space_type)
 
bool WM_toolsystem_key_from_context (ViewLayer *view_layer, ScrArea *area, bToolKey *tkey)
 
void WM_toolsystem_refresh_active (bContext *C)
 
void WM_toolsystem_refresh_screen_area (WorkSpace *workspace, ViewLayer *view_layer, ScrArea *area)
 
void WM_toolsystem_refresh_screen_all (Main *bmain)
 
bToolRef * WM_toolsystem_ref_set_by_id_ex (bContext *C, WorkSpace *workspace, const bToolKey *tkey, const char *name, bool cycle)
 
bToolRef * WM_toolsystem_ref_set_by_id (bContext *C, const char *name)
 
static void toolsystem_reinit_with_toolref (bContext *C, WorkSpace *workspace, bToolRef *tref)
 
static const char * toolsystem_default_tool (const bToolKey *tkey)
 
static void wm_toolsystem_update_from_context_view3d_impl (bContext *C, WorkSpace *workspace)
 
void WM_toolsystem_update_from_context_view3d (bContext *C)
 
void WM_toolsystem_update_from_context (bContext *C, WorkSpace *workspace, ViewLayer *view_layer, ScrArea *area)
 
bool WM_toolsystem_active_tool_is_brush (const bContext *C)
 
void WM_toolsystem_do_msg_notify_tag_refresh (bContext *C, wmMsgSubscribeKey *UNUSED(msg_key), wmMsgSubscribeValue *msg_val)
 
IDProperty * WM_toolsystem_ref_properties_ensure_idprops (bToolRef *tref)
 
bool WM_toolsystem_ref_properties_get_ex (bToolRef *tref, const char *idname, StructRNA *type, PointerRNA *r_ptr)
 
void WM_toolsystem_ref_properties_ensure_ex (bToolRef *tref, const char *idname, StructRNA *type, PointerRNA *r_ptr)
 
void WM_toolsystem_ref_properties_init_for_keymap (bToolRef *tref, PointerRNA *dst_ptr, PointerRNA *src_ptr, wmOperatorType *ot)
 
Tool Reference API
struct bToolRef * WM_toolsystem_ref_from_context (struct bContext *C)
 
struct bToolRef_Runtime * WM_toolsystem_runtime_from_context (struct bContext *C)
 
bToolRef * WM_toolsystem_ref_find (WorkSpace *workspace, const bToolKey *tkey)
 
bToolRef_Runtime * WM_toolsystem_runtime_find (WorkSpace *workspace, const bToolKey *tkey)
 
bool WM_toolsystem_ref_ensure (struct WorkSpace *workspace, const bToolKey *tkey, bToolRef **r_tref)
 

Detailed Description

Experimental tool-system>

Definition in file wm_toolsystem.c.

Function Documentation

◆ toolsystem_default_tool()

static const char* toolsystem_default_tool ( const bToolKey *  tkey)
static

◆ toolsystem_key_ensure_check()

static bool toolsystem_key_ensure_check ( const bToolKey *  tkey)
static

◆ toolsystem_ref_link()

static void toolsystem_ref_link ( bContext *  C,
WorkSpace *  workspace,
bToolRef *  tref 
)
static

◆ toolsystem_refresh_ref()

static void toolsystem_refresh_ref ( bContext *  C,
WorkSpace *  workspace,
bToolRef *  tref 
)
static

◆ toolsystem_refresh_screen_from_active_tool()

static void toolsystem_refresh_screen_from_active_tool ( Main *  bmain,
WorkSpace *  workspace,
bToolRef *  tref 
)
static

◆ toolsystem_reinit_ensure_toolref()

static bToolRef * toolsystem_reinit_ensure_toolref ( bContext *  C,
WorkSpace *  workspace,
const bToolKey *  tkey,
const char *  default_tool 
)
static

◆ toolsystem_reinit_ref()

static void toolsystem_reinit_ref ( bContext *  C,
WorkSpace *  workspace,
bToolRef *  tref 
)
static

Definition at line 242 of file wm_toolsystem.c.

References C, and toolsystem_reinit_with_toolref().

Referenced by WM_toolsystem_reinit(), and WM_toolsystem_reinit_all().

◆ toolsystem_reinit_with_toolref() [1/2]

static void toolsystem_reinit_with_toolref ( bContext *  C,
WorkSpace *  UNUSEDworkspace,
bToolRef *  tref 
)
static

◆ toolsystem_reinit_with_toolref() [2/2]

static void toolsystem_reinit_with_toolref ( bContext *  C,
WorkSpace *  workspace,
bToolRef *  tref 
)
static

◆ toolsystem_unlink_ref()

static void toolsystem_unlink_ref ( bContext *  C,
WorkSpace *  UNUSEDworkspace,
bToolRef *  tref 
)
static

◆ WM_toolsystem_active_tool_is_brush()

bool WM_toolsystem_active_tool_is_brush ( const bContext *  C)

◆ WM_toolsystem_do_msg_notify_tag_refresh()

void WM_toolsystem_do_msg_notify_tag_refresh ( bContext *  C,
wmMsgSubscribeKey *  UNUSEDmsg_key,
wmMsgSubscribeValue *  msg_val 
)

◆ WM_toolsystem_init()

void WM_toolsystem_init ( bContext *  C)

◆ WM_toolsystem_key_from_context()

bool WM_toolsystem_key_from_context ( ViewLayer *  view_layer,
ScrArea *  area,
bToolKey *  tkey 
)

◆ WM_toolsystem_mode_from_spacetype()

int WM_toolsystem_mode_from_spacetype ( ViewLayer *  view_layer,
ScrArea *  area,
int  space_type 
)

◆ WM_toolsystem_ref_ensure()

bool WM_toolsystem_ref_ensure ( struct WorkSpace *  workspace,
const bToolKey *  tkey,
bToolRef **  r_tref 
)

◆ WM_toolsystem_ref_find()

bToolRef* WM_toolsystem_ref_find ( WorkSpace *  workspace,
const bToolKey *  tkey 
)

◆ WM_toolsystem_ref_from_context()

struct bToolRef* WM_toolsystem_ref_from_context ( struct bContext *  C)

◆ WM_toolsystem_ref_properties_ensure_ex()

void WM_toolsystem_ref_properties_ensure_ex ( bToolRef *  tref,
const char *  idname,
StructRNA *  type,
PointerRNA *  r_ptr 
)

◆ WM_toolsystem_ref_properties_ensure_idprops()

IDProperty* WM_toolsystem_ref_properties_ensure_idprops ( bToolRef *  tref)

Definition at line 833 of file wm_toolsystem.c.

References IDP_GROUP, IDP_New(), NULL, and bToolRef::properties.

Referenced by WM_toolsystem_ref_properties_ensure_ex().

◆ WM_toolsystem_ref_properties_get_ex()

bool WM_toolsystem_ref_properties_get_ex ( bToolRef *  tref,
const char *  idname,
StructRNA *  type,
PointerRNA *  r_ptr 
)

◆ WM_toolsystem_ref_properties_init_for_keymap()

void WM_toolsystem_ref_properties_init_for_keymap ( bToolRef *  tref,
PointerRNA *  dst_ptr,
PointerRNA *  src_ptr,
wmOperatorType *  ot 
)

◆ WM_toolsystem_ref_set_by_id()

bToolRef* WM_toolsystem_ref_set_by_id ( bContext *  C,
const char *  name 
)

◆ WM_toolsystem_ref_set_by_id_ex()

bToolRef* WM_toolsystem_ref_set_by_id_ex ( bContext *  C,
WorkSpace *  workspace,
const bToolKey *  tkey,
const char *  name,
bool  cycle 
)

◆ WM_toolsystem_ref_set_from_runtime()

void WM_toolsystem_ref_set_from_runtime ( struct bContext *  C,
struct WorkSpace *  workspace,
bToolRef *  tref,
const bToolRef_Runtime *  tref_rt,
const char *  idname 
)

◆ WM_toolsystem_ref_sync_from_context()

void WM_toolsystem_ref_sync_from_context ( Main *  bmain,
WorkSpace *  workspace,
bToolRef *  tref 
)

◆ WM_toolsystem_refresh()

void WM_toolsystem_refresh ( bContext *  C,
WorkSpace *  workspace,
const bToolKey *  tkey 
)

◆ WM_toolsystem_refresh_active()

void WM_toolsystem_refresh_active ( bContext *  C)

Use to update the active tool (shown in the top bar) in the least disruptive way.

This is a little involved since there may be multiple valid active tools depending on the mode and space type.

Used when undoing since the active mode may have changed.

Definition at line 513 of file wm_toolsystem.c.

References blender::compositor::area(), bScreen::areabase, BKE_workspace_id_tag_all_visible(), C, CTX_data_main(), ListBase::first, LIB_TAG_DOIT, LISTBASE_FOREACH, NULL, bToolKey::space_type, toolsystem_refresh_ref(), toolsystem_reinit_ensure_toolref(), Main::wm, WM_toolsystem_mode_from_spacetype(), WM_toolsystem_ref_find(), WM_TOOLSYSTEM_SPACE_MASK, WM_window_get_active_screen(), WM_window_get_active_view_layer(), WM_window_get_active_workspace(), and Main::workspaces.

Referenced by ed_undo_step_post().

◆ WM_toolsystem_refresh_all()

void WM_toolsystem_refresh_all ( struct bContext *  C,
struct WorkSpace *  workspace 
)

◆ WM_toolsystem_refresh_screen_all()

void WM_toolsystem_refresh_screen_all ( Main *  bmain)

◆ WM_toolsystem_refresh_screen_area()

void WM_toolsystem_refresh_screen_area ( WorkSpace *  workspace,
ViewLayer *  view_layer,
ScrArea *  area 
)

◆ WM_toolsystem_reinit()

void WM_toolsystem_reinit ( bContext *  C,
WorkSpace *  workspace,
const bToolKey *  tkey 
)

Definition at line 246 of file wm_toolsystem.c.

References C, toolsystem_reinit_ref(), and WM_toolsystem_ref_find().

◆ WM_toolsystem_reinit_all()

void WM_toolsystem_reinit_all ( struct bContext *  C,
wmWindow *  win 
)

◆ WM_toolsystem_runtime_find()

bToolRef_Runtime* WM_toolsystem_runtime_find ( WorkSpace *  workspace,
const bToolKey *  tkey 
)

Definition at line 108 of file wm_toolsystem.c.

References NULL, bToolRef::runtime, and WM_toolsystem_ref_find().

◆ WM_toolsystem_runtime_from_context()

struct bToolRef_Runtime* WM_toolsystem_runtime_from_context ( struct bContext *  C)

◆ WM_toolsystem_unlink()

void WM_toolsystem_unlink ( bContext *  C,
WorkSpace *  workspace,
const bToolKey *  tkey 
)

◆ WM_toolsystem_unlink_all()

void WM_toolsystem_unlink_all ( struct bContext *  C,
struct WorkSpace *  workspace 
)

Definition at line 255 of file wm_toolsystem.c.

References C, LISTBASE_FOREACH, WorkSpace::tools, and toolsystem_unlink_ref().

◆ WM_toolsystem_update_from_context()

void WM_toolsystem_update_from_context ( bContext *  C,
WorkSpace *  workspace,
ViewLayer *  view_layer,
ScrArea *  area 
)

◆ WM_toolsystem_update_from_context_view3d()

void WM_toolsystem_update_from_context_view3d ( bContext *  C)

◆ wm_toolsystem_update_from_context_view3d_impl()

static void wm_toolsystem_update_from_context_view3d_impl ( bContext *  C,
WorkSpace *  workspace 
)
static