Blender  V2.93
rna_wm.c
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 
21 #include <stdlib.h>
22 
23 #include "DNA_screen_types.h"
24 #include "DNA_space_types.h"
25 #include "DNA_userdef_types.h"
27 
28 #include "BLI_utildefines.h"
29 
30 #include "BLT_translation.h"
31 
32 #include "BKE_keyconfig.h"
33 #include "BKE_workspace.h"
34 
35 #include "RNA_access.h"
36 #include "RNA_define.h"
37 #include "RNA_enum_types.h"
38 
39 #include "rna_internal.h"
40 
41 #include "WM_types.h"
42 
43 #ifdef RNA_RUNTIME
44 
45 static const EnumPropertyItem event_tweak_type_items[] = {
46  {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
47  {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
48  {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
49  {0, NULL, 0, NULL, NULL},
50 };
51 
52 static const EnumPropertyItem event_mouse_type_items[] = {
53  {LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
54  {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
55  {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
56  {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""},
57  {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""},
58  {BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6", ""},
59  {BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7", ""},
60  {0, "", 0, NULL, NULL},
61  {TABLET_STYLUS, "PEN", 0, "Pen", ""},
62  {TABLET_ERASER, "ERASER", 0, "Eraser", ""},
63  {0, "", 0, NULL, NULL},
64  {MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""},
65  {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""},
66  {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""},
67  {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""},
68  {MOUSESMARTZOOM, "MOUSESMARTZOOM", 0, "Mouse/Trackpad Smart Zoom", ""},
69  {0, "", 0, NULL, NULL},
70  {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
71  {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
72  {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
73  {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
74  {0, NULL, 0, NULL, NULL},
75 };
76 
77 static const EnumPropertyItem event_timer_type_items[] = {
78  {TIMER, "TIMER", 0, "Timer", ""},
79  {TIMER0, "TIMER0", 0, "Timer 0", ""},
80  {TIMER1, "TIMER1", 0, "Timer 1", ""},
81  {TIMER2, "TIMER2", 0, "Timer 2", ""},
82  {TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", ""},
83  {TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", ""},
84  {TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", ""},
85  {TIMERREGION, "TIMERREGION", 0, "Timer Region", ""},
86  {0, NULL, 0, NULL, NULL},
87 };
88 
89 static const EnumPropertyItem event_textinput_type_items[] = {
90  {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
91  {0, NULL, 0, NULL, NULL},
92 };
93 
94 static const EnumPropertyItem event_ndof_type_items[] = {
95  {NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""},
96  /* buttons on all 3dconnexion devices */
97  {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""},
98  {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""},
99  /* view buttons */
100  {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "Top", ""},
101  {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "Bottom", ""},
102  {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "Left", ""},
103  {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "Right", ""},
104  {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""},
105  {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""},
106  /* more views */
107  {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "Isometric 1", ""},
108  {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "Isometric 2", ""},
109  /* 90 degree rotations */
110  {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""},
111  {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""},
112  {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "Spin CW", ""},
113  {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "Spin CCW", ""},
114  {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "Tilt CW", ""},
115  {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "Tilt CCW", ""},
116  /* device control */
117  {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "Rotate", ""},
118  {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "Pan/Zoom", ""},
119  {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""},
120  {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""},
121  {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""},
122  /* keyboard emulation */
123  {NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "Esc"},
124  {NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "Alt"},
125  {NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "Shift"},
126  {NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "Ctrl"},
127  /* general-purpose buttons */
128  {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""},
129  {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""},
130  {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "Button 3", ""},
131  {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "Button 4", ""},
132  {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "Button 5", ""},
133  {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "Button 6", ""},
134  {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "Button 7", ""},
135  {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""},
136  {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""},
137  {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""},
138  {NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""},
139  {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""},
140  {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""},
141  {0, NULL, 0, NULL, NULL},
142 };
143 #endif /* RNA_RUNTIME */
144 
145 /* not returned: CAPSLOCKKEY, UNKNOWNKEY */
147  /* Note we abuse 'tooltip' message here to store a 'compact' form of some (too) long names. */
148  {0, "NONE", 0, "", ""},
149  {LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", "LMB"},
150  {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", "MMB"},
151  {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", "RMB"},
152  {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4 Mouse", "MB4"},
153  {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", "MB5"},
154  {BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6 Mouse", "MB6"},
155  {BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7 Mouse", "MB7"},
156  {0, "", 0, NULL, NULL},
157  {TABLET_STYLUS, "PEN", 0, "Pen", ""},
158  {TABLET_ERASER, "ERASER", 0, "Eraser", ""},
159  {0, "", 0, NULL, NULL},
160  {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", "MsMov"},
161  {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "In-between Move", "MsSubMov"},
162  {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", "MsPan"},
163  {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", "MsZoom"},
164  {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", "MsRot"},
165  {MOUSESMARTZOOM, "MOUSESMARTZOOM", 0, "Mouse/Trackpad Smart Zoom", "MsSmartZoom"},
166  {0, "", 0, NULL, NULL},
167  {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", "WhUp"},
168  {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", "WhDown"},
169  {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", "WhIn"},
170  {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", "WhOut"},
171  {0, "", 0, NULL, NULL},
172  {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", "TwkL"},
173  {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", "TwkM"},
174  {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", "TwkR"},
175  {0, "", 0, NULL, NULL},
176  {EVT_AKEY, "A", 0, "A", ""},
177  {EVT_BKEY, "B", 0, "B", ""},
178  {EVT_CKEY, "C", 0, "C", ""},
179  {EVT_DKEY, "D", 0, "D", ""},
180  {EVT_EKEY, "E", 0, "E", ""},
181  {EVT_FKEY, "F", 0, "F", ""},
182  {EVT_GKEY, "G", 0, "G", ""},
183  {EVT_HKEY, "H", 0, "H", ""},
184  {EVT_IKEY, "I", 0, "I", ""},
185  {EVT_JKEY, "J", 0, "J", ""},
186  {EVT_KKEY, "K", 0, "K", ""},
187  {EVT_LKEY, "L", 0, "L", ""},
188  {EVT_MKEY, "M", 0, "M", ""},
189  {EVT_NKEY, "N", 0, "N", ""},
190  {EVT_OKEY, "O", 0, "O", ""},
191  {EVT_PKEY, "P", 0, "P", ""},
192  {EVT_QKEY, "Q", 0, "Q", ""},
193  {EVT_RKEY, "R", 0, "R", ""},
194  {EVT_SKEY, "S", 0, "S", ""},
195  {EVT_TKEY, "T", 0, "T", ""},
196  {EVT_UKEY, "U", 0, "U", ""},
197  {EVT_VKEY, "V", 0, "V", ""},
198  {EVT_WKEY, "W", 0, "W", ""},
199  {EVT_XKEY, "X", 0, "X", ""},
200  {EVT_YKEY, "Y", 0, "Y", ""},
201  {EVT_ZKEY, "Z", 0, "Z", ""},
202  {0, "", 0, NULL, NULL},
203  {EVT_ZEROKEY, "ZERO", 0, "0", ""},
204  {EVT_ONEKEY, "ONE", 0, "1", ""},
205  {EVT_TWOKEY, "TWO", 0, "2", ""},
206  {EVT_THREEKEY, "THREE", 0, "3", ""},
207  {EVT_FOURKEY, "FOUR", 0, "4", ""},
208  {EVT_FIVEKEY, "FIVE", 0, "5", ""},
209  {EVT_SIXKEY, "SIX", 0, "6", ""},
210  {EVT_SEVENKEY, "SEVEN", 0, "7", ""},
211  {EVT_EIGHTKEY, "EIGHT", 0, "8", ""},
212  {EVT_NINEKEY, "NINE", 0, "9", ""},
213  {0, "", 0, NULL, NULL},
214  {EVT_LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", "CtrlL"},
215  {EVT_LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", "AltL"},
216  {EVT_LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", "ShiftL"},
217  {EVT_RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", "AltR"},
218  {EVT_RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", "CtrlR"},
219  {EVT_RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"},
220  {0, "", 0, NULL, NULL},
221  {EVT_OSKEY, "OSKEY", 0, "OS Key", "Cmd"},
222  {EVT_APPKEY, "APP", 0, "Application", "App"},
223  {EVT_GRLESSKEY, "GRLESS", 0, "Grless", ""},
224  {EVT_ESCKEY, "ESC", 0, "Esc", ""},
225  {EVT_TABKEY, "TAB", 0, "Tab", ""},
226  {EVT_RETKEY, "RET", 0, "Return", "Enter"},
227  {EVT_SPACEKEY, "SPACE", 0, "Spacebar", "Space"},
228  {EVT_LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""},
229  {EVT_BACKSPACEKEY, "BACK_SPACE", 0, "Backspace", "BkSpace"},
230  {EVT_DELKEY, "DEL", 0, "Delete", "Del"},
231  {EVT_SEMICOLONKEY, "SEMI_COLON", 0, ";", ""},
232  {EVT_PERIODKEY, "PERIOD", 0, ".", ""},
233  {EVT_COMMAKEY, "COMMA", 0, ",", ""},
234  {EVT_QUOTEKEY, "QUOTE", 0, "\"", ""},
235  {EVT_ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""},
236  {EVT_MINUSKEY, "MINUS", 0, "-", ""},
237  {EVT_PLUSKEY, "PLUS", 0, "+", ""},
238  {EVT_SLASHKEY, "SLASH", 0, "/", ""},
239  {EVT_BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""},
240  {EVT_EQUALKEY, "EQUAL", 0, "=", ""},
241  {EVT_LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""},
242  {EVT_RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""},
243  {EVT_LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", "←"},
244  {EVT_DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", "↓"},
245  {EVT_RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", "→"},
246  {EVT_UPARROWKEY, "UP_ARROW", 0, "Up Arrow", "↑"},
247  {EVT_PAD2, "NUMPAD_2", 0, "Numpad 2", "Pad2"},
248  {EVT_PAD4, "NUMPAD_4", 0, "Numpad 4", "Pad4"},
249  {EVT_PAD6, "NUMPAD_6", 0, "Numpad 6", "Pad6"},
250  {EVT_PAD8, "NUMPAD_8", 0, "Numpad 8", "Pad8"},
251  {EVT_PAD1, "NUMPAD_1", 0, "Numpad 1", "Pad1"},
252  {EVT_PAD3, "NUMPAD_3", 0, "Numpad 3", "Pad3"},
253  {EVT_PAD5, "NUMPAD_5", 0, "Numpad 5", "Pad5"},
254  {EVT_PAD7, "NUMPAD_7", 0, "Numpad 7", "Pad7"},
255  {EVT_PAD9, "NUMPAD_9", 0, "Numpad 9", "Pad9"},
256  {EVT_PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", "Pad."},
257  {EVT_PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", "Pad/"},
258  {EVT_PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", "Pad*"},
259  {EVT_PAD0, "NUMPAD_0", 0, "Numpad 0", "Pad0"},
260  {EVT_PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", "Pad-"},
261  {EVT_PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", "PadEnter"},
262  {EVT_PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", "Pad+"},
263  {EVT_F1KEY, "F1", 0, "F1", ""},
264  {EVT_F2KEY, "F2", 0, "F2", ""},
265  {EVT_F3KEY, "F3", 0, "F3", ""},
266  {EVT_F4KEY, "F4", 0, "F4", ""},
267  {EVT_F5KEY, "F5", 0, "F5", ""},
268  {EVT_F6KEY, "F6", 0, "F6", ""},
269  {EVT_F7KEY, "F7", 0, "F7", ""},
270  {EVT_F8KEY, "F8", 0, "F8", ""},
271  {EVT_F9KEY, "F9", 0, "F9", ""},
272  {EVT_F10KEY, "F10", 0, "F10", ""},
273  {EVT_F11KEY, "F11", 0, "F11", ""},
274  {EVT_F12KEY, "F12", 0, "F12", ""},
275  {EVT_F13KEY, "F13", 0, "F13", ""},
276  {EVT_F14KEY, "F14", 0, "F14", ""},
277  {EVT_F15KEY, "F15", 0, "F15", ""},
278  {EVT_F16KEY, "F16", 0, "F16", ""},
279  {EVT_F17KEY, "F17", 0, "F17", ""},
280  {EVT_F18KEY, "F18", 0, "F18", ""},
281  {EVT_F19KEY, "F19", 0, "F19", ""},
282  {EVT_F20KEY, "F20", 0, "F20", ""},
283  {EVT_F21KEY, "F21", 0, "F21", ""},
284  {EVT_F22KEY, "F22", 0, "F22", ""},
285  {EVT_F23KEY, "F23", 0, "F23", ""},
286  {EVT_F24KEY, "F24", 0, "F24", ""},
287  {EVT_PAUSEKEY, "PAUSE", 0, "Pause", ""},
288  {EVT_INSERTKEY, "INSERT", 0, "Insert", "Ins"},
289  {EVT_HOMEKEY, "HOME", 0, "Home", ""},
290  {EVT_PAGEUPKEY, "PAGE_UP", 0, "Page Up", "PgUp"},
291  {EVT_PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", "PgDown"},
292  {EVT_ENDKEY, "END", 0, "End", ""},
293  {0, "", 0, NULL, NULL},
294  {EVT_MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ">/||"},
295  {EVT_MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", "Stop"},
296  {EVT_MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", "|<<"},
297  {EVT_MEDIALAST, "MEDIA_LAST", 0, "Media Last", ">>|"},
298  {0, "", 0, NULL, NULL},
299  {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", "TxtIn"},
300  {0, "", 0, NULL, NULL},
301  {WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""},
302  {TIMER, "TIMER", 0, "Timer", "Tmr"},
303  {TIMER0, "TIMER0", 0, "Timer 0", "Tmr0"},
304  {TIMER1, "TIMER1", 0, "Timer 1", "Tmr1"},
305  {TIMER2, "TIMER2", 0, "Timer 2", "Tmr2"},
306  {TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", "TmrJob"},
307  {TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", "TmrSave"},
308  {TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", "TmrReport"},
309  {TIMERREGION, "TIMERREGION", 0, "Timer Region", "TmrReg"},
310  {0, "", 0, NULL, NULL},
311  {NDOF_MOTION, "NDOF_MOTION", 0, "NDOF Motion", "NdofMov"},
312  /* buttons on all 3dconnexion devices */
313  {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "NDOF Menu", "NdofMenu"},
314  {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "NDOF Fit", "NdofFit"},
315  /* view buttons */
316  {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "NDOF Top", "Ndof↑"},
317  {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "NDOF Bottom", "Ndof↓"},
318  {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "NDOF Left", "Ndof←"},
319  {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "NDOF Right", "Ndof→"},
320  {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "NDOF Front", "NdofFront"},
321  {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "NDOF Back", "NdofBack"},
322  /* more views */
323  {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "NDOF Isometric 1", "NdofIso1"},
324  {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "NDOF Isometric 2", "NdofIso2"},
325  /* 90 degree rotations */
326  {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "NDOF Roll CW", "NdofRCW"},
327  {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "NDOF Roll CCW", "NdofRCCW"},
328  {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "NDOF Spin CW", "NdofSCW"},
329  {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "NDOF Spin CCW", "NdofSCCW"},
330  {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "NDOF Tilt CW", "NdofTCW"},
331  {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "NDOF Tilt CCW", "NdofTCCW"},
332  /* device control */
333  {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "NDOF Rotate", "NdofRot"},
334  {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "NDOF Pan/Zoom", "NdofPanZoom"},
335  {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "NDOF Dominant", "NdofDom"},
336  {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "NDOF Plus", "Ndof+"},
337  {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "NDOF Minus", "Ndof-"},
338  /* keyboard emulation */
339  {NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "NDOF Esc", "NdofEsc"},
340  {NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "NDOF Alt", "NdofAlt"},
341  {NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "NDOF Shift", "NdofShift"},
342  {NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "NDOF Ctrl", "NdofCtrl"},
343  /* general-purpose buttons */
344  {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "NDOF Button 1", "NdofB1"},
345  {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "NDOF Button 2", "NdofB2"},
346  {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "NDOF Button 3", "NdofB3"},
347  {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "NDOF Button 4", "NdofB4"},
348  {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "NDOF Button 5", "NdofB5"},
349  {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "NDOF Button 6", "NdofB6"},
350  {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "NDOF Button 7", "NdofB7"},
351  {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "NDOF Button 8", "NdofB8"},
352  {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "NDOF Button 9", "NdofB9"},
353  {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "NDOF Button 10", "NdofB10"},
354  {NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "NDOF Button A", "NdofBA"},
355  {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", "NdofBB"},
356  {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", "NdofBC"},
357  /* Action Zones. */
358  {EVT_ACTIONZONE_AREA, "ACTIONZONE_AREA", 0, "ActionZone Area", "AZone Area"},
359  {EVT_ACTIONZONE_REGION, "ACTIONZONE_REGION", 0, "ActionZone Region", "AZone Region"},
361  "ACTIONZONE_FULLSCREEN",
362  0,
363  "ActionZone Fullscreen",
364  "AZone FullScr"},
365  {0, NULL, 0, NULL, NULL},
366 };
367 
377  {KM_ANY, "ANY", 0, "Any", ""},
378  {KM_PRESS, "PRESS", 0, "Press", ""},
379  {KM_RELEASE, "RELEASE", 0, "Release", ""},
380  {KM_CLICK, "CLICK", 0, "Click", ""},
381  {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
382  {KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
383  {EVT_GESTURE_N, "NORTH", 0, "North", ""},
384  {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
385  {EVT_GESTURE_E, "EAST", 0, "East", ""},
386  {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
387  {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
388  {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
389  {EVT_GESTURE_W, "WEST", 0, "West", ""},
390  {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
391  {KM_NOTHING, "NOTHING", 0, "Nothing", ""},
392  {0, NULL, 0, NULL, NULL},
393 };
394 
396  {KM_ANY, "ANY", 0, "Any", ""},
397  {KM_PRESS, "PRESS", 0, "Press", ""},
398  {KM_RELEASE, "RELEASE", 0, "Release", ""},
399  {KM_CLICK, "CLICK", 0, "Click", ""},
400  {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
401  {KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
402  /* Used for NDOF and trackpad events. */
403  {KM_NOTHING, "NOTHING", 0, "Nothing", ""},
404  {0, NULL, 0, NULL, NULL},
405 };
406 
408  {KM_ANY, "ANY", 0, "Any", ""},
409  {EVT_GESTURE_N, "NORTH", 0, "North", ""},
410  {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
411  {EVT_GESTURE_E, "EAST", 0, "East", ""},
412  {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
413  {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
414  {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
415  {EVT_GESTURE_W, "WEST", 0, "West", ""},
416  {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
417  {0, NULL, 0, NULL, NULL},
418 };
419 
421  {0, "NONE", 0, "", ""},
422  {0, NULL, 0, NULL, NULL},
423 };
424 
425 /* Mask event types used in keymap items. */
427  {EVT_TYPE_MASK_KEYBOARD_MODIFIER, "KEYBOARD_MODIFIER", 0, "Keyboard Modifier", ""},
428  {EVT_TYPE_MASK_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
429  {EVT_TYPE_MASK_MOUSE_WHEEL, "MOUSE_WHEEL", 0, "Mouse Wheel", ""},
430  {EVT_TYPE_MASK_MOUSE_GESTURE, "MOUSE_GESTURE", 0, "Mouse Gesture", ""},
431  {EVT_TYPE_MASK_MOUSE_BUTTON, "MOUSE_BUTTON", 0, "Mouse Button", ""},
432  {EVT_TYPE_MASK_MOUSE, "MOUSE", 0, "Mouse", ""},
433  {EVT_TYPE_MASK_NDOF, "NDOF", 0, "NDOF", ""},
434  {EVT_TYPE_MASK_TWEAK, "TWEAK", 0, "Tweak", ""},
435  {EVT_TYPE_MASK_ACTIONZONE, "ACTIONZONE", 0, "Action Zone", ""},
436  {0, NULL, 0, NULL, NULL},
437 };
438 
439 #if 0
440 static const EnumPropertyItem keymap_modifiers_items[] = {
441  {KM_ANY, "ANY", 0, "Any", ""},
442  {0, "NONE", 0, "None", ""},
443  {1, "FIRST", 0, "First", ""},
444  {2, "SECOND", 0, "Second", ""},
445  {0, NULL, 0, NULL, NULL},
446 };
447 #endif
448 
451  "REGISTER",
452  0,
453  "Register",
454  "Display in the info window and support the redo toolbar panel"},
455  {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
457  "UNDO_GROUPED",
458  0,
459  "Grouped Undo",
460  "Push a single undo event for repeated instances of this operator"},
461  {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
462  {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
464  "GRAB_CURSOR",
465  0,
466  "Grab Pointer",
467  "Use so the operator grabs the mouse focus, enables wrapping when continuous grab "
468  "is enabled"},
469  {OPTYPE_GRAB_CURSOR_X, "GRAB_CURSOR_X", 0, "Grab Pointer X", "Grab, only warping the X axis"},
470  {OPTYPE_GRAB_CURSOR_Y, "GRAB_CURSOR_Y", 0, "Grab Pointer Y", "Grab, only warping the Y axis"},
471  {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
472  {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
473  {0, NULL, 0, NULL, NULL},
474 };
475 
478  "RUNNING_MODAL",
479  0,
480  "Running Modal",
481  "Keep the operator running with blender"},
483  "CANCELLED",
484  0,
485  "Cancelled",
486  "The operator exited without doing anything, so no undo entry should be pushed"},
488  "FINISHED",
489  0,
490  "Finished",
491  "The operator exited after completing its action"},
492  /* used as a flag */
493  {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
494  {OPERATOR_INTERFACE, "INTERFACE", 0, "Interface", "Handled but not executed (popup menus)"},
495  {0, NULL, 0, NULL, NULL},
496 };
497 
500  "ADVANCED",
501  0,
502  "Advanced",
503  "The property is advanced so UI is suggested to hide it"},
504  {0, NULL, 0, NULL, NULL},
505 };
506 
507 /* flag/enum */
509  {RPT_DEBUG, "DEBUG", 0, "Debug", ""},
510  {RPT_INFO, "INFO", 0, "Info", ""},
511  {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""},
512  {RPT_PROPERTY, "PROPERTY", 0, "Property", ""},
513  {RPT_WARNING, "WARNING", 0, "Warning", ""},
514  {RPT_ERROR, "ERROR", 0, "Error", ""},
515  {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},
516  {RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""},
517  {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""},
518  {0, NULL, 0, NULL, NULL},
519 };
520 
521 #ifdef RNA_RUNTIME
522 
523 # include "BLI_string_utils.h"
524 
525 # include "WM_api.h"
526 
527 # include "DNA_object_types.h"
528 # include "DNA_workspace_types.h"
529 
530 # include "ED_screen.h"
531 
532 # include "UI_interface.h"
533 
534 # include "BKE_global.h"
535 # include "BKE_idprop.h"
536 
537 # include "MEM_guardedalloc.h"
538 
539 # ifdef WITH_PYTHON
540 # include "BPY_extern.h"
541 # endif
542 
543 static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
544 {
546 
547  if (wm) {
548  IDProperty *properties = (IDProperty *)ptr->data;
549  for (wmOperator *op = wm->operators.last; op; op = op->prev) {
550  if (op->properties == properties) {
551  return op;
552  }
553  }
554  }
555 
556  return NULL;
557 }
558 
559 static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
560 {
561  wmOperator *op = rna_OperatorProperties_find_operator(ptr);
562 
563  if (op) {
564  return op->type->srna;
565  }
566  else {
567  return ptr->type;
568  }
569 }
570 
571 static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, bool create)
572 {
573  if (create && !ptr->data) {
574  IDPropertyTemplate val = {0};
575  ptr->data = IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group");
576  }
577 
578  return ptr->data;
579 }
580 
581 static void rna_Operator_name_get(PointerRNA *ptr, char *value)
582 {
583  wmOperator *op = (wmOperator *)ptr->data;
584  strcpy(value, op->type->name);
585 }
586 
587 static int rna_Operator_name_length(PointerRNA *ptr)
588 {
589  wmOperator *op = (wmOperator *)ptr->data;
590  return strlen(op->type->name);
591 }
592 
593 static bool rna_Operator_has_reports_get(PointerRNA *ptr)
594 {
595  wmOperator *op = (wmOperator *)ptr->data;
596  return (op->reports && op->reports->list.first);
597 }
598 
599 static PointerRNA rna_Operator_options_get(PointerRNA *ptr)
600 {
601  return rna_pointer_inherit_refine(ptr, &RNA_OperatorOptions, ptr->data);
602 }
603 
604 static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
605 {
606  wmOperator *op = (wmOperator *)ptr->data;
607 
610  result.data = op->properties;
611  return result;
612 }
613 
614 static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
615 {
617  wmOperatorType *ot = WM_operatortype_find(otmacro->idname, true);
618 
621  result.data = otmacro->properties;
622  return result;
623 }
624 
625 static const EnumPropertyItem *rna_Event_value_itemf(bContext *UNUSED(C),
626  PointerRNA *ptr,
627  PropertyRNA *UNUSED(prop),
628  bool *UNUSED(r_free))
629 {
630  const wmEvent *event = ptr->data;
631  if (ISTWEAK(event->type)) {
633  }
635 }
636 
637 static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
638 {
639  const wmEvent *event = ptr->data;
640  value[0] = event->ascii;
641  value[1] = '\0';
642 }
643 
644 static int rna_Event_ascii_length(PointerRNA *ptr)
645 {
646  const wmEvent *event = ptr->data;
647  return (event->ascii) ? 1 : 0;
648 }
649 
650 static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
651 {
652  /* utf8 buf isn't \0 terminated */
653  const wmEvent *event = ptr->data;
654  size_t len = 0;
655 
656  if (event->utf8_buf[0]) {
657  BLI_str_utf8_as_unicode_and_size(event->utf8_buf, &len);
658  if (len > 0) {
659  memcpy(value, event->utf8_buf, len);
660  }
661  }
662 
663  value[len] = '\0';
664 }
665 
666 static int rna_Event_unicode_length(PointerRNA *ptr)
667 {
668 
669  const wmEvent *event = ptr->data;
670  if (event->utf8_buf[0]) {
671  /* invalid value is checked on assignment so we don't need to account for this */
672  return BLI_str_utf8_size(event->utf8_buf);
673  }
674  else {
675  return 0;
676  }
677 }
678 
679 static bool rna_Event_is_repeat_get(PointerRNA *ptr)
680 {
681  const wmEvent *event = ptr->data;
682  return event->is_repeat;
683 }
684 
685 static float rna_Event_pressure_get(PointerRNA *ptr)
686 {
687  const wmEvent *event = ptr->data;
688  return WM_event_tablet_data(event, NULL, NULL);
689 }
690 
691 static bool rna_Event_is_tablet_get(PointerRNA *ptr)
692 {
693  const wmEvent *event = ptr->data;
694  return WM_event_is_tablet(event);
695 }
696 
697 static void rna_Event_tilt_get(PointerRNA *ptr, float *values)
698 {
699  wmEvent *event = ptr->data;
700  WM_event_tablet_data(event, NULL, values);
701 }
702 
703 static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr)
704 {
705  struct uiPopupMenu *pup = ptr->data;
707 
708  PointerRNA rptr;
710 
711  return rptr;
712 }
713 
714 static PointerRNA rna_PopoverMenu_layout_get(PointerRNA *ptr)
715 {
716  struct uiPopover *pup = ptr->data;
718 
719  PointerRNA rptr;
721 
722  return rptr;
723 }
724 
725 static PointerRNA rna_PieMenu_layout_get(PointerRNA *ptr)
726 {
727  struct uiPieMenu *pie = ptr->data;
729 
730  PointerRNA rptr;
732 
733  return rptr;
734 }
735 
736 static void rna_Window_scene_set(PointerRNA *ptr,
737  PointerRNA value,
738  struct ReportList *UNUSED(reports))
739 {
740  wmWindow *win = ptr->data;
741 
742  if (value.data == NULL) {
743  return;
744  }
745 
746  win->new_scene = value.data;
747 }
748 
749 static void rna_Window_scene_update(bContext *C, PointerRNA *ptr)
750 {
751  Main *bmain = CTX_data_main(C);
752  wmWindow *win = ptr->data;
753 
754  /* exception: must use context so notifier gets to the right window */
755  if (win->new_scene) {
756 # ifdef WITH_PYTHON
758 # endif
759 
760  WM_window_set_active_scene(bmain, C, win, win->new_scene);
761 
762 # ifdef WITH_PYTHON
764 # endif
765 
768 
769  if (G.debug & G_DEBUG) {
770  printf("scene set %p\n", win->new_scene);
771  }
772 
773  win->new_scene = NULL;
774  }
775 }
776 
777 static PointerRNA rna_Window_workspace_get(PointerRNA *ptr)
778 {
779  wmWindow *win = ptr->data;
782 }
783 
784 static void rna_Window_workspace_set(PointerRNA *ptr,
785  PointerRNA value,
786  struct ReportList *UNUSED(reports))
787 {
788  wmWindow *win = (wmWindow *)ptr->data;
789 
790  /* disallow ID-browsing away from temp screens */
792  return;
793  }
794  if (value.data == NULL) {
795  return;
796  }
797 
798  /* exception: can't set workspaces inside of area/region handlers */
800 }
801 
802 static void rna_Window_workspace_update(bContext *C, PointerRNA *ptr)
803 {
804  wmWindow *win = ptr->data;
805  WorkSpace *new_workspace = win->workspace_hook->temp_workspace_store;
806 
807  /* exception: can't set screens inside of area/region handlers,
808  * and must use context so notifier gets to the right window */
809  if (new_workspace) {
811  WM_event_add_notifier_ex(wm, win, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
813  }
814 }
815 
816 PointerRNA rna_Window_screen_get(PointerRNA *ptr)
817 {
818  wmWindow *win = ptr->data;
821 }
822 
823 static void rna_Window_screen_set(PointerRNA *ptr,
824  PointerRNA value,
825  struct ReportList *UNUSED(reports))
826 {
827  wmWindow *win = ptr->data;
829  WorkSpaceLayout *layout_new;
831 
832  /* disallow ID-browsing away from temp screens */
833  if (screen->temp) {
834  return;
835  }
836  if (value.data == NULL) {
837  return;
838  }
839 
840  /* exception: can't set screens inside of area/region handlers */
841  layout_new = BKE_workspace_layout_find(workspace, value.data);
842  win->workspace_hook->temp_layout_store = layout_new;
843 }
844 
845 static bool rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
846 {
847  bScreen *screen = (bScreen *)value.owner_id;
848  return !screen->temp;
849 }
850 
851 static void rna_workspace_screen_update(bContext *C, PointerRNA *ptr)
852 {
853  wmWindow *win = ptr->data;
855 
856  /* exception: can't set screens inside of area/region handlers,
857  * and must use context so notifier gets to the right window */
858  if (layout_new) {
860  WM_event_add_notifier_ex(wm, win, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
862  }
863 }
864 
865 static PointerRNA rna_Window_view_layer_get(PointerRNA *ptr)
866 {
867  wmWindow *win = ptr->data;
869  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
870  PointerRNA scene_ptr;
871 
872  RNA_id_pointer_create(&scene->id, &scene_ptr);
873  return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, view_layer);
874 }
875 
876 static void rna_Window_view_layer_set(PointerRNA *ptr,
877  PointerRNA value,
878  struct ReportList *UNUSED(reports))
879 {
880  wmWindow *win = ptr->data;
881  ViewLayer *view_layer = value.data;
882 
883  WM_window_set_active_view_layer(win, view_layer);
884 }
885 
886 static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
887 {
888  wmKeyMapItem *kmi = ptr->data;
889 
890  if (kmi->ptr) {
891  BLI_assert(kmi->ptr->owner_id == NULL);
892  return *(kmi->ptr);
893  }
894 
895  /*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */
896  return PointerRNA_NULL;
897 }
898 
899 static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr)
900 {
901  wmKeyMapItem *kmi = ptr->data;
902 
903  return WM_keymap_item_map_type_get(kmi);
904 }
905 
906 static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
907 {
908  wmKeyMapItem *kmi = ptr->data;
909  int map_type = rna_wmKeyMapItem_map_type_get(ptr);
910 
911  if (value != map_type) {
912  switch (value) {
913  case KMI_TYPE_KEYBOARD:
914  kmi->type = EVT_AKEY;
915  kmi->val = KM_PRESS;
916  break;
917  case KMI_TYPE_TWEAK:
918  kmi->type = EVT_TWEAK_L;
919  kmi->val = KM_ANY;
920  break;
921  case KMI_TYPE_MOUSE:
922  kmi->type = LEFTMOUSE;
923  kmi->val = KM_PRESS;
924  break;
925  case KMI_TYPE_TEXTINPUT:
926  kmi->type = KM_TEXTINPUT;
927  kmi->val = KM_NOTHING;
928  break;
929  case KMI_TYPE_TIMER:
930  kmi->type = TIMER;
931  kmi->val = KM_NOTHING;
932  break;
933  case KMI_TYPE_NDOF:
934  kmi->type = NDOF_MOTION;
935  kmi->val = KM_NOTHING;
936  break;
937  }
938  }
939 }
940 
941 /* assumes value to be an enum from rna_enum_event_type_items */
942 /* function makes sure keymodifiers are only valid keys, ESC keeps it unaltered */
943 static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value)
944 {
945  wmKeyMapItem *kmi = ptr->data;
946 
947  /* XXX, this should really be managed in an _itemf function,
948  * giving a list of valid enums, then silently changing them when they are set is not
949  * a good precedent, don't do this unless you have a good reason! */
950  if (value == EVT_ESCKEY) {
951  /* pass */
952  }
953  else if (value >= EVT_AKEY) {
954  kmi->keymodifier = value;
955  }
956  else {
957  kmi->keymodifier = 0;
958  }
959 }
960 
961 static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C),
962  PointerRNA *ptr,
963  PropertyRNA *UNUSED(prop),
964  bool *UNUSED(r_free))
965 {
966  int map_type = rna_wmKeyMapItem_map_type_get(ptr);
967 
968  if (map_type == KMI_TYPE_MOUSE) {
969  return event_mouse_type_items;
970  }
971  if (map_type == KMI_TYPE_TWEAK) {
972  return event_tweak_type_items;
973  }
974  if (map_type == KMI_TYPE_TIMER) {
975  return event_timer_type_items;
976  }
977  if (map_type == KMI_TYPE_NDOF) {
978  return event_ndof_type_items;
979  }
980  if (map_type == KMI_TYPE_TEXTINPUT) {
981  return event_textinput_type_items;
982  }
983  else {
985  }
986 }
987 
988 static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C),
989  PointerRNA *ptr,
990  PropertyRNA *UNUSED(prop),
991  bool *UNUSED(r_free))
992 {
993  int map_type = rna_wmKeyMapItem_map_type_get(ptr);
994 
995  if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF) {
997  }
998  if (map_type == KMI_TYPE_TWEAK) {
1000  }
1001  else {
1003  }
1004 }
1005 
1006 static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C,
1007  PointerRNA *ptr,
1008  PropertyRNA *UNUSED(prop),
1009  bool *UNUSED(r_free))
1010 {
1012  wmKeyConfig *kc;
1013  wmKeyMap *km;
1014 
1015  for (kc = wm->keyconfigs.first; kc; kc = kc->next) {
1016  for (km = kc->keymaps.first; km; km = km->next) {
1017  /* only check if it's a modal keymap */
1018  if (km->modal_items) {
1019  wmKeyMapItem *kmi;
1020  for (kmi = km->items.first; kmi; kmi = kmi->next) {
1021  if (kmi == ptr->data) {
1022  return km->modal_items;
1023  }
1024  }
1025  }
1026  }
1027  }
1028 
1029  return rna_enum_keymap_propvalue_items; /* ERROR */
1030 }
1031 
1032 static bool rna_KeyMapItem_any_get(PointerRNA *ptr)
1033 {
1034  wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
1035 
1036  if (kmi->shift == KM_ANY && kmi->ctrl == KM_ANY && kmi->alt == KM_ANY && kmi->oskey == KM_ANY) {
1037  return 1;
1038  }
1039  else {
1040  return 0;
1041  }
1042 }
1043 
1044 static void rna_KeyMapItem_any_set(PointerRNA *ptr, bool value)
1045 {
1046  wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
1047 
1048  if (value) {
1049  kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = KM_ANY;
1050  }
1051  else {
1052  kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = 0;
1053  }
1054 }
1055 
1056 static bool rna_KeyMapItem_shift_get(PointerRNA *ptr)
1057 {
1058  wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
1059  return kmi->shift != 0;
1060 }
1061 
1062 static bool rna_KeyMapItem_ctrl_get(PointerRNA *ptr)
1063 {
1064  wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
1065  return kmi->ctrl != 0;
1066 }
1067 
1068 static bool rna_KeyMapItem_alt_get(PointerRNA *ptr)
1069 {
1070  wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
1071  return kmi->alt != 0;
1072 }
1073 
1074 static bool rna_KeyMapItem_oskey_get(PointerRNA *ptr)
1075 {
1076  wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
1077  return kmi->oskey != 0;
1078 }
1079 
1080 static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
1081 {
1082  wmWindowManager *wm = ptr->data;
1083  wmKeyConfig *kc;
1084 
1085  kc = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
1086 
1087  if (!kc) {
1088  kc = wm->defaultconf;
1089  }
1090 
1092 }
1093 
1094 static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr,
1095  PointerRNA value,
1096  struct ReportList *UNUSED(reports))
1097 {
1098  wmWindowManager *wm = ptr->data;
1099  wmKeyConfig *kc = value.data;
1100 
1101  if (kc) {
1103  }
1104 }
1105 
1106 /* -------------------------------------------------------------------- */
1110 static PointerRNA rna_wmKeyConfig_preferences_get(PointerRNA *ptr)
1111 {
1112  wmKeyConfig *kc = ptr->data;
1114  if (kpt_rt) {
1116  return rna_pointer_inherit_refine(ptr, kpt_rt->rna_ext.srna, kpt->prop);
1117  }
1118  else {
1119  return PointerRNA_NULL;
1120  }
1121 }
1122 
1123 static IDProperty *rna_wmKeyConfigPref_idprops(PointerRNA *ptr, bool create)
1124 {
1125  if (create && !ptr->data) {
1126  IDPropertyTemplate val = {0};
1127  ptr->data = IDP_New(IDP_GROUP, &val, "RNA_KeyConfigPreferences group");
1128  }
1129  return ptr->data;
1130 }
1131 
1132 static void rna_wmKeyConfigPref_unregister(Main *UNUSED(bmain), StructRNA *type)
1133 {
1135 
1136  if (!kpt_rt) {
1137  return;
1138  }
1139 
1140  RNA_struct_free_extension(type, &kpt_rt->rna_ext);
1142 
1143  /* Possible we're not in the preferences if they have been reset. */
1145 
1146  /* update while blender is running */
1148 }
1149 
1150 static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
1151  ReportList *reports,
1152  void *data,
1153  const char *identifier,
1154  StructValidateFunc validate,
1155  StructCallbackFunc call,
1157 {
1158  wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
1159  wmKeyConfigPref dummy_kpt = {NULL};
1160  PointerRNA dummy_ptr;
1161  // int have_function[1];
1162 
1163  /* setup dummy keyconf-prefs & keyconf-prefs type to store static properties in */
1164  RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_ptr);
1165 
1166  /* validate the python class */
1167  if (validate(&dummy_ptr, data, NULL /* have_function */) != 0) {
1168  return NULL;
1169  }
1170 
1171  STRNCPY(dummy_kpt_rt.idname, dummy_kpt.idname);
1172  if (strlen(identifier) >= sizeof(dummy_kpt_rt.idname)) {
1173  BKE_reportf(reports,
1174  RPT_ERROR,
1175  "Registering key-config preferences class: '%s' is too long, maximum length is %d",
1176  identifier,
1177  (int)sizeof(dummy_kpt_rt.idname));
1178  return NULL;
1179  }
1180 
1181  /* check if we have registered this keyconf-prefs type before, and remove it */
1182  kpt_rt = BKE_keyconfig_pref_type_find(dummy_kpt.idname, true);
1183  if (kpt_rt && kpt_rt->rna_ext.srna) {
1184  rna_wmKeyConfigPref_unregister(bmain, kpt_rt->rna_ext.srna);
1185  }
1186 
1187  /* create a new keyconf-prefs type */
1188  kpt_rt = MEM_mallocN(sizeof(wmKeyConfigPrefType_Runtime), "keyconfigpreftype");
1189  memcpy(kpt_rt, &dummy_kpt_rt, sizeof(dummy_kpt_rt));
1190 
1192 
1193  kpt_rt->rna_ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_KeyConfigPreferences);
1194  kpt_rt->rna_ext.data = data;
1195  kpt_rt->rna_ext.call = call;
1196  kpt_rt->rna_ext.free = free;
1197  RNA_struct_blender_type_set(kpt_rt->rna_ext.srna, kpt_rt);
1198 
1199  // kpt_rt->draw = (have_function[0]) ? header_draw : NULL;
1200 
1201  /* update while blender is running */
1203 
1204  return kpt_rt->rna_ext.srna;
1205 }
1206 
1207 /* placeholder, doesn't do anything useful yet */
1208 static StructRNA *rna_wmKeyConfigPref_refine(PointerRNA *ptr)
1209 {
1210  return (ptr->type) ? ptr->type : &RNA_KeyConfigPreferences;
1211 }
1212 
1215 static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value)
1216 {
1217  wmKeyMapItem *kmi = ptr->data;
1218  WM_operator_py_idname(value, kmi->idname);
1219 }
1220 
1221 static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
1222 {
1223  wmKeyMapItem *kmi = ptr->data;
1224  char pyname[OP_MAX_TYPENAME];
1225 
1226  WM_operator_py_idname(pyname, kmi->idname);
1227  return strlen(pyname);
1228 }
1229 
1230 static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
1231 {
1232  wmKeyMapItem *kmi = ptr->data;
1233  char idname[OP_MAX_TYPENAME];
1234 
1235  WM_operator_bl_idname(idname, value);
1236 
1237  if (!STREQ(idname, kmi->idname)) {
1238  BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
1239 
1241  }
1242 }
1243 
1244 static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value)
1245 {
1246  wmKeyMapItem *kmi = ptr->data;
1248  strcpy(value, ot ? WM_operatortype_name(ot, kmi->ptr) : kmi->idname);
1249 }
1250 
1251 static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
1252 {
1253  wmKeyMapItem *kmi = ptr->data;
1255  return strlen(ot ? WM_operatortype_name(ot, kmi->ptr) : kmi->idname);
1256 }
1257 
1258 static bool rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
1259 {
1260  wmKeyMapItem *kmi = ptr->data;
1261  return kmi->id < 0;
1262 }
1263 
1264 static PointerRNA rna_WindowManager_xr_session_state_get(PointerRNA *ptr)
1265 {
1266  wmWindowManager *wm = ptr->data;
1267  struct wmXrSessionState *state =
1268 # ifdef WITH_XR_OPENXR
1270 # else
1271  NULL;
1272  UNUSED_VARS(wm);
1273 # endif
1274 
1276 }
1277 
1278 # ifdef WITH_PYTHON
1279 
1280 static bool rna_operator_poll_cb(bContext *C, wmOperatorType *ot)
1281 {
1282  extern FunctionRNA rna_Operator_poll_func;
1283 
1284  PointerRNA ptr;
1285  ParameterList list;
1286  FunctionRNA *func;
1287  void *ret;
1288  bool visible;
1289 
1290  RNA_pointer_create(NULL, ot->rna_ext.srna, NULL, &ptr); /* dummy */
1291  func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
1292 
1293  RNA_parameter_list_create(&list, &ptr, func);
1294  RNA_parameter_set_lookup(&list, "context", &C);
1295  ot->rna_ext.call(C, &ptr, func, &list);
1296 
1297  RNA_parameter_get_lookup(&list, "visible", &ret);
1298  visible = *(bool *)ret;
1299 
1300  RNA_parameter_list_free(&list);
1301 
1302  return visible;
1303 }
1304 
1305 static int rna_operator_execute_cb(bContext *C, wmOperator *op)
1306 {
1307  extern FunctionRNA rna_Operator_execute_func;
1308 
1309  PointerRNA opr;
1310  ParameterList list;
1311  FunctionRNA *func;
1312  void *ret;
1313  int result;
1314 
1315  RNA_pointer_create(NULL, op->type->rna_ext.srna, op, &opr);
1316  func = &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
1317 
1318  RNA_parameter_list_create(&list, &opr, func);
1319  RNA_parameter_set_lookup(&list, "context", &C);
1320  op->type->rna_ext.call(C, &opr, func, &list);
1321 
1322  RNA_parameter_get_lookup(&list, "result", &ret);
1323  result = *(int *)ret;
1324 
1325  RNA_parameter_list_free(&list);
1326 
1327  return result;
1328 }
1329 
1330 /* same as execute() but no return value */
1331 static bool rna_operator_check_cb(bContext *C, wmOperator *op)
1332 {
1333  extern FunctionRNA rna_Operator_check_func;
1334 
1335  PointerRNA opr;
1336  ParameterList list;
1337  FunctionRNA *func;
1338  void *ret;
1339  bool result;
1340 
1341  RNA_pointer_create(NULL, op->type->rna_ext.srna, op, &opr);
1342  func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
1343 
1344  RNA_parameter_list_create(&list, &opr, func);
1345  RNA_parameter_set_lookup(&list, "context", &C);
1346  op->type->rna_ext.call(C, &opr, func, &list);
1347 
1348  RNA_parameter_get_lookup(&list, "result", &ret);
1349  result = (*(bool *)ret) != 0;
1350 
1351  RNA_parameter_list_free(&list);
1352 
1353  return result;
1354 }
1355 
1356 static int rna_operator_invoke_cb(bContext *C, wmOperator *op, const wmEvent *event)
1357 {
1358  extern FunctionRNA rna_Operator_invoke_func;
1359 
1360  PointerRNA opr;
1361  ParameterList list;
1362  FunctionRNA *func;
1363  void *ret;
1364  int result;
1365 
1366  RNA_pointer_create(NULL, op->type->rna_ext.srna, op, &opr);
1367  func = &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
1368 
1369  RNA_parameter_list_create(&list, &opr, func);
1370  RNA_parameter_set_lookup(&list, "context", &C);
1371  RNA_parameter_set_lookup(&list, "event", &event);
1372  op->type->rna_ext.call(C, &opr, func, &list);
1373 
1374  RNA_parameter_get_lookup(&list, "result", &ret);
1375  result = *(int *)ret;
1376 
1377  RNA_parameter_list_free(&list);
1378 
1379  return result;
1380 }
1381 
1382 /* same as invoke */
1383 static int rna_operator_modal_cb(bContext *C, wmOperator *op, const wmEvent *event)
1384 {
1385  extern FunctionRNA rna_Operator_modal_func;
1386 
1387  PointerRNA opr;
1388  ParameterList list;
1389  FunctionRNA *func;
1390  void *ret;
1391  int result;
1392 
1393  RNA_pointer_create(NULL, op->type->rna_ext.srna, op, &opr);
1394  func = &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
1395 
1396  RNA_parameter_list_create(&list, &opr, func);
1397  RNA_parameter_set_lookup(&list, "context", &C);
1398  RNA_parameter_set_lookup(&list, "event", &event);
1399  op->type->rna_ext.call(C, &opr, func, &list);
1400 
1401  RNA_parameter_get_lookup(&list, "result", &ret);
1402  result = *(int *)ret;
1403 
1404  RNA_parameter_list_free(&list);
1405 
1406  return result;
1407 }
1408 
1409 static void rna_operator_draw_cb(bContext *C, wmOperator *op)
1410 {
1411  extern FunctionRNA rna_Operator_draw_func;
1412 
1413  PointerRNA opr;
1414  ParameterList list;
1415  FunctionRNA *func;
1416 
1417  RNA_pointer_create(NULL, op->type->rna_ext.srna, op, &opr);
1418  func = &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
1419 
1420  RNA_parameter_list_create(&list, &opr, func);
1421  RNA_parameter_set_lookup(&list, "context", &C);
1422  op->type->rna_ext.call(C, &opr, func, &list);
1423 
1424  RNA_parameter_list_free(&list);
1425 }
1426 
1427 /* same as exec(), but call cancel */
1428 static void rna_operator_cancel_cb(bContext *C, wmOperator *op)
1429 {
1430  extern FunctionRNA rna_Operator_cancel_func;
1431 
1432  PointerRNA opr;
1433  ParameterList list;
1434  FunctionRNA *func;
1435 
1436  RNA_pointer_create(NULL, op->type->rna_ext.srna, op, &opr);
1437  func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
1438 
1439  RNA_parameter_list_create(&list, &opr, func);
1440  RNA_parameter_set_lookup(&list, "context", &C);
1441  op->type->rna_ext.call(C, &opr, func, &list);
1442 
1443  RNA_parameter_list_free(&list);
1444 }
1445 
1446 static char *rna_operator_description_cb(bContext *C, wmOperatorType *ot, PointerRNA *prop_ptr)
1447 {
1448  extern FunctionRNA rna_Operator_description_func;
1449 
1450  PointerRNA ptr;
1451  ParameterList list;
1452  FunctionRNA *func;
1453  void *ret;
1454  char *result;
1455 
1456  RNA_pointer_create(NULL, ot->rna_ext.srna, NULL, &ptr); /* dummy */
1457  func = &rna_Operator_description_func; /* RNA_struct_find_function(&ptr, "description"); */
1458 
1459  RNA_parameter_list_create(&list, &ptr, func);
1460  RNA_parameter_set_lookup(&list, "context", &C);
1461  RNA_parameter_set_lookup(&list, "properties", prop_ptr);
1462  ot->rna_ext.call(C, &ptr, func, &list);
1463 
1464  RNA_parameter_get_lookup(&list, "result", &ret);
1465  result = (char *)ret;
1466 
1467  if (result && result[0]) {
1469  }
1470  else {
1471  result = NULL;
1472  }
1473 
1474  RNA_parameter_list_free(&list);
1475 
1476  return result;
1477 }
1478 
1479 static void rna_Operator_unregister(struct Main *bmain, StructRNA *type);
1480 
1481 /* bpy_operator_wrap.c */
1482 extern void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata);
1483 extern void BPY_RNA_operator_macro_wrapper(wmOperatorType *ot, void *userdata);
1484 
1485 static StructRNA *rna_Operator_register(Main *bmain,
1486  ReportList *reports,
1487  void *data,
1488  const char *identifier,
1489  StructValidateFunc validate,
1490  StructCallbackFunc call,
1492 {
1493  wmOperatorType dummyot = {NULL};
1494  wmOperator dummyop = {NULL};
1495  PointerRNA dummyotr;
1496  int have_function[8];
1497 
1498  struct {
1499  char idname[OP_MAX_TYPENAME];
1500  char name[OP_MAX_TYPENAME];
1501  char description[RNA_DYN_DESCR_MAX];
1502  char translation_context[RNA_DYN_DESCR_MAX];
1503  char undo_group[OP_MAX_TYPENAME];
1504  } temp_buffers;
1505 
1506  /* setup dummy operator & operator type to store static properties in */
1507  dummyop.type = &dummyot;
1508  dummyot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */
1509  dummyot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */
1510  dummyot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */
1511  dummyot.translation_context =
1512  temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */
1513  dummyot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */
1514  RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr);
1515 
1516  /* clear in case they are left unset */
1517  temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
1518  temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
1519 
1520  /* validate the python class */
1521  if (validate(&dummyotr, data, have_function) != 0) {
1522  return NULL;
1523  }
1524 
1525  /* check if we have registered this operator type before, and remove it */
1526  {
1527  wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
1528  if (ot && ot->rna_ext.srna) {
1529  rna_Operator_unregister(bmain, ot->rna_ext.srna);
1530  }
1531  }
1532 
1533  if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
1534  return NULL;
1535  }
1536 
1537  char idname_conv[sizeof(dummyop.idname)];
1538  WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
1539 
1540  if (!RNA_struct_available_or_report(reports, idname_conv)) {
1541  return NULL;
1542  }
1543 
1544  /* We have to set default context if the class doesn't define it. */
1545  if (temp_buffers.translation_context[0] == '\0') {
1546  STRNCPY(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
1547  }
1548 
1549  /* Convert foo.bar to FOO_OT_bar
1550  * allocate all strings at once. */
1551  {
1552  const char *strings[] = {
1553  idname_conv,
1554  temp_buffers.name,
1555  temp_buffers.description,
1556  temp_buffers.translation_context,
1557  temp_buffers.undo_group,
1558  };
1559  char *strings_table[ARRAY_SIZE(strings)];
1561  '\0', strings_table, strings, ARRAY_SIZE(strings));
1562 
1563  dummyot.idname = strings_table[0]; /* allocated string stored here */
1564  dummyot.name = strings_table[1];
1565  dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
1566  dummyot.translation_context = strings_table[3];
1567  dummyot.undo_group = strings_table[4];
1568  BLI_assert(ARRAY_SIZE(strings) == 5);
1569  }
1570 
1571  /* XXX, this doubles up with the operator name T29666.
1572  * for now just remove from dir(bpy.types) */
1573 
1574  /* create a new operator type */
1576 
1577  /* Operator properties are registered separately. */
1579 
1582  dummyot.rna_ext.data = data;
1583  dummyot.rna_ext.call = call;
1584  dummyot.rna_ext.free = free;
1585 
1586  dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
1587  dummyot.exec = (have_function[1]) ? rna_operator_execute_cb : NULL;
1588  dummyot.check = (have_function[2]) ? rna_operator_check_cb : NULL;
1589  dummyot.invoke = (have_function[3]) ? rna_operator_invoke_cb : NULL;
1590  dummyot.modal = (have_function[4]) ? rna_operator_modal_cb : NULL;
1591  dummyot.ui = (have_function[5]) ? rna_operator_draw_cb : NULL;
1592  dummyot.cancel = (have_function[6]) ? rna_operator_cancel_cb : NULL;
1593  dummyot.get_description = (have_function[7]) ? rna_operator_description_cb : NULL;
1595 
1596  /* update while blender is running */
1598 
1599  return dummyot.rna_ext.srna;
1600 }
1601 
1602 static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
1603 {
1604  const char *idname;
1606  wmWindowManager *wm;
1607 
1608  if (!ot) {
1609  return;
1610  }
1611 
1612  /* update while blender is running */
1613  wm = bmain->wm.first;
1614  if (wm) {
1616 
1618  }
1620 
1622 
1623  idname = ot->idname;
1625 
1626  /* Not to be confused with the RNA_struct_free that WM_operatortype_remove calls,
1627  * they are 2 different srna's. */
1629 
1630  MEM_freeN((void *)idname);
1631 }
1632 
1633 static void **rna_Operator_instance(PointerRNA *ptr)
1634 {
1635  wmOperator *op = ptr->data;
1636  return &op->py_instance;
1637 }
1638 
1639 static StructRNA *rna_MacroOperator_register(Main *bmain,
1640  ReportList *reports,
1641  void *data,
1642  const char *identifier,
1643  StructValidateFunc validate,
1644  StructCallbackFunc call,
1646 {
1647  wmOperatorType dummyot = {NULL};
1648  wmOperator dummyop = {NULL};
1649  PointerRNA dummyotr;
1650  int have_function[4];
1651 
1652  struct {
1653  char idname[OP_MAX_TYPENAME];
1654  char name[OP_MAX_TYPENAME];
1655  char description[RNA_DYN_DESCR_MAX];
1656  char translation_context[RNA_DYN_DESCR_MAX];
1657  char undo_group[OP_MAX_TYPENAME];
1658  } temp_buffers;
1659 
1660  /* setup dummy operator & operator type to store static properties in */
1661  dummyop.type = &dummyot;
1662  dummyot.idname = temp_buffers.idname; /* only assign the pointer, string is NULL'd */
1663  dummyot.name = temp_buffers.name; /* only assign the pointer, string is NULL'd */
1664  dummyot.description = temp_buffers.description; /* only assign the pointer, string is NULL'd */
1665  dummyot.translation_context =
1666  temp_buffers.translation_context; /* only assign the pointer, string is NULL'd */
1667  dummyot.undo_group = temp_buffers.undo_group; /* only assign the pointer, string is NULL'd */
1668  RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr);
1669 
1670  /* clear in case they are left unset */
1671  temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
1672  temp_buffers.undo_group[0] = temp_buffers.translation_context[0] = '\0';
1673 
1674  /* validate the python class */
1675  if (validate(&dummyotr, data, have_function) != 0) {
1676  return NULL;
1677  }
1678 
1679  if (strlen(identifier) >= sizeof(dummyop.idname)) {
1680  BKE_reportf(reports,
1681  RPT_ERROR,
1682  "Registering operator class: '%s' is too long, maximum length is %d",
1683  identifier,
1684  (int)sizeof(dummyop.idname));
1685  return NULL;
1686  }
1687 
1688  /* check if we have registered this operator type before, and remove it */
1689  {
1690  wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
1691  if (ot && ot->rna_ext.srna) {
1692  rna_Operator_unregister(bmain, ot->rna_ext.srna);
1693  }
1694  }
1695 
1696  if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
1697  return NULL;
1698  }
1699 
1700  char idname_conv[sizeof(dummyop.idname)];
1701  WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
1702 
1703  if (!RNA_struct_available_or_report(reports, idname_conv)) {
1704  return NULL;
1705  }
1706 
1707  /* We have to set default context if the class doesn't define it. */
1708  if (temp_buffers.translation_context[0] == '\0') {
1709  STRNCPY(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
1710  }
1711 
1712  /* Convert foo.bar to FOO_OT_bar
1713  * allocate all strings at once. */
1714  {
1715  const char *strings[] = {
1716  idname_conv,
1717  temp_buffers.name,
1718  temp_buffers.description,
1719  temp_buffers.translation_context,
1720  temp_buffers.undo_group,
1721  };
1722  char *strings_table[ARRAY_SIZE(strings)];
1724  '\0', strings_table, strings, ARRAY_SIZE(strings));
1725 
1726  dummyot.idname = strings_table[0]; /* allocated string stored here */
1727  dummyot.name = strings_table[1];
1728  dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
1729  dummyot.translation_context = strings_table[3];
1730  dummyot.undo_group = strings_table[4];
1731  BLI_assert(ARRAY_SIZE(strings) == 5);
1732  }
1733 
1734  /* XXX, this doubles up with the operator name T29666.
1735  * for now just remove from dir(bpy.types) */
1736 
1737  /* create a new operator type */
1740  dummyot.rna_ext.data = data;
1741  dummyot.rna_ext.call = call;
1742  dummyot.rna_ext.free = free;
1743 
1744  dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
1745  dummyot.ui = (have_function[3]) ? rna_operator_draw_cb : NULL;
1746 
1748 
1749  /* update while blender is running */
1751 
1752  return dummyot.rna_ext.srna;
1753 }
1754 # endif /* WITH_PYTHON */
1755 
1756 static StructRNA *rna_Operator_refine(PointerRNA *opr)
1757 {
1758  wmOperator *op = (wmOperator *)opr->data;
1759  return (op->type && op->type->rna_ext.srna) ? op->type->rna_ext.srna : &RNA_Operator;
1760 }
1761 
1762 static StructRNA *rna_MacroOperator_refine(PointerRNA *opr)
1763 {
1764  wmOperator *op = (wmOperator *)opr->data;
1765  return (op->type && op->type->rna_ext.srna) ? op->type->rna_ext.srna : &RNA_Macro;
1766 }
1767 
1768 /* just to work around 'const char *' warning and to ensure this is a python op */
1769 static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value)
1770 {
1771  wmOperator *data = (wmOperator *)(ptr->data);
1772  char *str = (char *)data->type->idname;
1773  if (!str[0]) {
1774  BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
1775  }
1776  else {
1777  BLI_assert(!"setting the bl_idname on a non-builtin operator");
1778  }
1779 }
1780 
1781 static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
1782 {
1783  wmOperator *data = (wmOperator *)(ptr->data);
1784  char *str = (char *)data->type->name;
1785  if (!str[0]) {
1786  BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
1787  }
1788  else {
1789  BLI_assert(!"setting the bl_label on a non-builtin operator");
1790  }
1791 }
1792 
1798 # define OPERATOR_STR_MAYBE_NULL_GETSET(attr, len) \
1799  static void rna_Operator_bl_##attr##_set(PointerRNA *ptr, const char *value) \
1800  { \
1801  wmOperator *data = (wmOperator *)(ptr->data); \
1802  char *str = (char *)data->type->attr; \
1803  if (str && !str[0]) { \
1804  BLI_strncpy(str, value, len); /* utf8 already ensured */ \
1805  } \
1806  else { \
1807  BLI_assert( \
1808  !"setting the bl_" STRINGIFY(translation_context) " on a non-builtin operator"); \
1809  } \
1810  } \
1811  static void rna_Operator_bl_##attr##_get(PointerRNA *ptr, char *value) \
1812  { \
1813  const wmOperator *data = (wmOperator *)(ptr->data); \
1814  const char *str = data->type->attr; \
1815  BLI_strncpy(value, str ? str : "", len); \
1816  } \
1817  static int rna_Operator_bl_##attr##_length(PointerRNA *ptr) \
1818  { \
1819  const wmOperator *data = (wmOperator *)(ptr->data); \
1820  const char *str = data->type->attr; \
1821  return BLI_strnlen(str ? str : "", len); \
1822  }
1823 
1824 OPERATOR_STR_MAYBE_NULL_GETSET(translation_context, RNA_DYN_DESCR_MAX)
1825 OPERATOR_STR_MAYBE_NULL_GETSET(description, RNA_DYN_DESCR_MAX)
1826 OPERATOR_STR_MAYBE_NULL_GETSET(undo_group, OP_MAX_TYPENAME)
1827 
1828 static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
1829 {
1830  wmKeyMapItem *kmi = ptr->data;
1832 }
1833 
1834 #else /* RNA_RUNTIME */
1835 
1841 {
1842  StructRNA *srna;
1843  PropertyRNA *prop;
1844 
1845  srna = RNA_def_struct(brna, "OperatorOptions", NULL);
1846  RNA_def_struct_ui_text(srna, "Operator Options", "Runtime options");
1847  RNA_def_struct_sdna(srna, "wmOperator");
1848 
1849  prop = RNA_def_property(srna, "is_grab_cursor", PROP_BOOLEAN, PROP_BOOLEAN);
1851  RNA_def_property_ui_text(prop, "Grab Cursor", "True when the cursor is grabbed");
1853 
1854  prop = RNA_def_property(srna, "is_invoke", PROP_BOOLEAN, PROP_BOOLEAN);
1857  prop, "Invoke", "True when invoked (even if only the execute callbacks available)");
1859 
1860  prop = RNA_def_property(srna, "is_repeat", PROP_BOOLEAN, PROP_BOOLEAN);
1862  RNA_def_property_ui_text(prop, "Repeat", "True when run from the 'Adjust Last Operation' panel");
1864 
1865  prop = RNA_def_property(srna, "is_repeat_last", PROP_BOOLEAN, PROP_BOOLEAN);
1867  RNA_def_property_ui_text(prop, "Repeat Call", "True when run from the operator 'Repeat Last'");
1869 
1870  prop = RNA_def_property(srna, "use_cursor_region", PROP_BOOLEAN, PROP_BOOLEAN);
1873  prop, "Focus Region", "Enable to use the region under the cursor for modal execution");
1874 }
1875 
1876 static void rna_def_operator(BlenderRNA *brna)
1877 {
1878  StructRNA *srna;
1879  PropertyRNA *prop;
1880 
1881  srna = RNA_def_struct(brna, "Operator", NULL);
1883  srna, "Operator", "Storage of an operator being executed, or registered after execution");
1884  RNA_def_struct_sdna(srna, "wmOperator");
1885  RNA_def_struct_refine_func(srna, "rna_Operator_refine");
1886 # ifdef WITH_PYTHON
1888  srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance");
1889 # endif
1892 
1893  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
1895  RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
1896  RNA_def_property_ui_text(prop, "Name", "");
1897 
1898  prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
1900  RNA_def_property_struct_type(prop, "OperatorProperties");
1901  RNA_def_property_ui_text(prop, "Properties", "");
1902  RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
1903 
1904  prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
1905  RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
1906  RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL);
1908  prop,
1909  "Has Reports",
1910  "Operator has a set of reports (warnings and errors) from last execution");
1911 
1912  prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
1913  RNA_def_property_struct_type(prop, "UILayout");
1914 
1915  prop = RNA_def_property(srna, "options", PROP_POINTER, PROP_NONE);
1917  RNA_def_property_struct_type(prop, "OperatorOptions");
1918  RNA_def_property_pointer_funcs(prop, "rna_Operator_options_get", NULL, NULL, NULL);
1919  RNA_def_property_ui_text(prop, "Options", "Runtime options");
1920 
1921  /* Registration */
1922  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
1923  RNA_def_property_string_sdna(prop, NULL, "type->idname");
1924  /* else it uses the pointer size!. -3 because '.' -> '_OT_' */
1926  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
1927  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
1929  RNA_def_struct_name_property(srna, prop);
1930 
1931  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
1932  RNA_def_property_string_sdna(prop, NULL, "type->name");
1933  RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
1934  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
1935  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
1937 
1938  prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
1939  RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
1940  RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
1942  "rna_Operator_bl_translation_context_get",
1943  "rna_Operator_bl_translation_context_length",
1944  "rna_Operator_bl_translation_context_set");
1947 
1948  prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
1949  RNA_def_property_string_sdna(prop, NULL, "type->description");
1950  RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
1952  "rna_Operator_bl_description_get",
1953  "rna_Operator_bl_description_length",
1954  "rna_Operator_bl_description_set");
1955  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
1957 
1958  prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
1959  RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
1960  RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
1962  "rna_Operator_bl_undo_group_get",
1963  "rna_Operator_bl_undo_group_length",
1964  "rna_Operator_bl_undo_group_set");
1965  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
1967 
1968  prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
1969  RNA_def_property_enum_sdna(prop, NULL, "type->flag");
1972  RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
1973 
1974  prop = RNA_def_property(srna, "macros", PROP_COLLECTION, PROP_NONE);
1975  RNA_def_property_collection_sdna(prop, NULL, "macro", NULL);
1976  RNA_def_property_struct_type(prop, "Macro");
1977  RNA_def_property_ui_text(prop, "Macros", "");
1978 
1979  RNA_api_operator(srna);
1980 
1981  srna = RNA_def_struct(brna, "OperatorProperties", NULL);
1982  RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an operator");
1983  RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
1984  RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
1988 }
1989 
1991 {
1992  StructRNA *srna;
1993  PropertyRNA *prop;
1994 
1995  srna = RNA_def_struct(brna, "Macro", NULL);
1997  srna,
1998  "Macro Operator",
1999  "Storage of a macro operator being executed, or registered after execution");
2000  RNA_def_struct_sdna(srna, "wmOperator");
2001  RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine");
2002 # ifdef WITH_PYTHON
2004  srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance");
2005 # endif
2008 
2009  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2011  RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
2012  RNA_def_property_ui_text(prop, "Name", "");
2013 
2014  prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
2016  RNA_def_property_struct_type(prop, "OperatorProperties");
2017  RNA_def_property_ui_text(prop, "Properties", "");
2018  RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
2019 
2020  /* Registration */
2021  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
2022  RNA_def_property_string_sdna(prop, NULL, "type->idname");
2023  RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
2024  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
2025  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
2027  RNA_def_struct_name_property(srna, prop);
2028 
2029  prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
2030  RNA_def_property_string_sdna(prop, NULL, "type->name");
2031  RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
2032  RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
2033  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
2035 
2036  prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
2037  RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
2038  RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
2040  "rna_Operator_bl_translation_context_get",
2041  "rna_Operator_bl_translation_context_length",
2042  "rna_Operator_bl_translation_context_set");
2045 
2046  prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
2047  RNA_def_property_string_sdna(prop, NULL, "type->description");
2048  RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
2050  "rna_Operator_bl_description_get",
2051  "rna_Operator_bl_description_length",
2052  "rna_Operator_bl_description_set");
2053  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
2055 
2056  prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
2057  RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
2058  RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
2060  "rna_Operator_bl_undo_group_get",
2061  "rna_Operator_bl_undo_group_length",
2062  "rna_Operator_bl_undo_group_set");
2063  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
2065 
2066  prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
2067  RNA_def_property_enum_sdna(prop, NULL, "type->flag");
2070  RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
2071 
2072  RNA_api_macro(srna);
2073 }
2074 
2076 {
2077  StructRNA *srna;
2078  PropertyRNA *prop;
2079 
2080  srna = RNA_def_struct(brna, "OperatorMacro", NULL);
2082  srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added");
2083  RNA_def_struct_sdna(srna, "wmOperatorTypeMacro");
2084 
2085  /* prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); */
2086  /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
2087  /* RNA_def_property_string_sdna(prop, NULL, "idname"); */
2088  /* RNA_def_property_ui_text(prop, "Name", "Name of the sub operator"); */
2089  /* RNA_def_struct_name_property(srna, prop); */
2090 
2091  prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
2093  RNA_def_property_struct_type(prop, "OperatorProperties");
2094  RNA_def_property_ui_text(prop, "Properties", "");
2095  RNA_def_property_pointer_funcs(prop, "rna_OperatorMacro_properties_get", NULL, NULL, NULL);
2096 }
2097 
2099 {
2100  StructRNA *srna;
2101  PropertyRNA *prop;
2102 
2103  srna = RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup");
2105  srna, "Operator Mouse Path", "Mouse path values for operators that record such paths");
2106 
2107  prop = RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ);
2109  RNA_def_property_array(prop, 2);
2110  RNA_def_property_ui_text(prop, "Location", "Mouse location");
2111 
2112  prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE);
2114  RNA_def_property_ui_text(prop, "Time", "Time of mouse location");
2115 }
2116 
2118 {
2119  StructRNA *srna;
2120  PropertyRNA *prop;
2121 
2122  srna = RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup");
2123  RNA_def_struct_ui_text(srna, "Operator File List Element", "");
2124 
2125  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME);
2127  RNA_def_property_ui_text(prop, "Name", "Name of a file or directory within a file list");
2128 }
2129 
2130 static void rna_def_event(BlenderRNA *brna)
2131 {
2132  StructRNA *srna;
2133  PropertyRNA *prop;
2134 
2135  srna = RNA_def_struct(brna, "Event", NULL);
2136  RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
2137  RNA_def_struct_sdna(srna, "wmEvent");
2138 
2139  RNA_define_verify_sdna(0); /* not in sdna */
2140 
2141  /* strings */
2142  prop = RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
2144  RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL);
2145  RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event");
2146 
2147  prop = RNA_def_property(srna, "unicode", PROP_STRING, PROP_NONE);
2149  RNA_def_property_string_funcs(prop, "rna_Event_unicode_get", "rna_Event_unicode_length", NULL);
2150  RNA_def_property_ui_text(prop, "Unicode", "Single unicode character for this event");
2151 
2152  /* enums */
2153  prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
2154  RNA_def_property_enum_sdna(prop, NULL, "val");
2156  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Event_value_itemf");
2158  RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some");
2159 
2160  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2161  RNA_def_property_enum_sdna(prop, NULL, "type");
2165  RNA_def_property_ui_text(prop, "Type", "");
2166 
2167  /* keyboard */
2168  prop = RNA_def_property(srna, "is_repeat", PROP_BOOLEAN, PROP_NONE);
2170  RNA_def_property_boolean_funcs(prop, "rna_Event_is_repeat_get", NULL);
2171  RNA_def_property_ui_text(prop, "Is Repeat", "The event is generated by holding a key down");
2172 
2173  /* mouse */
2174  prop = RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE);
2175  RNA_def_property_int_sdna(prop, NULL, "x");
2178  prop, "Mouse X Position", "The window relative horizontal location of the mouse");
2179 
2180  prop = RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE);
2181  RNA_def_property_int_sdna(prop, NULL, "y");
2184  prop, "Mouse Y Position", "The window relative vertical location of the mouse");
2185 
2186  prop = RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE);
2187  RNA_def_property_int_sdna(prop, NULL, "mval[0]");
2190  prop, "Mouse X Position", "The region relative horizontal location of the mouse");
2191 
2192  prop = RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE);
2193  RNA_def_property_int_sdna(prop, NULL, "mval[1]");
2196  prop, "Mouse Y Position", "The region relative vertical location of the mouse");
2197 
2198  prop = RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE);
2199  RNA_def_property_int_sdna(prop, NULL, "prevx");
2202  prop, "Mouse Previous X Position", "The window relative horizontal location of the mouse");
2203 
2204  prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
2205  RNA_def_property_int_sdna(prop, NULL, "prevy");
2208  prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse");
2209 
2210  prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
2212  RNA_def_property_float_funcs(prop, "rna_Event_pressure_get", NULL, NULL);
2214  prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
2215 
2216  prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_XYZ_LENGTH);
2217  RNA_def_property_array(prop, 2);
2219  RNA_def_property_float_funcs(prop, "rna_Event_tilt_get", NULL, NULL);
2221  prop, "Tablet Tilt", "The pressure of the tablet or zeroes if no tablet present");
2222 
2223  prop = RNA_def_property(srna, "is_tablet", PROP_BOOLEAN, PROP_NONE);
2225  RNA_def_property_boolean_funcs(prop, "rna_Event_is_tablet_get", NULL);
2226  RNA_def_property_ui_text(prop, "Is Tablet", "The event has tablet data");
2227 
2228  prop = RNA_def_property(srna, "is_mouse_absolute", PROP_BOOLEAN, PROP_NONE);
2229  RNA_def_property_boolean_sdna(prop, NULL, "tablet.is_motion_absolute", 1);
2231  RNA_def_property_ui_text(prop, "Absolute Motion", "The last motion event was an absolute input");
2232 
2233  /* modifiers */
2234  prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
2235  RNA_def_property_boolean_sdna(prop, NULL, "shift", 1);
2237  RNA_def_property_ui_text(prop, "Shift", "True when the Shift key is held");
2239 
2240  prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
2241  RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1);
2243  RNA_def_property_ui_text(prop, "Ctrl", "True when the Ctrl key is held");
2244 
2245  prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
2246  RNA_def_property_boolean_sdna(prop, NULL, "alt", 1);
2248  RNA_def_property_ui_text(prop, "Alt", "True when the Alt/Option key is held");
2249 
2250  prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
2251  RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1);
2253  RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held");
2254 
2255  RNA_define_verify_sdna(1); /* not in sdna */
2256 }
2257 
2258 static void rna_def_timer(BlenderRNA *brna)
2259 {
2260  StructRNA *srna;
2261  PropertyRNA *prop;
2262 
2263  srna = RNA_def_struct(brna, "Timer", NULL);
2264  RNA_def_struct_ui_text(srna, "Timer", "Window event timer");
2265  RNA_def_struct_sdna(srna, "wmTimer");
2266 
2267  RNA_define_verify_sdna(0); /* not in sdna */
2268 
2269  /* could wrap more, for now this is enough */
2270  prop = RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
2271  RNA_def_property_float_sdna(prop, NULL, "timestep");
2273  RNA_def_property_ui_text(prop, "Time Step", "");
2274 
2275  prop = RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
2276  RNA_def_property_float_sdna(prop, NULL, "delta");
2278  RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
2279 
2280  prop = RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
2281  RNA_def_property_float_sdna(prop, NULL, "duration");
2283  RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
2284 
2285  RNA_define_verify_sdna(1); /* not in sdna */
2286 }
2287 
2289  const char *rna_type,
2290  const char *c_type,
2291  const char *layout_get_fn)
2292 {
2293  StructRNA *srna;
2294  PropertyRNA *prop;
2295 
2296  srna = RNA_def_struct(brna, rna_type, NULL);
2297  /* UI name isn't visible, name same as type. */
2298  RNA_def_struct_ui_text(srna, rna_type, "");
2299  RNA_def_struct_sdna(srna, c_type);
2300 
2301  RNA_define_verify_sdna(0); /* not in sdna */
2302 
2303  /* could wrap more, for now this is enough */
2304  prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
2305  RNA_def_property_struct_type(prop, "UILayout");
2306  RNA_def_property_pointer_funcs(prop, layout_get_fn, NULL, NULL, NULL);
2307 
2308  RNA_define_verify_sdna(1); /* not in sdna */
2309 }
2310 
2311 static void rna_def_popupmenu(BlenderRNA *brna)
2312 {
2313  rna_def_popup_menu_wrapper(brna, "UIPopupMenu", "uiPopupMenu", "rna_PopupMenu_layout_get");
2314 }
2315 
2317 {
2318  rna_def_popup_menu_wrapper(brna, "UIPopover", "uiPopover", "rna_PopoverMenu_layout_get");
2319 }
2320 
2321 static void rna_def_piemenu(BlenderRNA *brna)
2322 {
2323  rna_def_popup_menu_wrapper(brna, "UIPieMenu", "uiPieMenu", "rna_PieMenu_layout_get");
2324 }
2325 
2327 {
2328  StructRNA *srna;
2329  PropertyRNA *prop;
2330 
2331  srna = RNA_def_struct(brna, "Stereo3dDisplay", NULL);
2332  RNA_def_struct_sdna(srna, "Stereo3dFormat");
2334  RNA_def_struct_ui_text(srna, "Stereo 3D Display", "Settings for stereo 3D display");
2335 
2336  prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
2338  RNA_def_property_ui_text(prop, "Display Mode", "");
2339 
2340  prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
2342  RNA_def_property_ui_text(prop, "Anaglyph Type", "");
2343 
2344  prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
2346  RNA_def_property_ui_text(prop, "Interlace Type", "");
2347 
2348  prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
2350  RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
2351 
2352  prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
2354  RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice versa");
2355 }
2356 
2357 static void rna_def_window(BlenderRNA *brna)
2358 {
2359  StructRNA *srna;
2360  PropertyRNA *prop;
2361 
2362  srna = RNA_def_struct(brna, "Window", NULL);
2363  RNA_def_struct_ui_text(srna, "Window", "Open window");
2364  RNA_def_struct_sdna(srna, "wmWindow");
2365 
2366  prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
2367  RNA_def_property_ui_text(prop, "Parent Window", "Active workspace and scene follow this window");
2368 
2370 
2371  prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
2373  RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_scene_set", NULL, NULL);
2374  RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the window");
2376  RNA_def_property_update(prop, 0, "rna_Window_scene_update");
2377 
2378  prop = RNA_def_property(srna, "workspace", PROP_POINTER, PROP_NONE);
2380  RNA_def_property_struct_type(prop, "WorkSpace");
2381  RNA_def_property_ui_text(prop, "Workspace", "Active workspace showing in the window");
2383  prop, "rna_Window_workspace_get", "rna_Window_workspace_set", NULL, NULL);
2385  RNA_def_property_update(prop, 0, "rna_Window_workspace_update");
2386 
2387  prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
2388  RNA_def_property_struct_type(prop, "Screen");
2389  RNA_def_property_ui_text(prop, "Screen", "Active workspace screen showing in the window");
2391  "rna_Window_screen_get",
2392  "rna_Window_screen_set",
2393  NULL,
2394  "rna_Window_screen_assign_poll");
2396  RNA_def_property_update(prop, 0, "rna_workspace_screen_update");
2397 
2398  prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
2399  RNA_def_property_struct_type(prop, "ViewLayer");
2401  prop, "rna_Window_view_layer_get", "rna_Window_view_layer_set", NULL, NULL);
2403  prop, "Active View Layer", "The active workspace view layer showing in the window");
2406 
2407  prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
2408  RNA_def_property_int_sdna(prop, NULL, "posx");
2410  RNA_def_property_ui_text(prop, "X Position", "Horizontal location of the window");
2411 
2412  prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
2413  RNA_def_property_int_sdna(prop, NULL, "posy");
2415  RNA_def_property_ui_text(prop, "Y Position", "Vertical location of the window");
2416 
2417  prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
2418  RNA_def_property_int_sdna(prop, NULL, "sizex");
2420  RNA_def_property_ui_text(prop, "Width", "Window width");
2421 
2422  prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
2423  RNA_def_property_int_sdna(prop, NULL, "sizey");
2425  RNA_def_property_ui_text(prop, "Height", "Window height");
2426 
2427  prop = RNA_def_property(srna, "stereo_3d_display", PROP_POINTER, PROP_NONE);
2428  RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
2430  RNA_def_property_struct_type(prop, "Stereo3dDisplay");
2431  RNA_def_property_ui_text(prop, "Stereo 3D Display", "Settings for stereo 3D display");
2432 
2433  RNA_api_window(srna);
2434 }
2435 
2436 /* curve.splines */
2438 {
2439  StructRNA *srna;
2440  PropertyRNA *prop;
2441 
2442  RNA_def_property_srna(cprop, "KeyConfigurations");
2443  srna = RNA_def_struct(brna, "KeyConfigurations", NULL);
2444  RNA_def_struct_sdna(srna, "wmWindowManager");
2445  RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
2446 
2447  prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
2448  RNA_def_property_struct_type(prop, "KeyConfig");
2450  "rna_WindowManager_active_keyconfig_get",
2451  "rna_WindowManager_active_keyconfig_set",
2452  NULL,
2453  NULL);
2455  RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)");
2456 
2457  prop = RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
2458  RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
2459  RNA_def_property_struct_type(prop, "KeyConfig");
2460  RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration");
2461 
2462  prop = RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
2463  RNA_def_property_pointer_sdna(prop, NULL, "addonconf");
2464  RNA_def_property_struct_type(prop, "KeyConfig");
2466  prop,
2467  "Add-on Key Configuration",
2468  "Key configuration that can be extended by add-ons, and is added to the active "
2469  "configuration when handling events");
2470 
2471  prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
2472  RNA_def_property_pointer_sdna(prop, NULL, "userconf");
2473  RNA_def_property_struct_type(prop, "KeyConfig");
2475  prop,
2476  "User Key Configuration",
2477  "Final key configuration that combines keymaps from the active and add-on configurations, "
2478  "and can be edited by the user");
2479 
2480  RNA_api_keyconfigs(srna);
2481 }
2482 
2484 {
2485  StructRNA *srna;
2486  PropertyRNA *prop;
2487 
2488  srna = RNA_def_struct(brna, "WindowManager", "ID");
2490  srna,
2491  "Window Manager",
2492  "Window manager data-block defining open windows and other user interface data");
2494  RNA_def_struct_sdna(srna, "wmWindowManager");
2495 
2496  prop = RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
2497  RNA_def_property_struct_type(prop, "Operator");
2498  RNA_def_property_ui_text(prop, "Operators", "Operator registry");
2499 
2500  prop = RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
2501  RNA_def_property_struct_type(prop, "Window");
2502  RNA_def_property_ui_text(prop, "Windows", "Open windows");
2503 
2504  prop = RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
2505  RNA_def_property_struct_type(prop, "KeyConfig");
2506  RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
2507  rna_def_wm_keyconfigs(brna, prop);
2508 
2509  prop = RNA_def_property(srna, "xr_session_settings", PROP_POINTER, PROP_NONE);
2510  RNA_def_property_pointer_sdna(prop, NULL, "xr.session_settings");
2512  RNA_def_property_ui_text(prop, "XR Session Settings", "");
2513 
2514  prop = RNA_def_property(srna, "xr_session_state", PROP_POINTER, PROP_NONE);
2515  RNA_def_property_struct_type(prop, "XrSessionState");
2516  RNA_def_property_pointer_funcs(prop, "rna_WindowManager_xr_session_state_get", NULL, NULL, NULL);
2519  prop, "XR Session State", "Runtime state information about the VR session");
2520 
2521  RNA_api_wm(srna);
2522 }
2523 
2524 /* keyconfig.items */
2525 static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
2526 {
2527  StructRNA *srna;
2528 
2529  RNA_def_property_srna(cprop, "KeyMapItems");
2530  srna = RNA_def_struct(brna, "KeyMapItems", NULL);
2531  RNA_def_struct_sdna(srna, "wmKeyMap");
2532  RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
2533 
2534  RNA_api_keymapitems(srna);
2535 }
2536 
2537 static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
2538 {
2539  StructRNA *srna;
2540 
2541  RNA_def_property_srna(cprop, "KeyMaps");
2542  srna = RNA_def_struct(brna, "KeyMaps", NULL);
2543  RNA_def_struct_sdna(srna, "wmKeyConfig");
2544  RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
2545 
2546  RNA_api_keymaps(srna);
2547 }
2548 
2550 {
2551  StructRNA *srna;
2552  PropertyRNA *prop;
2553 
2554  srna = RNA_def_struct(brna, "KeyConfigPreferences", NULL);
2555  RNA_def_struct_ui_text(srna, "Key-Config Preferences", "");
2556  RNA_def_struct_sdna(srna, "wmKeyConfigPref"); /* WARNING: only a bAddon during registration */
2557 
2558  RNA_def_struct_refine_func(srna, "rna_wmKeyConfigPref_refine");
2560  srna, "rna_wmKeyConfigPref_register", "rna_wmKeyConfigPref_unregister", NULL);
2561  RNA_def_struct_idprops_func(srna, "rna_wmKeyConfigPref_idprops");
2562  RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); /* Mandatory! */
2563 
2564  /* registration */
2566  prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
2567  RNA_def_property_string_sdna(prop, NULL, "idname");
2570 }
2571 
2572 static void rna_def_keyconfig(BlenderRNA *brna)
2573 {
2574  StructRNA *srna;
2575  PropertyRNA *prop;
2576 
2577  static const EnumPropertyItem map_type_items[] = {
2578  {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
2579  {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
2580  {KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
2581  {KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""},
2582  {KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
2583  {KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
2584  {0, NULL, 0, NULL, NULL},
2585  };
2586 
2587  /* KeyConfig */
2588  srna = RNA_def_struct(brna, "KeyConfig", NULL);
2589  RNA_def_struct_sdna(srna, "wmKeyConfig");
2590  RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps");
2591 
2592  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2593  RNA_def_property_string_sdna(prop, NULL, "idname");
2594  RNA_def_property_ui_text(prop, "Name", "Name of the key configuration");
2595  RNA_def_struct_name_property(srna, prop);
2596 
2597  prop = RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
2598  RNA_def_property_struct_type(prop, "KeyMap");
2599  RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
2600  rna_def_wm_keymaps(brna, prop);
2601 
2602  prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
2606  prop, "User Defined", "Indicates that a keyconfig was defined by the user");
2607 
2608  /* Collection active property */
2609  prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
2610  RNA_def_property_struct_type(prop, "KeyConfigPreferences");
2611  RNA_def_property_pointer_funcs(prop, "rna_wmKeyConfig_preferences_get", NULL, NULL, NULL);
2612 
2613  RNA_api_keyconfig(srna);
2614 
2615  /* KeyMap */
2616  srna = RNA_def_struct(brna, "KeyMap", NULL);
2617  RNA_def_struct_sdna(srna, "wmKeyMap");
2618  RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps");
2619 
2620  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2621  RNA_def_property_string_sdna(prop, NULL, "idname");
2623  RNA_def_property_ui_text(prop, "Name", "Name of the key map");
2624  RNA_def_struct_name_property(srna, prop);
2625 
2626  prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
2627  RNA_def_property_string_sdna(prop, NULL, "owner_id");
2628  RNA_def_property_ui_text(prop, "Owner", "Internal owner");
2629 
2630  prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
2631  RNA_def_property_enum_sdna(prop, NULL, "spaceid");
2634  RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with");
2635 
2636  prop = RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
2637  RNA_def_property_enum_sdna(prop, NULL, "regionid");
2640  RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with");
2641 
2642  prop = RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE);
2643  RNA_def_property_collection_sdna(prop, NULL, "items", NULL);
2644  RNA_def_property_struct_type(prop, "KeyMapItem");
2646  prop, "Items", "Items in the keymap, linking an operator to an input event");
2647  rna_def_keymap_items(brna, prop);
2648 
2649  prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
2651  RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user");
2652 
2653  prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
2657  prop,
2658  "Modal Keymap",
2659  "Indicates that a keymap is used for translate modal events for an operator");
2660 
2661  prop = RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
2663  RNA_def_property_ui_text(prop, "Items Expanded", "Expanded in the user interface");
2664  RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
2665 
2666  prop = RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE);
2668  RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in the user interface");
2669  RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
2670 
2671  RNA_api_keymap(srna);
2672 
2673  /* KeyMapItem */
2674  srna = RNA_def_struct(brna, "KeyMapItem", NULL);
2675  RNA_def_struct_sdna(srna, "wmKeyMapItem");
2676  RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map");
2677 
2678  prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
2679  RNA_def_property_string_sdna(prop, NULL, "idname");
2680  RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event");
2682  "rna_wmKeyMapItem_idname_get",
2683  "rna_wmKeyMapItem_idname_length",
2684  "rna_wmKeyMapItem_idname_set");
2685  RNA_def_struct_name_property(srna, prop);
2686  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2687 
2688  /* this is in fact the operator name, but if the operator can't be found we
2689  * fallback on the operator ID */
2690  prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
2692  RNA_def_property_ui_text(prop, "Name", "Name of operator (translated) to call on input event");
2694  prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL);
2695 
2696  prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
2697  RNA_def_property_struct_type(prop, "OperatorProperties");
2698  RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL);
2699  RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called");
2700  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2701 
2702  prop = RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
2703  RNA_def_property_enum_sdna(prop, NULL, "maptype");
2704  RNA_def_property_enum_items(prop, map_type_items);
2706  prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL);
2707  RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping");
2708  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2709 
2710  prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
2711  RNA_def_property_enum_sdna(prop, NULL, "type");
2714  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_type_itemf");
2715  RNA_def_property_ui_text(prop, "Type", "Type of event");
2716  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2717 
2718  prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
2719  RNA_def_property_enum_sdna(prop, NULL, "val");
2721  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
2722  RNA_def_property_ui_text(prop, "Value", "");
2723  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2724 
2725  prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
2726  RNA_def_property_int_sdna(prop, NULL, "id");
2728  RNA_def_property_ui_text(prop, "ID", "ID of the item");
2729  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2730 
2731  prop = RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE);
2732  RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_get", "rna_KeyMapItem_any_set");
2733  RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed");
2734  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2735 
2736  prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
2737  RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
2738  RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_shift_get", NULL);
2739  /* RNA_def_property_enum_sdna(prop, NULL, "shift"); */
2740  /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
2741  RNA_def_property_ui_text(prop, "Shift", "Shift key pressed");
2743  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2744 
2745  prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
2746  RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
2747  RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_ctrl_get", NULL);
2748  /* RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */
2749  /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
2750  RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed");
2751  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2752 
2753  prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
2754  RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
2755  RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_alt_get", NULL);
2756  /* RNA_def_property_enum_sdna(prop, NULL, "alt"); */
2757  /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
2758  RNA_def_property_ui_text(prop, "Alt", "Alt key pressed");
2759  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2760 
2761  prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
2762  RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
2763  RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_oskey_get", NULL);
2764  /* RNA_def_property_enum_sdna(prop, NULL, "oskey"); */
2765  /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
2766  RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed");
2767  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2768 
2769  prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
2770  RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
2773  RNA_def_property_enum_funcs(prop, NULL, "rna_wmKeyMapItem_keymodifier_set", NULL);
2774  RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
2775  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2776 
2777  prop = RNA_def_property(srna, "repeat", PROP_BOOLEAN, PROP_NONE);
2780  RNA_def_property_ui_text(prop, "Repeat", "Active on key-repeat events (when a key is held)");
2781  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2782 
2783  prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
2787  prop, "Expanded", "Show key map event and property details in the user interface");
2788  RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
2789 
2790  prop = RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE);
2791  RNA_def_property_enum_sdna(prop, NULL, "propvalue");
2793  RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
2795  prop, "Property Value", "The value this event translates to in a modal keymap");
2796  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2797 
2798  prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
2800  RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item");
2801  RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
2802  RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
2803 
2804  prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
2807  RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user");
2808 
2809  prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
2812  prop,
2813  "User Defined",
2814  "Is this keymap item user defined (doesn't just replace a builtin item)");
2815  RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL);
2816 
2817  RNA_api_keymapitem(srna);
2818 }
2819 
2821 {
2822  rna_def_operator(brna);
2824  rna_def_operator_utils(brna);
2826  rna_def_macro_operator(brna);
2828  rna_def_event(brna);
2829  rna_def_timer(brna);
2830  rna_def_popupmenu(brna);
2831  rna_def_popovermenu(brna);
2832  rna_def_piemenu(brna);
2833  rna_def_window(brna);
2834  rna_def_windowmanager(brna);
2836  rna_def_keyconfig(brna);
2837 }
2838 
2839 #endif /* RNA_RUNTIME */
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1018
@ G_DEBUG
Definition: BKE_global.h:133
struct IDProperty * IDP_New(const char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: idprop.c:907
struct wmKeyConfigPref * BKE_keyconfig_pref_ensure(struct UserDef *userdef, const char *kc_idname)
Definition: keyconfig.c:47
void BKE_keyconfig_pref_type_add(struct wmKeyConfigPrefType_Runtime *kpt_rt)
Definition: keyconfig.c:96
void BKE_keyconfig_pref_type_remove(const struct wmKeyConfigPrefType_Runtime *kpt_rt)
struct wmKeyConfigPrefType_Runtime wmKeyConfigPrefType_Runtime
Definition: BKE_keyconfig.h:43
struct wmKeyConfigPrefType_Runtime * BKE_keyconfig_pref_type_find(const char *idname, bool quiet)
Definition: keyconfig.c:73
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
struct WorkSpace * BKE_workspace_active_get(struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition: workspace.c:535
struct bScreen * BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
struct WorkSpaceLayout * BKE_workspace_layout_find(const struct WorkSpace *workspace, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
#define BLI_assert(a)
Definition: BLI_assert.h:58
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:116
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define STRNCPY(dst, src)
Definition: BLI_string.h:163
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:70
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
int BLI_str_utf8_size(const char *p) ATTR_NONNULL()
Definition: string_utf8.c:495
unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index) ATTR_NONNULL()
Definition: string_utf8.c:550
char * BLI_string_join_array_by_sep_char_with_tableN(char sep, char *table[], const char *strings[], uint strings_len) ATTR_NONNULL()
Definition: string_utils.c:508
#define ARRAY_SIZE(arr)
#define UNUSED_VARS(...)
#define UNUSED(x)
#define STREQ(a, b)
#define BLT_I18NCONTEXT_ID_WINDOWMANAGER
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define BLT_I18NCONTEXT_UI_EVENTS
#define BPy_BEGIN_ALLOW_THREADS
Definition: BPY_extern.h:62
#define BPy_END_ALLOW_THREADS
Definition: BPY_extern.h:66
@ IDP_GROUP
Definition: DNA_ID.h:101
Object is a sort of wrapper for general info.
@ S3D_INTERLACE_SWAP
@ S3D_SIDEBYSIDE_CROSSEYED
#define OP_MAX_TYPENAME
@ OPERATOR_CANCELLED
@ OPERATOR_INTERFACE
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
@ KEYMAP_USER_MODIFIED
@ KEYMAP_CHILDREN_EXPANDED
@ KMI_REPEAT_IGNORE
@ KMI_USER_MODIFIED
@ OP_IS_REPEAT_LAST
@ OP_IS_MODAL_CURSOR_REGION
@ OP_IS_MODAL_GRAB_CURSOR
@ RPT_ERROR_OUT_OF_MEMORY
@ RPT_ERROR_INVALID_INPUT
@ RPT_ERROR_INVALID_CONTEXT
@ KMI_TYPE_TEXTINPUT
@ KMI_TYPE_KEYBOARD
_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
Read Guarded memory(de)allocation.
StructRNA RNA_KeyConfigPreferences
StructRNA RNA_ViewLayer
StructRNA RNA_Screen
StructRNA RNA_WorkSpace
StructRNA RNA_Macro
StructRNA RNA_XrSessionState
StructRNA RNA_UILayout
StructRNA RNA_KeyConfig
StructRNA RNA_Operator
#define RNA_DYN_DESCR_MAX
Definition: RNA_define.h:532
void(* StructFreeFunc)(void *data)
Definition: RNA_types.h:652
int(* StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function)
Definition: RNA_types.h:647
@ STRUCT_ID_REFCOUNT
Definition: RNA_types.h:621
@ STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID
Definition: RNA_types.h:644
@ STRUCT_NO_DATABLOCK_IDPROPERTIES
Definition: RNA_types.h:632
@ STRUCT_NO_IDPROPERTIES
Definition: RNA_types.h:630
@ STRUCT_PUBLIC_NAMESPACE_INHERIT
Definition: RNA_types.h:638
@ STRUCT_UNDO
Definition: RNA_types.h:623
int(* StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list)
Definition: RNA_types.h:648
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
@ PROP_CONTEXT_UPDATE
Definition: RNA_types.h:254
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_ENUM_FLAG
Definition: RNA_types.h:251
@ PROP_REGISTER_OPTIONAL
Definition: RNA_types.h:259
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_NO_DEG_UPDATE
Definition: RNA_types.h:286
@ PROP_REGISTER
Definition: RNA_types.h:258
@ PROP_IDPROPERTY
Definition: RNA_types.h:273
@ PROP_XYZ
Definition: RNA_types.h:148
@ PROP_FILENAME
Definition: RNA_types.h:118
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_XYZ_LENGTH
Definition: RNA_types.h:149
@ PROP_UNSIGNED
Definition: RNA_types.h:129
#define C
Definition: RandGen.cpp:39
struct uiLayout * UI_pie_menu_layout(struct uiPieMenu *pie)
struct uiLayout * UI_popover_layout(uiPopover *pup)
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
#define NC_WINDOW
Definition: WM_types.h:277
@ OPTYPE_PRESET
Definition: WM_types.h:168
@ OPTYPE_INTERNAL
Definition: WM_types.h:175
@ OPTYPE_MACRO
Definition: WM_types.h:158
@ OPTYPE_BLOCKING
Definition: WM_types.h:157
@ OPTYPE_UNDO_GROUPED
Definition: WM_types.h:180
@ OPTYPE_UNDO
Definition: WM_types.h:155
@ OPTYPE_GRAB_CURSOR_XY
Definition: WM_types.h:161
@ OPTYPE_REGISTER
Definition: WM_types.h:153
@ OPTYPE_GRAB_CURSOR_X
Definition: WM_types.h:163
@ OPTYPE_GRAB_CURSOR_Y
Definition: WM_types.h:165
#define KM_CLICK
Definition: WM_types.h:244
#define KM_ANY
Definition: WM_types.h:240
#define NC_SCREEN
Definition: WM_types.h:278
#define KM_CLICK_DRAG
Definition: WM_types.h:246
#define NC_SCENE
Definition: WM_types.h:279
#define NA_EDITED
Definition: WM_types.h:462
#define KM_PRESS
Definition: WM_types.h:242
#define KM_TEXTINPUT
Definition: WM_types.h:237
#define KM_NOTHING
Definition: WM_types.h:241
#define ND_LAYER
Definition: WM_types.h:350
#define ND_WORKSPACE_SET
Definition: WM_types.h:328
#define ND_LAYOUTBROWSE
Definition: WM_types.h:321
@ OP_PROP_TAG_ADVANCED
Definition: WM_types.h:214
#define ND_SCENEBROWSE
Definition: WM_types.h:332
#define KM_DBL_CLICK
Definition: WM_types.h:245
#define KM_RELEASE
Definition: WM_types.h:243
return(oflags[bm->toolflag_index].f &oflag) !=0
void BPY_RNA_operator_macro_wrapper(wmOperatorType *ot, void *userdata)
void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata)
unsigned int U
Definition: btGjkEpa3.h:78
Scene scene
#define str(s)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static ulong state[N]
return ret
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void **value)
Definition: rna_access.c:7407
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:122
bool RNA_struct_available_or_report(ReportList *reports, const char *identifier)
Definition: rna_access.c:1063
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
Definition: rna_access.c:1044
ParameterList * RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSED(ptr), FunctionRNA *func)
Definition: rna_access.c:7207
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
void * RNA_struct_blender_type_get(StructRNA *srna)
Definition: rna_access.c:1039
void RNA_parameter_list_free(ParameterList *parms)
Definition: rna_access.c:7303
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value)
Definition: rna_access.c:7469
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
Definition: rna_access.c:196
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
Definition: rna_define.c:1167
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2762
void RNA_def_struct_flag(StructRNA *srna, int flag)
Definition: rna_define.c:1152
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t bit)
Definition: rna_define.c:2257
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
Definition: rna_define.c:3312
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
Definition: rna_define.c:3153
void RNA_define_verify_sdna(bool verify)
Definition: rna_define.c:751
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2717
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
Definition: rna_define.c:1684
void RNA_def_struct_property_tags(StructRNA *srna, const EnumPropertyItem *prop_tag_defines)
Definition: rna_define.c:1162
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
Definition: rna_define.c:3462
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
Definition: rna_define.c:1259
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
Definition: rna_define.c:2971
void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
Definition: rna_define.c:1191
StructRNA * RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
Definition: rna_define.c:919
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
Definition: rna_define.c:1067
void RNA_def_struct_clear_flag(StructRNA *srna, int flag)
Definition: rna_define.c:1157
void RNA_def_property_array(PropertyRNA *prop, int length)
Definition: rna_define.c:1568
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
Definition: rna_define.c:1940
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
Definition: rna_define.c:1792
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
Definition: rna_define.c:2791
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
Definition: rna_define.c:2927
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
Definition: rna_define.c:3251
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
Definition: rna_define.c:1122
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *rna_ext)
Definition: rna_define.c:780
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
Definition: rna_define.c:3373
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
Definition: rna_define.c:1047
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2623
void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
Definition: rna_define.c:2086
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
Definition: rna_define.c:795
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
Definition: rna_define.c:1179
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
Definition: rna_define.c:2870
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2515
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
Definition: rna_define.c:2364
void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
Definition: rna_define.c:1272
void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
Definition: rna_define.c:2348
void RNA_api_keymapitem(struct StructRNA *srna)
Definition: rna_wm_api.c:1102
void RNA_api_keyconfig(struct StructRNA *srna)
void RNA_api_keyconfigs(struct StructRNA *srna)
Definition: rna_wm_api.c:1256
BlenderRNA BLENDER_RNA
void RNA_api_keymap(struct StructRNA *srna)
Definition: rna_wm_api.c:1083
void RNA_api_wm(struct StructRNA *srna)
Definition: rna_wm_api.c:742
void RNA_api_keymaps(struct StructRNA *srna)
Definition: rna_wm_api.c:1212
void RNA_api_window(struct StructRNA *srna)
Definition: rna_wm_api.c:693
void RNA_api_macro(struct StructRNA *srna)
Definition: rna_wm_api.c:1047
void RNA_api_operator(struct StructRNA *srna)
Definition: rna_wm_api.c:940
void RNA_api_keymapitems(struct StructRNA *srna)
Definition: rna_wm_api.c:1120
const EnumPropertyItem rna_enum_stereo3d_display_items[]
Definition: rna_scene.c:487
const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[]
Definition: rna_scene.c:519
const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[]
Definition: rna_scene.c:526
const EnumPropertyItem rna_enum_region_type_items[]
Definition: rna_screen.c:35
const EnumPropertyItem rna_enum_space_type_items[]
Definition: rna_space.c:72
static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_wm.c:2537
void RNA_def_wm(BlenderRNA *brna)
Definition: rna_wm.c:2820
const EnumPropertyItem rna_enum_event_value_all_items[]
Definition: rna_wm.c:376
static void rna_def_operator_type_macro(BlenderRNA *brna)
Definition: rna_wm.c:2075
static void rna_def_timer(BlenderRNA *brna)
Definition: rna_wm.c:2258
static void rna_def_keyconfig_prefs(BlenderRNA *brna)
Definition: rna_wm.c:2549
static void rna_def_popup_menu_wrapper(BlenderRNA *brna, const char *rna_type, const char *c_type, const char *layout_get_fn)
Definition: rna_wm.c:2288
static void rna_def_event(BlenderRNA *brna)
Definition: rna_wm.c:2130
static void rna_def_window_stereo3d(BlenderRNA *brna)
Definition: rna_wm.c:2326
static void rna_def_macro_operator(BlenderRNA *brna)
Definition: rna_wm.c:1990
const EnumPropertyItem rna_enum_event_type_mask_items[]
Definition: rna_wm.c:426
static void rna_def_popovermenu(BlenderRNA *brna)
Definition: rna_wm.c:2316
static void rna_def_operator_filelist_element(BlenderRNA *brna)
Definition: rna_wm.c:2117
static void rna_def_windowmanager(BlenderRNA *brna)
Definition: rna_wm.c:2483
static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_wm.c:2437
const EnumPropertyItem rna_enum_event_value_keymouse_items[]
Definition: rna_wm.c:395
static void rna_def_operator(BlenderRNA *brna)
Definition: rna_wm.c:1876
const EnumPropertyItem rna_enum_event_value_tweak_items[]
Definition: rna_wm.c:407
const EnumPropertyItem rna_enum_event_type_items[]
Definition: rna_wm.c:146
static void rna_def_operator_options_runtime(BlenderRNA *brna)
Definition: rna_wm.c:1840
const EnumPropertyItem rna_enum_operator_property_tags[]
Definition: rna_wm.c:498
static void rna_def_piemenu(BlenderRNA *brna)
Definition: rna_wm.c:2321
static void rna_def_window(BlenderRNA *brna)
Definition: rna_wm.c:2357
const EnumPropertyItem rna_enum_wm_report_items[]
Definition: rna_wm.c:508
const EnumPropertyItem rna_enum_keymap_propvalue_items[]
Definition: rna_wm.c:420
const EnumPropertyItem rna_enum_operator_type_flag_items[]
Definition: rna_wm.c:449
const EnumPropertyItem rna_enum_operator_return_items[]
Definition: rna_wm.c:476
static void rna_def_keyconfig(BlenderRNA *brna)
Definition: rna_wm.c:2572
static void rna_def_operator_utils(BlenderRNA *brna)
Definition: rna_wm.c:2098
static void rna_def_popupmenu(BlenderRNA *brna)
Definition: rna_wm.c:2311
static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
Definition: rna_wm.c:2525
StructRNA * srna
Definition: RNA_types.h:681
StructCallbackFunc call
Definition: RNA_types.h:682
void * data
Definition: RNA_types.h:680
StructFreeFunc free
Definition: RNA_types.h:683
void * last
Definition: DNA_listBase.h:47
void * first
Definition: DNA_listBase.h:47
Definition: BKE_main.h:116
ListBase wm
Definition: BKE_main.h:175
struct StructRNA * type
Definition: RNA_types.h:51
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
struct WorkSpaceLayout * temp_layout_store
Wrapper for bScreen.
struct wmKeyConfig * next
struct PointerRNA * ptr
struct wmKeyMapItem * next
struct wmKeyMap * next
const void * modal_items
struct IDProperty * properties
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:768
const char * idname
Definition: WM_types.h:723
char *(* get_description)(struct bContext *C, struct wmOperatorType *, struct PointerRNA *)
Definition: WM_types.h:799
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:760
struct StructRNA * srna
Definition: WM_types.h:802
ExtensionRNA rna_ext
Definition: WM_types.h:826
const char * translation_context
Definition: WM_types.h:724
const char * description
Definition: WM_types.h:726
void(* ui)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:787
bool(* check)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:744
bool(* pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:823
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
const char * undo_group
Definition: WM_types.h:728
struct ReportList * reports
IDProperty * properties
struct wmOperatorType * type
struct wmKeyConfig * defaultconf
struct WorkSpaceInstanceHook * workspace_hook
struct Scene * new_scene
#define G(x, y, z)
uint len
void WM_operator_stack_clear(wmWindowManager *wm)
Definition: wm.c:401
void WM_operator_handlers_clear(wmWindowManager *wm, wmOperatorType *ot)
Definition: wm.c:416
bool WM_event_is_tablet(const struct wmEvent *event)
float WM_event_tablet_data(const wmEvent *event, int *pen_flip, float tilt[2])
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier_ex(wmWindowManager *wm, const wmWindow *win, uint type, void *reference)
#define ISTWEAK(event_type)
@ EVT_PAD8
@ EVT_F14KEY
@ EVT_PAD2
@ MOUSEPAN
@ BUTTON7MOUSE
@ RIGHTMOUSE
@ EVT_SIXKEY
@ EVT_QUOTEKEY
@ EVT_PADPERIOD
@ NDOF_BUTTON_SPIN_CW
@ EVT_OKEY
@ NDOF_BUTTON_TILT_CCW
@ TIMER
@ EVT_EKEY
@ EVT_PAD4
@ EVT_JKEY
@ EVT_PADASTERKEY
@ NDOF_BUTTON_7
@ BUTTON6MOUSE
@ NDOF_BUTTON_SHIFT
@ EVT_F18KEY
@ EVT_PLUSKEY
@ EVT_PAD0
@ EVT_F7KEY
@ EVT_FOURKEY
@ NDOF_BUTTON_2
@ EVT_YKEY
@ EVT_RIGHTCTRLKEY
@ EVT_F17KEY
@ EVT_SKEY
@ EVT_VKEY
@ MOUSEZOOM
@ NDOF_BUTTON_8
@ EVT_IKEY
@ NDOF_BUTTON_MENU
@ EVT_F1KEY
@ EVT_PERIODKEY
@ EVT_PADSLASHKEY
@ EVT_XKEY
@ NDOF_BUTTON_1
@ EVT_COMMAKEY
@ NDOF_BUTTON_BOTTOM
@ EVT_MEDIAPLAY
@ EVT_LEFTBRACKETKEY
@ EVT_ACTIONZONE_FULLSCREEN
@ EVT_MEDIAFIRST
@ EVT_F23KEY
@ EVT_ZEROKEY
@ EVT_F10KEY
@ EVT_FKEY
@ EVT_PAD9
@ EVT_DELKEY
@ EVT_SEVENKEY
@ TIMERJOBS
@ EVT_F20KEY
@ EVT_CKEY
@ EVT_F2KEY
@ EVT_GKEY
@ EVT_ACTIONZONE_REGION
@ EVT_KKEY
@ EVT_TABKEY
@ EVT_DOWNARROWKEY
@ NDOF_BUTTON_ESC
@ NDOF_BUTTON_BACK
@ EVT_UKEY
@ EVT_MEDIASTOP
@ EVT_AKEY
@ EVT_PAD3
@ EVT_MINUSKEY
@ MOUSEROTATE
@ WHEELUPMOUSE
@ EVT_PAGEUPKEY
@ EVT_OSKEY
@ EVT_TWEAK_M
@ EVT_F4KEY
@ EVT_PAGEDOWNKEY
@ NDOF_BUTTON_5
@ TIMERAUTOSAVE
@ TIMER1
@ EVT_F8KEY
@ NDOF_BUTTON_RIGHT
@ EVT_LEFTCTRLKEY
@ NDOF_BUTTON_ROLL_CW
@ NDOF_BUTTON_10
@ TABLET_ERASER
@ EVT_EQUALKEY
@ NDOF_BUTTON_3
@ EVT_RIGHTARROWKEY
@ EVT_F6KEY
@ EVT_F5KEY
@ EVT_PADENTER
@ EVT_F22KEY
@ EVT_F19KEY
@ EVT_NINEKEY
@ NDOF_BUTTON_PLUS
@ EVT_SPACEKEY
@ BUTTON4MOUSE
@ WHEELDOWNMOUSE
@ NDOF_BUTTON_A
@ EVT_PAD6
@ EVT_ACTIONZONE_AREA
@ NDOF_BUTTON_ISO2
@ EVT_PAD5
@ EVT_HOMEKEY
@ TABLET_STYLUS
@ MOUSEMOVE
@ EVT_RIGHTBRACKETKEY
@ EVT_WKEY
@ NDOF_BUTTON_PANZOOM
@ EVT_ENDKEY
@ EVT_RIGHTALTKEY
@ EVT_MEDIALAST
@ NDOF_BUTTON_B
@ EVT_MKEY
@ EVT_LINEFEEDKEY
@ TIMER2
@ EVT_TKEY
@ EVT_HKEY
@ EVT_TWEAK_R
@ MOUSESMARTZOOM
@ NDOF_BUTTON_MINUS
@ EVT_BACKSLASHKEY
@ EVT_FIVEKEY
@ EVT_APPKEY
@ EVT_F24KEY
@ TIMER0
@ EVT_ACCENTGRAVEKEY
@ NDOF_BUTTON_C
@ EVT_PADMINUS
@ EVT_F21KEY
@ EVT_ONEKEY
@ EVT_UPARROWKEY
@ LEFTMOUSE
@ EVT_F11KEY
@ EVT_SLASHKEY
@ EVT_EIGHTKEY
@ EVT_F13KEY
@ NDOF_BUTTON_DOMINANT
@ EVT_F15KEY
@ EVT_LEFTARROWKEY
@ NDOF_MOTION
@ EVT_INSERTKEY
@ EVT_NKEY
@ EVT_QKEY
@ MIDDLEMOUSE
@ TIMERREPORT
@ NDOF_BUTTON_TILT_CW
@ NDOF_BUTTON_ALT
@ EVT_LEFTALTKEY
@ EVT_ZKEY
@ EVT_ESCKEY
@ NDOF_BUTTON_9
@ NDOF_BUTTON_LEFT
@ NDOF_BUTTON_FIT
@ EVT_THREEKEY
@ WHEELOUTMOUSE
@ EVT_BACKSPACEKEY
@ EVT_TWEAK_L
@ WHEELINMOUSE
@ EVT_F12KEY
@ INBETWEEN_MOUSEMOVE
@ EVT_DKEY
@ EVT_F16KEY
@ NDOF_BUTTON_4
@ EVT_PAD1
@ EVT_TWOKEY
@ EVT_GRLESSKEY
@ EVT_LKEY
@ EVT_RIGHTSHIFTKEY
@ NDOF_BUTTON_FRONT
@ EVT_PAUSEKEY
@ EVT_PAD7
@ NDOF_BUTTON_SPIN_CCW
@ EVT_LEFTSHIFTKEY
@ NDOF_BUTTON_ISO1
@ EVT_PADPLUSKEY
@ NDOF_BUTTON_6
@ EVT_F3KEY
@ NDOF_BUTTON_CTRL
@ NDOF_BUTTON_TOP
@ EVT_F9KEY
@ EVT_RKEY
@ WINDEACTIVATE
@ EVT_SEMICOLONKEY
@ EVT_BKEY
@ EVT_PKEY
@ TIMERREGION
@ NDOF_BUTTON_ROTATE
@ EVT_RETKEY
@ BUTTON5MOUSE
@ NDOF_BUTTON_ROLL_CCW
@ EVT_TYPE_MASK_TWEAK
@ EVT_TYPE_MASK_ACTIONZONE
@ EVT_TYPE_MASK_KEYBOARD_MODIFIER
@ EVT_TYPE_MASK_NDOF
@ EVT_TYPE_MASK_MOUSE_WHEEL
@ EVT_TYPE_MASK_MOUSE_GESTURE
@ EVT_TYPE_MASK_MOUSE_BUTTON
@ EVT_TYPE_MASK_MOUSE
@ EVT_TYPE_MASK_KEYBOARD
@ EVT_GESTURE_NW
@ EVT_GESTURE_SW
@ EVT_GESTURE_W
@ EVT_GESTURE_N
@ EVT_GESTURE_NE
@ EVT_GESTURE_SE
@ EVT_GESTURE_E
@ EVT_GESTURE_S
PointerRNA * ptr
Definition: wm_files.c:3157
wmOperatorType * ot
Definition: wm_files.c:3156
int WM_keymap_item_map_type_get(const wmKeyMapItem *kmi)
Definition: wm_keymap.c:207
void WM_keyconfig_set_active(wmWindowManager *wm, const char *idname)
Definition: wm_keymap.c:360
void WM_keyconfig_update_tag(wmKeyMap *keymap, wmKeyMapItem *kmi)
Definition: wm_keymap.c:1739
void WM_keymap_item_properties_reset(wmKeyMapItem *kmi, struct IDProperty *properties)
Definition: wm_keymap.c:193
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operatortype_append_macro_ptr(void(*opfunc)(wmOperatorType *, void *), void *userdata)
void WM_operatortype_append_ptr(void(*opfunc)(wmOperatorType *, void *), void *userdata)
const char * WM_operatortype_name(struct wmOperatorType *ot, struct PointerRNA *properties)
void WM_operatortype_remove_ptr(wmOperatorType *ot)
void WM_operator_bl_idname(char *to, const char *from)
Definition: wm_operators.c:144
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
Definition: wm_operators.c:584
void WM_operator_py_idname(char *to, const char *from)
Definition: wm_operators.c:123
bool WM_operator_py_idname_ok_or_report(ReportList *reports, const char *classname, const char *idname)
Definition: wm_operators.c:171
void WM_window_set_active_scene(Main *bmain, bContext *C, wmWindow *win, Scene *scene)
Definition: wm_window.c:2257
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2286
bool WM_window_is_temp_screen(const wmWindow *win)
Definition: wm_window.c:2383
void WM_window_set_active_view_layer(wmWindow *win, ViewLayer *view_layer)
Definition: wm_window.c:2306
Scene * WM_window_get_active_scene(const wmWindow *win)
Definition: wm_window.c:2249
wmXrSessionState * WM_xr_session_state_handle_get(const wmXrData *xr)