Blender  V2.93
rna_wm_api.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2009 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <ctype.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 
28 #include "BLI_utildefines.h"
29 
30 #include "RNA_define.h"
31 #include "RNA_enum_types.h"
32 
33 #include "DNA_screen_types.h"
34 #include "DNA_space_types.h"
36 
37 #include "UI_interface.h"
38 
39 #include "wm_cursors.h"
40 #include "wm_event_types.h"
41 
42 #include "rna_internal.h" /* own include */
43 
44 /* confusing 2 enums mixed up here */
46  {WM_CURSOR_DEFAULT, "DEFAULT", 0, "Default", ""},
47  {WM_CURSOR_NONE, "NONE", 0, "None", ""},
48  {WM_CURSOR_WAIT, "WAIT", 0, "Wait", ""},
49  {WM_CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""},
50  {WM_CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""},
51  {WM_CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""},
52 
53  /* new */
54  {WM_CURSOR_KNIFE, "KNIFE", 0, "Knife", ""},
55  {WM_CURSOR_TEXT_EDIT, "TEXT", 0, "Text", ""},
56  {WM_CURSOR_PAINT_BRUSH, "PAINT_BRUSH", 0, "Paint Brush", ""},
57  {WM_CURSOR_PAINT, "PAINT_CROSS", 0, "Paint Cross", ""},
58  {WM_CURSOR_DOT, "DOT", 0, "Dot Cursor", ""},
59  {WM_CURSOR_ERASER, "ERASER", 0, "Eraser", ""},
60  {WM_CURSOR_HAND, "HAND", 0, "Hand", ""},
61  {WM_CURSOR_EW_SCROLL, "SCROLL_X", 0, "Scroll-X", ""},
62  {WM_CURSOR_NS_SCROLL, "SCROLL_Y", 0, "Scroll-Y", ""},
63  {WM_CURSOR_NSEW_SCROLL, "SCROLL_XY", 0, "Scroll-XY", ""},
64  {WM_CURSOR_EYEDROPPER, "EYEDROPPER", 0, "Eyedropper", ""},
65  {0, NULL, 0, NULL, NULL},
66 };
67 
68 #ifdef RNA_RUNTIME
69 
70 # include "BKE_context.h"
71 # include "BKE_undo_system.h"
72 
73 # include "WM_types.h"
74 
75 /* Needed since RNA doesn't use `const` in function signatures. */
76 static bool rna_KeyMapItem_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2)
77 {
78  return WM_keymap_item_compare(k1, k2);
79 }
80 
81 static void rna_KeyMapItem_to_string(wmKeyMapItem *kmi, bool compact, char *result)
82 {
84 }
85 
86 static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C)
87 {
89  return WM_keymap_active(wm, km);
90 }
91 
92 static void rna_keymap_restore_to_default(wmKeyMap *km, bContext *C)
93 {
95 }
96 
97 static void rna_keymap_restore_item_to_default(wmKeyMap *km, bContext *C, wmKeyMapItem *kmi)
98 {
100 }
101 
102 static void rna_Operator_report(wmOperator *op, int type, const char *msg)
103 {
104  BKE_report(op->reports, type, msg);
105 }
106 
107 static bool rna_Operator_is_repeat(wmOperator *op, bContext *C)
108 {
109  return WM_operator_is_repeat(C, op);
110 }
111 
112 /* since event isn't needed... */
113 static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
114 {
116 }
117 
118 static bool rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator)
119 {
120  return WM_event_add_modal_handler(C, operator) != NULL;
121 }
122 
123 /* XXX, need a way for python to know event types, 0x0110 is hard coded */
124 static wmTimer *rna_event_timer_add(struct wmWindowManager *wm, float time_step, wmWindow *win)
125 {
126  return WM_event_add_timer(wm, win, 0x0110, time_step);
127 }
128 
129 static void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer)
130 {
131  WM_event_remove_timer(wm, timer->win, timer);
132 }
133 
134 static wmGizmoGroupType *wm_gizmogrouptype_find_for_add_remove(ReportList *reports,
135  const char *idname)
136 {
137  wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, true);
138  if (gzgt == NULL) {
139  BKE_reportf(reports, RPT_ERROR, "Gizmo group type '%s' not found!", idname);
140  return NULL;
141  }
142  if (gzgt->flag & WM_GIZMOGROUPTYPE_PERSISTENT) {
143  BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' has 'PERSISTENT' option set!", idname);
144  return NULL;
145  }
146  return gzgt;
147 }
148 
149 static void rna_gizmo_group_type_ensure(ReportList *reports, const char *idname)
150 {
151  wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
152  if (gzgt != NULL) {
154  }
155 }
156 
157 static void rna_gizmo_group_type_unlink_delayed(ReportList *reports, const char *idname)
158 {
159  wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
160  if (gzgt != NULL) {
162  }
163 }
164 
165 /* Placeholder data for final implementation of a true progress-bar. */
166 static struct wmStaticProgress {
167  float min;
168  float max;
169  bool is_valid;
170 } wm_progress_state = {0, 0, false};
171 
172 static void rna_progress_begin(struct wmWindowManager *UNUSED(wm), float min, float max)
173 {
174  float range = max - min;
175  if (range != 0) {
176  wm_progress_state.min = min;
177  wm_progress_state.max = max;
178  wm_progress_state.is_valid = true;
179  }
180  else {
181  wm_progress_state.is_valid = false;
182  }
183 }
184 
185 static void rna_progress_update(struct wmWindowManager *wm, float value)
186 {
187  if (wm_progress_state.is_valid) {
188  /* Map to cursor_time range [0,9999] */
189  wmWindow *win = wm->winactive;
190  if (win) {
191  int val = (int)(10000 * (value - wm_progress_state.min) /
192  (wm_progress_state.max - wm_progress_state.min));
193  WM_cursor_time(win, val);
194  }
195  }
196 }
197 
198 static void rna_progress_end(struct wmWindowManager *wm)
199 {
200  if (wm_progress_state.is_valid) {
201  wmWindow *win = wm->winactive;
202  if (win) {
204  wm_progress_state.is_valid = false;
205  }
206  }
207 }
208 
209 /* wrap these because of 'const wmEvent *' */
210 static int rna_Operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
211 {
212  return WM_operator_confirm(C, op, event);
213 }
214 static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
215 {
216  return WM_operator_props_popup(C, op, event);
217 }
218 
219 static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km,
220  ReportList *reports,
221  const char *idname,
222  int type,
223  int value,
224  bool any,
225  bool shift,
226  bool ctrl,
227  bool alt,
228  bool oskey,
229  int keymodifier,
230  bool repeat,
231  bool head)
232 {
233  /* wmWindowManager *wm = CTX_wm_manager(C); */
234  wmKeyMapItem *kmi = NULL;
235  char idname_bl[OP_MAX_TYPENAME];
236  int modifier = 0;
237 
238  /* only on non-modal maps */
239  if (km->flag & KEYMAP_MODAL) {
240  BKE_report(reports, RPT_ERROR, "Not a non-modal keymap");
241  return NULL;
242  }
243 
244  WM_operator_bl_idname(idname_bl, idname);
245 
246  if (shift) {
247  modifier |= KM_SHIFT;
248  }
249  if (ctrl) {
250  modifier |= KM_CTRL;
251  }
252  if (alt) {
253  modifier |= KM_ALT;
254  }
255  if (oskey) {
256  modifier |= KM_OSKEY;
257  }
258 
259  if (any) {
260  modifier = KM_ANY;
261  }
262 
263  /* create keymap item */
264  kmi = WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier);
265 
266  if (!repeat) {
267  kmi->flag |= KMI_REPEAT_IGNORE;
268  }
269 
270  /* T32437 allow scripts to define hotkeys that get added to start of keymap
271  * so that they stand a chance against catch-all defines later on
272  */
273  if (head) {
274  BLI_remlink(&km->items, kmi);
275  BLI_addhead(&km->items, kmi);
276  }
277 
278  return kmi;
279 }
280 
281 static wmKeyMapItem *rna_KeyMap_item_new_from_item(wmKeyMap *km,
282  ReportList *reports,
283  wmKeyMapItem *kmi_src,
284  bool head)
285 {
286  /* wmWindowManager *wm = CTX_wm_manager(C); */
287 
288  if ((km->flag & KEYMAP_MODAL) == (kmi_src->idname[0] != '\0')) {
289  BKE_report(reports, RPT_ERROR, "Can not mix modal/non-modal items");
290  return NULL;
291  }
292 
293  /* create keymap item */
294  wmKeyMapItem *kmi = WM_keymap_add_item_copy(km, kmi_src);
295  if (head) {
296  BLI_remlink(&km->items, kmi);
297  BLI_addhead(&km->items, kmi);
298  }
299  return kmi;
300 }
301 
302 static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km,
303  ReportList *reports,
304  const char *propvalue_str,
305  int type,
306  int value,
307  bool any,
308  bool shift,
309  bool ctrl,
310  bool alt,
311  bool oskey,
312  int keymodifier,
313  bool repeat)
314 {
315  wmKeyMapItem *kmi = NULL;
316  int modifier = 0;
317  int propvalue = 0;
318 
319  /* only modal maps */
320  if ((km->flag & KEYMAP_MODAL) == 0) {
321  BKE_report(reports, RPT_ERROR, "Not a modal keymap");
322  return NULL;
323  }
324 
325  if (shift) {
326  modifier |= KM_SHIFT;
327  }
328  if (ctrl) {
329  modifier |= KM_CTRL;
330  }
331  if (alt) {
332  modifier |= KM_ALT;
333  }
334  if (oskey) {
335  modifier |= KM_OSKEY;
336  }
337 
338  if (any) {
339  modifier = KM_ANY;
340  }
341 
342  /* not initialized yet, do delayed lookup */
343  if (!km->modal_items) {
344  kmi = WM_modalkeymap_add_item_str(km, type, value, modifier, keymodifier, propvalue_str);
345  }
346  else {
347  if (RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue) == 0) {
348  BKE_report(reports, RPT_WARNING, "Property value not in enumeration");
349  }
350  kmi = WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
351  }
352 
353  if (!repeat) {
354  kmi->flag |= KMI_REPEAT_IGNORE;
355  }
356 
357  return kmi;
358 }
359 
360 static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA *kmi_ptr)
361 {
362  wmKeyMapItem *kmi = kmi_ptr->data;
363 
364  if (WM_keymap_remove_item(km, kmi) == false) {
365  BKE_reportf(reports,
366  RPT_ERROR,
367  "KeyMapItem '%s' cannot be removed from '%s'",
368  kmi->idname,
369  km->idname);
370  return;
371  }
372 
373  RNA_POINTER_INVALIDATE(kmi_ptr);
374 }
375 
376 static PointerRNA rna_KeyMap_item_find_from_operator(ID *id,
377  wmKeyMap *km,
378  const char *idname,
379  PointerRNA *properties,
380  int include_mask,
381  int exclude_mask)
382 {
383  char idname_bl[OP_MAX_TYPENAME];
384  WM_operator_bl_idname(idname_bl, idname);
385 
387  km, idname_bl, properties->data, include_mask, exclude_mask);
388  PointerRNA kmi_ptr;
389  RNA_pointer_create(id, &RNA_KeyMapItem, kmi, &kmi_ptr);
390  return kmi_ptr;
391 }
392 
393 static PointerRNA rna_KeyMap_item_match_event(ID *id, wmKeyMap *km, bContext *C, wmEvent *event)
394 {
395  wmKeyMapItem *kmi = WM_event_match_keymap_item(C, km, event);
396  PointerRNA kmi_ptr;
397  RNA_pointer_create(id, &RNA_KeyMapItem, kmi, &kmi_ptr);
398  return kmi_ptr;
399 }
400 
401 static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf,
402  ReportList *reports,
403  const char *idname,
404  int spaceid,
405  int regionid,
406  bool modal,
407  bool tool)
408 {
409  if (modal) {
410  /* Sanity check: Don't allow add-ons to override internal modal key-maps
411  * because this isn't supported, the restriction can be removed when
412  * add-ons can define modal key-maps.
413  * Currently this is only useful for add-ons to override built-in modal keymaps
414  * which is not the intended use for add-on keymaps. */
415  wmWindowManager *wm = G_MAIN->wm.first;
416  if (keyconf == wm->addonconf) {
417  BKE_reportf(reports, RPT_ERROR, "Modal key-maps not supported for add-on key-config");
418  return NULL;
419  }
420  }
421 
422  wmKeyMap *keymap;
423 
424  if (modal == 0) {
425  keymap = WM_keymap_ensure(keyconf, idname, spaceid, regionid);
426  }
427  else {
428  keymap = WM_modalkeymap_ensure(keyconf, idname, NULL); /* items will be lazy init */
429  }
430 
431  if (keymap && tool) {
432  keymap->flag |= KEYMAP_TOOL;
433  }
434 
435  return keymap;
436 }
437 
438 static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf,
439  const char *idname,
440  int spaceid,
441  int regionid)
442 {
443  return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
444 }
445 
446 static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char *idname)
447 {
448  wmOperatorType *ot = WM_operatortype_find(idname, 0);
449 
450  if (!ot) {
451  return NULL;
452  }
453  else {
454  return ot->modalkeymap;
455  }
456 }
457 
458 static void rna_KeyMap_remove(wmKeyConfig *keyconfig, ReportList *reports, PointerRNA *keymap_ptr)
459 {
460  wmKeyMap *keymap = keymap_ptr->data;
461 
462  if (WM_keymap_remove(keyconfig, keymap) == false) {
463  BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keymap->idname);
464  return;
465  }
466 
467  RNA_POINTER_INVALIDATE(keymap_ptr);
468 }
469 
470 static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr)
471 {
472  wmKeyConfig *keyconf = keyconf_ptr->data;
473 
474  if (WM_keyconfig_remove(wm, keyconf) == false) {
475  BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
476  return;
477  }
478 
479  RNA_POINTER_INVALIDATE(keyconf_ptr);
480 }
481 
482 static PointerRNA rna_KeyConfig_find_item_from_operator(wmWindowManager *wm,
483  bContext *C,
484  const char *idname,
485  int opcontext,
486  PointerRNA *properties,
487  int include_mask,
488  int exclude_mask,
489  PointerRNA *km_ptr)
490 {
491  char idname_bl[OP_MAX_TYPENAME];
492  WM_operator_bl_idname(idname_bl, idname);
493 
494  wmKeyMap *km = NULL;
496  C, idname_bl, opcontext, properties->data, include_mask, exclude_mask, &km);
497  PointerRNA kmi_ptr;
498  RNA_pointer_create(&wm->id, &RNA_KeyMap, km, km_ptr);
499  RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &kmi_ptr);
500  return kmi_ptr;
501 }
502 
503 static void rna_KeyConfig_update(wmWindowManager *wm)
504 {
506 }
507 
508 /* popup menu wrapper */
509 static PointerRNA rna_PopMenuBegin(bContext *C, const char *title, int icon)
510 {
511  PointerRNA r_ptr;
512  void *data;
513 
514  data = (void *)UI_popup_menu_begin(C, title, icon);
515 
517 
518  return r_ptr;
519 }
520 
521 static void rna_PopMenuEnd(bContext *C, PointerRNA *handle)
522 {
523  UI_popup_menu_end(C, handle->data);
524 }
525 
526 /* popover wrapper */
527 static PointerRNA rna_PopoverBegin(bContext *C, int ui_units_x, bool from_active_button)
528 {
529  PointerRNA r_ptr;
530  void *data;
531 
532  data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x, from_active_button);
533 
534  RNA_pointer_create(NULL, &RNA_UIPopover, data, &r_ptr);
535 
536  return r_ptr;
537 }
538 
539 static void rna_PopoverEnd(bContext *C, PointerRNA *handle, wmKeyMap *keymap)
540 {
541  UI_popover_end(C, handle->data, keymap);
542 }
543 
544 /* pie menu wrapper */
545 static PointerRNA rna_PieMenuBegin(bContext *C, const char *title, int icon, PointerRNA *event)
546 {
547  PointerRNA r_ptr;
548  void *data;
549 
550  data = (void *)UI_pie_menu_begin(C, title, icon, event->data);
551 
553 
554  return r_ptr;
555 }
556 
557 static void rna_PieMenuEnd(bContext *C, PointerRNA *handle)
558 {
559  UI_pie_menu_end(C, handle->data);
560 }
561 
562 static void rna_WindowManager_print_undo_steps(wmWindowManager *wm)
563 {
565 }
566 
567 static void rna_WindowManager_tag_script_reload(void)
568 {
571 }
572 
573 static PointerRNA rna_WindoManager_operator_properties_last(const char *idname)
574 {
575  wmOperatorType *ot = WM_operatortype_find(idname, true);
576 
577  if (ot != NULL) {
578  PointerRNA ptr;
580  return ptr;
581  }
582  return PointerRNA_NULL;
583 }
584 
585 static wmEvent *rna_Window_event_add_simulate(wmWindow *win,
586  ReportList *reports,
587  int type,
588  int value,
589  const char *unicode,
590  int x,
591  int y,
592  bool shift,
593  bool ctrl,
594  bool alt,
595  bool oskey)
596 {
597  if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
598  BKE_report(reports, RPT_ERROR, "Not running with '--enable-event-simulate' enabled");
599  return NULL;
600  }
601 
602  if (!ELEM(value, KM_PRESS, KM_RELEASE, KM_NOTHING)) {
603  BKE_report(reports, RPT_ERROR, "Value: only 'PRESS/RELEASE/NOTHING' are supported");
604  return NULL;
605  }
606  if (ISKEYBOARD(type) || ISMOUSE_BUTTON(type)) {
607  if (!ELEM(value, KM_PRESS, KM_RELEASE)) {
608  BKE_report(reports, RPT_ERROR, "Value: must be 'PRESS/RELEASE' for keyboard/buttons");
609  return NULL;
610  }
611  }
613  if (value != KM_NOTHING) {
614  BKE_report(reports, RPT_ERROR, "Value: must be 'NOTHING' for motion");
615  return NULL;
616  }
617  }
618  if (unicode != NULL) {
619  if (value != KM_PRESS) {
620  BKE_report(reports, RPT_ERROR, "Value: must be 'PRESS' when unicode is set");
621  return NULL;
622  }
623  }
624  /* TODO: validate NDOF. */
625 
626  char ascii = 0;
627  if (unicode != NULL) {
628  int len = BLI_str_utf8_size(unicode);
629  if (len == -1 || unicode[len] != '\0') {
630  BKE_report(reports, RPT_ERROR, "Only a single character supported");
631  return NULL;
632  }
633  if (len == 1 && isascii(unicode[0])) {
634  ascii = unicode[0];
635  }
636  }
637 
638  wmEvent e = *win->eventstate;
639  e.type = type;
640  e.val = value;
641  e.is_repeat = false;
642  e.x = x;
643  e.y = y;
644  /* Note: KM_MOD_FIRST, KM_MOD_SECOND aren't used anywhere, set as bools */
645  e.shift = shift;
646  e.ctrl = ctrl;
647  e.alt = alt;
648  e.oskey = oskey;
649 
650  e.ascii = '\0';
651  e.utf8_buf[0] = '\0';
652  if (unicode != NULL) {
653  e.ascii = ascii;
654  STRNCPY(e.utf8_buf, unicode);
655  }
656 
657  /* Until we expose setting tablet values here. */
659 
660  return WM_event_add_simulate(win, &e);
661 }
662 
663 #else
664 
665 # define WM_GEN_INVOKE_EVENT (1 << 0)
666 # define WM_GEN_INVOKE_SIZE (1 << 1)
667 # define WM_GEN_INVOKE_RETURN (1 << 2)
668 
669 static void rna_generic_op_invoke(FunctionRNA *func, int flag)
670 {
671  PropertyRNA *parm;
672 
674  parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
676 
677  if (flag & WM_GEN_INVOKE_EVENT) {
678  parm = RNA_def_pointer(func, "event", "Event", "", "Event");
680  }
681 
682  if (flag & WM_GEN_INVOKE_SIZE) {
683  RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX);
684  }
685 
686  if (flag & WM_GEN_INVOKE_RETURN) {
687  parm = RNA_def_enum_flag(
688  func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
689  RNA_def_function_return(func, parm);
690  }
691 }
692 
694 {
695  FunctionRNA *func;
696  PropertyRNA *parm;
697 
698  func = RNA_def_function(srna, "cursor_warp", "WM_cursor_warp");
699  parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
701  parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
703  RNA_def_function_ui_description(func, "Set the cursor position");
704 
705  func = RNA_def_function(srna, "cursor_set", "WM_cursor_set");
706  parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
709  RNA_def_function_ui_description(func, "Set the cursor");
710 
711  func = RNA_def_function(srna, "cursor_modal_set", "WM_cursor_modal_set");
712  parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
715  RNA_def_function_ui_description(func, "Set the cursor, so the previous cursor can be restored");
716 
717  RNA_def_function(srna, "cursor_modal_restore", "WM_cursor_modal_restore");
719  func, "Restore the previous cursor after calling ``cursor_modal_set``");
720 
721  /* Arguments match 'rna_KeyMap_item_new'. */
722  func = RNA_def_function(srna, "event_simulate", "rna_Window_event_add_simulate");
724  parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
726  parm = RNA_def_enum(func, "value", rna_enum_event_value_all_items, 0, "Value", "");
728  parm = RNA_def_string(func, "unicode", NULL, 0, "", "");
730 
731  RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
732  RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
733 
734  RNA_def_boolean(func, "shift", 0, "Shift", "");
735  RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
736  RNA_def_boolean(func, "alt", 0, "Alt", "");
737  RNA_def_boolean(func, "oskey", 0, "OS Key", "");
738  parm = RNA_def_pointer(func, "event", "Event", "Item", "Added key map item");
739  RNA_def_function_return(func, parm);
740 }
741 
743 {
744  FunctionRNA *func;
745  PropertyRNA *parm;
746 
747  func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
749  func,
750  "Opens a file selector with an operator. "
751  "The string properties 'filepath', 'filename', 'directory' and a 'files' "
752  "collection are assigned when present in the operator");
753  rna_generic_op_invoke(func, 0);
754 
755  func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
757  func,
758  "Add a modal handler to the window manager, for the given modal operator "
759  "(called by invoke() with self, just before returning {'RUNNING_MODAL'})");
761  parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
764  func, RNA_def_boolean(func, "handle", 1, "", "Whether adding the handler was successful"));
765 
766  func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
768  func, "Add a timer to the given window, to generate periodic 'TIMER' events");
769  parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
771  RNA_def_property_range(parm, 0.0, FLT_MAX);
772  RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
773  RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to, or None");
774  parm = RNA_def_pointer(func, "result", "Timer", "", "");
775  RNA_def_function_return(func, parm);
776 
777  func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
778  parm = RNA_def_pointer(func, "timer", "Timer", "", "");
780 
781  func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure");
783  func, "Activate an existing widget group (when the persistent option isn't set)");
785  parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
787 
788  func = RNA_def_function(
789  srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed");
791  "Unlink a widget group (when the persistent option is set)");
793  parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
795 
796  /* Progress bar interface */
797  func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
798  RNA_def_function_ui_description(func, "Start progress report");
799  parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
800  RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
802  parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
804  RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");
805 
806  func = RNA_def_function(srna, "progress_update", "rna_progress_update");
807  RNA_def_function_ui_description(func, "Update the progress feedback");
808  parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
811  parm, "value", "Any value between min and max as set in progress_begin()");
812 
813  func = RNA_def_function(srna, "progress_end", "rna_progress_end");
814  RNA_def_function_ui_description(func, "Terminate progress report");
815 
816  /* invoke functions, for use with python */
817  func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
819  func,
820  "Operator popup invoke "
821  "(show operator properties and execute it automatically on changes)");
823 
824  /* invoked dialog opens popup with OK button, does not auto-exec operator. */
825  func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
827  func,
828  "Operator dialog (non-autoexec popup) invoke "
829  "(show operator properties and only execute it on click on OK button)");
831 
832  /* invoke enum */
833  func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
835  func,
836  "Operator search popup invoke which "
837  "searches values of the operator's :class:`bpy.types.Operator.bl_property` "
838  "(which must be an EnumProperty), executing it on confirmation");
839  rna_generic_op_invoke(func, 0);
840 
841  /* invoke functions, for use with python */
842  func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
844  "Operator popup invoke "
845  "(only shows operator's properties, without executing it)");
847 
848  func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm");
850  func,
851  "Operator confirmation popup "
852  "(only to let user confirm the execution, no operator properties shown)");
854 
855  /* wrap UI_popup_menu_begin */
856  func = RNA_def_function(srna, "popmenu_begin__internal", "rna_PopMenuBegin");
858  parm = RNA_def_string(func, "title", NULL, 0, "", "");
860  parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
862  /* return */
863  parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
865  RNA_def_function_return(func, parm);
866 
867  /* wrap UI_popup_menu_end */
868  func = RNA_def_function(srna, "popmenu_end__internal", "rna_PopMenuEnd");
870  parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
872 
873  /* wrap UI_popover_begin */
874  func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin");
876  RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED);
877  /* return */
878  parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
880  RNA_def_function_return(func, parm);
882  func, "from_active_button", 0, "Use Button", "Use the active button for positioning");
883 
884  /* wrap UI_popover_end */
885  func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd");
887  parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
889  RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
890 
891  /* wrap uiPieMenuBegin */
892  func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin");
894  parm = RNA_def_string(func, "title", NULL, 0, "", "");
896  parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
898  parm = RNA_def_pointer(func, "event", "Event", "", "");
900  /* return */
901  parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", "");
903  RNA_def_function_return(func, parm);
904 
905  /* wrap uiPieMenuEnd */
906  func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd");
908  parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", "");
910 
911  /* access last operator options (optionally create). */
912  func = RNA_def_function(
913  srna, "operator_properties_last", "rna_WindoManager_operator_properties_last");
915  parm = RNA_def_string(func, "operator", NULL, 0, "", "");
917  /* return */
918  parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
920  RNA_def_function_return(func, parm);
921 
922  RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
923 
924  /* Used by (#SCRIPT_OT_reload). */
925  func = RNA_def_function(srna, "tag_script_reload", "rna_WindowManager_tag_script_reload");
927  func, "Tag for refreshing the interface after scripts have been reloaded");
929 
930  parm = RNA_def_property(srna, "is_interface_locked", PROP_BOOLEAN, PROP_NONE);
932  parm,
933  "Is Interface Locked",
934  "If true, the interface is currently locked by a running job and data shouldn't be modified "
935  "from application timers. Otherwise, the running job might conflict with the handler "
936  "causing unexpected results or even crashes");
938 }
939 
941 {
942  FunctionRNA *func;
943  PropertyRNA *parm;
944 
945  /* utility, not for registering */
946  func = RNA_def_function(srna, "report", "rna_Operator_report");
947  parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
949  parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
951 
952  /* utility, not for registering */
953  func = RNA_def_function(srna, "is_repeat", "rna_Operator_is_repeat");
955  /* return */
956  parm = RNA_def_boolean(func, "result", 0, "result", "");
957  RNA_def_function_return(func, parm);
958 
959  /* Registration */
960 
961  /* poll */
962  func = RNA_def_function(srna, "poll", NULL);
963  RNA_def_function_ui_description(func, "Test if the operator can be called or not");
965  RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
966  parm = RNA_def_pointer(func, "context", "Context", "", "");
968 
969  /* exec */
970  func = RNA_def_function(srna, "execute", NULL);
971  RNA_def_function_ui_description(func, "Execute the operator");
973  parm = RNA_def_pointer(func, "context", "Context", "", "");
975 
976  /* better name? */
977  parm = RNA_def_enum_flag(
978  func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
979  RNA_def_function_return(func, parm);
980 
981  /* check */
982  func = RNA_def_function(srna, "check", NULL);
984  func, "Check the operator settings, return True to signal a change to redraw");
986  parm = RNA_def_pointer(func, "context", "Context", "", "");
988 
989  parm = RNA_def_boolean(func, "result", 0, "result", ""); /* better name? */
990  RNA_def_function_return(func, parm);
991 
992  /* invoke */
993  func = RNA_def_function(srna, "invoke", NULL);
994  RNA_def_function_ui_description(func, "Invoke the operator");
996  parm = RNA_def_pointer(func, "context", "Context", "", "");
998  parm = RNA_def_pointer(func, "event", "Event", "", "");
1000 
1001  /* better name? */
1002  parm = RNA_def_enum_flag(
1003  func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1004  RNA_def_function_return(func, parm);
1005 
1006  func = RNA_def_function(srna, "modal", NULL); /* same as invoke */
1007  RNA_def_function_ui_description(func, "Modal operator function");
1009  parm = RNA_def_pointer(func, "context", "Context", "", "");
1011  parm = RNA_def_pointer(func, "event", "Event", "", "");
1013 
1014  /* better name? */
1015  parm = RNA_def_enum_flag(
1016  func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1017  RNA_def_function_return(func, parm);
1018 
1019  /* draw */
1020  func = RNA_def_function(srna, "draw", NULL);
1021  RNA_def_function_ui_description(func, "Draw function for the operator");
1023  parm = RNA_def_pointer(func, "context", "Context", "", "");
1025 
1026  /* cancel */
1027  func = RNA_def_function(srna, "cancel", NULL);
1028  RNA_def_function_ui_description(func, "Called when the operator is canceled");
1030  parm = RNA_def_pointer(func, "context", "Context", "", "");
1032 
1033  /* description */
1034  func = RNA_def_function(srna, "description", NULL);
1035  RNA_def_function_ui_description(func, "Compute a description string that depends on parameters");
1037  parm = RNA_def_string(func, "result", NULL, 4096, "result", "");
1040  RNA_def_function_output(func, parm);
1041  parm = RNA_def_pointer(func, "context", "Context", "", "");
1043  parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1045 }
1046 
1048 {
1049  FunctionRNA *func;
1050  PropertyRNA *parm;
1051 
1052  /* utility, not for registering */
1053  func = RNA_def_function(srna, "report", "rna_Operator_report");
1054  parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
1056  parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
1058 
1059  /* Registration */
1060 
1061  /* poll */
1062  func = RNA_def_function(srna, "poll", NULL);
1063  RNA_def_function_ui_description(func, "Test if the operator can be called or not");
1065  RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
1066  parm = RNA_def_pointer(func, "context", "Context", "", "");
1068 
1069  /* draw */
1070  func = RNA_def_function(srna, "draw", NULL);
1071  RNA_def_function_ui_description(func, "Draw function for the operator");
1073  parm = RNA_def_pointer(func, "context", "Context", "", "");
1075 }
1076 
1078 {
1079  /* FunctionRNA *func; */
1080  /* PropertyRNA *parm; */
1081 }
1082 
1084 {
1085  FunctionRNA *func;
1086  PropertyRNA *parm;
1087 
1088  func = RNA_def_function(srna, "active", "rna_keymap_active");
1090  parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
1091  RNA_def_function_return(func, parm);
1092 
1093  func = RNA_def_function(srna, "restore_to_default", "rna_keymap_restore_to_default");
1095 
1096  func = RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
1098  parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1100 }
1101 
1103 {
1104  FunctionRNA *func;
1105  PropertyRNA *parm;
1106 
1107  func = RNA_def_function(srna, "compare", "rna_KeyMapItem_compare");
1108  parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1110  parm = RNA_def_boolean(func, "result", 0, "Comparison result", "");
1111  RNA_def_function_return(func, parm);
1112 
1113  func = RNA_def_function(srna, "to_string", "rna_KeyMapItem_to_string");
1114  RNA_def_boolean(func, "compact", false, "Compact", "");
1115  parm = RNA_def_string(func, "result", NULL, UI_MAX_SHORTCUT_STR, "result", "");
1117  RNA_def_function_output(func, parm);
1118 }
1119 
1121 {
1122  FunctionRNA *func;
1123  PropertyRNA *parm;
1124 
1125  func = RNA_def_function(srna, "new", "rna_KeyMap_item_new");
1127  parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
1129  parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
1131  parm = RNA_def_enum(func, "value", rna_enum_event_value_all_items, 0, "Value", "");
1133  RNA_def_boolean(func, "any", 0, "Any", "");
1134  RNA_def_boolean(func, "shift", 0, "Shift", "");
1135  RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
1136  RNA_def_boolean(func, "alt", 0, "Alt", "");
1137  RNA_def_boolean(func, "oskey", 0, "OS Key", "");
1138  RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
1139  RNA_def_boolean(func, "repeat", false, "Repeat", "When set, accept key-repeat events");
1140  RNA_def_boolean(func,
1141  "head",
1142  0,
1143  "At Head",
1144  "Force item to be added at start (not end) of key map so that "
1145  "it doesn't get blocked by an existing key map item");
1146  parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
1147  RNA_def_function_return(func, parm);
1148 
1149  func = RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
1151  parm = RNA_def_string(func, "propvalue", NULL, 0, "Property Value", "");
1153  parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
1155  parm = RNA_def_enum(func, "value", rna_enum_event_value_all_items, 0, "Value", "");
1157  RNA_def_boolean(func, "any", 0, "Any", "");
1158  RNA_def_boolean(func, "shift", 0, "Shift", "");
1159  RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
1160  RNA_def_boolean(func, "alt", 0, "Alt", "");
1161  RNA_def_boolean(func, "oskey", 0, "OS Key", "");
1162  RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
1163  RNA_def_boolean(func, "repeat", false, "Repeat", "When set, accept key-repeat events");
1164  parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
1165  RNA_def_function_return(func, parm);
1166 
1167  func = RNA_def_function(srna, "new_from_item", "rna_KeyMap_item_new_from_item");
1169  parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Item to use as a reference");
1171  RNA_def_boolean(func, "head", 0, "At Head", "");
1172  parm = RNA_def_pointer(func, "result", "KeyMapItem", "Item", "Added key map item");
1173  RNA_def_function_return(func, parm);
1174 
1175  func = RNA_def_function(srna, "remove", "rna_KeyMap_item_remove");
1177  parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1180 
1181  func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
1182  parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
1184  RNA_def_property_ui_text(parm, "id", "ID of the item");
1185  parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1186  RNA_def_function_return(func, parm);
1187 
1188  /* Keymap introspection
1189  * Args follow: KeyConfigs.find_item_from_operator */
1190  func = RNA_def_function(srna, "find_from_operator", "rna_KeyMap_item_find_from_operator");
1192  parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
1194  parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1197  func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
1198  RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
1199  parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1201  RNA_def_function_return(func, parm);
1202 
1203  func = RNA_def_function(srna, "match_event", "rna_KeyMap_item_match_event");
1205  parm = RNA_def_pointer(func, "event", "Event", "", "");
1207  parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1209  RNA_def_function_return(func, parm);
1210 }
1211 
1213 {
1214  FunctionRNA *func;
1215  PropertyRNA *parm;
1216 
1217  func = RNA_def_function(srna, "new", "rna_keymap_new"); /* add_keymap */
1220  func,
1221  "Ensure the keymap exists. This will return the one with the given name/space type/region "
1222  "type, or create a new one if it does not exist yet.");
1223 
1224  parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
1226  RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
1227  RNA_def_enum(
1228  func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
1229  RNA_def_boolean(func, "modal", 0, "Modal", "Keymap for modal operators");
1230  RNA_def_boolean(func, "tool", 0, "Tool", "Keymap for active tools");
1231  parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
1232  RNA_def_function_return(func, parm);
1233 
1234  func = RNA_def_function(srna, "remove", "rna_KeyMap_remove"); /* remove_keymap */
1236  parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Removed key map");
1239 
1240  func = RNA_def_function(srna, "find", "rna_keymap_find"); /* find_keymap */
1241  parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
1243  RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
1244  RNA_def_enum(
1245  func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
1246  parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
1247  RNA_def_function_return(func, parm);
1248 
1249  func = RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); /* find_keymap_modal */
1250  parm = RNA_def_string(func, "name", NULL, 0, "Operator Name", "");
1252  parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
1253  RNA_def_function_return(func, parm);
1254 }
1255 
1257 {
1258  FunctionRNA *func;
1259  PropertyRNA *parm;
1260 
1261  func = RNA_def_function(srna, "new", "WM_keyconfig_new_user"); /* add_keyconfig */
1262  parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
1264  parm = RNA_def_pointer(
1265  func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration");
1266  RNA_def_function_return(func, parm);
1267 
1268  func = RNA_def_function(srna, "remove", "rna_KeyConfig_remove"); /* remove_keyconfig */
1270  parm = RNA_def_pointer(
1271  func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
1274 
1275  /* Helper functions */
1276 
1277  /* Keymap introspection */
1278  func = RNA_def_function(
1279  srna, "find_item_from_operator", "rna_KeyConfig_find_item_from_operator");
1281  parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
1283  parm = RNA_def_property(func, "context", PROP_ENUM, PROP_NONE);
1285  parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1288  func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
1289  RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
1290  parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "");
1292  parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1294  RNA_def_function_return(func, parm);
1295 
1296  RNA_def_function(srna, "update", "rna_KeyConfig_update"); /* WM_keyconfig_update */
1297 }
1298 
1299 #endif
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:689
#define G_MAIN
Definition: BKE_global.h:232
@ G_FLAG_EVENT_SIMULATE
Definition: BKE_global.h:113
void BKE_report(ReportList *reports, ReportType type, const char *message)
Definition: report.c:104
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_undosys_print(UndoStack *ustack)
Definition: undo_system.c:1033
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:87
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
#define STRNCPY(dst, src)
Definition: BLI_string.h:163
int BLI_str_utf8_size(const char *p) ATTR_NONNULL()
Definition: string_utf8.c:495
#define UNUSED(x)
#define ELEM(...)
@ RGN_TYPE_WINDOW
@ SPACE_EMPTY
#define OP_MAX_TYPENAME
@ OPERATOR_FINISHED
@ KMI_REPEAT_IGNORE
_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
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
#define RNA_POINTER_INVALIDATE(ptr)
Definition: RNA_access.h:1425
StructRNA RNA_UIPieMenu
StructRNA RNA_UIPopupMenu
StructRNA RNA_KeyMap
StructRNA RNA_KeyMapItem
@ PARM_RNAPTR
Definition: RNA_types.h:339
@ PARM_REQUIRED
Definition: RNA_types.h:337
@ PARM_OUTPUT
Definition: RNA_types.h:338
@ FUNC_USE_REPORTS
Definition: RNA_types.h:578
@ FUNC_NO_SELF
Definition: RNA_types.h:571
@ FUNC_USE_CONTEXT
Definition: RNA_types.h:577
@ FUNC_USE_SELF_ID
Definition: RNA_types.h:565
@ FUNC_REGISTER_OPTIONAL
Definition: RNA_types.h:587
@ FUNC_ALLOW_WRITE
Definition: RNA_types.h:593
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_THICK_WRAP
Definition: RNA_types.h:270
@ PROP_EDITABLE
Definition: RNA_types.h:175
@ PROP_NEVER_NULL
Definition: RNA_types.h:225
@ PROP_NONE
Definition: RNA_types.h:113
@ PROP_UNSIGNED
Definition: RNA_types.h:129
#define C
Definition: RandGen.cpp:39
void UI_popover_end(struct bContext *C, struct uiPopover *pup, struct wmKeyMap *keymap)
#define UI_MAX_SHORTCUT_STR
Definition: UI_interface.h:92
void UI_pie_menu_end(struct bContext *C, uiPieMenu *pie)
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup)
struct uiPieMenu * UI_pie_menu_begin(struct bContext *C, const char *title, int icon, const struct wmEvent *event) ATTR_NONNULL()
uiPopover * UI_popover_begin(struct bContext *C, int menu_width, bool from_active_button) ATTR_NONNULL(1)
uiPopupMenu * UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL()
@ WM_GIZMOGROUPTYPE_PERSISTENT
#define NC_WINDOW
Definition: WM_types.h:277
#define KM_SHIFT
Definition: WM_types.h:221
#define KM_ANY
Definition: WM_types.h:240
#define KM_PRESS
Definition: WM_types.h:242
#define KM_NOTHING
Definition: WM_types.h:241
#define KM_CTRL
Definition: WM_types.h:222
#define KM_ALT
Definition: WM_types.h:223
#define KM_OSKEY
Definition: WM_types.h:224
#define KM_RELEASE
Definition: WM_types.h:243
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
unsigned int U
Definition: btGjkEpa3.h:78
bool is_valid
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:146
bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
Definition: rna_access.c:6474
const PointerRNA PointerRNA_NULL
Definition: rna_access.c:71
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3795
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
Definition: rna_define.c:4159
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1555
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
Definition: rna_define.c:4302
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
Definition: rna_define.c:1676
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
Definition: rna_define.c:4262
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
Definition: rna_define.c:4327
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
Definition: rna_define.c:1892
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
Definition: rna_define.c:1757
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
Definition: rna_define.c:4337
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
Definition: rna_define.c:1279
void RNA_def_function_flag(FunctionRNA *func, int flag)
Definition: rna_define.c:4332
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1517
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3675
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3585
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3771
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
Definition: rna_define.c:1547
const EnumPropertyItem rna_enum_region_type_items[]
Definition: rna_screen.c:35
const EnumPropertyItem rna_enum_space_type_items[]
Definition: rna_space.c:72
const EnumPropertyItem rna_enum_operator_context_items[]
Definition: rna_ui.c:44
const EnumPropertyItem rna_enum_icon_items[]
Definition: rna_ui_api.c:46
const EnumPropertyItem rna_enum_event_value_all_items[]
Definition: rna_wm.c:376
const EnumPropertyItem rna_enum_event_type_mask_items[]
Definition: rna_wm.c:426
const EnumPropertyItem rna_enum_event_type_items[]
Definition: rna_wm.c:146
const EnumPropertyItem rna_enum_wm_report_items[]
Definition: rna_wm.c:508
const EnumPropertyItem rna_enum_operator_return_items[]
Definition: rna_wm.c:476
void RNA_api_keymapitem(StructRNA *srna)
Definition: rna_wm_api.c:1102
#define WM_GEN_INVOKE_EVENT
Definition: rna_wm_api.c:665
void RNA_api_window(StructRNA *srna)
Definition: rna_wm_api.c:693
void RNA_api_wm(StructRNA *srna)
Definition: rna_wm_api.c:742
#define WM_GEN_INVOKE_SIZE
Definition: rna_wm_api.c:666
void RNA_api_keyconfigs(StructRNA *srna)
Definition: rna_wm_api.c:1256
void RNA_api_macro(StructRNA *srna)
Definition: rna_wm_api.c:1047
void RNA_api_keyconfig(StructRNA *UNUSED(srna))
Definition: rna_wm_api.c:1077
void RNA_api_keymap(StructRNA *srna)
Definition: rna_wm_api.c:1083
void RNA_api_keymapitems(StructRNA *srna)
Definition: rna_wm_api.c:1120
#define WM_GEN_INVOKE_RETURN
Definition: rna_wm_api.c:667
void RNA_api_keymaps(StructRNA *srna)
Definition: rna_wm_api.c:1212
const EnumPropertyItem rna_enum_window_cursor_items[]
Definition: rna_wm_api.c:45
static void rna_generic_op_invoke(FunctionRNA *func, int flag)
Definition: rna_wm_api.c:669
void RNA_api_operator(StructRNA *srna)
Definition: rna_wm_api.c:940
#define min(a, b)
Definition: sort.c:51
Definition: DNA_ID.h:273
void * data
Definition: RNA_types.h:52
eWM_GizmoFlagGroupTypeFlag flag
const void * modal_items
struct wmKeyMap * modalkeymap
Definition: WM_types.h:820
struct ReportList * reports
struct wmWindow * win
Definition: WM_types.h:693
struct UndoStack * undo_stack
struct wmKeyConfig * addonconf
struct wmWindow * winactive
struct wmEvent * eventstate
float max
__forceinline bool any(const avxb &b)
Definition: util_avxb.h:218
#define G(x, y, z)
uint len
void WM_cursor_modal_restore(wmWindow *win)
Definition: wm_cursors.c:216
void WM_cursor_time(wmWindow *win, int nr)
Definition: wm_cursors.c:338
@ WM_CURSOR_WAIT
Definition: wm_cursors.h:36
@ WM_CURSOR_HAND
Definition: wm_cursors.h:40
@ WM_CURSOR_NSEW_SCROLL
Definition: wm_cursors.h:67
@ WM_CURSOR_DEFAULT
Definition: wm_cursors.h:34
@ WM_CURSOR_PAINT
Definition: wm_cursors.h:43
@ WM_CURSOR_Y_MOVE
Definition: wm_cursors.h:55
@ WM_CURSOR_TEXT_EDIT
Definition: wm_cursors.h:35
@ WM_CURSOR_PAINT_BRUSH
Definition: wm_cursors.h:49
@ WM_CURSOR_NS_SCROLL
Definition: wm_cursors.h:68
@ WM_CURSOR_DOT
Definition: wm_cursors.h:44
@ WM_CURSOR_EDIT
Definition: wm_cursors.h:38
@ WM_CURSOR_KNIFE
Definition: wm_cursors.h:47
@ WM_CURSOR_EYEDROPPER
Definition: wm_cursors.h:51
@ WM_CURSOR_ERASER
Definition: wm_cursors.h:50
@ WM_CURSOR_EW_SCROLL
Definition: wm_cursors.h:69
@ WM_CURSOR_NONE
Definition: wm_cursors.h:74
@ WM_CURSOR_X_MOVE
Definition: wm_cursors.h:54
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
wmKeyMapItem * WM_event_match_keymap_item(bContext *C, wmKeyMap *keymap, const wmEvent *event)
void WM_event_tablet_data_default_set(wmTabletData *tablet_data)
wmEvent * WM_event_add_simulate(wmWindow *win, const wmEvent *event_to_add)
bool WM_operator_is_repeat(const bContext *C, const wmOperator *op)
#define ISMOUSE_BUTTON(event_type)
@ MOUSEMOVE
@ INBETWEEN_MOUSEMOVE
#define ISKEYBOARD(event_type)
#define EVT_TYPE_MASK_ALL
PointerRNA * ptr
Definition: wm_files.c:3157
wmOperatorType * ot
Definition: wm_files.c:3156
bool WM_gizmo_group_type_ensure_ptr(wmGizmoGroupType *gzgt)
void WM_gizmo_group_type_unlink_delayed_ptr(wmGizmoGroupType *gzgt)
wmGizmoGroupType * WM_gizmogrouptype_find(const char *idname, bool quiet)
void WM_script_tag_reload(void)
Definition: wm_init_exit.c:700
void WM_keymap_item_restore_to_default(wmWindowManager *wm, wmKeyMap *keymap, wmKeyMapItem *kmi)
Definition: wm_keymap.c:1920
void WM_keymap_restore_to_default(wmKeyMap *keymap, wmWindowManager *wm)
Definition: wm_keymap.c:1977
wmKeyMapItem * WM_modalkeymap_add_item(wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value)
Definition: wm_keymap.c:927
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852
void WM_keyconfig_update(wmWindowManager *wm)
Definition: wm_keymap.c:1781
wmKeyMapItem * WM_keymap_add_item(wmKeyMap *keymap, const char *idname, int type, int val, int modifier, int keymodifier)
Definition: wm_keymap.c:506
wmKeyMapItem * WM_key_event_operator_from_keymap(wmKeyMap *keymap, const char *opname, IDProperty *properties, const short include_mask, const short exclude_mask)
Definition: wm_keymap.c:1650
wmKeyMap * WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:823
int WM_keymap_item_to_string(const wmKeyMapItem *kmi, const bool compact, char *result, const int result_len)
Definition: wm_keymap.c:1213
wmKeyMapItem * WM_modalkeymap_add_item_str(wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value)
Definition: wm_keymap.c:944
bool WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
Definition: wm_keymap.c:537
wmKeyMap * WM_keymap_active(const wmWindowManager *wm, wmKeyMap *keymap)
Definition: wm_keymap.c:1895
bool WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
Definition: wm_keymap.c:314
bool WM_keymap_remove(wmKeyConfig *keyconf, wmKeyMap *keymap)
Definition: wm_keymap.c:438
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition: wm_keymap.c:888
bool WM_keymap_item_compare(const wmKeyMapItem *k1, const wmKeyMapItem *k2)
Definition: wm_keymap.c:1669
wmKeyMapItem * WM_key_event_operator(const bContext *C, const char *opname, int opcontext, IDProperty *properties, const short include_mask, const short exclude_mask, wmKeyMap **r_keymap)
Definition: wm_keymap.c:1627
wmKeyMapItem * WM_keymap_add_item_copy(struct wmKeyMap *keymap, wmKeyMapItem *kmi_src)
Definition: wm_keymap.c:524
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
int WM_operator_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void WM_operator_last_properties_ensure(wmOperatorType *ot, PointerRNA *ptr)
void WM_operator_bl_idname(char *to, const char *from)
Definition: wm_operators.c:144
int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
Definition: wm_window.c:1669
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
Definition: wm_window.c:1632