Blender V5.0
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_icons.hh"
20#include "UI_interface_types.hh"
21
22#include "wm_cursors.hh"
23#include "wm_event_types.hh"
24
25#include "WM_api.hh"
26#include "WM_types.hh"
27
28#include "rna_internal.hh" /* own include */
29
30/* confusing 2 enums mixed up here */
32 {WM_CURSOR_DEFAULT, "DEFAULT", 0, "Default", ""},
33 {WM_CURSOR_NONE, "NONE", 0, "None", ""},
34 {WM_CURSOR_WAIT, "WAIT", 0, "Wait", ""},
35 {WM_CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""},
36 {WM_CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""},
37 {WM_CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""},
38
39 /* new */
40 {WM_CURSOR_KNIFE, "KNIFE", 0, "Knife", ""},
41 {WM_CURSOR_TEXT_EDIT, "TEXT", 0, "Text", ""},
42 {WM_CURSOR_PAINT_BRUSH, "PAINT_BRUSH", 0, "Paint Brush", ""},
43 {WM_CURSOR_PAINT, "PAINT_CROSS", 0, "Paint Cross", ""},
44 {WM_CURSOR_DOT, "DOT", 0, "Dot Cursor", ""},
45 {WM_CURSOR_ERASER, "ERASER", 0, "Eraser", ""},
46 {WM_CURSOR_HAND, "HAND", 0, "Open Hand", ""},
47 {WM_CURSOR_HAND_POINT, "HAND_POINT", 0, "Pointing Hand", ""},
48 {WM_CURSOR_HAND_CLOSED, "HAND_CLOSED", 0, "Closed Hand", ""},
49 {WM_CURSOR_EW_SCROLL, "SCROLL_X", 0, "Scroll-X", ""},
50 {WM_CURSOR_NS_SCROLL, "SCROLL_Y", 0, "Scroll-Y", ""},
51 {WM_CURSOR_NSEW_SCROLL, "SCROLL_XY", 0, "Scroll-XY", ""},
52 {WM_CURSOR_EYEDROPPER, "EYEDROPPER", 0, "Eyedropper", ""},
53 {WM_CURSOR_PICK_AREA, "PICK_AREA", 0, "Pick Area", ""},
54 {WM_CURSOR_STOP, "STOP", 0, "Stop", ""},
55 {WM_CURSOR_COPY, "COPY", 0, "Copy", ""},
56 {WM_CURSOR_CROSS, "CROSS", 0, "Cross", ""},
57 {WM_CURSOR_MUTE, "MUTE", 0, "Mute", ""},
58 {WM_CURSOR_ZOOM_IN, "ZOOM_IN", 0, "Zoom In", ""},
59 {WM_CURSOR_ZOOM_OUT, "ZOOM_OUT", 0, "Zoom Out", ""},
60 {0, nullptr, 0, nullptr, nullptr},
61};
62
63#ifdef RNA_RUNTIME
64
65# include "DNA_userdef_types.h"
66
67# include "BLI_string.h"
68# include "BLI_string_utf8.h"
69
70# include "BKE_context.hh"
71# include "BKE_global.hh"
72# include "BKE_main.hh"
73# include "BKE_report.hh"
74# include "BKE_undo_system.hh"
75
76# include "WM_types.hh"
77
78/* Needed since RNA doesn't use `const` in function signatures. */
79static bool rna_KeyMapItem_compare(wmKeyMapItem *k1, wmKeyMapItem *k2)
80{
81 return WM_keymap_item_compare(k1, k2);
82}
83
84static void rna_KeyMapItem_to_string(wmKeyMapItem *kmi, bool compact, char *result)
85{
87 result, WM_keymap_item_to_string(kmi, compact).value_or("").c_str(), UI_MAX_SHORTCUT_STR);
88}
89
90static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C)
91{
93 return WM_keymap_active(wm, km);
94}
95
96static void rna_keymap_restore_to_default(wmKeyMap *km, bContext *C)
97{
99}
100
101static void rna_keymap_restore_item_to_default(wmKeyMap *km, bContext *C, wmKeyMapItem *kmi)
102{
104}
105
106static void rna_Operator_report(wmOperator *op, int type, const char *msg)
107{
108 BKE_report(op->reports, eReportType(type), msg);
109}
110
111static bool rna_Operator_is_repeat(wmOperator *op, bContext *C)
112{
113 return WM_operator_is_repeat(C, op);
114}
115
116/* since event isn't needed... */
117static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
118{
119 WM_enum_search_invoke(C, op, nullptr);
120}
121
122static int rna_Operator_ui_popup(bContext *C, wmOperator *op, int width)
123{
124 return wmOperatorStatus(WM_operator_ui_popup(C, op, width));
125}
126
127static bool rna_event_modal_handler_add(bContext *C, ReportList *reports, wmOperator *op)
128{
129 wmWindow *win = CTX_wm_window(C);
130 if (win == nullptr) {
131 BKE_report(reports, RPT_ERROR, "No active window in context!");
132 return false;
133 }
134 ScrArea *area = CTX_wm_area(C);
135 ARegion *region = CTX_wm_region(C);
136 return WM_event_add_modal_handler_ex(win, area, region, op) != nullptr;
137}
138
139static wmTimer *rna_event_timer_add(wmWindowManager *wm, float time_step, wmWindow *win)
140{
141 /* NOTE: we need a way for Python to know event types, `TIMER` is hard coded. */
142 return WM_event_timer_add(wm, win, TIMER, time_step);
143}
144
145static void rna_event_timer_remove(wmWindowManager *wm, wmTimer *timer)
146{
148}
149
150static wmGizmoGroupType *wm_gizmogrouptype_find_for_add_remove(ReportList *reports,
151 const char *idname)
152{
153 wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, true);
154 if (gzgt == nullptr) {
155 BKE_reportf(reports, RPT_ERROR, "Gizmo group type '%s' not found!", idname);
156 return nullptr;
157 }
159 BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' has 'PERSISTENT' option set!", idname);
160 return nullptr;
161 }
162 return gzgt;
163}
164
165static void rna_gizmo_group_type_ensure(ReportList *reports, const char *idname)
166{
167 wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
168 if (gzgt != nullptr) {
170 }
171}
172
173static void rna_gizmo_group_type_unlink_delayed(ReportList *reports, const char *idname)
174{
175 wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
176 if (gzgt != nullptr) {
178 }
179}
180
181/* Placeholder data for final implementation of a true progress-bar. */
182static struct wmStaticProgress {
183 float min;
184 float max;
185 bool is_valid;
186} wm_progress_state = {0, 0, false};
187
188static void rna_progress_begin(wmWindowManager * /*wm*/, float min, float max)
189{
190 float range = max - min;
191 if (range != 0) {
192 wm_progress_state.min = min;
193 wm_progress_state.max = max;
194 wm_progress_state.is_valid = true;
195 }
196 else {
197 wm_progress_state.is_valid = false;
198 }
199}
200
201static void rna_progress_update(wmWindowManager *wm, float value)
202{
203 if (wm_progress_state.is_valid) {
204 /* Map to factor 0..1. */
205 wmWindow *win = wm->runtime->winactive;
206 if (win) {
207 const float progress_factor = (value - wm_progress_state.min) /
208 (wm_progress_state.max - wm_progress_state.min);
209 WM_cursor_progress(win, progress_factor);
210 }
211 }
212}
213
214static void rna_progress_end(wmWindowManager *wm)
215{
216 if (wm_progress_state.is_valid) {
217 wmWindow *win = wm->runtime->winactive;
218 if (win) {
220 wm_progress_state.is_valid = false;
221 }
222 }
223}
224
225/* wrap these because of 'const wmEvent *' */
226static int rna_Operator_confirm(bContext *C,
227 wmOperator *op,
228 wmEvent * /*event*/,
229 const char *title,
230 const char *message,
231 const char *confirm_text,
232 const int icon,
233 const char *text_ctxt,
234 const bool translate)
235{
236 std::optional<blender::StringRefNull> title_str = RNA_translate_ui_text(
237 title, text_ctxt, nullptr, nullptr, translate);
238 std::optional<blender::StringRefNull> message_str = RNA_translate_ui_text(
239 message, text_ctxt, nullptr, nullptr, translate);
240 std::optional<blender::StringRefNull> confirm_text_str = RNA_translate_ui_text(
241 confirm_text, text_ctxt, nullptr, nullptr, translate);
243 op,
244 title_str ? title_str->c_str() : nullptr,
245 message_str ? message_str->c_str() : nullptr,
246 confirm_text_str ? confirm_text_str->c_str() : nullptr,
247 icon);
248}
249
250static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
251{
252 return WM_operator_props_popup(C, op, event);
253}
254
255static int rna_Operator_props_dialog_popup(bContext *C,
256 wmOperator *op,
257 const int width,
258 const char *title,
259 const char *confirm_text,
260 const bool cancel_default,
261 const char *text_ctxt,
262 const bool translate)
263{
264 std::optional<blender::StringRefNull> title_str = RNA_translate_ui_text(
265 title, text_ctxt, nullptr, nullptr, translate);
266 std::optional<blender::StringRefNull> confirm_text_str = RNA_translate_ui_text(
267 confirm_text, text_ctxt, nullptr, nullptr, translate);
269 C,
270 op,
271 width,
272 title_str ? std::make_optional<std::string>(*title_str) : std::nullopt,
273 confirm_text_str ? std::make_optional<std::string>(*confirm_text_str) : std::nullopt,
274 cancel_default);
275}
276
277static int16_t keymap_item_modifier_flag_from_args(
278 bool any, int shift, int ctrl, int alt, int oskey, int hyper)
279{
280 int16_t modifier = 0;
281 if (any) {
282 modifier = KM_ANY;
283 }
284 else {
285# define MOD_VAR_ASSIGN_FLAG(mod_var, mod_flag) \
286 if (mod_var == KM_MOD_HELD) { \
287 modifier |= mod_flag; \
288 } \
289 else if (mod_var == KM_ANY) { \
290 modifier |= KMI_PARAMS_MOD_TO_ANY(mod_flag); \
291 } \
292 ((void)0)
293
294 MOD_VAR_ASSIGN_FLAG(shift, KM_SHIFT);
295 MOD_VAR_ASSIGN_FLAG(ctrl, KM_CTRL);
296 MOD_VAR_ASSIGN_FLAG(alt, KM_ALT);
297 MOD_VAR_ASSIGN_FLAG(oskey, KM_OSKEY);
298 MOD_VAR_ASSIGN_FLAG(hyper, KM_HYPER);
299
300# undef MOD_VAR_ASSIGN_FLAG
301 }
302 return modifier;
303}
304
305static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km,
306 ReportList *reports,
307 const char *idname,
308 int type,
309 int value,
310 bool any,
311 int shift,
312 int ctrl,
313 int alt,
314 int oskey,
315 int hyper,
316 int keymodifier,
317 int direction,
318 bool repeat,
319 bool head)
320{
321 /* only on non-modal maps */
322 if (km->flag & KEYMAP_MODAL) {
323 BKE_report(reports, RPT_ERROR, "Not a non-modal keymap");
324 return nullptr;
325 }
326
327 // wmWindowManager *wm = CTX_wm_manager(C);
328 wmKeyMapItem *kmi = nullptr;
329 char idname_bl[OP_MAX_TYPENAME];
330
331 WM_operator_bl_idname(idname_bl, idname);
332
334 params.type = type;
335 params.value = value;
336 params.modifier = keymap_item_modifier_flag_from_args(any, shift, ctrl, alt, oskey, hyper);
337 params.keymodifier = keymodifier;
338 params.direction = direction;
339
340 /* create keymap item */
341 kmi = WM_keymap_add_item(km, idname_bl, &params);
342
343 if (!repeat) {
344 kmi->flag |= KMI_REPEAT_IGNORE;
345 }
346
347 /* #32437 allow scripts to define hotkeys that get added to start of keymap
348 * so that they stand a chance against catch-all defines later on
349 */
350 if (head) {
351 BLI_remlink(&km->items, kmi);
352 BLI_addhead(&km->items, kmi);
353 }
354
355 return kmi;
356}
357
358static wmKeyMapItem *rna_KeyMap_item_new_from_item(wmKeyMap *km,
359 ReportList *reports,
360 wmKeyMapItem *kmi_src,
361 bool head)
362{
363 // wmWindowManager *wm = CTX_wm_manager(C);
364
365 if ((km->flag & KEYMAP_MODAL) == (kmi_src->idname[0] != '\0')) {
366 BKE_report(reports, RPT_ERROR, "Cannot mix modal/non-modal items");
367 return nullptr;
368 }
369
370 /* create keymap item */
371 wmKeyMapItem *kmi = WM_keymap_add_item_copy(km, kmi_src);
372 if (head) {
373 BLI_remlink(&km->items, kmi);
374 BLI_addhead(&km->items, kmi);
375 }
376 return kmi;
377}
378
379static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km,
380 ReportList *reports,
381 const char *propvalue_str,
382 int type,
383 int value,
384 bool any,
385 int shift,
386 int ctrl,
387 int alt,
388 int oskey,
389 int hyper,
390 int keymodifier,
391 int direction,
392 bool repeat)
393{
394 /* only modal maps */
395 if ((km->flag & KEYMAP_MODAL) == 0) {
396 BKE_report(reports, RPT_ERROR, "Not a modal keymap");
397 return nullptr;
398 }
399
400 wmKeyMapItem *kmi = nullptr;
401 int propvalue = 0;
402
404 params.type = type;
405 params.value = value;
406 params.modifier = keymap_item_modifier_flag_from_args(any, shift, ctrl, alt, oskey, hyper);
407 params.keymodifier = keymodifier;
408 params.direction = direction;
409
410 /* not initialized yet, do delayed lookup */
411 if (!km->modal_items) {
412 kmi = WM_modalkeymap_add_item_str(km, &params, propvalue_str);
413 }
414 else {
415 if (RNA_enum_value_from_id(static_cast<const EnumPropertyItem *>(km->modal_items),
416 propvalue_str,
417 &propvalue) == 0)
418 {
419 BKE_report(reports, RPT_WARNING, "Property value not in enumeration");
420 }
421 kmi = WM_modalkeymap_add_item(km, &params, propvalue);
422 }
423
424 if (!repeat) {
425 kmi->flag |= KMI_REPEAT_IGNORE;
426 }
427
428 return kmi;
429}
430
431static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA *kmi_ptr)
432{
433 wmKeyMapItem *kmi = static_cast<wmKeyMapItem *>(kmi_ptr->data);
434
435 if (UNLIKELY(BLI_findindex(&km->items, kmi) == -1)) {
437 reports, RPT_ERROR, "KeyMapItem '%s' not found in KeyMap '%s'", kmi->idname, km->idname);
438 return;
439 }
440
441 WM_keymap_remove_item(km, kmi);
442 kmi_ptr->invalidate();
443}
444
445static PointerRNA rna_KeyMap_item_find_match(
446 ID *id, wmKeyMap *km_base, ReportList *reports, wmKeyMap *km_match, wmKeyMapItem *kmi_match)
447{
448 wmKeyMapItem *kmi_base = WM_keymap_item_find_match(km_base, km_match, kmi_match, reports);
449 if (kmi_base) {
450 return RNA_pointer_create_discrete(id, &RNA_KeyMapItem, kmi_base);
451 }
452 return PointerRNA_NULL;
453}
454
455static PointerRNA rna_KeyMap_item_find_from_operator(ID *id,
456 wmKeyMap *km,
457 const char *idname,
458 PointerRNA *properties,
459 int include_mask,
460 int exclude_mask)
461{
462 char idname_bl[OP_MAX_TYPENAME];
463 WM_operator_bl_idname(idname_bl, idname);
464
466 km, idname_bl, static_cast<IDProperty *>(properties->data), include_mask, exclude_mask);
467 PointerRNA kmi_ptr = RNA_pointer_create_discrete(id, &RNA_KeyMapItem, kmi);
468 return kmi_ptr;
469}
470
471static PointerRNA rna_KeyMap_item_match_event(ID *id, wmKeyMap *km, bContext *C, wmEvent *event)
472{
473 wmKeyMapItem *kmi = WM_event_match_keymap_item(C, km, event);
474 PointerRNA kmi_ptr = RNA_pointer_create_discrete(id, &RNA_KeyMapItem, kmi);
475 return kmi_ptr;
476}
477
478static wmKeyMap *rna_KeyMaps_new(wmKeyConfig *keyconf,
479 ReportList *reports,
480 const char *idname,
481 int spaceid,
482 int regionid,
483 bool modal,
484 bool tool)
485{
486 if (modal) {
487 /* Sanity check: Don't allow add-ons to override internal modal key-maps
488 * because this isn't supported, the restriction can be removed when
489 * add-ons can define modal key-maps.
490 * Currently this is only useful for add-ons to override built-in modal keymaps
491 * which is not the intended use for add-on keymaps. */
492 wmWindowManager *wm = static_cast<wmWindowManager *>(G_MAIN->wm.first);
493 if (keyconf == wm->runtime->addonconf) {
494 BKE_reportf(reports, RPT_ERROR, "Modal key-maps not supported for add-on key-config");
495 return nullptr;
496 }
497 }
498
499 wmKeyMap *keymap;
500
501 if (modal == 0) {
502 keymap = WM_keymap_ensure(keyconf, idname, spaceid, regionid);
503 }
504 else {
505 keymap = WM_modalkeymap_ensure(keyconf, idname, nullptr); /* items will be lazy init */
506 }
507
508 if (keymap && tool) {
509 keymap->flag |= KEYMAP_TOOL;
510 }
511
512 return keymap;
513}
514
515static wmKeyMap *rna_KeyMaps_find(wmKeyConfig *keyconf,
516 const char *idname,
517 int spaceid,
518 int regionid)
519{
520 return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
521}
522
523static wmKeyMap *rna_KeyMaps_find_match(wmKeyConfig *keyconf, wmKeyMap *km_match)
524{
525 return WM_keymap_list_find(
526 &keyconf->keymaps, km_match->idname, km_match->spaceid, km_match->regionid);
527}
528
529static wmKeyMap *rna_KeyMaps_find_modal(wmKeyConfig * /*keyconf*/, const char *idname)
530{
531 wmOperatorType *ot = WM_operatortype_find(idname, false);
532
533 if (!ot) {
534 return nullptr;
535 }
536 return ot->modalkeymap;
537}
538
539static void rna_KeyMaps_remove(wmKeyConfig *keyconfig, ReportList *reports, PointerRNA *keymap_ptr)
540{
541 wmKeyMap *keymap = static_cast<wmKeyMap *>(keymap_ptr->data);
542
543 if (UNLIKELY(BLI_findindex(&keyconfig->keymaps, keymap) == -1)) {
544 BKE_reportf(reports,
545 RPT_ERROR,
546 "KeyMap '%s' not found in KeyConfig '%s'",
547 keymap->idname,
548 keyconfig->idname);
549 return;
550 }
551
552 WM_keymap_remove(keyconfig, keymap);
553 keymap_ptr->invalidate();
554}
555
556static void rna_KeyMaps_clear(wmKeyConfig *keyconfig)
557{
558 WM_keyconfig_clear(keyconfig);
559}
560
561wmKeyConfig *rna_KeyConfig_new(wmWindowManager *wm, const char *idname)
562{
563 return WM_keyconfig_ensure(wm, idname, true);
564}
565
566static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr)
567{
568 wmKeyConfig *keyconf = static_cast<wmKeyConfig *>(keyconf_ptr->data);
569 if (UNLIKELY(BLI_findindex(&wm->runtime->keyconfigs, keyconf) == -1)) {
570 BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
571 return;
572 }
573 WM_keyconfig_remove(wm, keyconf);
574 keyconf_ptr->invalidate();
575}
576
577static PointerRNA rna_KeyConfig_find_item_from_operator(wmWindowManager *wm,
578 bContext *C,
579 const char *idname,
580 int opcontext,
581 PointerRNA *properties,
582 int include_mask,
583 int exclude_mask,
584 PointerRNA *km_ptr)
585{
586 char idname_bl[OP_MAX_TYPENAME];
587 WM_operator_bl_idname(idname_bl, idname);
588
589 wmKeyMap *km = nullptr;
591 idname_bl,
593 static_cast<IDProperty *>(properties->data),
594 include_mask,
595 exclude_mask,
596 &km);
597 *km_ptr = RNA_pointer_create_discrete(&wm->id, &RNA_KeyMap, km);
598 PointerRNA kmi_ptr = RNA_pointer_create_discrete(&wm->id, &RNA_KeyMapItem, kmi);
599 return kmi_ptr;
600}
601
602static void rna_KeyConfig_update(wmWindowManager *wm, bool keep_properties)
603{
604 WM_keyconfig_update_ex(wm, keep_properties);
605}
606
608static bool rna_popup_context_ok_or_report(bContext *C, ReportList *reports)
609{
610 if (CTX_wm_window(C) == nullptr) {
611 BKE_report(reports, RPT_ERROR, "context \"window\" is None");
612 return false;
613 }
614 return true;
615}
616
617/* popup menu wrapper */
618static PointerRNA rna_PopMenuBegin(bContext *C,
619 ReportList *reports,
620 const char *title,
621 const int icon)
622{
623 if (!rna_popup_context_ok_or_report(C, reports)) {
624 return PointerRNA_NULL;
625 }
626
627 void *data = (void *)UI_popup_menu_begin(C, title, icon);
628 PointerRNA ptr_result = RNA_pointer_create_discrete(nullptr, &RNA_UIPopupMenu, data);
629 return ptr_result;
630}
631
632static void rna_PopMenuEnd(bContext *C, PointerRNA *handle)
633{
634 UI_popup_menu_end(C, static_cast<uiPopupMenu *>(handle->data));
635}
636
637/* popover wrapper */
638static PointerRNA rna_PopoverBegin(bContext *C,
639 ReportList *reports,
640 const int ui_units_x,
641 const bool from_active_button)
642{
643 if (!rna_popup_context_ok_or_report(C, reports)) {
644 return PointerRNA_NULL;
645 }
646
647 void *data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x, from_active_button);
648 PointerRNA ptr_result = RNA_pointer_create_discrete(nullptr, &RNA_UIPopover, data);
649 return ptr_result;
650}
651
652static void rna_PopoverEnd(bContext *C, PointerRNA *handle, wmKeyMap *keymap)
653{
654 UI_popover_end(C, static_cast<uiPopover *>(handle->data), keymap);
655}
656
657/* pie menu wrapper */
658static PointerRNA rna_PieMenuBegin(
659 bContext *C, ReportList *reports, const char *title, const int icon, PointerRNA *event)
660{
661 if (!rna_popup_context_ok_or_report(C, reports)) {
662 return PointerRNA_NULL;
663 }
664
665 void *data = (void *)UI_pie_menu_begin(
666 C, title, icon, static_cast<const wmEvent *>(event->data));
667
668 PointerRNA ptr_result = RNA_pointer_create_discrete(nullptr, &RNA_UIPieMenu, data);
669 return ptr_result;
670}
671
672static void rna_PieMenuEnd(bContext *C, PointerRNA *handle)
673{
674 UI_pie_menu_end(C, static_cast<uiPieMenu *>(handle->data));
675}
676
677static void rna_WindowManager_print_undo_steps(wmWindowManager *wm)
678{
679 BKE_undosys_print(wm->runtime->undo_stack);
680}
681
682static void rna_WindowManager_tag_script_reload()
683{
686}
687
688static PointerRNA rna_WindoManager_operator_properties_last(const char *idname)
689{
690 wmOperatorType *ot = WM_operatortype_find(idname, true);
691
692 if (ot != nullptr) {
695 return ptr;
696 }
697 return PointerRNA_NULL;
698}
699
700static wmEvent *rna_Window_event_add_simulate(wmWindow *win,
701 ReportList *reports,
702 int type,
703 int value,
704 const char *unicode,
705 int x,
706 int y,
707 bool shift,
708 bool ctrl,
709 bool alt,
710 bool oskey,
711 bool hyper)
712{
713 if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
714 BKE_report(reports, RPT_ERROR, "Not running with '--enable-event-simulate' enabled");
715 return nullptr;
716 }
717
718 if (!ELEM(value, KM_PRESS, KM_RELEASE, KM_NOTHING)) {
719 BKE_report(reports, RPT_ERROR, "Value: only 'PRESS/RELEASE/NOTHING' are supported");
720 return nullptr;
721 }
722 if (ISKEYBOARD(type) || ISMOUSE_BUTTON(type)) {
723 if (!ELEM(value, KM_PRESS, KM_RELEASE)) {
724 BKE_report(reports, RPT_ERROR, "Value: must be 'PRESS/RELEASE' for keyboard/buttons");
725 return nullptr;
726 }
727 }
728 if (ISMOUSE_MOTION(type)) {
729 if (value != KM_NOTHING) {
730 BKE_report(reports, RPT_ERROR, "Value: must be 'NOTHING' for motion");
731 return nullptr;
732 }
733 }
734 if (unicode != nullptr) {
735 if (value != KM_PRESS) {
736 BKE_report(reports, RPT_ERROR, "Value: must be 'PRESS' when unicode is set");
737 return nullptr;
738 }
739 }
740 /* TODO: validate NDOF. */
741
742 if (unicode != nullptr) {
743 int len = BLI_str_utf8_size_or_error(unicode);
744 if (len == -1 || unicode[len] != '\0') {
745 BKE_report(reports, RPT_ERROR, "Only a single character supported");
746 return nullptr;
747 }
748 }
749
750 wmEvent e = *win->eventstate;
751 e.type = wmEventType(type);
752 e.val = value;
753 e.flag = eWM_EventFlag(0);
754 e.xy[0] = x;
755 e.xy[1] = y;
756
757 e.modifier = wmEventModifierFlag(0);
758 if (shift) {
759 e.modifier |= KM_SHIFT;
760 }
761 if (ctrl) {
762 e.modifier |= KM_CTRL;
763 }
764 if (alt) {
765 e.modifier |= KM_ALT;
766 }
767 if (oskey) {
768 e.modifier |= KM_OSKEY;
769 }
770 if (hyper) {
771 e.modifier |= KM_HYPER;
772 }
773
774 e.utf8_buf[0] = '\0';
775 if (unicode != nullptr) {
776 STRNCPY(e.utf8_buf, unicode);
777 }
778
779 /* Until we expose setting tablet values here. */
781
782 return WM_event_add_simulate(win, &e);
783}
784
785#else
786
787# define WM_GEN_INVOKE_EVENT (1 << 0)
788# define WM_GEN_INVOKE_SIZE (1 << 1)
789# define WM_GEN_INVOKE_RETURN (1 << 2)
790
792{
793 PropertyRNA *parm;
794
796 parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
798
800 parm = RNA_def_pointer(func, "event", "Event", "", "Event");
802 }
803
804 if (flag & WM_GEN_INVOKE_SIZE) {
805 RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX);
806 }
807
809 parm = RNA_def_enum_flag(
810 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
811 RNA_def_function_return(func, parm);
812 }
813}
814
816{
817 FunctionRNA *func;
818 PropertyRNA *parm;
819
820 func = RNA_def_function(srna, "cursor_warp", "WM_cursor_warp");
821 parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
823 parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
825 RNA_def_function_ui_description(func, "Set the cursor position");
826
827 func = RNA_def_function(srna, "cursor_set", "WM_cursor_set");
828 parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
831 RNA_def_function_ui_description(func, "Set the cursor");
832
833 func = RNA_def_function(srna, "cursor_modal_set", "WM_cursor_modal_set");
834 parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
837 RNA_def_function_ui_description(func, "Set the cursor, so the previous cursor can be restored");
838
839 func = RNA_def_function(srna, "cursor_modal_restore", "WM_cursor_modal_restore");
841 func, "Restore the previous cursor after calling ``cursor_modal_set``");
842
843 /* Arguments match 'rna_KeyMap_item_new'. */
844 func = RNA_def_function(srna, "event_simulate", "rna_Window_event_add_simulate");
846 parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
848 parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
850 parm = RNA_def_string(func, "unicode", nullptr, 0, "", "");
852
853 RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
854 RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
855
856 RNA_def_boolean(func, "shift", false, "Shift", "");
857 RNA_def_boolean(func, "ctrl", false, "Ctrl", "");
858 RNA_def_boolean(func, "alt", false, "Alt", "");
859 RNA_def_boolean(func, "oskey", false, "OS Key", "");
860 RNA_def_boolean(func, "hyper", false, "Hyper", "");
861 parm = RNA_def_pointer(func, "event", "Event", "Item", "Added key map item");
862 RNA_def_function_return(func, parm);
863}
864
866 {ALERT_ICON_NONE, "NONE", 0, "None", ""},
867 {ALERT_ICON_WARNING, "WARNING", 0, "Warning", ""},
868 {ALERT_ICON_QUESTION, "QUESTION", 0, "Question", ""},
869 {ALERT_ICON_ERROR, "ERROR", 0, "Error", ""},
870 {ALERT_ICON_INFO, "INFO", 0, "Info", ""},
871 {0, nullptr, 0, nullptr, nullptr},
872};
873
875{
876 FunctionRNA *func;
877 PropertyRNA *parm;
878
879 func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
880 /* Note that a full description is located at:
881 * `doc/python_api/examples/bpy.types.WindowManager.fileselect_add.py`. */
882 RNA_def_function_ui_description(func, "Opens a file selector with an operator.");
883 rna_generic_op_invoke(func, 0);
884
885 func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
887 func,
888 "Add a modal handler to the window manager, for the given modal operator "
889 "(called by invoke() with self, just before returning {'RUNNING_MODAL'})");
891 parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
894 func,
895 RNA_def_boolean(func, "handle", true, "", "Whether adding the handler was successful"));
896
897 func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
899 func, "Add a timer to the given window, to generate periodic 'TIMER' events");
900 parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
903 RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
904 RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to, or None");
905 parm = RNA_def_pointer(func, "result", "Timer", "", "");
906 RNA_def_function_return(func, parm);
907
908 func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
909 parm = RNA_def_pointer(func, "timer", "Timer", "", "");
911
912 func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure");
914 func, "Activate an existing widget group (when the persistent option isn't set)");
916 parm = RNA_def_string(func, "identifier", nullptr, 0, "", "Gizmo group type name");
918
919 func = RNA_def_function(
920 srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed");
922 "Unlink a widget group (when the persistent option is set)");
924 parm = RNA_def_string(func, "identifier", nullptr, 0, "", "Gizmo group type name");
926
927 /* Progress bar interface */
928 func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
929 RNA_def_function_ui_description(func, "Start progress report");
930 parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
931 RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
933 parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
935 RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");
936
937 func = RNA_def_function(srna, "progress_update", "rna_progress_update");
938 RNA_def_function_ui_description(func, "Update the progress feedback");
939 parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
942 parm, "value", "Any value between min and max as set in progress_begin()");
943
944 func = RNA_def_function(srna, "progress_end", "rna_progress_end");
945 RNA_def_function_ui_description(func, "Terminate progress report");
946
947 /* invoke functions, for use with python */
948 func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
950 func,
951 "Operator popup invoke "
952 "(show operator properties and execute it automatically on changes)");
954
955 /* invoked dialog opens popup with OK button, does not auto-exec operator. */
956 func = RNA_def_function(srna, "invoke_props_dialog", "rna_Operator_props_dialog_popup");
958 func,
959 "Operator dialog (non-autoexec popup) invoke "
960 "(show operator properties and only execute it on click on OK button)");
962
963 parm = RNA_def_property(func, "title", PROP_STRING, PROP_NONE);
964 RNA_def_property_ui_text(parm, "Title", "Optional text to show as title of the popup");
965 parm = RNA_def_property(func, "confirm_text", PROP_STRING, PROP_NONE);
967 parm,
968 "Confirm Text",
969 "Optional text to show instead to the default \"OK\" confirmation button text");
970 RNA_def_property(func, "cancel_default", PROP_BOOLEAN, PROP_NONE);
972
973 /* invoke enum */
974 func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
976 func,
977 "Operator search popup invoke which "
978 "searches values of the operator's :class:`bpy.types.Operator.bl_property` "
979 "(which must be an EnumProperty), executing it on confirmation");
980 rna_generic_op_invoke(func, 0);
981
982 /* invoke functions, for use with python */
983 func = RNA_def_function(srna, "invoke_popup", "rna_Operator_ui_popup");
985 "Operator popup invoke "
986 "(only shows operator's properties, without executing it)");
988
989 func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm");
991 func,
992 "Operator confirmation popup "
993 "(only to let user confirm the execution, no operator properties shown)");
995
996 parm = RNA_def_property(func, "title", PROP_STRING, PROP_NONE);
997 RNA_def_property_ui_text(parm, "Title", "Optional text to show as title of the popup");
998
999 parm = RNA_def_property(func, "message", PROP_STRING, PROP_NONE);
1000 RNA_def_property_ui_text(parm, "Message", "Optional first line of content text");
1001
1002 parm = RNA_def_property(func, "confirm_text", PROP_STRING, PROP_NONE);
1004 parm,
1005 "Confirm Text",
1006 "Optional text to show instead to the default \"OK\" confirmation button text");
1007
1008 parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
1011 RNA_def_property_ui_text(parm, "Icon", "Optional icon displayed in the dialog");
1012
1014
1015 /* wrap UI_popup_menu_begin */
1016 func = RNA_def_function(srna, "popmenu_begin__internal", "rna_PopMenuBegin");
1018 parm = RNA_def_string(func, "title", nullptr, 0, "", "");
1020 parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
1022 /* return */
1023 parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
1025 RNA_def_function_return(func, parm);
1026
1027 /* wrap UI_popup_menu_end */
1028 func = RNA_def_function(srna, "popmenu_end__internal", "rna_PopMenuEnd");
1030 parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
1032
1033 /* wrap UI_popover_begin */
1034 func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin");
1036 RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED);
1037 /* return */
1038 parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
1040 RNA_def_function_return(func, parm);
1042 func, "from_active_button", false, "Use Button", "Use the active button for positioning");
1043
1044 /* wrap UI_popover_end */
1045 func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd");
1047 parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
1049 RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
1050
1051 /* wrap uiPieMenuBegin */
1052 func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin");
1054 parm = RNA_def_string(func, "title", nullptr, 0, "", "");
1056 parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
1058 parm = RNA_def_pointer(func, "event", "Event", "", "");
1060 /* return */
1061 parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", "");
1063 RNA_def_function_return(func, parm);
1064
1065 /* wrap uiPieMenuEnd */
1066 func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd");
1068 parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", "");
1070
1071 /* access last operator options (optionally create). */
1072 func = RNA_def_function(
1073 srna, "operator_properties_last", "rna_WindoManager_operator_properties_last");
1075 parm = RNA_def_string(func, "operator", nullptr, 0, "", "");
1077 /* return */
1078 parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
1080 RNA_def_function_return(func, parm);
1081
1082 RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
1083
1084 /* Used by (#SCRIPT_OT_reload). */
1085 func = RNA_def_function(srna, "tag_script_reload", "rna_WindowManager_tag_script_reload");
1087 func, "Tag for refreshing the interface after scripts have been reloaded");
1089
1090 parm = RNA_def_property(srna, "is_interface_locked", PROP_BOOLEAN, PROP_NONE);
1091 RNA_def_property_boolean_sdna(parm, nullptr, "runtime->is_interface_locked", 0);
1093 parm,
1094 "Is Interface Locked",
1095 "If true, the interface is currently locked by a running job and data should not be "
1096 "modified from application timers. Otherwise, the running job might conflict with the "
1097 "handler causing unexpected results or even crashes.");
1099}
1100
1102{
1103 FunctionRNA *func;
1104 PropertyRNA *parm;
1105
1106 /* utility, not for registering */
1107 func = RNA_def_function(srna, "report", "rna_Operator_report");
1108 parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
1110 parm = RNA_def_string(func, "message", nullptr, 0, "Report Message", "");
1112
1113 /* utility, not for registering */
1114 func = RNA_def_function(srna, "is_repeat", "rna_Operator_is_repeat");
1116 /* return */
1117 parm = RNA_def_boolean(func, "result", false, "result", "");
1118 RNA_def_function_return(func, parm);
1119
1120 /* Registration */
1121
1122 /* poll */
1123 func = RNA_def_function(srna, "poll", nullptr);
1124 RNA_def_function_ui_description(func, "Test if the operator can be called or not");
1126 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
1127 parm = RNA_def_pointer(func, "context", "Context", "", "");
1129
1130 /* exec */
1131 func = RNA_def_function(srna, "execute", nullptr);
1132 RNA_def_function_ui_description(func, "Execute the operator");
1134 parm = RNA_def_pointer(func, "context", "Context", "", "");
1136
1137 /* better name? */
1138 parm = RNA_def_enum_flag(
1139 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1140 RNA_def_function_return(func, parm);
1141
1142 /* check */
1143 func = RNA_def_function(srna, "check", nullptr);
1145 func, "Check the operator settings, return True to signal a change to redraw");
1147 parm = RNA_def_pointer(func, "context", "Context", "", "");
1149
1150 parm = RNA_def_boolean(func, "result", false, "result", ""); /* better name? */
1151 RNA_def_function_return(func, parm);
1152
1153 /* invoke */
1154 func = RNA_def_function(srna, "invoke", nullptr);
1155 RNA_def_function_ui_description(func, "Invoke the operator");
1157 parm = RNA_def_pointer(func, "context", "Context", "", "");
1159 parm = RNA_def_pointer(func, "event", "Event", "", "");
1161
1162 /* better name? */
1163 parm = RNA_def_enum_flag(
1164 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1165 RNA_def_function_return(func, parm);
1166
1167 func = RNA_def_function(srna, "modal", nullptr); /* same as invoke */
1168 RNA_def_function_ui_description(func, "Modal operator function");
1170 parm = RNA_def_pointer(func, "context", "Context", "", "");
1172 parm = RNA_def_pointer(func, "event", "Event", "", "");
1174
1175 /* better name? */
1176 parm = RNA_def_enum_flag(
1177 func, "result", rna_enum_operator_return_items, OPERATOR_FINISHED, "result", "");
1178 RNA_def_function_return(func, parm);
1179
1180 /* draw */
1181 func = RNA_def_function(srna, "draw", nullptr);
1182 RNA_def_function_ui_description(func, "Draw function for the operator");
1184 parm = RNA_def_pointer(func, "context", "Context", "", "");
1186
1187 /* cancel */
1188 func = RNA_def_function(srna, "cancel", nullptr);
1189 RNA_def_function_ui_description(func, "Called when the operator is canceled");
1191 parm = RNA_def_pointer(func, "context", "Context", "", "");
1193
1194 /* description */
1195 func = RNA_def_function(srna, "description", nullptr);
1196 RNA_def_function_ui_description(func, "Compute a description string that depends on parameters");
1198 parm = RNA_def_string(func, "result", nullptr, 4096, "result", "");
1201 RNA_def_function_output(func, parm);
1202 parm = RNA_def_pointer(func, "context", "Context", "", "");
1204 parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1206}
1207
1209{
1210 FunctionRNA *func;
1211 PropertyRNA *parm;
1212
1213 /* utility, not for registering */
1214 func = RNA_def_function(srna, "report", "rna_Operator_report");
1215 parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
1217 parm = RNA_def_string(func, "message", nullptr, 0, "Report Message", "");
1219
1220 /* Registration */
1221
1222 /* poll */
1223 func = RNA_def_function(srna, "poll", nullptr);
1224 RNA_def_function_ui_description(func, "Test if the operator can be called or not");
1226 RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
1227 parm = RNA_def_pointer(func, "context", "Context", "", "");
1229
1230 /* draw */
1231 func = RNA_def_function(srna, "draw", nullptr);
1232 RNA_def_function_ui_description(func, "Draw function for the operator");
1234 parm = RNA_def_pointer(func, "context", "Context", "", "");
1236}
1237
1239{
1240 // FunctionRNA *func;
1241 // PropertyRNA *parm;
1242}
1243
1245{
1246 FunctionRNA *func;
1247 PropertyRNA *parm;
1248
1249 func = RNA_def_function(srna, "active", "rna_keymap_active");
1251 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
1252 RNA_def_function_return(func, parm);
1253
1254 func = RNA_def_function(srna, "restore_to_default", "rna_keymap_restore_to_default");
1256
1257 func = RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
1259 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1261}
1262
1264{
1265 FunctionRNA *func;
1266 PropertyRNA *parm;
1267
1268 func = RNA_def_function(srna, "compare", "rna_KeyMapItem_compare");
1269 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1271 parm = RNA_def_boolean(func, "result", false, "Comparison result", "");
1272 RNA_def_function_return(func, parm);
1273
1274 func = RNA_def_function(srna, "to_string", "rna_KeyMapItem_to_string");
1275 RNA_def_boolean(func, "compact", false, "Compact", "");
1276 parm = RNA_def_string(func, "result", nullptr, UI_MAX_SHORTCUT_STR, "result", "");
1278 RNA_def_function_output(func, parm);
1279}
1280
1282{
1283 FunctionRNA *func;
1284 PropertyRNA *parm;
1285
1286 func = RNA_def_function(srna, "new", "rna_KeyMap_item_new");
1288 parm = RNA_def_string(func, "idname", nullptr, 0, "Operator Identifier", "");
1290 parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
1292 parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
1294 RNA_def_boolean(func, "any", false, "Any", "");
1295 RNA_def_int(func, "shift", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Shift", "", KM_ANY, KM_MOD_HELD);
1296 RNA_def_int(func, "ctrl", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Ctrl", "", KM_ANY, KM_MOD_HELD);
1297 RNA_def_int(func, "alt", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Alt", "", KM_ANY, KM_MOD_HELD);
1298 RNA_def_int(func, "oskey", KM_NOTHING, KM_ANY, KM_MOD_HELD, "OS Key", "", KM_ANY, KM_MOD_HELD);
1299 RNA_def_int(func, "hyper", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Hyper", "", KM_ANY, KM_MOD_HELD);
1300 RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
1301 RNA_def_enum(func, "direction", rna_enum_event_direction_items, KM_ANY, "Direction", "");
1302 RNA_def_boolean(func, "repeat", false, "Repeat", "When set, accept key-repeat events");
1303 RNA_def_boolean(func,
1304 "head",
1305 false,
1306 "At Head",
1307 "Force item to be added at start (not end) of key map so that "
1308 "it doesn't get blocked by an existing key map item");
1309 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
1310 RNA_def_function_return(func, parm);
1311
1312 func = RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
1314 parm = RNA_def_string(func, "propvalue", nullptr, 0, "Property Value", "");
1316 parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
1318 parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
1320 RNA_def_boolean(func, "any", false, "Any", "");
1321 RNA_def_int(func, "shift", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Shift", "", KM_ANY, KM_MOD_HELD);
1322 RNA_def_int(func, "ctrl", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Ctrl", "", KM_ANY, KM_MOD_HELD);
1323 RNA_def_int(func, "alt", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Alt", "", KM_ANY, KM_MOD_HELD);
1324 RNA_def_int(func, "oskey", KM_NOTHING, KM_ANY, KM_MOD_HELD, "OS Key", "", KM_ANY, KM_MOD_HELD);
1325 RNA_def_int(func, "hyper", KM_NOTHING, KM_ANY, KM_MOD_HELD, "Hyper", "", KM_ANY, KM_MOD_HELD);
1326 RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
1327 RNA_def_enum(func, "direction", rna_enum_event_direction_items, KM_ANY, "Direction", "");
1328 RNA_def_boolean(func, "repeat", false, "Repeat", "When set, accept key-repeat events");
1329 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
1330 RNA_def_function_return(func, parm);
1331
1332 func = RNA_def_function(srna, "new_from_item", "rna_KeyMap_item_new_from_item");
1334 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Item to use as a reference");
1336 RNA_def_boolean(func, "head", false, "At Head", "");
1337 parm = RNA_def_pointer(func, "result", "KeyMapItem", "Item", "Added key map item");
1338 RNA_def_function_return(func, parm);
1339
1340 func = RNA_def_function(srna, "remove", "rna_KeyMap_item_remove");
1342 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1345
1346 func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
1347 parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
1349 RNA_def_property_ui_text(parm, "id", "ID of the item");
1350 parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
1351 RNA_def_function_return(func, parm);
1352
1353 /* Keymap introspection
1354 * Args follow: KeyConfigs.find_item_from_operator */
1355 func = RNA_def_function(srna, "find_from_operator", "rna_KeyMap_item_find_from_operator");
1357 parm = RNA_def_string(func, "idname", nullptr, 0, "Operator Identifier", "");
1359 parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1362 func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
1363 RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
1364 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1366 RNA_def_function_return(func, parm);
1367
1368 func = RNA_def_function(srna, "find_match", "rna_KeyMap_item_find_match");
1370 parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "The matching keymap");
1372 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "The matching keymap item");
1374 parm = RNA_def_pointer(func,
1375 "result",
1376 "KeyMapItem",
1377 "",
1378 "The keymap item from this keymap which matches the keymap item from the "
1379 "arguments passed in");
1381 RNA_def_function_return(func, parm);
1382
1383 func = RNA_def_function(srna, "match_event", "rna_KeyMap_item_match_event");
1385 parm = RNA_def_pointer(func, "event", "Event", "", "");
1387 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1389 RNA_def_function_return(func, parm);
1390}
1391
1393{
1394 FunctionRNA *func;
1395 PropertyRNA *parm;
1396
1397 func = RNA_def_function(srna, "new", "rna_KeyMaps_new");
1400 func,
1401 "Ensure the keymap exists. This will return the one with the given name/space type/region "
1402 "type, or create a new one if it does not exist yet.");
1403
1404 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
1406 RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
1408 func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
1409 RNA_def_boolean(func, "modal", false, "Modal", "Keymap for modal operators");
1410 RNA_def_boolean(func, "tool", false, "Tool", "Keymap for active tools");
1411 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
1412 RNA_def_function_return(func, parm);
1413
1414 func = RNA_def_function(srna, "remove", "rna_KeyMaps_remove");
1416 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Removed key map");
1419
1420 func = RNA_def_function(srna, "clear", "rna_KeyMaps_clear");
1421 RNA_def_function_ui_description(func, "Remove all keymaps.");
1422
1423 func = RNA_def_function(srna, "find", "rna_KeyMaps_find");
1424 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
1426 RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
1428 func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
1429 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
1430 RNA_def_function_return(func, parm);
1431
1432 func = RNA_def_function(srna, "find_match", "rna_KeyMaps_find_match");
1433 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "The key map for comparison");
1435 parm = RNA_def_pointer(func, "result", "KeyMap", "Key Map", "Corresponding key map");
1436 RNA_def_function_return(func, parm);
1437
1438 func = RNA_def_function(srna, "find_modal", "rna_KeyMaps_find_modal");
1439 parm = RNA_def_string(func, "name", nullptr, 0, "Operator Name", "");
1441 parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
1442 RNA_def_function_return(func, parm);
1443}
1444
1446{
1447 FunctionRNA *func;
1448 PropertyRNA *parm;
1449
1450 func = RNA_def_function(srna, "new", "rna_KeyConfig_new"); /* add_keyconfig */
1451 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "");
1453 parm = RNA_def_pointer(
1454 func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration");
1455 RNA_def_function_return(func, parm);
1456
1457 func = RNA_def_function(srna, "remove", "rna_KeyConfig_remove"); /* remove_keyconfig */
1459 parm = RNA_def_pointer(
1460 func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
1463
1464 /* Helper functions */
1465
1466 /* Keymap introspection */
1467 func = RNA_def_function(
1468 srna, "find_item_from_operator", "rna_KeyConfig_find_item_from_operator");
1470 parm = RNA_def_string(func, "idname", nullptr, 0, "Operator Identifier", "");
1472 parm = RNA_def_property(func, "context", PROP_ENUM, PROP_NONE);
1474 parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
1477 func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
1478 RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
1479 parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "");
1481 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
1483 RNA_def_function_return(func, parm);
1484
1485 func = RNA_def_function(srna, "update", "rna_KeyConfig_update"); /* WM_keyconfig_update */
1487 func,
1488 "keep_properties",
1489 false,
1490 "Keep Properties",
1491 "Operator properties are kept to allow the operators to be registered again in the future");
1492}
1493
1494#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
eReportType
Definition BKE_report.hh:33
@ RPT_ERROR
Definition BKE_report.hh:39
@ RPT_WARNING
Definition BKE_report.hh:38
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
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:693
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:544
@ PARM_RNAPTR
Definition RNA_types.hh:547
@ PARM_REQUIRED
Definition RNA_types.hh:545
@ PARM_OUTPUT
Definition RNA_types.hh:546
@ FUNC_USE_REPORTS
Definition RNA_types.hh:914
@ FUNC_NO_SELF
Definition RNA_types.hh:907
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:913
@ FUNC_USE_SELF_ID
Definition RNA_types.hh:889
@ FUNC_REGISTER_OPTIONAL
Definition RNA_types.hh:923
@ FUNC_ALLOW_WRITE
Definition RNA_types.hh:929
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
PropertyFlag
Definition RNA_types.hh:300
@ PROP_THICK_WRAP
Definition RNA_types.hh:423
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_UNSIGNED
Definition RNA_types.hh:249
#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:375
wmEventModifierFlag
Definition WM_types.hh:277
@ KM_CTRL
Definition WM_types.hh:279
@ KM_ALT
Definition WM_types.hh:280
@ KM_HYPER
Definition WM_types.hh:292
@ KM_OSKEY
Definition WM_types.hh:282
@ KM_SHIFT
Definition WM_types.hh:278
eWM_EventFlag
Definition WM_types.hh:671
@ KM_NOTHING
Definition WM_types.hh:310
@ KM_ANY
Definition WM_types.hh:309
@ KM_PRESS
Definition WM_types.hh:311
@ KM_RELEASE
Definition WM_types.hh:312
#define KM_MOD_HELD
Definition WM_types.hh:326
#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:73
const EnumPropertyItem rna_enum_operator_context_items[]
Definition rna_ui.cc:33
const EnumPropertyItem rna_enum_icon_items[]
Definition rna_ui_api.cc:26
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:31
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:414
void invalidate()
Definition RNA_types.hh:110
void * data
Definition RNA_types.hh:53
eWM_GizmoFlagGroupTypeFlag flag
const void * modal_items
struct ReportList * reports
WindowManagerRuntimeHandle * runtime
struct wmEvent * eventstate
max
Definition text_draw.cc:251
wmTimer * timer
uint len
void WM_cursor_progress(wmWindow *win, float progress_factor)
void WM_cursor_modal_restore(wmWindow *win)
@ 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:4238
wmOperatorType * ot
Definition wm_files.cc:4237
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)
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:567
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition wm_keymap.cc:932
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:972
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:548
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:895
wmKeyMap * WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:866
wmKeyMapItem * WM_modalkeymap_add_item_str(wmKeyMap *km, const KeyMapItem_Params *params, const char *value)
Definition wm_keymap.cc:988
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:580
bool WM_keymap_item_compare(const wmKeyMapItem *k1, const wmKeyMapItem *k2)
wmKeyMapItem * WM_key_event_operator(const bContext *C, const char *opname, blender::wm::OpCallContext opcontext, IDProperty *properties, const short include_mask, const short exclude_mask, wmKeyMap **r_keymap)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operator_last_properties_ensure(wmOperatorType *ot, PointerRNA *ptr)
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, std::optional< std::string > message)
size_t WM_operator_bl_idname(char *dst, const char *src)
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:145