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