Blender  V3.3
WM_toolsystem.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #pragma once
3 
8 /* dna-savable wmStructs here */
9 #include "BLI_compiler_attrs.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 struct IDProperty;
16 struct Main;
17 struct PointerRNA;
18 struct ScrArea;
19 struct StructRNA;
20 struct WorkSpace;
21 struct bContext;
22 struct bToolRef_Runtime;
23 struct wmMsgSubscribeKey;
24 struct wmMsgSubscribeValue;
25 struct wmOperatorType;
26 
27 /* wm_toolsystem.c */
28 
29 #define WM_TOOLSYSTEM_SPACE_MASK \
30  ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ))
34 #define WM_TOOLSYSTEM_SPACE_MASK_MODE_FROM_SPACE ((1 << SPACE_IMAGE) | (1 << SPACE_SEQ))
35 
36 /* Values that define a category of active tool. */
37 typedef struct bToolKey {
39  int mode;
41 
43 struct bToolRef *WM_toolsystem_ref_find(struct WorkSpace *workspace, const bToolKey *tkey);
44 bool WM_toolsystem_ref_ensure(struct WorkSpace *workspace,
45  const bToolKey *tkey,
46  struct bToolRef **r_tref);
47 
49  struct WorkSpace *workspace,
50  const bToolKey *tkey,
51  const char *name,
52  bool cycle);
53 struct bToolRef *WM_toolsystem_ref_set_by_id(struct bContext *C, const char *name);
54 
56 struct bToolRef_Runtime *WM_toolsystem_runtime_find(struct WorkSpace *workspace,
57  const bToolKey *tkey);
58 
59 void WM_toolsystem_unlink(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
60 void WM_toolsystem_refresh(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
61 void WM_toolsystem_reinit(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
62 
66 void WM_toolsystem_unlink_all(struct bContext *C, struct WorkSpace *workspace);
67 void WM_toolsystem_refresh_all(struct bContext *C, struct WorkSpace *workspace);
68 void WM_toolsystem_reinit_all(struct bContext *C, struct wmWindow *win);
69 
71  struct WorkSpace *workspace,
72  struct bToolRef *tref,
73  const struct bToolRef_Runtime *tref_rt,
74  const char *idname);
75 
82 void WM_toolsystem_ref_sync_from_context(struct Main *bmain,
83  struct WorkSpace *workspace,
84  struct bToolRef *tref);
85 
86 void WM_toolsystem_init(struct bContext *C);
87 
88 int WM_toolsystem_mode_from_spacetype(struct ViewLayer *view_layer,
89  struct ScrArea *area,
90  int space_type);
91 bool WM_toolsystem_key_from_context(struct ViewLayer *view_layer,
92  struct ScrArea *area,
93  bToolKey *tkey);
94 
97  struct WorkSpace *workspace,
98  struct ViewLayer *view_layer,
99  struct ScrArea *area);
100 
105 
108  struct wmMsgSubscribeKey *msg_key,
109  struct wmMsgSubscribeValue *msg_val);
110 
114  const char *idname,
115  struct StructRNA *type,
116  struct PointerRNA *r_ptr);
117 
118 #define WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, r_ptr) \
119  WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
120 #define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr) \
121  WM_toolsystem_ref_properties_ensure_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
122 
124  const char *idname,
125  struct StructRNA *type,
126  struct PointerRNA *r_ptr);
127 #define WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr) \
128  WM_toolsystem_ref_properties_get_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
129 #define WM_toolsystem_ref_properties_get_from_gizmo_group(tref, gzgroup, r_ptr) \
130  WM_toolsystem_ref_properties_get_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
131 
133  struct PointerRNA *dst_ptr,
134  struct PointerRNA *src_ptr,
135  struct wmOperatorType *ot);
136 
146 
147 void WM_toolsystem_refresh_screen_area(struct WorkSpace *workspace,
148  struct ViewLayer *view_layer,
149  struct ScrArea *area);
151 void WM_toolsystem_refresh_screen_all(struct Main *bmain);
152 
153 #ifdef __cplusplus
154 }
155 #endif
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
#define C
Definition: RandGen.cpp:25
struct bToolRef * WM_toolsystem_ref_set_by_id_ex(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey, const char *name, bool cycle)
struct bToolRef_Runtime * WM_toolsystem_runtime_from_context(struct bContext *C)
Definition: wm_toolsystem.c:77
void WM_toolsystem_update_from_context_view3d(struct bContext *C)
void WM_toolsystem_refresh_active(struct bContext *C)
void WM_toolsystem_ref_properties_init_for_keymap(struct bToolRef *tref, struct PointerRNA *dst_ptr, struct PointerRNA *src_ptr, struct wmOperatorType *ot)
struct bToolRef_Runtime * WM_toolsystem_runtime_find(struct WorkSpace *workspace, const bToolKey *tkey)
Definition: wm_toolsystem.c:94
void WM_toolsystem_refresh_screen_area(struct WorkSpace *workspace, struct ViewLayer *view_layer, struct ScrArea *area)
void WM_toolsystem_update_from_context(struct bContext *C, struct WorkSpace *workspace, struct ViewLayer *view_layer, struct ScrArea *area)
struct bToolRef * WM_toolsystem_ref_set_by_id(struct bContext *C, const char *name)
struct IDProperty * WM_toolsystem_ref_properties_ensure_idprops(struct bToolRef *tref)
void WM_toolsystem_reinit_all(struct bContext *C, struct wmWindow *win)
bool WM_toolsystem_ref_ensure(struct WorkSpace *workspace, const bToolKey *tkey, struct bToolRef **r_tref)
struct bToolRef * WM_toolsystem_ref_find(struct WorkSpace *workspace, const bToolKey *tkey)
Definition: wm_toolsystem.c:83
bool WM_toolsystem_active_tool_is_brush(const struct bContext *C)
void WM_toolsystem_reinit(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey)
bool WM_toolsystem_ref_properties_get_ex(struct bToolRef *tref, const char *idname, struct StructRNA *type, struct PointerRNA *r_ptr)
void WM_toolsystem_unlink_all(struct bContext *C, struct WorkSpace *workspace)
void WM_toolsystem_unlink(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey)
void WM_toolsystem_refresh_all(struct bContext *C, struct WorkSpace *workspace)
void WM_toolsystem_init(struct bContext *C)
void WM_toolsystem_ref_set_from_runtime(struct bContext *C, struct WorkSpace *workspace, struct bToolRef *tref, const struct bToolRef_Runtime *tref_rt, const char *idname)
void WM_toolsystem_refresh_screen_all(struct Main *bmain)
void WM_toolsystem_refresh_screen_window(struct wmWindow *win)
bool WM_toolsystem_key_from_context(struct ViewLayer *view_layer, struct ScrArea *area, bToolKey *tkey)
struct IDProperty * WM_toolsystem_ref_properties_get_idprops(struct bToolRef *tref)
int WM_toolsystem_mode_from_spacetype(struct ViewLayer *view_layer, struct ScrArea *area, int space_type)
void WM_toolsystem_do_msg_notify_tag_refresh(struct bContext *C, struct wmMsgSubscribeKey *msg_key, struct wmMsgSubscribeValue *msg_val)
void WM_toolsystem_ref_properties_ensure_ex(struct bToolRef *tref, const char *idname, struct StructRNA *type, struct PointerRNA *r_ptr)
struct bToolRef * WM_toolsystem_ref_from_context(struct bContext *C)
Definition: wm_toolsystem.c:57
struct bToolKey bToolKey
void WM_toolsystem_ref_sync_from_context(struct Main *bmain, struct WorkSpace *workspace, struct bToolRef *tref)
void WM_toolsystem_refresh(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey)
static void area(int d1, int d2, int e1, int e2, float weights[2])
Definition: BKE_main.h:121
int space_type
Definition: WM_toolsystem.h:38
wmOperatorType * ot
Definition: wm_files.c:3479