Blender  V2.93
WM_toolsystem.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 #pragma once
17 
22 /* dna-savable wmStructs here */
23 #include "BLI_compiler_attrs.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 struct IDProperty;
30 struct Main;
31 struct PointerRNA;
32 struct ScrArea;
33 struct StructRNA;
34 struct WorkSpace;
35 struct bContext;
36 struct bToolRef_Runtime;
37 struct wmMsgSubscribeKey;
38 struct wmMsgSubscribeValue;
39 struct wmOperatorType;
40 
41 /* wm_toolsystem.c */
42 
43 #define WM_TOOLSYSTEM_SPACE_MASK \
44  ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ))
45 /* Values that define a category of active tool. */
46 typedef struct bToolKey {
48  int mode;
50 
52 struct bToolRef *WM_toolsystem_ref_find(struct WorkSpace *workspace, const bToolKey *tkey);
53 bool WM_toolsystem_ref_ensure(struct WorkSpace *workspace,
54  const bToolKey *tkey,
55  struct bToolRef **r_tref);
56 
58  struct WorkSpace *workspace,
59  const bToolKey *tkey,
60  const char *name,
61  bool cycle);
62 struct bToolRef *WM_toolsystem_ref_set_by_id(struct bContext *C, const char *name);
63 
65 struct bToolRef_Runtime *WM_toolsystem_runtime_find(struct WorkSpace *workspace,
66  const bToolKey *tkey);
67 
68 void WM_toolsystem_unlink(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
69 void WM_toolsystem_refresh(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
70 void WM_toolsystem_reinit(struct bContext *C, struct WorkSpace *workspace, const bToolKey *tkey);
71 
72 void WM_toolsystem_unlink_all(struct bContext *C, struct WorkSpace *workspace);
73 void WM_toolsystem_refresh_all(struct bContext *C, struct WorkSpace *workspace);
74 void WM_toolsystem_reinit_all(struct bContext *C, struct wmWindow *win);
75 
77  struct WorkSpace *workspace,
78  struct bToolRef *tref,
79  const struct bToolRef_Runtime *tref_rt,
80  const char *idname);
81 
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 
102 
104  struct wmMsgSubscribeKey *msg_key,
105  struct wmMsgSubscribeValue *msg_val);
106 
109  const char *idname,
110  struct StructRNA *type,
111  struct PointerRNA *r_ptr);
112 
113 #define WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, r_ptr) \
114  WM_toolsystem_ref_properties_ensure_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
115 #define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr) \
116  WM_toolsystem_ref_properties_ensure_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
117 
119  const char *idname,
120  struct StructRNA *type,
121  struct PointerRNA *r_ptr);
122 #define WM_toolsystem_ref_properties_get_from_operator(tref, ot, r_ptr) \
123  WM_toolsystem_ref_properties_get_ex(tref, (ot)->idname, (ot)->srna, r_ptr)
124 #define WM_toolsystem_ref_properties_get_from_gizmo_group(tref, gzgroup, r_ptr) \
125  WM_toolsystem_ref_properties_get_ex(tref, (gzgroup)->idname, (gzgroup)->srna, r_ptr)
126 
128  struct PointerRNA *dst_ptr,
129  struct PointerRNA *src_ptr,
130  struct wmOperatorType *ot);
131 
133 
134 void WM_toolsystem_refresh_screen_area(struct WorkSpace *workspace,
135  struct ViewLayer *view_layer,
136  struct ScrArea *area);
137 void WM_toolsystem_refresh_screen_all(struct Main *bmain);
138 
139 #ifdef __cplusplus
140 }
141 #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:39
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:91
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)
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:97
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)
bool WM_toolsystem_key_from_context(struct ViewLayer *view_layer, struct ScrArea *area, bToolKey *tkey)
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:71
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:116
int space_type
Definition: WM_toolsystem.h:47
wmOperatorType * ot
Definition: wm_files.c:3156