Blender V4.5
rna_wm_api.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cctype>
10#include <cstdlib>
11
12#include "RNA_define.hh"
13#include "RNA_enum_types.hh"
14
15#include "DNA_screen_types.h"
16#include "DNA_space_types.h"
18
19#include "UI_interface.hh"
20
21#include "wm_cursors.hh"
22#include "wm_event_types.hh"
23
24#include "WM_api.hh"
25#include "WM_types.hh"
26
27#include "rna_internal.hh" /* own include */
28
29/* confusing 2 enums mixed up here */
31 {WM_CURSOR_DEFAULT, "DEFAULT", 0, "Default", ""},
32 {WM_CURSOR_NONE, "NONE", 0, "None", ""},
33 {WM_CURSOR_WAIT, "WAIT", 0, "Wait", ""},
34 {WM_CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""},
35 {WM_CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""},
36 {WM_CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""},
37
38 /* new */
39 {WM_CURSOR_KNIFE, "KNIFE", 0, "Knife", ""},
40 {WM_CURSOR_TEXT_EDIT, "TEXT", 0, "Text", ""},
41 {WM_CURSOR_PAINT_BRUSH, "PAINT_BRUSH", 0, "Paint Brush", ""},
42 {WM_CURSOR_PAINT, "PAINT_CROSS", 0, "Paint Cross", ""},
43 {WM_CURSOR_DOT, "DOT", 0, "Dot Cursor", ""},
44 {WM_CURSOR_ERASER, "ERASER", 0, "Eraser", ""},
45 {WM_CURSOR_HAND, "HAND", 0, "Open Hand", ""},
46 {WM_CURSOR_HAND_POINT, "HAND_POINT", 0, "Pointing Hand", ""},
47 {WM_CURSOR_HAND_CLOSED, "HAND_CLOSED", 0, "Closed Hand", ""},
48 {WM_CURSOR_EW_SCROLL, "SCROLL_X", 0, "Scroll-X", ""},
49 {WM_CURSOR_NS_SCROLL, "SCROLL_Y", 0, "Scroll-Y", ""},
50 {WM_CURSOR_NSEW_SCROLL, "SCROLL_XY", 0, "Scroll-XY", ""},
51 {WM_CURSOR_EYEDROPPER, "EYEDROPPER", 0, "Eyedropper", ""},
52 {WM_CURSOR_PICK_AREA, "PICK_AREA", 0, "Pick Area", ""},
53 {WM_CURSOR_STOP, "STOP", 0, "Stop", ""},
54 {WM_CURSOR_COPY, "COPY", 0, "Copy", ""},
55 {WM_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
56 {WM_CURSOR_MUTE, "MUTE", 0, "Mute", ""},
57 {WM_CURSOR_ZOOM_IN, "ZOOM_IN", 0, "Zoom In", ""},
58 {WM_CURSOR_ZOOM_OUT, "ZOOM_OUT", 0, "Zoom Out", ""},
59 {0, nullptr, 0, nullptr, nullptr},
60};
61
62#ifdef RNA_RUNTIME
63
64# include "DNA_userdef_types.h"
65
66# include "BLI_string.h"
67# include "BLI_string_utf8.h"
68
69# include "BKE_context.hh"
70# include "BKE_global.hh"
71# include "BKE_main.hh"
72# include "BKE_report.hh"
73# include "BKE_undo_system.hh"
74
75# include "WM_types.hh"
76
77/* Needed since RNA doesn't use `const` in function signatures. */
78static bool rna_KeyMapItem_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
79{
80 return WM_keymap_item_compare(k1, k2);
81}
82
83static void rna_KeyMapItem_to_string(wmKeyMapItem *kmi, bool compact, char *result)
84{
86 result, WM_keymap_item_to_string(kmi, compact).value_or("").c_str(), UI_MAX_SHORTCUT_STR);
87}
88
89static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C)
90{
92 return WM_keymap_active(wm, km);
93}
94
95static void rna_keymap_restore_to_default(wmKeyMap *km, bContext *C)
96{
98}
99
100static void rna_keymap_restore_item_to_default(wmKeyMap *km, bContext *C, wmKeyMapItem *kmi)
101{
103}
104
105static void rna_Operator_report(wmOperator *op, int type, const char *msg)
106{
107 BKE_report(op->reports, eReportType(type), msg);
108}
109
110static bool rna_Operator_is_repeat(wmOperator *op, bContext *C)
111{
112 return WM_operator_is_repeat(C, op);
113}
114
115/* since event isn't needed... */
116static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
117{
118 WM_enum_search_invoke(C, op, nullptr);
119}
120
121static int rna_Operator_ui_popup(bContext *C, wmOperator *op, int width)
122{
123 return wmOperatorStatus(WM_operator_ui_popup(C, op, width));
124}
125
126static bool rna_event_modal_handler_add(bContext *C, ReportList *reports, wmOperator *op)
127{
128 wmWindow *win = CTX_wm_window(C);
129 if (win == nullptr) {
130 BKE_report(reports, RPT_ERROR, "No active window in context!");
131 return false;
132 }
133 ScrArea *area = CTX_wm_area(C);
134 ARegion *region = CTX_wm_region(C);
135 return WM_event_add_modal_handler_ex(win, area, region, op) != nullptr;
136}
137
138static wmTimer *rna_event_timer_add(wmWindowManager *wm, float time_step, wmWindow *win)
139{
140 /* NOTE: we need a way for Python to know event types, `TIMER` is hard coded. */
141 return WM_event_timer_add(wm, win, TIMER, time_step);
142}
143
144static void rna_event_timer_remove(wmWindowManager *wm, wmTimer *timer)
145{
147}
148
149static wmGizmoGroupType *wm_gizmogrouptype_find_for_add_remove(ReportList *reports,
150 const char *idname)
151{
152 wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, true);
153 if (gzgt == nullptr) {
154 BKE_reportf(reports, RPT_ERROR, "Gizmo group type '%s' not found!", idname);
155 return nullptr;
156 }
158 BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' has 'PERSISTENT' option set!", idname);
159 return nullptr;
160 }
161 return gzgt;
162}
163
164static void rna_gizmo_group_type_ensure(ReportList *reports, const char *idname)
165{
166 wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
167 if (gzgt != nullptr) {
169 }
170}
171
172static void rna_gizmo_group_type_unlink_delayed(ReportList *reports, const char *idname)
173{
174 wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
175 if (gzgt != nullptr) {
177 }
178}
179
180/* Placeholder data for final implementation of a true progress-bar. */
181static struct wmStaticProgress {
182 float min;
183 float max;
184 bool is_valid;
185} wm_progress_state = {0, 0, false};
186
187static void rna_progress_begin(wmWindowManager * /*wm*/, float min, float max)
188{
189 float range = max - min;
190 if (range != 0) {
191 wm_progress_state.min = min;
192 wm_progress_state.max = max;
193 wm_progress_state.is_valid = true;
194 }
195 else {
196 wm_progress_state.is_valid = false;
197 }
198}
199
200static void rna_progress_update(wmWindowManager *wm, float value)
201{
202 if (wm_progress_state.is_valid) {
203 /* Map to cursor_time range [0,9999] */
204 wmWindow *win = wm->winactive;
205 if (win) {
206 int val = int(10000 * (value - wm_progress_state.min) /
207 (wm_progress_state.max - wm_progress_state.min));
208 WM_cursor_time(win, val);
209 }
210 }
211}
212
213static void rna_progress_end(wmWindowManager *wm)
214{
215 if (wm_progress_state.is_valid) {
216 wmWindow *win = wm->winactive;
217 if (win) {
219 wm_progress_state.is_valid = false;
220 }
221 }
222}
223
224/* wrap these because of 'const wmEvent *' */
225static int rna_Operator_confirm(bContext *C,
226 wmOperator *op,
227 wmEvent * /*event*/,
228 const char *title,
229 const char *message,
230 const char *confirm_text,
231 const int icon,
232 const char *text_ctxt,
233 const bool translate)
234{
235 std::optional<blender::StringRefNull> title_str = RNA_translate_ui_text(
236 title, text_ctxt, nullptr, nullptr, translate);
237 std::optional<blender::StringRefNull> message_str = RNA_translate_ui_text(
238 message, text_ctxt, nullptr, nullptr, translate);
239 std::optional<blender::StringRefNull> confirm_text_str = RNA_translate_ui_text(
240 confirm_text, text_ctxt, nullptr, nullptr, translate);
242 op,
243 title_str ? title_str->c_str() : nullptr,
244 message_str ? message_str->c_str() : nullptr,
245 confirm_text_str ? confirm_text_str->c_str() : nullptr,
246 icon);
247}
248
249static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
250{
251 return WM_operator_props_popup(C, op, event);
252}
253
254static int rna_Operator_props_dialog_popup(bContext *C,
255 wmOperator *op,
256 const int width,
257 const char *title,
258 const char *confirm_text,
259 const bool cancel_default,
260 const char *text_ctxt,
261 const bool translate)
262{
263 std::optional<blender::StringRefNull> title_str = RNA_translate_ui_text(
264 title, text_ctxt, nullptr, nullptr, translate);
265 std::optional<blender::StringRefNull> confirm_text_str = RNA_translate_ui_text(
266 confirm_text, text_ctxt, nullptr, nullptr, translate);
268 C,
269 op,
270 width,
271 title_str ? std::make_optional<std::string>(*title_str) : std::nullopt,
272 confirm_text_str ? std::make_optional<std::string>(*confirm_text_str) : std::nullopt,
273 cancel_default);
274}
275
276static int16_t keymap_item_modifier_flag_from_args(
277 bool any, int shift, int ctrl, int alt, int oskey, int hyper)
278{
279 int16_t modifier = 0;
280 if (any) {
281 modifier = KM_ANY;
282 }
283 else {
284# define MOD_VAR_ASSIGN_FLAG(mod_var, mod_flag) \
285 if (mod_var == KM_MOD_HELD) { \
286 modifier |= mod_flag; \
287 } \
288 else if (mod_var == KM_ANY) { \
289 modifier |= KMI_PARAMS_MOD_TO_ANY(mod_flag); \
290 } \
291 ((void)0)
292
293 MOD_VAR_ASSIGN_FLAG(shift, KM_SHIFT);
294 MOD_VAR_ASSIGN_FLAG(ctrl, KM_CTRL);
295 MOD_VAR_ASSIGN_FLAG(alt, KM_ALT);
296 MOD_VAR_ASSIGN_FLAG(oskey, KM_OSKEY);
297 MOD_VAR_ASSIGN_FLAG(hyper, KM_HYPER);
298
299# undef MOD_VAR_ASSIGN_FLAG
300 }
301 return modifier;
302}
303
304static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km,
306 const char *idname,
307 int type,
308 int value,
309 bool any,
310 int shift,
311 int ctrl,
312 int alt,
313 int oskey,
314 int hyper,
315 int keymodifier,
316 int direction,
317 bool repeat,
318 bool head)
319{
320 /* only on non-modal maps */
321 if (km->flag & KEYMAP_MODAL) {
322 BKE_report(reports, RPT_ERROR, "Not a non-modal keymap");
323 return nullptr;
324 }
325
326 // wmWindowManager *wm = CTX_wm_manager(C);
327 wmKeyMapItem *kmi = nullptr;
328 char idname_bl[OP_MAX_TYPENAME];
329
330 WM_operator_bl_idname(idname_bl, idname);
331
333 params.type = type;
334 params.value = value;
335 params.modifier = keymap_item_modifier_flag_from_args(any, shift, ctrl, alt, oskey, hyper);
336 params.keymodifier = keymodifier;
337 params.direction = direction;
338
339 /* create keymap item */
340 kmi = WM_keymap_add_item(km, idname_bl, &params);
341
342 if (!repeat) {
343 kmi->flag |= KMI_REPEAT_IGNORE;
344 }
345
346 /* #32437 allow scripts to define hotkeys that get added to start of keymap
347 * so that they stand a chance against catch-all defines later on
348 */
349 if (head) {
350 BLI_remlink(&km->items, kmi);
351 BLI_addhead(&km->items, kmi);
352 }
353
354 return kmi;
355}
356
357static wmKeyMapItem *rna_KeyMap_item_new_from_item(wmKeyMap *km,
359 wmKeyMapItem *kmi_src,
360 bool head)
361{
362 // wmWindowManager *wm = CTX_wm_manager(C);
363
364 if ((km->flag & KEYMAP_MODAL) == (kmi_src->idname[0] != '\0')) {
365 BKE_report(reports, RPT_ERROR, "Cannot mix modal/non-modal items");
366 return nullptr;
367 }
368
369 /* create keymap item */
370 wmKeyMapItem *kmi = WM_keymap_add_item_copy(km, kmi_src);
371 if (head) {
372 BLI_remlink(&km->items, kmi);
373 BLI_addhead(&km->items, kmi);
374 }
375 return kmi;
376}
377
378static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km,
380 const char *propvalue_str,
381 int type,
382 int value,
383 bool any,
384 int shift,
385 int ctrl,
386 int alt,
387 int oskey,
388 int hyper,
389 int keymodifier,
390 int direction,
391 bool repeat)
392{
393 /* only modal maps */
394 if ((km->flag & KEYMAP_MODAL) == 0) {
395 BKE_report(reports, RPT_ERROR, "Not a modal keymap");
396 return nullptr;
397 }
398
399 wmKeyMapItem *kmi = nullptr;
400 int propvalue = 0;
401
403 params.type = type;
404 params.value = value;
405 params.modifier = keymap_item_modifier_flag_from_args(any, shift, ctrl, alt, oskey, hyper);
406 params.keymodifier = keymodifier;
407 params.direction = direction;
408
409 /* not initialized yet, do delayed lookup */
410 if (!km->modal_items) {
411 kmi = WM_modalkeymap_add_item_str(km, &params, propvalue_str);
412 }
413 else {
414 if (RNA_enum_value_from_id(static_cast<const EnumPropertyItem *>(km->modal_items),
415 propvalue_str,
416 &propvalue) == 0)
417 {
418 BKE_report(reports, RPT_WARNING, "Property value not in enumeration");
419 }
420 kmi = WM_modalkeymap_add_item(km, &params, propvalue);
421 }
422
423 if (!repeat) {
424 kmi->flag |= KMI_REPEAT_IGNORE;
425 }
426
427 return kmi;
428}
429
430static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA *kmi_ptr)
431{
432 wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(kmi_ptr->data);
433
434 if (UNLIKELY(BLI_findindex(&km->items, kmi) == -1)) {
436 reports, RPT_ERROR, "KeyMapItem '%s' not found in KeyMap '%s'", kmi->idname, km->idname);
437 return;
438 }
439
440 WM_keymap_remove_item(km, kmi);
441 kmi_ptr->invalidate();
442}
443
444static PointerRNA rna_KeyMap_item_find_match(
445 ID *id, wmKeyMap *km_base, ReportList *reports, wmKeyMap *km_match, wmKeyMapItem *kmi_match)
446{
447 wmKeyMapItem *kmi_base = WM_keymap_item_find_match(km_base, km_match, kmi_match, reports);
448 if (kmi_base) {
449 return RNA_pointer_create_discrete(id, &RNA_KeyMapItem, kmi_base);
450 }
451 return PointerRNA_NULL;
452}
453
454static PointerRNA rna_KeyMap_item_find_from_operator(ID *id,
455 wmKeyMap *km,
456 const char *idname,
457 PointerRNA *properties,
458 int include_mask,
459 int exclude_mask)
460{
461 char idname_bl[OP_MAX_TYPENAME];
462 WM_operator_bl_idname(idname_bl, idname);
463
465 km, idname_bl, static_cast<IDProperty *>(properties->data), include_mask, exclude_mask);
466 PointerRNA kmi_ptr = RNA_pointer_create_discrete(id, &RNA_KeyMapItem, kmi);
467 return kmi_ptr;
468}
469
470static PointerRNA rna_KeyMap_item_match_event(ID *id, wmKeyMap *km, bContext *C, wmEvent *event)
471{
472 wmKeyMapItem *kmi = WM_event_match_keymap_item(C, km, event);
473 PointerRNA kmi_ptr = RNA_pointer_create_discrete(id, &RNA_KeyMapItem, kmi);
474 return kmi_ptr;
475}
476
477static wmKeyMap *rna_KeyMaps_new(wmKeyConfig *keyconf,
479 const char *idname,
480 int spaceid,
481 int regionid,
482 bool modal,
483 bool tool)
484{
485 if (modal) {
486 /* Sanity check: Don't allow add-ons to override internal modal key-maps
487 * because this isn't supported, the restriction can be removed when
488 * add-ons can define modal key-maps.
489 * Currently this is only useful for add-ons to override built-in modal keymaps
490 * which is not the intended use for add-on keymaps. */
491 wmWindowManager *wm = static_cast<wmWindowManager *>(G_MAIN->wm.first);
492 if (keyconf == wm->addonconf) {
493 BKE_reportf(reports, RPT_ERROR, "Modal key-maps not supported for add-on key-config");
494 return nullptr;
495 }
496 }
497
498 wmKeyMap *keymap;
499
500 if (modal == 0) {
501 keymap = WM_keymap_ensure(keyconf, idname, spaceid, regionid);
502 }
503 else {
504 keymap = WM_modalkeymap_ensure(keyconf, idname, nullptr); /* items will be lazy init */
505 }
506
507 if (keymap && tool) {
508 keymap->flag |= KEYMAP_TOOL;
509 }
510
511 return keymap;
512}
513
514static wmKeyMap *rna_KeyMaps_find(wmKeyConfig *keyconf,
515 const char *idname,
516 int spaceid,
517 int regionid)
518{
519 return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
520}
521
522static wmKeyMap *rna_KeyMaps_find_match(wmKeyConfig *keyconf, wmKeyMap *km_match)
523{
524 return WM_keymap_list_find(
525 &keyconf->keymaps, km_match->idname, km_match->spaceid, km_match->regionid);
526}
527
528static wmKeyMap *rna_KeyMaps_find_modal(wmKeyConfig * /*keyconf*/, const char *idname)
529{
530 wmOperatorType *ot = WM_operatortype_find(idname, false);
531
532 if (!ot) {
533 return nullptr;
534 }
535 return ot->modalkeymap;
536}
537
538static void rna_KeyMaps_remove(wmKeyConfig *keyconfig, ReportList *reports, PointerRNA *keymap_ptr)
539{
540 wmKeyMap *keymap = static_cast<wmKeyMap *>(keymap_ptr->data);
541
542 if (UNLIKELY(BLI_findindex(&keyconfig->keymaps, keymap) == -1)) {
544 RPT_ERROR,
545 "KeyMap '%s' not found in KeyConfig '%s'",
546 keymap->idname,
547 keyconfig->idname);
548 return;
549 }
550
551 WM_keymap_remove(keyconfig, keymap);
552 keymap_ptr->invalidate();
553}
554
555static void rna_KeyMaps_clear(wmKeyConfig *keyconfig)
556{
557 WM_keyconfig_clear(keyconfig);
558}
559
560wmKeyConfig *rna_KeyConfig_new(wmWindowManager *wm, const char *idname)
561{
562 return WM_keyconfig_ensure(wm, idname, true);
563}
564
565static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr)
566{
567 wmKeyConfig *keyconf = static_cast<wmKeyConfig *>(keyconf_ptr->data);
568 if (UNLIKELY(BLI_findindex(&wm->keyconfigs, keyconf) == -1)) {
569 BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
570 return;
571 }
572 WM_keyconfig_remove(wm, keyconf);
573 keyconf_ptr->invalidate();
574}
575
576static PointerRNA rna_KeyConfig_find_item_from_operator(wmWindowManager *wm,
577 bContext *C,
578 const char *idname,
579 int opcontext,
580 PointerRNA *properties,
581 int include_mask,
582 int exclude_mask,
583 PointerRNA *km_ptr)
584{
585 char idname_bl[OP_MAX_TYPENAME];
586 WM_operator_bl_idname(idname_bl, idname);
587
588 wmKeyMap *km = nullptr;
590 idname_bl,
591 wmOperatorCallContext(opcontext),
592 static_cast<IDProperty *>(properties->data),
593 include_mask,
594 exclude_mask,
595 &km);
596 *km_ptr = RNA_pointer_create_discrete(&wm->id, &RNA_KeyMap, km);
597 PointerRNA kmi_ptr = RNA_pointer_create_discrete(&wm->id, &RNA_KeyMapItem, kmi);
598 return kmi_ptr;
599}
600
601static void rna_KeyConfig_update(wmWindowManager *wm, bool keep_properties)
602{
603 WM_keyconfig_update_ex(wm, keep_properties);
604}
605
607static bool rna_popup_context_ok_or_report(bContext *C, ReportList *reports)
608{
609 if (CTX_wm_window(C) == nullptr) {
610 BKE_report(reports, RPT_ERROR, "context \"window\" is None");
611 return false;
612 }
613 return true;
614}
615
616/* popup menu wrapper */
617static PointerRNA rna_PopMenuBegin(bContext *C,
619 const char *title,
620 const int icon)
621{
622 if (!rna_popup_context_ok_or_report(C, reports)) {
623 return PointerRNA_NULL;
624 }
625
626 void *data = (void *)UI_popup_menu_begin(C, title, icon);
627 PointerRNA r_ptr = RNA_pointer_create_discrete(nullptr, &RNA_UIPopupMenu, data);
628 return r_ptr;
629}
630
631static void rna_PopMenuEnd(bContext *C, PointerRNA *handle)
632{
633 UI_popup_menu_end(C, static_cast<uiPopupMenu *>(handle->data));
634}
635
636/* popover wrapper */
637static PointerRNA rna_PopoverBegin(bContext *C,
639 const int ui_units_x,
640 const bool from_active_button)
641{
642 if (!rna_popup_context_ok_or_report(C, reports)) {
643 return PointerRNA_NULL;
644 }
645
646 void *data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x, from_active_button);
647 PointerRNA r_ptr = RNA_pointer_create_discrete(nullptr, &RNA_UIPopover, data);
648 return r_ptr;
649}
650
651static void rna_PopoverEnd(bContext *C, PointerRNA *handle, wmKeyMap *keymap)
652{
653 UI_popover_end(C, static_cast<uiPopover *>(handle->data), keymap);
654}
655
656/* pie menu wrapper */
657static PointerRNA rna_PieMenuBegin(
658 bContext *C, ReportList *reports, const char *title, const int icon, PointerRNA *event)
659{
660 if (!rna_popup_context_ok_or_report(C, reports)) {
661 return PointerRNA_NULL;
662 }
663
664 void *data = (void *)UI_pie_menu_begin(
665 C, title, icon, static_cast<const wmEvent *>(event->data));
666
667 PointerRNA r_ptr = RNA_pointer_create_discrete(nullptr, &RNA_UIPieMenu, data);
668 return r_ptr;
669}
670
671static void rna_PieMenuEnd(bContext *C, PointerRNA *handle)
672{
673 UI_pie_menu_end(C, static_cast<uiPieMenu *>(handle->data));
674}
675
676static void rna_WindowManager_print_undo_steps(wmWindowManager *wm)
677{
679}
680
681static void rna_WindowManager_tag_script_reload()
682{
685}
686
687static PointerRNA rna_WindoManager_operator_properties_last(const char *idname)
688{
689 wmOperatorType *ot = WM_operatortype_find(idname, true);
690
691 if (ot != nullptr) {
694 return ptr;
695 }
696 return PointerRNA_NULL;
697}
698
699static wmEvent *rna_Window_event_add_simulate(wmWindow *win,
701 int type,
702 int value,
703 const char *unicode,
704 int x,
705 int y,
706 bool shift,
707 bool ctrl,
708 bool alt,
709 bool oskey,
710 bool hyper)
711{
712 if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
713 BKE_report(reports, RPT_ERROR, "Not running with '--enable-event-simulate' enabled");
714 return nullptr;
715 }
716
717 if (!ELEM(value, KM_PRESS, KM_RELEASE, KM_NOTHING)) {
718 BKE_report(reports, RPT_ERROR, "Value: only 'PRESS/RELEASE/NOTHING' are supported");
719 return nullptr;
720 }
721 if (ISKEYBOARD(type) || ISMOUSE_BUTTON(type)) {
722 if (!ELEM(value, KM_PRESS, KM_RELEASE)) {
723 BKE_report(reports, RPT_ERROR, "Value: must be 'PRESS/RELEASE' for keyboard/buttons");
724 return nullptr;
725 }
726 }
727 if (ISMOUSE_MOTION(type)) {
728 if (value != KM_NOTHING) {
729 BKE_report(reports, RPT_ERROR, "Value: must be 'NOTHING' for motion");
730 return nullptr;
731 }
732 }
733 if (unicode != nullptr) {
734 if (value != KM_PRESS) {
735 BKE_report(reports, RPT_ERROR, "Value: must be 'PRESS' when unicode is set");
736 return nullptr;
737 }
738 }
739 /* TODO: validate NDOF. */
740
741 if (unicode != nullptr) {
742 int len = BLI_str_utf8_size_or_error(unicode);
743 if (len == -1 || unicode[len] != '\0') {
744 BKE_report(reports, RPT_ERROR, "Only a single character supported");
745 return nullptr;
746 }
747 }
748
749 wmEvent e = *win->eventstate;
750 e.type = wmEventType(type);
751 e.val = value;
752 e.flag = eWM_EventFlag(0);
753 e.xy[0] = x;
754 e.xy[1] = y;
755
756 e.modifier = wmEventModifierFlag(0);
757 if (shift) {
758 e.modifier |= KM_SHIFT;
759 }
760 if (ctrl) {
761 e.modifier |= KM_CTRL;
762 }
763 if (alt) {
764 e.modifier |= KM_ALT;
765 }
766 if (oskey) {
767 e.modifier |= KM_OSKEY;
768 }
769 if (hyper) {
770 e.modifier |= KM_HYPER;
771 }
772
773 e.utf8_buf[0] = '\0';
774 if (unicode != nullptr) {
775 STRNCPY(e.utf8_buf, unicode);
776 }
777
778 /* Until we expose setting tablet values here. */
780
781 return WM_event_add_simulate(win, &e);
782}
783
784#else
785
786# define WM_GEN_INVOKE_EVENT (1 << 0)
787# define WM_GEN_INVOKE_SIZE (1 << 1)
788# define WM_GEN_INVOKE_RETURN (1 << 2)
789
791{
792 PropertyRNA *parm;
793
795 parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
797
799 parm = RNA_def_pointer(func, "event", "Event", "", "Event");
801 }
802
803 if (flag & WM_GEN_INVOKE_SIZE) {
804 RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX);
805 }
806
808 parm = RNA_def_enum_flag(
809 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
810 RNA_def_function_return(func, parm);
811 }
812}
813
815{
816 FunctionRNA *func;
817 PropertyRNA *parm;
818
819 func = RNA_def_function(srna, "cursor_warp", "WM_cursor_warp");
820 parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
822 parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
824 RNA_def_function_ui_description(func, "Set the cursor position");
825
826 func = RNA_def_function(srna, "cursor_set", "WM_cursor_set");
827 parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
830 RNA_def_function_ui_description(func, "Set the cursor");
831
832 func = RNA_def_function(srna, "cursor_modal_set", "WM_cursor_modal_set");
833 parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
836 RNA_def_function_ui_description(func, "Set the cursor, so the previous cursor can be restored");
837
838 func = RNA_def_function(srna, "cursor_modal_restore", "WM_cursor_modal_restore");
840 func, "Restore the previous cursor after calling ``cursor_modal_set``");
841
842 /* Arguments match 'rna_KeyMap_item_new'. */
843 func = RNA_def_function(srna, "event_simulate", "rna_Window_event_add_simulate");
845 parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
847 parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
849 parm = RNA_def_string(func, "unicode", nullptr, 0, "", "");
851
852 RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
853 RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
854
855 RNA_def_boolean(func, "shift", false, "Shift", "");
856 RNA_def_boolean(func, "ctrl", false, "Ctrl", "");
857 RNA_def_boolean(func, "alt", false, "Alt", "");
858 RNA_def_boolean(func, "oskey", false, "OS Key", "");
859 RNA_def_boolean(func, "hyper", false, "Hyper", "");
860 parm = RNA_def_pointer(func, "event", "Event", "Item", "Added key map item");
861 RNA_def_function_return(func, parm);
862}
863
865 {ALERT_ICON_NONE, "NONE", 0, "None", ""},
866 {ALERT_ICON_WARNING, "WARNING", 0, "Warning", ""},
867 {ALERT_ICON_QUESTION, "QUESTION", 0, "Question", ""},
868 {ALERT_ICON_ERROR, "ERROR", 0, "Error", ""},
869 {ALERT_ICON_INFO, "INFO", 0, "Info", ""},
870 {0, nullptr, 0, nullptr, nullptr},
871};
872
874{
875 FunctionRNA *func;
876 PropertyRNA *parm;
877
878 func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
879 /* Note that a full description is located at:
880 * `doc/python_api/examples/bpy.types.WindowManager.fileselect_add.py`. */
881 RNA_def_function_ui_description(func, "Opens a file selector with an operator.");
882 rna_generic_op_invoke(func, 0);
883
884 func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
886 func,
887 "Add a modal handler to the window manager, for the given modal operator "
888 "(called by invoke() with self, just before returning {'RUNNING_MODAL'})");
890 parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
893 func,
894 RNA_def_boolean(func, "handle", true, "", "Whether adding the handler was successful"));
895
896 func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
898 func, "Add a timer to the given window, to generate periodic 'TIMER' events");
899 parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
902 RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
903 RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to, or None");
904 parm = RNA_def_pointer(func, "result", "Timer", "", "");
905 RNA_def_function_return(func, parm);
906
907 func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
908 parm = RNA_def_pointer(func, "timer", "Timer", "", "");
910
911 func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure");
913 func, "Activate an existing widget group (when the persistent option isn't set)");
915 parm = RNA_def_string(func, "identifier", nullptr, 0, "", "Gizmo group type name");
917
918 func = RNA_def_function(
919 srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed");
921 "Unlink a widget group (when the persistent option is set)");
923 parm = RNA_def_string(func, "identifier", nullptr, 0, "", "Gizmo group type name");
925
926 /* Progress bar interface */
927 func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
928 RNA_def_function_ui_description(func, "Start progress report");
929 parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
930 RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
932 parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
934 RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");
935
936 func = RNA_def_function(srna, "progress_update", "rna_progress_update");
937 RNA_def_function_ui_description(func, "Update the progress feedback");
938 parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
941 parm, "value", "Any value between min and max as set in progress_begin()");
942
943 func = RNA_def_function(srna, "progress_end", "rna_progress_end");
944 RNA_def_function_ui_description(func, "Terminate progress report");
945
946 /* invoke functions, for use with python */
947 func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
949 func,
950 "Operator popup invoke "
951 "(show operator properties and execute it automatically on changes)");
953
954 /* invoked dialog opens popup with OK button, does not auto-exec operator. */
955 func = RNA_def_function(srna, "invoke_props_dialog", "rna_Operator_props_dialog_popup");
957 func,
958 "Operator dialog (non-autoexec popup) invoke "
959 "(show operator properties and only execute it on click on OK button)");
961
962 parm = RNA_def_property(func, "title", PROP_STRING, PROP_NONE);
963 RNA_def_property_ui_text(parm, "Title", "Optional text to show as title of the popup");
964 parm = RNA_def_property(func, "confirm_text", PROP_STRING, PROP_NONE);
966 parm,
967 "Confirm Text",
968 "Optional text to show instead to the default \"OK\" confirmation button text");
969 RNA_def_property(func, "cancel_default", PROP_BOOLEAN, PROP_NONE);
971
972 /* invoke enum */
973 func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
975 func,
976 "Operator search popup invoke which "
977 "searches values of the operator's :class:`bpy.types.Operator.bl_property` "
978 "(which must be an EnumProperty), executing it on confirmation");
979 rna_generic_op_invoke(func, 0);
980
981 /* invoke functions, for use with python */
982 func = RNA_def_function(srna, "invoke_popup", "rna_Operator_ui_popup");
984 "Operator popup invoke "
985 "(only shows operator's properties, without executing it)");
987
988 func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm");
990 func,
991 "Operator confirmation popup "
992 "(only to let user confirm the execution, no operator properties shown)");
994
995 parm = RNA_def_property(func, "title", PROP_STRING, PROP_NONE);
996 RNA_def_property_ui_text(parm, "Title", "Optional text to show as title of the popup");
997
998 parm = RNA_def_property(func, "message", PROP_STRING, PROP_NONE);
999 RNA_def_property_ui_text(parm, "Message", "Optional first line of content text");
1000
1001 parm = RNA_def_property(func, "confirm_text", PROP_STRING, PROP_NONE);
1003 parm,
1004 "Confirm Text",
1005 "Optional text to show instead to the default \"OK\" confirmation button text");
1006
1007 parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
1010 RNA_def_property_ui_text(parm, "Icon", "Optional icon displayed in the dialog");
1011
1013
1014 /* wrap UI_popup_menu_begin */
1015 func = RNA_def_function(srna, "popmenu_begin__internal", "rna_PopMenuBegin");
1017 parm = RNA_def_string(func, "title", nullptr, 0, "", "");
1019 parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
1021 /* return */
1022 parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
1024 RNA_def_function_return(func, parm);
1025
1026 /* wrap UI_popup_menu_end */
1027 func = RNA_def_function(srna, "popmenu_end__internal", "rna_PopMenuEnd");
1029 parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
1031
1032 /* wrap UI_popover_begin */
1033 func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin");
1035 RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED);
1036 /* return */
1037 parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
1039 RNA_def_function_return(func, parm);
1041 func, "from_active_button", false, "Use Button", "Use the active button for positioning");
1042
1043 /* wrap UI_popover_end */
1044 func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd");
1046 parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
1048 RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
1049
1050 /* wrap uiPieMenuBegin */
1051 func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin");
1053 parm = RNA_def_string(func, "title", nullptr, 0, "", "");
1055 parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
1057 parm = RNA_def_pointer(func, "event", "Event", "", "");
1059 /* return */
1060 parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", "");
1062 RNA_def_function_return(func, parm);
1063
1064 /* wrap uiPieMenuEnd */
1065 func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd");
1067 parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", "");
1069
1070 /* access last operator options (optionally create). */
1071 func = RNA_def_function(
1072 srna, "operator_properties_last", "rna_WindoManager_operator_properties_last");
1074 parm = RNA_def_string(func, "operator", nullptr, 0, "", "");
1076 /* return */
1077 parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
1079 RNA_def_function_return(func, parm);
1080
1081 RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
1082
1083 /* Used by (#SCRIPT_OT_reload). */
1084 func = RNA_def_function(srna, "tag_script_reload", "rna_WindowManager_tag_script_reload");
1086 func, "Tag for refreshing the interface after scripts have been reloaded");
1088
1089 parm = RNA_def_property(srna, "is_interface_locked", PROP_BOOLEAN, PROP_NONE);
1090 RNA_def_property_boolean_sdna(parm, nullptr, "runtime->is_interface_locked", 0);
1092 parm,
1093 "Is Interface Locked",
1094 "If true, the interface is currently locked by a running job and data shouldn't be modified "
1095 "from application timers. Otherwise, the running job might conflict with the handler "
1096 "causing unexpected results or even crashes.");
1098}
1099
1101{
1102 FunctionRNA *func;
1103 PropertyRNA *parm;
1104
1105 /* utility, not for registering */
1106 func = RNA_def_function(srna, "report", "rna_Operator_report");
1107 parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
1109 parm = RNA_def_string(func, "message", nullptr, 0, "Report Message", "");
1111
1112 /* utility, not for registering */
1113 func = RNA_def_function(srna, "is_repeat", "rna_Operator_is_repeat");
1115 /* return */
1116 parm = RNA_def_boolean(func, "result", false, "result", "");
1117 RNA_def_function_return(func, parm);
1118
1119 /* Registration */
1120
1121 /* poll */
1122 func = RNA_def_function(srna, "poll", nullptr);
1123 RNA_def_function_ui_description(func, "Test if the operator can be called or not");
1125 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
1126 parm = RNA_def_pointer(func, "context", "Context", "", "");
1128
1129 /* exec */
1130 func = RNA_def_function(srna, "execute", nullptr);
1131 RNA_def_function_ui_description(func, "Execute the operator");
1133 parm = RNA_def_pointer(func, "context", "Context", "", "");
1135
1136 /* better name? */
1137 parm = RNA_def_enum_flag(
1138 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1139 RNA_def_function_return(func, parm);
1140
1141 /* check */
1142 func = RNA_def_function(srna, "check", nullptr);
1144 func, "Check the operator settings, return True to signal a change to redraw");
1146 parm = RNA_def_pointer(func, "context", "Context", "", "");
1148
1149 parm = RNA_def_boolean(func, "result", false, "result", ""); /* better name? */
1150 RNA_def_function_return(func, parm);
1151
1152 /* invoke */
1153 func = RNA_def_function(srna, "invoke", nullptr);
1154 RNA_def_function_ui_description(func, "Invoke the operator");
1156 parm = RNA_def_pointer(func, "context", "Context", "", "");
1158 parm = RNA_def_pointer(func, "event", "Event", "", "");
1160
1161 /* better name? */
1162 parm = RNA_def_enum_flag(
1163 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1164 RNA_def_function_return(func, parm);
1165
1166 func = RNA_def_function(srna, "modal", nullptr); /* same as invoke */
1167 RNA_def_function_ui_description(func, "Modal operator function");
1169 parm = RNA_def_pointer(func, "context", "Context", "", "");
1171 parm = RNA_def_pointer(func, "event", "Event", "", "");
1173
1174 /* better name? */
1175 parm = RNA_def_enum_flag(
1176 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1177 RNA_def_function_return(func, parm);
1178
1179 /* draw */
1180 func = RNA_def_function(srna, "draw", nullptr);
1181 RNA_def_function_ui_description(func, "Draw function for the operator");
1183 parm = RNA_def_pointer(func, "context", "Context", "", "");
1185
1186 /* cancel */
1187 func = RNA_def_function(srna, "cancel", nullptr);
1188 RNA_def_function_ui_description(func, "Called when the operator is canceled");
1190 parm = RNA_def_pointer(func, "context", "Context", "", "");
1192
1193 /* description */
1194 func = RNA_def_function(srna, "description", nullptr);
1195 RNA_def_function_ui_description(func, "Compute a description string that depends on parameters");
1197 parm = RNA_def_string(func, "result", nullptr, 4096, "result", "");
1200 RNA_def_function_output(func, parm);
1201 parm = RNA_def_pointer(func, "context", "Context", "", "");
1203 parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1205}
1206
1208{
1209 FunctionRNA *func;
1210 PropertyRNA *parm;
1211
1212 /* utility, not for registering */
1213 func = RNA_def_function(srna, "report", "rna_Operator_report");
1214 parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
1216 parm = RNA_def_string(func, "message", nullptr, 0, "Report Message", "");
1218
1219 /* Registration */
1220
1221 /* poll */
1222 func = RNA_def_function(srna, "poll", nullptr);
1223 RNA_def_function_ui_description(func, "Test if the operator can be called or not");
1225 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
1226 parm = RNA_def_pointer(func, "context", "Context", "", "");
1228
1229 /* draw */
1230 func = RNA_def_function(srna, "draw", nullptr);
1231 RNA_def_function_ui_description(func, "Draw function for the operator");
1233 parm = RNA_def_pointer(func, "context", "Context", "", "");
1235}
1236
1238{
1239 // FunctionRNA *func;
1240 // PropertyRNA *parm;
1241}
1242
1244{
1245 FunctionRNA *func;
1246 PropertyRNA *parm;
1247
1248 func = RNA_def_function(srna, "active", "rna_keymap_active");
1250 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
1251 RNA_def_function_return(func, parm);
1252
1253 func = RNA_def_function(srna, "restore_to_default", "rna_keymap_restore_to_default");
1255
1256 func = RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
1258 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1260}
1261
1263{
1264 FunctionRNA *func;
1265 PropertyRNA *parm;
1266
1267 func = RNA_def_function(srna, "compare", "rna_KeyMapItem_compare");
1268 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1270 parm = RNA_def_boolean(func, "result", false, "Comparison result", "");
1271 RNA_def_function_return(func, parm);
1272
1273 func = RNA_def_function(srna, "to_string", "rna_KeyMapItem_to_string");
1274 RNA_def_boolean(func, "compact", false, "Compact", "");
1275 parm = RNA_def_string(func, "result", nullptr, UI_MAX_SHORTCUT_STR, "result", "");
1277 RNA_def_function_output(func, parm);
1278}
1279
1281{
1282 FunctionRNA *func;
1283 PropertyRNA *parm;
1284
1285 func = RNA_def_function(srna, "new", "rna_KeyMap_item_new");
1287 parm = RNA_def_string(func, "idname", nullptr, 0, "Operator Identifier", "");
1289 parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
1291 parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
1293 RNA_def_boolean(func, "any", false, "Any", "");
1294 RNA_def_int(func, "shift", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Shift", "", KM_ANY, KM_MOD_HELD);
1295 RNA_def_int(func, "ctrl", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Ctrl", "", KM_ANY, KM_MOD_HELD);
1296 RNA_def_int(func, "alt", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Alt", "", KM_ANY, KM_MOD_HELD);
1297 RNA_def_int(func, "oskey", KM_NOTHING, KM_ANY, KM_MOD_HELD, "OS Key", "", KM_ANY, KM_MOD_HELD);
1298 RNA_def_int(func, "hyper", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Hyper", "", KM_ANY, KM_MOD_HELD);
1299 RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
1300 RNA_def_enum(func, "direction", rna_enum_event_direction_items, KM_ANY, "Direction", "");
1301 RNA_def_boolean(func, "repeat", false, "Repeat", "When set, accept key-repeat events");
1302 RNA_def_boolean(func,
1303 "head",
1304 false,
1305 "At Head",
1306 "Force item to be added at start (not end) of key map so that "
1307 "it doesn't get blocked by an existing key map item");
1308 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
1309 RNA_def_function_return(func, parm);
1310
1311 func = RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
1313 parm = RNA_def_string(func, "propvalue", nullptr, 0, "Property Value", "");
1315 parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
1317 parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
1319 RNA_def_boolean(func, "any", false, "Any", "");
1320 RNA_def_int(func, "shift", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Shift", "", KM_ANY, KM_MOD_HELD);
1321 RNA_def_int(func, "ctrl", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Ctrl", "", KM_ANY, KM_MOD_HELD);
1322 RNA_def_int(func, "alt", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Alt", "", KM_ANY, KM_MOD_HELD);
1323 RNA_def_int(func, "oskey", KM_NOTHING, KM_ANY, KM_MOD_HELD, "OS Key", "", KM_ANY, KM_MOD_HELD);
1324 RNA_def_int(func, "hyper", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Hyper", "", KM_ANY, KM_MOD_HELD);
1325 RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
1326 RNA_def_enum(func, "direction", rna_enum_event_direction_items, KM_ANY, "Direction", "");
1327 RNA_def_boolean(func, "repeat", false, "Repeat", "When set, accept key-repeat events");
1328 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
1329 RNA_def_function_return(func, parm);
1330
1331 func = RNA_def_function(srna, "new_from_item", "rna_KeyMap_item_new_from_item");
1333 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Item to use as a reference");
1335 RNA_def_boolean(func, "head", false, "At Head", "");
1336 parm = RNA_def_pointer(func, "result", "KeyMapItem", "Item", "Added key map item");
1337 RNA_def_function_return(func, parm);
1338
1339 func = RNA_def_function(srna, "remove", "rna_KeyMap_item_remove");
1341 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1344
1345 func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
1346 parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
1348 RNA_def_property_ui_text(parm, "id", "ID of the item");
1349 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1350 RNA_def_function_return(func, parm);
1351
1352 /* Keymap introspection
1353 * Args follow: KeyConfigs.find_item_from_operator */
1354 func = RNA_def_function(srna, "find_from_operator", "rna_KeyMap_item_find_from_operator");
1356 parm = RNA_def_string(func, "idname", nullptr, 0, "Operator Identifier", "");
1358 parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1361 func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
1362 RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
1363 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1365 RNA_def_function_return(func, parm);
1366
1367 func = RNA_def_function(srna, "find_match", "rna_KeyMap_item_find_match");
1369 parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "The matching keymap");
1371 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "The matching keymap item");
1373 parm = RNA_def_pointer(func,
1374 "result",
1375 "KeyMapItem",
1376 "",
1377 "The keymap item from this keymap which matches the keymap item from the "
1378 "arguments passed in");
1380 RNA_def_function_return(func, parm);
1381
1382 func = RNA_def_function(srna, "match_event", "rna_KeyMap_item_match_event");
1384 parm = RNA_def_pointer(func, "event", "Event", "", "");
1386 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1388 RNA_def_function_return(func, parm);
1389}
1390
1392{
1393 FunctionRNA *func;
1394 PropertyRNA *parm;
1395
1396 func = RNA_def_function(srna, "new", "rna_KeyMaps_new");
1399 func,
1400 "Ensure the keymap exists. This will return the one with the given name/space type/region "
1401 "type, or create a new one if it does not exist yet.");
1402
1403 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
1405 RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
1407 func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
1408 RNA_def_boolean(func, "modal", false, "Modal", "Keymap for modal operators");
1409 RNA_def_boolean(func, "tool", false, "Tool", "Keymap for active tools");
1410 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
1411 RNA_def_function_return(func, parm);
1412
1413 func = RNA_def_function(srna, "remove", "rna_KeyMaps_remove");
1415 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Removed key map");
1418
1419 func = RNA_def_function(srna, "clear", "rna_KeyMaps_clear");
1420 RNA_def_function_ui_description(func, "Remove all keymaps.");
1421
1422 func = RNA_def_function(srna, "find", "rna_KeyMaps_find");
1423 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
1425 RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
1427 func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
1428 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
1429 RNA_def_function_return(func, parm);
1430
1431 func = RNA_def_function(srna, "find_match", "rna_KeyMaps_find_match");
1432 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "The key map for comparison");
1434 parm = RNA_def_pointer(func, "result", "KeyMap", "Key Map", "Corresponding key map");
1435 RNA_def_function_return(func, parm);
1436
1437 func = RNA_def_function(srna, "find_modal", "rna_KeyMaps_find_modal");
1438 parm = RNA_def_string(func, "name", nullptr, 0, "Operator Name", "");
1440 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
1441 RNA_def_function_return(func, parm);
1442}
1443
1445{
1446 FunctionRNA *func;
1447 PropertyRNA *parm;
1448
1449 func = RNA_def_function(srna, "new", "rna_KeyConfig_new"); /* add_keyconfig */
1450 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
1452 parm = RNA_def_pointer(
1453 func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration");
1454 RNA_def_function_return(func, parm);
1455
1456 func = RNA_def_function(srna, "remove", "rna_KeyConfig_remove"); /* remove_keyconfig */
1458 parm = RNA_def_pointer(
1459 func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
1462
1463 /* Helper functions */
1464
1465 /* Keymap introspection */
1466 func = RNA_def_function(
1467 srna, "find_item_from_operator", "rna_KeyConfig_find_item_from_operator");
1469 parm = RNA_def_string(func, "idname", nullptr, 0, "Operator Identifier", "");
1471 parm = RNA_def_property(func, "context", PROP_ENUM, PROP_NONE);
1473 parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1476 func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
1477 RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
1478 parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "");
1480 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1482 RNA_def_function_return(func, parm);
1483
1484 func = RNA_def_function(srna, "update", "rna_KeyConfig_update"); /* WM_keyconfig_update */
1486 func,
1487 "keep_properties",
1488 false,
1489 "Keep Properties",
1490 "Operator properties are kept to allow the operators to be registered again in the future");
1491}
1492
1493#endif
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
@ G_FLAG_EVENT_SIMULATE
#define G_MAIN
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
void BKE_undosys_print(UndoStack *ustack)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:586
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:131
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:91
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:688
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
const char int BLI_str_utf8_size_or_error(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define UNLIKELY(x)
#define ELEM(...)
@ RGN_TYPE_WINDOW
@ SPACE_EMPTY
@ OPERATOR_FINISHED
#define OP_MAX_TYPENAME
ParameterFlag
Definition RNA_types.hh:510
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ PARM_OUTPUT
Definition RNA_types.hh:512
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_NO_SELF
Definition RNA_types.hh:798
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:804
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:792
@ FUNC_REGISTER_OPTIONAL
Definition RNA_types.hh:814
@ FUNC_ALLOW_WRITE
Definition RNA_types.hh:820
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_STRING
Definition RNA_types.hh:153
PropertyFlag
Definition RNA_types.hh:286
@ PROP_THICK_WRAP
Definition RNA_types.hh:397
@ PROP_EDITABLE
Definition RNA_types.hh:292
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_UNSIGNED
Definition RNA_types.hh:237
#define C
Definition RandGen.cpp:29
void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap)
uiPopover * UI_popover_begin(bContext *C, int ui_menu_width, bool from_active_button) ATTR_NONNULL(1)
void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
uiPieMenu * UI_pie_menu_begin(bContext *C, const char *title, int icon, const wmEvent *event) ATTR_NONNULL()
uiPopupMenu * UI_popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
void UI_pie_menu_end(bContext *C, uiPieMenu *pie)
@ ALERT_ICON_NONE
@ ALERT_ICON_INFO
@ ALERT_ICON_WARNING
@ ALERT_ICON_QUESTION
@ ALERT_ICON_ERROR
#define UI_MAX_SHORTCUT_STR
@ WM_GIZMOGROUPTYPE_PERSISTENT
#define NC_WINDOW
Definition WM_types.hh:372
wmEventModifierFlag
Definition WM_types.hh:274
@ KM_CTRL
Definition WM_types.hh:276
@ KM_ALT
Definition WM_types.hh:277
@ KM_HYPER
Definition WM_types.hh:289
@ KM_OSKEY
Definition WM_types.hh:279
@ KM_SHIFT
Definition WM_types.hh:275
eWM_EventFlag
Definition WM_types.hh:668
ReportList * reports
Definition WM_types.hh:1025
wmOperatorCallContext
Definition WM_types.hh:236
@ KM_NOTHING
Definition WM_types.hh:307
@ KM_ANY
Definition WM_types.hh:306
@ KM_PRESS
Definition WM_types.hh:308
@ KM_RELEASE
Definition WM_types.hh:309
#define KM_MOD_HELD
Definition WM_types.hh:323
#define U
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
bool any(VecOp< bool, D >) RET
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define G(x, y, z)
bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
const PointerRNA PointerRNA_NULL
std::optional< blender::StringRefNull > RNA_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, int translate)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void api_ui_item_common_translation(FunctionRNA *func)
const EnumPropertyItem rna_enum_region_type_items[]
Definition rna_screen.cc:21
const EnumPropertyItem rna_enum_space_type_items[]
Definition rna_space.cc:72
const EnumPropertyItem rna_enum_operator_context_items[]
Definition rna_ui.cc:29
const EnumPropertyItem rna_enum_icon_items[]
Definition rna_ui_api.cc:25
const EnumPropertyItem rna_enum_event_direction_items[]
Definition rna_wm.cc:489
const EnumPropertyItem rna_enum_event_value_items[]
Definition rna_wm.cc:477
const EnumPropertyItem rna_enum_event_type_mask_items[]
Definition rna_wm.cc:518
const EnumPropertyItem rna_enum_event_type_items[]
Definition rna_wm.cc:215
const EnumPropertyItem rna_enum_wm_report_items[]
Definition rna_wm.cc:616
const EnumPropertyItem rna_enum_operator_return_items[]
Definition rna_wm.cc:584
void RNA_api_keymapitem(StructRNA *srna)
#define WM_GEN_INVOKE_EVENT
void RNA_api_window(StructRNA *srna)
void RNA_api_wm(StructRNA *srna)
#define WM_GEN_INVOKE_SIZE
void RNA_api_keyconfigs(StructRNA *srna)
const EnumPropertyItem rna_operator_popup_icon_items[]
void RNA_api_macro(StructRNA *srna)
void RNA_api_keymap(StructRNA *srna)
void RNA_api_keymapitems(StructRNA *srna)
#define WM_GEN_INVOKE_RETURN
void RNA_api_keyconfig(StructRNA *)
void RNA_api_keymaps(StructRNA *srna)
const EnumPropertyItem rna_enum_window_cursor_items[]
Definition rna_wm_api.cc:30
static void rna_generic_op_invoke(FunctionRNA *func, int flag)
void RNA_api_operator(StructRNA *srna)
#define min(a, b)
Definition sort.cc:36
#define FLT_MAX
Definition stdcycles.h:14
Definition DNA_ID.h:404
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
eWM_GizmoFlagGroupTypeFlag flag
const void * modal_items
struct ReportList * reports
struct UndoStack * undo_stack
struct wmWindow * winactive
struct wmKeyConfig * addonconf
struct wmEvent * eventstate
max
Definition text_draw.cc:251
wmTimer * timer
uint len
void WM_cursor_modal_restore(wmWindow *win)
void WM_cursor_time(wmWindow *win, int nr)
@ WM_CURSOR_WAIT
Definition wm_cursors.hh:17
@ WM_CURSOR_COPY
Definition wm_cursors.hh:20
@ WM_CURSOR_HAND
Definition wm_cursors.hh:22
@ WM_CURSOR_NSEW_SCROLL
Definition wm_cursors.hh:52
@ WM_CURSOR_CROSS
Definition wm_cursors.hh:26
@ WM_CURSOR_DEFAULT
Definition wm_cursors.hh:15
@ WM_CURSOR_HAND_CLOSED
Definition wm_cursors.hh:23
@ WM_CURSOR_PAINT
Definition wm_cursors.hh:27
@ WM_CURSOR_Y_MOVE
Definition wm_cursors.hh:40
@ WM_CURSOR_PICK_AREA
Definition wm_cursors.hh:62
@ WM_CURSOR_TEXT_EDIT
Definition wm_cursors.hh:16
@ WM_CURSOR_PAINT_BRUSH
Definition wm_cursors.hh:34
@ WM_CURSOR_NS_SCROLL
Definition wm_cursors.hh:53
@ WM_CURSOR_DOT
Definition wm_cursors.hh:28
@ WM_CURSOR_ZOOM_OUT
Definition wm_cursors.hh:57
@ WM_CURSOR_EDIT
Definition wm_cursors.hh:19
@ WM_CURSOR_ZOOM_IN
Definition wm_cursors.hh:56
@ WM_CURSOR_KNIFE
Definition wm_cursors.hh:31
@ WM_CURSOR_STOP
Definition wm_cursors.hh:18
@ WM_CURSOR_EYEDROPPER
Definition wm_cursors.hh:36
@ WM_CURSOR_ERASER
Definition wm_cursors.hh:35
@ WM_CURSOR_HAND_POINT
Definition wm_cursors.hh:24
@ WM_CURSOR_EW_SCROLL
Definition wm_cursors.hh:54
@ WM_CURSOR_MUTE
Definition wm_cursors.hh:60
@ WM_CURSOR_NONE
Definition wm_cursors.hh:59
@ WM_CURSOR_X_MOVE
Definition wm_cursors.hh:39
wmEvent * WM_event_add_simulate(wmWindow *win, const wmEvent *event_to_add)
void WM_main_add_notifier(uint type, void *reference)
void WM_event_tablet_data_default_set(wmTabletData *tablet_data)
wmEventHandler_Op * WM_event_add_modal_handler_ex(wmWindow *win, ScrArea *area, ARegion *region, wmOperator *op)
bool WM_operator_is_repeat(const bContext *C, const wmOperator *op)
wmKeyMapItem * WM_event_match_keymap_item(bContext *C, wmKeyMap *keymap, const wmEvent *event)
#define ISMOUSE_BUTTON(event_type)
#define ISMOUSE_MOTION(event_type)
wmEventType
@ TIMER
#define ISKEYBOARD(event_type)
#define EVT_TYPE_MASK_ALL
PointerRNA * ptr
Definition wm_files.cc:4226
wmOperatorType * ot
Definition wm_files.cc:4225
bool WM_gizmo_group_type_ensure_ptr(wmGizmoGroupType *gzgt)
void WM_gizmo_group_type_unlink_delayed_ptr(wmGizmoGroupType *gzgt)
wmGizmoGroupType * WM_gizmogrouptype_find(const StringRef idname, bool quiet)
void WM_script_tag_reload()
void WM_keyconfig_clear(wmKeyConfig *keyconf)
Definition wm_keymap.cc:351
void WM_keymap_item_restore_to_default(wmWindowManager *wm, wmKeyMap *keymap, wmKeyMapItem *kmi)
wmKeyMapItem * WM_key_event_operator(const bContext *C, const char *opname, wmOperatorCallContext opcontext, IDProperty *properties, const short include_mask, const short exclude_mask, wmKeyMap **r_keymap)
void WM_keymap_restore_to_default(wmKeyMap *keymap, wmWindowManager *wm)
wmKeyMapItem * WM_keymap_add_item_copy(wmKeyMap *keymap, wmKeyMapItem *kmi_src)
Definition wm_keymap.cc:565
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition wm_keymap.cc:929
wmKeyMapItem * WM_key_event_operator_from_keymap(wmKeyMap *keymap, const char *opname, IDProperty *properties, const short include_mask, const short exclude_mask)
wmKeyMapItem * WM_modalkeymap_add_item(wmKeyMap *km, const KeyMapItem_Params *params, int value)
Definition wm_keymap.cc:969
void WM_keyconfig_update_ex(wmWindowManager *wm, bool keep_properties)
wmKeyConfig * WM_keyconfig_ensure(wmWindowManager *wm, const char *idname, bool user_defined)
Definition wm_keymap.cc:306
wmKeyMap * WM_keymap_active(const wmWindowManager *wm, wmKeyMap *keymap)
wmKeyMapItem * WM_keymap_item_find_match(wmKeyMap *km_base, wmKeyMap *km_match, wmKeyMapItem *kmi_match, ReportList *reports)
wmKeyMapItem * WM_keymap_add_item(wmKeyMap *keymap, const char *idname, const KeyMapItem_Params *params)
Definition wm_keymap.cc:546
std::optional< std::string > WM_keymap_item_to_string(const wmKeyMapItem *kmi, const bool compact)
void WM_keymap_remove(wmKeyConfig *keyconf, wmKeyMap *keymap)
Definition wm_keymap.cc:462
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:893
wmKeyMap * WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:864
wmKeyMapItem * WM_modalkeymap_add_item_str(wmKeyMap *km, const KeyMapItem_Params *params, const char *value)
Definition wm_keymap.cc:985
void WM_keyconfig_remove(wmWindowManager *wm, wmKeyConfig *keyconf)
Definition wm_keymap.cc:329
void WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
Definition wm_keymap.cc:578
bool WM_keymap_item_compare(const wmKeyMapItem *k1, const wmKeyMapItem *k2)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operator_last_properties_ensure(wmOperatorType *ot, PointerRNA *ptr)
size_t WM_operator_bl_idname(char *dst, const char *src)
wmOperatorStatus WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default)
wmOperatorStatus WM_operator_confirm_ex(bContext *C, wmOperator *op, const char *title, const char *message, const char *confirm_text, int icon, bool cancel_default)
wmOperatorStatus WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *)
wmOperatorStatus WM_operator_ui_popup(bContext *C, wmOperator *op, int width)
wmOperatorStatus WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *)
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
uint8_t flag
Definition wm_window.cc:139