Blender V4.5
rna_ui_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 <cstdlib>
10
11#include "RNA_define.hh"
12#include "RNA_enum_types.hh"
13
14#include "DNA_screen_types.h"
15
16#include "UI_interface.hh"
17#include "UI_resources.hh"
18
19#include "rna_internal.hh"
20
21#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
22#define DEF_ICON_VECTOR(name) {ICON_##name, (#name), 0, (#name), ""},
23#define DEF_ICON_COLOR(name) {ICON_##name, (#name), 0, (#name), ""},
24#define DEF_ICON_BLANK(name)
26#include "UI_icons.hh"
27 {0, nullptr, 0, nullptr, nullptr},
28};
29
30#ifdef RNA_RUNTIME
31
32# include "BLT_translation.hh"
33
34# include "DNA_asset_types.h"
35
36# include "BKE_report.hh"
37
38# include "ED_asset_filter.hh"
39# include "ED_geometry.hh"
40# include "ED_node.hh"
41# include "ED_object.hh"
42
43# include "WM_api.hh"
44
46
47std::optional<StringRefNull> rna_translate_ui_text(
48 const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate)
49{
50 if (!text) {
51 return std::nullopt;
52 }
53 /* Also return text if UI labels translation is disabled. */
54 if (!text[0] || !translate || !BLT_translate_iface()) {
55 return text;
56 }
57
58 /* If a text_ctxt is specified, use it! */
59 if (text_ctxt && text_ctxt[0]) {
60 return BLT_pgettext(text_ctxt, text);
61 }
62
63 /* Else, if an RNA type or property is specified, use its context. */
64# if 0
65 /* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA
66 * struct corresponding to the 'data' (in functions like prop() & co),
67 * as this is pure runtime data. Hence, messages extraction script can't determine the
68 * correct context it should use for such 'text' messages...
69 * So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc.
70 * functions, if default context is not suitable.
71 */
72 if (prop) {
74 }
75# else
76 (void)prop;
77# endif
78 if (type) {
80 }
81
82 /* Else, default context! */
84}
85
86static void rna_uiItemR(uiLayout *layout,
88 const char *propname,
89 const char *name,
90 const char *text_ctxt,
91 bool translate,
92 int icon,
93 const char *placeholder,
94 bool expand,
95 bool slider,
96 int toggle,
97 bool icon_only,
98 bool event,
99 bool full_event,
100 bool emboss,
101 int index,
102 int icon_value,
103 bool invert_checkbox)
104{
105 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
107
108 if (!prop) {
109 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
110 return;
111 }
112
113 if (icon_value && !icon) {
114 icon = icon_value;
115 }
116
117 /* Get translated name (label). */
118 std::optional<StringRefNull> text = rna_translate_ui_text(
119 name, text_ctxt, nullptr, prop, translate);
120 std::optional<StringRefNull> placeholder_str = rna_translate_ui_text(
121 placeholder, text_ctxt, nullptr, prop, translate);
122
123 if (slider) {
125 }
126 if (expand) {
128 }
129
130 if (toggle == 1) {
132 }
133 else if (toggle == 0) {
135 }
136
137 if (icon_only) {
139 }
140 if (event) {
142 }
143 if (full_event) {
145 }
146 if (emboss == false) {
148 }
149 if (invert_checkbox) {
151 }
152
153 layout->prop(ptr, prop, index, 0, flag, text, icon, placeholder_str);
154}
155
156static void rna_uiItemR_with_popover(uiLayout *layout,
158 const char *propname,
159 const char *name,
160 const char *text_ctxt,
161 bool translate,
162 int icon,
163 bool icon_only,
164 const char *panel_type)
165{
166 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
167
168 if (!prop) {
169 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
170 return;
171 }
172 if ((RNA_property_type(prop) != PROP_ENUM) &&
174 {
176 "property is not an enum or color: %s.%s", RNA_struct_identifier(ptr->type), propname);
177 return;
178 }
180 if (icon_only) {
182 }
183
184 /* Get translated name (label). */
185 std::optional<StringRefNull> text = rna_translate_ui_text(
186 name, text_ctxt, nullptr, prop, translate);
187 uiItemFullR_with_popover(layout, ptr, prop, -1, 0, flag, text, icon, panel_type);
188}
189
190static void rna_uiItemR_with_menu(uiLayout *layout,
192 const char *propname,
193 const char *name,
194 const char *text_ctxt,
195 bool translate,
196 int icon,
197 bool icon_only,
198 const char *menu_type)
199{
200 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
201
202 if (!prop) {
203 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
204 return;
205 }
206 if (RNA_property_type(prop) != PROP_ENUM) {
207 RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
208 return;
209 }
211 if (icon_only) {
213 }
214
215 /* Get translated name (label). */
216 std::optional<StringRefNull> text = rna_translate_ui_text(
217 name, text_ctxt, nullptr, prop, translate);
218 uiItemFullR_with_menu(layout, ptr, prop, -1, 0, flag, text, icon, menu_type);
219}
220
221static void rna_uiItemMenuEnumR(uiLayout *layout,
223 const char *propname,
224 const char *name,
225 const char *text_ctxt,
226 bool translate,
227 int icon)
228{
229 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
230
231 if (!prop) {
232 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
233 return;
234 }
235
236 /* Get translated name (label). */
237 std::optional<StringRefNull> text = rna_translate_ui_text(
238 name, text_ctxt, nullptr, prop, translate);
239 uiItemMenuEnumR_prop(layout, ptr, prop, text, icon);
240}
241
242static void rna_uiItemTabsEnumR(uiLayout *layout,
243 bContext *C,
245 const char *propname,
246 PointerRNA *ptr_highlight,
247 const char *propname_highlight,
248 bool icon_only)
249{
250 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
251
252 if (!prop) {
253 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
254 return;
255 }
256 if (RNA_property_type(prop) != PROP_ENUM) {
257 RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
258 return;
259 }
260
261 /* Get the highlight property used to gray out some of the tabs. */
262 PropertyRNA *prop_highlight = nullptr;
263 if (!RNA_pointer_is_null(ptr_highlight)) {
264 prop_highlight = RNA_struct_find_property(ptr_highlight, propname_highlight);
265 if (!prop_highlight) {
266 RNA_warning("property not found: %s.%s",
267 RNA_struct_identifier(ptr_highlight->type),
268 propname_highlight);
269 return;
270 }
271 if (RNA_property_type(prop_highlight) != PROP_BOOLEAN) {
272 RNA_warning("property is not a boolean: %s.%s",
273 RNA_struct_identifier(ptr_highlight->type),
274 propname_highlight);
275 return;
276 }
277 if (!RNA_property_array_check(prop_highlight)) {
278 RNA_warning("property is not an array: %s.%s",
279 RNA_struct_identifier(ptr_highlight->type),
280 propname_highlight);
281 return;
282 }
283 }
284
285 uiItemTabsEnumR_prop(layout, C, ptr, prop, ptr_highlight, prop_highlight, icon_only);
286}
287
288static void rna_uiItemEnumR_string(uiLayout *layout,
290 const char *propname,
291 const char *value,
292 const char *name,
293 const char *text_ctxt,
294 bool translate,
295 int icon)
296{
297 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
298
299 if (!prop) {
300 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
301 return;
302 }
303
304 /* Get translated name (label). */
305 std::optional<StringRefNull> text = rna_translate_ui_text(
306 name, text_ctxt, nullptr, prop, translate);
307
308 uiItemEnumR_string_prop(layout, ptr, prop, value, text, icon);
309}
310
311static void rna_uiItemPointerR(uiLayout *layout,
313 const char *propname,
314 PointerRNA *searchptr,
315 const char *searchpropname,
316 const char *name,
317 const char *text_ctxt,
318 bool translate,
319 int icon,
320 const bool results_are_suggestions)
321{
322 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
323 if (!prop) {
324 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
325 return;
326 }
327 PropertyRNA *searchprop = RNA_struct_find_property(searchptr, searchpropname);
328 if (!searchprop) {
330 "property not found: %s.%s", RNA_struct_identifier(searchptr->type), searchpropname);
331 return;
332 }
333
334 /* Get translated name (label). */
335 std::optional<StringRefNull> text = rna_translate_ui_text(
336 name, text_ctxt, nullptr, prop, translate);
337
339 layout, ptr, prop, searchptr, searchprop, text, icon, results_are_suggestions);
340}
341
342static PointerRNA rna_uiItemO(uiLayout *layout,
343 const char *opname,
344 const char *name,
345 const char *text_ctxt,
346 bool translate,
347 int icon,
348 bool emboss,
349 bool depress,
350 int icon_value,
351 const float search_weight)
352{
354
355 ot = WM_operatortype_find(opname, false); /* print error next */
356 if (!ot || !ot->srna) {
357 RNA_warning("%s '%s'", ot ? "operator missing srna" : "unknown operator", opname);
358 return PointerRNA_NULL;
359 }
360
361 /* Get translated name (label). */
362 std::optional<StringRefNull> text = rna_translate_ui_text(
363 name, text_ctxt, ot->srna, nullptr, translate);
364
365 if (icon_value && !icon) {
366 icon = icon_value;
367 }
369 if (emboss == false) {
371 }
372 if (depress) {
374 }
375
376 const float prev_weight = uiLayoutGetSearchWeight(layout);
377 uiLayoutSetSearchWeight(layout, search_weight);
378
379 PointerRNA opptr = layout->op(ot, text, icon, uiLayoutGetOperatorContext(layout), flag);
380
381 uiLayoutSetSearchWeight(layout, prev_weight);
382 return opptr;
383}
384
385static PointerRNA rna_uiItemOMenuHold(uiLayout *layout,
386 const char *opname,
387 const char *name,
388 const char *text_ctxt,
389 bool translate,
390 int icon,
391 bool emboss,
392 bool depress,
393 int icon_value,
394 const char *menu)
395{
396 wmOperatorType *ot = WM_operatortype_find(opname, false); /* print error next */
397 if (!ot || !ot->srna) {
398 RNA_warning("%s '%s'", ot ? "operator missing srna" : "unknown operator", opname);
399 return PointerRNA_NULL;
400 }
401
402 /* Get translated name (label). */
403 std::optional<StringRefNull> text = rna_translate_ui_text(
404 name, text_ctxt, ot->srna, nullptr, translate);
405 if (icon_value && !icon) {
406 icon = icon_value;
407 }
409 if (emboss == false) {
411 }
412 if (depress) {
414 }
415
416 PointerRNA opptr;
418 layout, ot, text, icon, uiLayoutGetOperatorContext(layout), flag, menu, &opptr);
419 return opptr;
420}
421
422static void rna_uiItemsEnumO(uiLayout *layout,
423 const char *opname,
424 const char *propname,
425 const bool icon_only)
426{
428 uiItemsFullEnumO(layout, opname, propname, nullptr, uiLayoutGetOperatorContext(layout), flag);
429}
430
431static PointerRNA rna_uiItemMenuEnumO(uiLayout *layout,
432 bContext *C,
433 const char *opname,
434 const char *propname,
435 const char *name,
436 const char *text_ctxt,
437 bool translate,
438 int icon)
439{
440 wmOperatorType *ot = WM_operatortype_find(opname, false); /* print error next */
441
442 if (!ot || !ot->srna) {
443 RNA_warning("%s '%s'", ot ? "operator missing srna" : "unknown operator", opname);
444 return PointerRNA_NULL;
445 }
446
447 /* Get translated name (label). */
448 std::optional<StringRefNull> text = rna_translate_ui_text(
449 name, text_ctxt, ot->srna, nullptr, translate);
450
451 PointerRNA opptr;
452 uiItemMenuEnumFullO_ptr(layout, C, ot, propname, text, icon, &opptr);
453 return opptr;
454}
455
456static void rna_uiItemL(uiLayout *layout,
457 const char *name,
458 const char *text_ctxt,
459 bool translate,
460 int icon,
461 int icon_value)
462{
463 /* Get translated name (label). */
464 std::optional<StringRefNull> text = rna_translate_ui_text(
465 name, text_ctxt, nullptr, nullptr, translate);
466
467 if (icon_value && !icon) {
468 icon = icon_value;
469 }
470
471 layout->label(text.value_or(""), icon);
472}
473
474static void rna_uiItemM(uiLayout *layout,
475 const char *menuname,
476 const char *name,
477 const char *text_ctxt,
478 bool translate,
479 int icon,
480 int icon_value)
481{
482 /* Get translated name (label). */
483 std::optional<StringRefNull> text = rna_translate_ui_text(
484 name, text_ctxt, nullptr, nullptr, translate);
485
486 if (icon_value && !icon) {
487 icon = icon_value;
488 }
489
490 layout->menu(menuname, text, icon);
491}
492
493static void rna_uiItemM_contents(uiLayout *layout, const char *menuname)
494{
495 uiItemMContents(layout, menuname);
496}
497
498static void rna_uiItemPopoverPanel(uiLayout *layout,
499 bContext *C,
500 const char *panel_type,
501 const char *name,
502 const char *text_ctxt,
503 bool translate,
504 int icon,
505 int icon_value)
506{
507 /* Get translated name (label). */
508 std::optional<StringRefNull> text = rna_translate_ui_text(
509 name, text_ctxt, nullptr, nullptr, translate);
510
511 if (icon_value && !icon) {
512 icon = icon_value;
513 }
514
515 uiItemPopoverPanel(layout, C, panel_type, text, icon);
516}
517
518static void rna_uiItemPopoverPanelFromGroup(uiLayout *layout,
519 bContext *C,
520 int space_id,
521 int region_id,
522 const char *context,
523 const char *category)
524{
525 uiItemPopoverPanelFromGroup(layout, C, space_id, region_id, context, category);
526}
527
528static void rna_uiItemProgress(uiLayout *layout,
529 const char *text,
530 const char *text_ctxt,
531 bool translate,
532 float factor,
533 int progress_type)
534{
535 if (translate && BLT_translate_iface()) {
536 text = BLT_pgettext((text_ctxt && text_ctxt[0]) ? text_ctxt : BLT_I18NCONTEXT_DEFAULT, text);
537 }
538
539 uiItemProgressIndicator(layout, text, factor, eButProgressType(progress_type));
540}
541
542static void rna_uiItemSeparator(uiLayout *layout, float factor, int type)
543{
544 layout->separator(factor, LayoutSeparatorType(type));
545}
546
547static void rna_uiTemplateID(uiLayout *layout,
548 bContext *C,
550 const char *propname,
551 const char *newop,
552 const char *openop,
553 const char *unlinkop,
554 int filter,
555 const bool live_icon,
556 const char *name,
557 const char *text_ctxt,
558 bool translate)
559{
560 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
561
562 if (!prop) {
563 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
564 return;
565 }
566
567 /* Get translated name (label). */
568 std::optional<StringRefNull> text = rna_translate_ui_text(
569 name, text_ctxt, nullptr, prop, translate);
570
571 uiTemplateID(layout, C, ptr, propname, newop, openop, unlinkop, filter, live_icon, text);
572}
573
574static void rna_uiTemplateAnyID(uiLayout *layout,
576 const char *propname,
577 const char *proptypename,
578 const char *name,
579 const char *text_ctxt,
580 bool translate)
581{
582 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
583
584 if (!prop) {
585 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
586 return;
587 }
588
589 /* Get translated name (label). */
590 std::optional<StringRefNull> text = rna_translate_ui_text(
591 name, text_ctxt, nullptr, prop, translate);
592
593 /* XXX This will search property again :( */
594 uiTemplateAnyID(layout, ptr, propname, proptypename, text);
595}
596
597static void rna_uiTemplateAction(uiLayout *layout,
598 bContext *C,
599 ID *id,
600 const char *newop,
601 const char *unlinkop,
602 const char *name,
603 const char *text_ctxt,
604 const bool translate)
605{
606 std::optional<StringRefNull> text = rna_translate_ui_text(
607 name, text_ctxt, nullptr, nullptr, translate);
608 uiTemplateAction(layout, C, id, newop, unlinkop, text);
609}
610
611static void rna_uiTemplateSearch(uiLayout *layout,
612 const bContext *C,
614 const char *propname,
615 PointerRNA *searchptr,
616 const char *searchpropname,
617 const char *newop,
618 const char *unlinkop,
619 const char *name,
620 const char *text_ctxt,
621 bool translate)
622{
623 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
624
625 if (!prop) {
626 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
627 return;
628 }
629
630 /* Get translated name (label). */
631 std::optional<StringRefNull> text = rna_translate_ui_text(
632 name, text_ctxt, nullptr, prop, translate);
633
634 uiTemplateSearch(layout, C, ptr, propname, searchptr, searchpropname, newop, unlinkop, text);
635}
636
637static void rna_uiTemplateSearchPreview(uiLayout *layout,
638 bContext *C,
640 const char *propname,
641 PointerRNA *searchptr,
642 const char *searchpropname,
643 const char *newop,
644 const char *unlinkop,
645 const char *name,
646 const char *text_ctxt,
647 bool translate,
648 const int rows,
649 const int cols)
650{
651 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
652
653 if (!prop) {
654 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
655 return;
656 }
657
658 /* Get translated name (label). */
659 std::optional<StringRefNull> text = rna_translate_ui_text(
660 name, text_ctxt, nullptr, prop, translate);
661
663 layout, C, ptr, propname, searchptr, searchpropname, newop, unlinkop, rows, cols, text);
664}
665
666void rna_uiTemplateList(uiLayout *layout,
667 bContext *C,
668 const char *listtype_name,
669 const char *list_id,
670 PointerRNA *dataptr,
671 const char *propname,
672 PointerRNA *active_dataptr,
673 const char *active_propname,
674 const char *item_dyntip_propname,
675 const int rows,
676 const int maxrows,
677 const int layout_type,
678 const int columns,
679 const bool sort_reverse,
680 const bool sort_lock)
681{
683 if (sort_reverse) {
685 }
686 if (sort_lock) {
688 }
689
690 uiTemplateList(layout,
691 C,
692 listtype_name,
693 list_id,
694 dataptr,
695 propname,
696 active_dataptr,
697 active_propname,
698 item_dyntip_propname,
699 rows,
700 maxrows,
701 layout_type,
702 columns,
703 flags);
704}
705
706static void rna_uiTemplateCacheFile(uiLayout *layout,
707 bContext *C,
709 const char *propname)
710{
711 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
712
713 if (!prop) {
714 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
715 return;
716 }
717
718 uiTemplateCacheFile(layout, C, ptr, propname);
719}
720
721static void rna_uiTemplateCacheFileVelocity(uiLayout *layout,
723 const char *propname)
724{
725 PointerRNA fileptr;
726 if (!uiTemplateCacheFilePointer(ptr, propname, &fileptr)) {
727 return;
728 }
729
730 uiTemplateCacheFileVelocity(layout, &fileptr);
731}
732
733static void rna_uiTemplateCacheFileProcedural(uiLayout *layout,
734 bContext *C,
736 const char *propname)
737{
738 PointerRNA fileptr;
739 if (!uiTemplateCacheFilePointer(ptr, propname, &fileptr)) {
740 return;
741 }
742
743 uiTemplateCacheFileProcedural(layout, C, &fileptr);
744}
745
746static void rna_uiTemplateCacheFileTimeSettings(uiLayout *layout,
748 const char *propname)
749{
750 PointerRNA fileptr;
751 if (!uiTemplateCacheFilePointer(ptr, propname, &fileptr)) {
752 return;
753 }
754
755 uiTemplateCacheFileTimeSettings(layout, &fileptr);
756}
757
758static void rna_uiTemplateCacheFileLayers(uiLayout *layout,
759 bContext *C,
761 const char *propname)
762{
763 PointerRNA fileptr;
764 if (!uiTemplateCacheFilePointer(ptr, propname, &fileptr)) {
765 return;
766 }
767
768 uiTemplateCacheFileLayers(layout, C, &fileptr);
769}
770
771static void rna_uiTemplatePathBuilder(uiLayout *layout,
773 const char *propname,
774 PointerRNA *root_ptr,
775 const char *name,
776 const char *text_ctxt,
777 bool translate)
778{
779 PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
780
781 if (!prop) {
782 RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
783 return;
784 }
785
786 /* Get translated name (label). */
787 std::optional<StringRefNull> text = rna_translate_ui_text(
788 name, text_ctxt, nullptr, prop, translate);
789
790 /* XXX This will search property again :( */
791 uiTemplatePathBuilder(layout, ptr, propname, root_ptr, text);
792}
793
794static void rna_uiTemplateEventFromKeymapItem(
795 uiLayout *layout, wmKeyMapItem *kmi, const char *name, const char *text_ctxt, bool translate)
796{
797 /* Get translated name (label). */
798 std::optional<StringRefNull> text = rna_translate_ui_text(
799 name, text_ctxt, nullptr, nullptr, translate);
800 uiTemplateEventFromKeymapItem(layout, text.value_or(""), kmi, true);
801}
802
803static void rna_uiTemplateAssetView(uiLayout *layout,
804 bContext *C,
805 const char *list_id,
806 PointerRNA *asset_library_dataptr,
807 const char *asset_library_propname,
808 PointerRNA *assets_dataptr,
809 const char *assets_propname,
810 PointerRNA *active_dataptr,
811 const char *active_propname,
812 int filter_id_types,
813 int display_flags,
814 const char *activate_opname,
815 PointerRNA *r_activate_op_properties,
816 const char *drag_opname,
817 PointerRNA *r_drag_op_properties)
818{
820 filter_settings.id_types = filter_id_types ? filter_id_types : FILTER_ID_ALL;
821
822 uiTemplateAssetView(layout,
823 C,
824 list_id,
825 asset_library_dataptr,
826 asset_library_propname,
827 assets_dataptr,
828 assets_propname,
829 active_dataptr,
830 active_propname,
831 &filter_settings,
832 display_flags,
833 activate_opname,
834 r_activate_op_properties,
835 drag_opname,
836 r_drag_op_properties);
837}
838
843static const EnumPropertyItem *rna_uiTemplateAssetView_filter_id_types_itemf(
844 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
845{
846 EnumPropertyItem *items = nullptr;
847 int totitem = 0;
848
849 for (int i = 0; rna_enum_id_type_filter_items[i].identifier; i++) {
850 if (rna_enum_id_type_filter_items[i].flag > (1ULL << 31)) {
851 continue;
852 }
853
854 EnumPropertyItem tmp = {0, "", 0, "", ""};
860 RNA_enum_item_add(&items, &totitem, &tmp);
861 }
862 RNA_enum_item_end(&items, &totitem);
863
864 *r_free = true;
865 return items;
866}
867
868static uiLayout *rna_uiLayoutBox(uiLayout *layout)
869{
870 return &layout->box();
871}
872
873static uiLayout *rna_uiLayoutSplit(uiLayout *layout, float factor, bool align)
874{
875 return &layout->split(factor, align);
876}
877
878static uiLayout *rna_uiLayoutRowWithHeading(
879 uiLayout *layout, bool align, const char *heading, const char *heading_ctxt, bool translate)
880{
881 /* Get translated heading. */
882 std::optional<StringRefNull> text = rna_translate_ui_text(
883 heading, heading_ctxt, nullptr, nullptr, translate);
884 return &layout->row(align, text.value_or(""));
885}
886
887static uiLayout *rna_uiLayoutColumnWithHeading(
888 uiLayout *layout, bool align, const char *heading, const char *heading_ctxt, bool translate)
889{
890 /* Get translated heading. */
891 std::optional<StringRefNull> text = rna_translate_ui_text(
892 heading, heading_ctxt, nullptr, nullptr, translate);
893 return &layout->column(align, text.value_or(""));
894}
895
896static uiLayout *rna_uiLayoutColumnFlow(uiLayout *layout, int number, bool align)
897{
898 return &layout->column_flow(number, align);
899}
900
901static uiLayout *rna_uiLayoutGridFlow(uiLayout *layout,
902 bool row_major,
903 int columns_len,
904 bool even_columns,
905 bool even_rows,
906 bool align)
907{
908 return &layout->grid_flow(row_major, columns_len, even_columns, even_rows, align);
909}
910
911static uiLayout *rna_uiLayoutMenuPie(uiLayout *layout)
912{
913 return &layout->menu_pie();
914}
915
916void rna_uiLayoutPanelProp(uiLayout *layout,
917 bContext *C,
920 const char *property,
921 uiLayout **r_layout_header,
922 uiLayout **r_layout_body)
923{
924 Panel *panel = uiLayoutGetRootPanel(layout);
925 if (panel == nullptr) {
926 BKE_reportf(reports, RPT_ERROR, "Layout panels can not be used in this context");
927 *r_layout_header = nullptr;
928 *r_layout_body = nullptr;
929 return;
930 }
931
932 PanelLayout panel_layout = layout->panel_prop(C, data, property);
933 *r_layout_header = panel_layout.header;
934 *r_layout_body = panel_layout.body;
935}
936
937void rna_uiLayoutPanel(uiLayout *layout,
938 bContext *C,
940 const char *idname,
941 const bool default_closed,
942 uiLayout **r_layout_header,
943 uiLayout **r_layout_body)
944{
945 Panel *panel = uiLayoutGetRootPanel(layout);
946 if (panel == nullptr) {
947 BKE_reportf(reports, RPT_ERROR, "Layout panels can not be used in this context");
948 *r_layout_header = nullptr;
949 *r_layout_body = nullptr;
950 return;
951 }
952 PanelLayout panel_layout = layout->panel(C, idname, default_closed);
953 *r_layout_header = panel_layout.header;
954 *r_layout_body = panel_layout.body;
955}
956
957static void rna_uiLayout_template_node_asset_menu_items(uiLayout *layout,
958 bContext *C,
959 const char *catalog_path)
960{
961 using namespace blender;
963}
964
965static void rna_uiLayout_template_node_operator_asset_menu_items(uiLayout *layout,
966 bContext *C,
967 const char *catalog_path)
968{
969 using namespace blender;
971}
972
973static void rna_uiLayout_template_modifier_asset_menu_items(uiLayout *layout,
974 const char *catalog_path)
975{
976 using namespace blender;
978}
979
980static void rna_uiLayout_template_node_operator_root_items(uiLayout *layout, bContext *C)
981{
983}
984
985static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
986{
987 return UI_icon_from_rnaptr(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false);
988}
989
990static const char *rna_ui_get_enum_name(bContext *C,
992 const char *propname,
993 const char *identifier)
994{
995 PropertyRNA *prop = nullptr;
996 const EnumPropertyItem *items = nullptr;
997 bool free;
998 const char *name = "";
999
1000 prop = RNA_struct_find_property(ptr, propname);
1001 if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
1003 "Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
1004 return name;
1005 }
1006
1007 RNA_property_enum_items_gettexted(C, ptr, prop, &items, nullptr, &free);
1008
1009 if (items) {
1010 const int index = RNA_enum_from_identifier(items, identifier);
1011 if (index != -1) {
1012 name = items[index].name;
1013 }
1014 if (free) {
1015 MEM_freeN(items);
1016 }
1017 }
1018
1019 return name;
1020}
1021
1022static const char *rna_ui_get_enum_description(bContext *C,
1023 PointerRNA *ptr,
1024 const char *propname,
1025 const char *identifier)
1026{
1027 PropertyRNA *prop = nullptr;
1028 const EnumPropertyItem *items = nullptr;
1029 bool free;
1030 const char *desc = "";
1031
1032 prop = RNA_struct_find_property(ptr, propname);
1033 if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
1035 "Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
1036 return desc;
1037 }
1038
1039 RNA_property_enum_items_gettexted(C, ptr, prop, &items, nullptr, &free);
1040
1041 if (items) {
1042 const int index = RNA_enum_from_identifier(items, identifier);
1043 if (index != -1) {
1044 desc = items[index].description;
1045 }
1046 if (free) {
1047 MEM_freeN(items);
1048 }
1049 }
1050
1051 return desc;
1052}
1053
1054static int rna_ui_get_enum_icon(bContext *C,
1055 PointerRNA *ptr,
1056 const char *propname,
1057 const char *identifier)
1058{
1059 PropertyRNA *prop = nullptr;
1060 const EnumPropertyItem *items = nullptr;
1061 bool free;
1062 int icon = ICON_NONE;
1063
1064 prop = RNA_struct_find_property(ptr, propname);
1065 if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
1067 "Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
1068 return icon;
1069 }
1070
1071 RNA_property_enum_items(C, ptr, prop, &items, nullptr, &free);
1072
1073 if (items) {
1074 const int index = RNA_enum_from_identifier(items, identifier);
1075 if (index != -1) {
1076 icon = items[index].icon;
1077 }
1078 if (free) {
1079 MEM_freeN(items);
1080 }
1081 }
1082
1083 return icon;
1084}
1085
1086void rna_uiTemplateAssetShelfPopover(uiLayout *layout,
1087 bContext *C,
1088 const char *asset_shelf_id,
1089 const char *name,
1090 BIFIconID icon,
1091 int icon_value)
1092{
1093 if (icon_value && !icon) {
1094 icon = icon_value;
1095 }
1096
1097 blender::ui::template_asset_shelf_popover(*layout, *C, asset_shelf_id, name ? name : "", icon);
1098}
1099
1100PointerRNA rna_uiTemplatePopupConfirm(uiLayout *layout,
1102 const char *opname,
1103 const char *text,
1104 const char *text_ctxt,
1105 bool translate,
1106 int icon,
1107 const char *cancel_text,
1108 bool cancel_default)
1109{
1111
1112 /* This allows overriding buttons in `WM_operator_props_dialog_popup` and other popups. */
1113 wmOperatorType *ot = nullptr;
1114 if (opname[0]) {
1115 /* Confirming is optional. */
1116 ot = WM_operatortype_find(opname, false); /* print error next */
1117 }
1118 else {
1119 text = "";
1120 }
1121
1122 if (opname[0] ? (!ot || !ot->srna) : false) {
1123 RNA_warning("%s '%s'", ot ? "operator missing srna" : "unknown operator", opname);
1124 }
1126 BKE_reportf(reports, RPT_ERROR, "template_popup_confirm used outside of a popup");
1127 }
1128 else {
1129 std::optional<StringRefNull> text_str = rna_translate_ui_text(
1130 text, text_ctxt, nullptr, nullptr, translate);
1131 std::optional<StringRefNull> cancel_text_str;
1132 if (cancel_text && cancel_text[0]) {
1133 cancel_text_str = rna_translate_ui_text(cancel_text, text_ctxt, nullptr, nullptr, translate);
1134 }
1135
1137 layout, ot, text_str, cancel_text_str, icon, cancel_default, &opptr);
1138 }
1139 return opptr;
1140}
1141
1142#else
1143
1145{
1146 RNA_def_string(func,
1147 "heading",
1148 nullptr,
1150 "Heading",
1151 "Label to insert into the layout for this sub-layout");
1152 RNA_def_string(func,
1153 "heading_ctxt",
1154 nullptr,
1155 0,
1156 "",
1157 "Override automatic translation context of the given heading");
1159 func, "translate", true, "", "Translate the given heading, when UI translation is enabled");
1160}
1161
1163{
1164 PropertyRNA *prop = RNA_def_string(func,
1165 "text_ctxt",
1166 nullptr,
1167 0,
1168 "",
1169 "Override automatic translation context of the given text");
1172 func, "translate", true, "", "Translate the given text, when UI translation is enabled");
1173}
1174
1176{
1177 PropertyRNA *prop;
1178
1179 prop = RNA_def_string(func, "text", nullptr, 0, "", "Override automatic text of the item");
1182}
1183
1185{
1186 PropertyRNA *prop;
1187
1189
1190 prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
1192 RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
1193}
1194
1195static void api_ui_item_op(FunctionRNA *func)
1196{
1197 PropertyRNA *parm;
1198 parm = RNA_def_string(func, "operator", nullptr, 0, "", "Identifier of the operator");
1200}
1201
1203{
1204 api_ui_item_op(func);
1205 api_ui_item_common(func);
1206}
1207
1209{
1210 PropertyRNA *parm;
1211
1212 parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
1214 parm = RNA_def_string(func, "property", nullptr, 0, "", "Identifier of property in data");
1216}
1217
1219{
1220 FunctionRNA *func;
1221 PropertyRNA *parm;
1222
1223 static const EnumPropertyItem curve_type_items[] = {
1224 {0, "NONE", 0, "None", ""},
1225 {'v', "VECTOR", 0, "Vector", ""},
1226 {'c', "COLOR", 0, "Color", ""},
1227 {'h', "HUE", 0, "Hue", ""},
1228 {0, nullptr, 0, nullptr, nullptr},
1229 };
1230
1231 static const EnumPropertyItem id_template_filter_items[] = {
1232 {UI_TEMPLATE_ID_FILTER_ALL, "ALL", 0, "All", ""},
1233 {UI_TEMPLATE_ID_FILTER_AVAILABLE, "AVAILABLE", 0, "Available", ""},
1234 {0, nullptr, 0, nullptr, nullptr},
1235 };
1236
1237 static const EnumPropertyItem progress_type_items[] = {
1238 {UI_BUT_PROGRESS_TYPE_BAR, "BAR", 0, "Bar", ""},
1239 {UI_BUT_PROGRESS_TYPE_RING, "RING", 0, "Ring", ""},
1240 {0, nullptr, 0, nullptr, nullptr},
1241 };
1242
1243 static const EnumPropertyItem asset_view_template_options[] = {
1245 "NO_NAMES",
1246 0,
1247 "",
1248 "Do not display the name of each asset underneath preview images"},
1250 "NO_FILTER",
1251 0,
1252 "",
1253 "Do not display buttons for filtering the available assets"},
1255 "NO_LIBRARY",
1256 0,
1257 "",
1258 "Do not display buttons to choose or refresh an asset library"},
1259 {0, nullptr, 0, nullptr, nullptr},
1260 };
1261
1262 static const EnumPropertyItem rna_enum_separator_type_items[] = {
1264 "AUTO",
1265 0,
1266 "Auto",
1267 "Best guess at what type of separator is needed."},
1269 "SPACE",
1270 0,
1271 "Empty space",
1272 "Horizontal or Vertical empty space, depending on layout direction."},
1274 "LINE",
1275 0,
1276 "Line",
1277 "Horizontal or Vertical line, depending on layout direction."},
1278 {0, nullptr, 0, nullptr, nullptr},
1279 };
1280
1281 static const float node_socket_color_default[] = {0.0f, 0.0f, 0.0f, 1.0f};
1282
1283 /* simple layout specifiers */
1284 func = RNA_def_function(srna, "row", "rna_uiLayoutRowWithHeading");
1285 parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
1286 RNA_def_function_return(func, parm);
1288 func,
1289 "Sub-layout. Items placed in this sublayout are placed next to each other "
1290 "in a row.");
1291 RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
1293
1294 func = RNA_def_function(srna, "column", "rna_uiLayoutColumnWithHeading");
1295 parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
1296 RNA_def_function_return(func, parm);
1298 func,
1299 "Sub-layout. Items placed in this sublayout are placed under each other "
1300 "in a column.");
1301 RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
1303
1304 func = RNA_def_function(srna, "panel", "rna_uiLayoutPanel");
1306 func,
1307 "Creates a collapsable panel. Whether it is open or closed is stored in the region using "
1308 "the given idname. This can only be used when the panel has the full width of the panel "
1309 "region available to it. So it can't be used in e.g. in a box or columns.");
1311 parm = RNA_def_string(func, "idname", nullptr, 0, "", "Identifier of the panel");
1313 RNA_def_boolean(func,
1314 "default_closed",
1315 false,
1316 "Open by Default",
1317 "When true, the panel will be open the first time it is shown");
1318 parm = RNA_def_pointer(func, "layout_header", "UILayout", "", "Sub-layout to put items in");
1319 RNA_def_function_output(func, parm);
1320 parm = RNA_def_pointer(func,
1321 "layout_body",
1322 "UILayout",
1323 "",
1324 "Sub-layout to put items in. Will be none if the panel is collapsed.");
1325 RNA_def_function_output(func, parm);
1326
1327 func = RNA_def_function(srna, "panel_prop", "rna_uiLayoutPanelProp");
1329 func,
1330 "Similar to `.panel(...)` but instead of storing whether it is open or closed in the "
1331 "region, it is stored in the provided boolean property. This should be used when multiple "
1332 "instances of the same panel can exist. For example one for every item in a collection "
1333 "property or list. This can only be used when the panel has the full width of the panel "
1334 "region available to it. So it can't be used in e.g. in a box or columns.");
1336 parm = RNA_def_pointer(
1337 func, "data", "AnyType", "", "Data from which to take the open-state property");
1339 parm = RNA_def_string(
1340 func,
1341 "property",
1342 nullptr,
1343 0,
1344 "",
1345 "Identifier of the boolean property that determines whether the panel is open or closed");
1347 parm = RNA_def_pointer(func, "layout_header", "UILayout", "", "Sub-layout to put items in");
1348 RNA_def_function_output(func, parm);
1349 parm = RNA_def_pointer(func,
1350 "layout_body",
1351 "UILayout",
1352 "",
1353 "Sub-layout to put items in. Will be none if the panel is collapsed.");
1354 RNA_def_function_output(func, parm);
1355
1356 func = RNA_def_function(srna, "column_flow", "rna_uiLayoutColumnFlow");
1357 RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
1358 parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
1359 RNA_def_function_return(func, parm);
1360 RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
1361
1362 func = RNA_def_function(srna, "grid_flow", "rna_uiLayoutGridFlow");
1363 RNA_def_boolean(func, "row_major", false, "", "Fill row by row, instead of column by column");
1365 func,
1366 "columns",
1367 0,
1368 INT_MIN,
1369 INT_MAX,
1370 "",
1371 "Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are "
1372 "automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. "
1373 "columns for row major layout, and 2, 4, 6 etc. rows for column major layout).",
1374 INT_MIN,
1375 INT_MAX);
1376 RNA_def_boolean(func, "even_columns", false, "", "All columns will have the same width");
1377 RNA_def_boolean(func, "even_rows", false, "", "All rows will have the same height");
1378 RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
1379 parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
1380 RNA_def_function_return(func, parm);
1381
1382 /* box layout */
1383 func = RNA_def_function(srna, "box", "rna_uiLayoutBox");
1384 parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
1385 RNA_def_function_return(func, parm);
1387 "Sublayout (items placed in this sublayout are placed "
1388 "under each other in a column and are surrounded by a box)");
1389
1390 /* split layout */
1391 func = RNA_def_function(srna, "split", "rna_uiLayoutSplit");
1392 parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
1393 RNA_def_function_return(func, parm);
1394 RNA_def_float(func,
1395 "factor",
1396 0.0f,
1397 0.0f,
1398 1.0f,
1399 "Percentage",
1400 "Percentage of width to split at (leave unset for automatic calculation)",
1401 0.0f,
1402 1.0f);
1403 RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
1404
1405 /* radial/pie layout */
1406 func = RNA_def_function(srna, "menu_pie", "rna_uiLayoutMenuPie");
1407 parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
1408 RNA_def_function_return(func, parm);
1410 "Sublayout. Items placed in this sublayout are placed "
1411 "in a radial fashion around the menu center).");
1412
1413 /* Icon of a rna pointer */
1414 func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
1415 parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
1416 RNA_def_function_return(func, parm);
1418 parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
1421 "Return the custom icon for this data, "
1422 "use it e.g. to get materials or texture icons.");
1423
1424 /* UI name, description and icon of an enum item */
1425 func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
1426 parm = RNA_def_string(func, "name", nullptr, 0, "", "UI name of the enum item");
1427 RNA_def_function_return(func, parm);
1430 parm = RNA_def_string(func, "identifier", nullptr, 0, "", "Identifier of the enum item");
1432 RNA_def_function_ui_description(func, "Return the UI name for this enum item");
1433
1434 func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
1435 parm = RNA_def_string(func, "description", nullptr, 0, "", "UI description of the enum item");
1436 RNA_def_function_return(func, parm);
1439 parm = RNA_def_string(func, "identifier", nullptr, 0, "", "Identifier of the enum item");
1441 RNA_def_function_ui_description(func, "Return the UI description for this enum item");
1442
1443 func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
1444 parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
1445 RNA_def_function_return(func, parm);
1448 parm = RNA_def_string(func, "identifier", nullptr, 0, "", "Identifier of the enum item");
1450 RNA_def_function_ui_description(func, "Return the icon for this enum item");
1451
1452 /* items */
1453 func = RNA_def_function(srna, "prop", "rna_uiItemR");
1455 "Item. Exposes an RNA item and places it into the layout.");
1457 api_ui_item_common(func);
1459 func, "placeholder", nullptr, 0, "", "Hint describing the expected value when empty");
1461 RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
1462 RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values");
1463 RNA_def_int(func,
1464 "toggle",
1465 -1,
1466 -1,
1467 1,
1468 "",
1469 "Use toggle widget for boolean values, "
1470 "or a checkbox when disabled "
1471 "(the default is -1 which uses toggle only when an icon is displayed)",
1472 -1,
1473 1);
1474 RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
1475 RNA_def_boolean(func, "event", false, "", "Use button to input key events");
1477 func, "full_event", false, "", "Use button to input full events including modifiers");
1478 RNA_def_boolean(func,
1479 "emboss",
1480 true,
1481 "",
1482 "Draw the button itself, not just the icon/text. When false, corresponds to the "
1483 "'NONE_OR_STATUS' layout emboss type.");
1484 RNA_def_int(func,
1485 "index",
1486 /* RNA_NO_INDEX == -1 */
1487 -1,
1488 -2,
1489 INT_MAX,
1490 "",
1491 "The index of this button, when set a single member of an array can be accessed, "
1492 "when set to -1 all array members are used",
1493 -2,
1494 INT_MAX);
1495 parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
1496 RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
1497 RNA_def_boolean(func, "invert_checkbox", false, "", "Draw checkbox value inverted");
1498
1499 func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
1501
1502 func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR");
1504 api_ui_item_common(func);
1505
1506 func = RNA_def_function(srna, "prop_with_popover", "rna_uiItemR_with_popover");
1508 api_ui_item_common(func);
1509 RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
1510 parm = RNA_def_string(func, "panel", nullptr, 0, "", "Identifier of the panel");
1512
1513 func = RNA_def_function(srna, "prop_with_menu", "rna_uiItemR_with_menu");
1515 api_ui_item_common(func);
1516 RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
1517 parm = RNA_def_string(func, "menu", nullptr, 0, "", "Identifier of the menu");
1519
1520 func = RNA_def_function(srna, "prop_tabs_enum", "rna_uiItemTabsEnumR");
1523 parm = RNA_def_pointer(
1524 func, "data_highlight", "AnyType", "", "Data from which to take highlight property");
1526 parm = RNA_def_string(
1527 func, "property_highlight", nullptr, 0, "", "Identifier of highlight property in data");
1528 RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
1529
1530 func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
1532 parm = RNA_def_string(func, "value", nullptr, 0, "", "Enum property value");
1534 api_ui_item_common(func);
1535
1536 func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
1538 parm = RNA_def_pointer(
1539 func, "search_data", "AnyType", "", "Data from which to take collection to search in");
1541 parm = RNA_def_string(
1542 func, "search_property", nullptr, 0, "", "Identifier of search collection property");
1544 api_ui_item_common(func);
1546 func, "results_are_suggestions", false, "", "Accept inputs that do not match any item");
1547
1548 func = RNA_def_function(srna, "prop_decorator", "uiItemDecoratorR");
1550 RNA_def_int(func,
1551 "index",
1552 /* RNA_NO_INDEX == -1 */
1553 -1,
1554 -2,
1555 INT_MAX,
1556 "",
1557 "The index of this button, when set a single member of an array can be accessed, "
1558 "when set to -1 all array members are used",
1559 -2,
1560 INT_MAX);
1561
1562 for (int is_menu_hold = 0; is_menu_hold < 2; is_menu_hold++) {
1563 func = (is_menu_hold) ? RNA_def_function(srna, "operator_menu_hold", "rna_uiItemOMenuHold") :
1564 RNA_def_function(srna, "operator", "rna_uiItemO");
1566 RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text");
1567 RNA_def_boolean(func, "depress", false, "", "Draw pressed in");
1568 parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
1569 RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
1570 if (is_menu_hold) {
1571 parm = RNA_def_string(func, "menu", nullptr, 0, "", "Identifier of the menu");
1573 }
1574 else {
1575 RNA_def_float(func,
1576 "search_weight",
1577 0.0f,
1578 -FLT_MAX,
1579 FLT_MAX,
1580 "Search Weight",
1581 "Influences the sorting when using menu-seach",
1582 -FLT_MAX,
1583 FLT_MAX);
1584 }
1585 parm = RNA_def_pointer(
1586 func, "properties", "OperatorProperties", "", "Operator properties to fill in");
1588 RNA_def_function_return(func, parm);
1590 "Item. Places a button into the layout to call an Operator.");
1591 }
1592
1593 func = RNA_def_function(srna, "operator_enum", "rna_uiItemsEnumO");
1594 parm = RNA_def_string(func, "operator", nullptr, 0, "", "Identifier of the operator");
1596 parm = RNA_def_string(func, "property", nullptr, 0, "", "Identifier of property in operator");
1598 RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
1599
1600 func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
1602 /* Can't use #api_ui_item_op_common because property must come right after. */
1603 api_ui_item_op(func);
1604 parm = RNA_def_string(func, "property", nullptr, 0, "", "Identifier of property in operator");
1606 api_ui_item_common(func);
1607 parm = RNA_def_pointer(
1608 func, "properties", "OperatorProperties", "", "Operator properties to fill in");
1610 RNA_def_function_return(func, parm);
1611
1612 func = RNA_def_function(srna, "label", "rna_uiItemL");
1613 RNA_def_function_ui_description(func, "Item. Displays text and/or icon in the layout.");
1614 api_ui_item_common(func);
1615 parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
1616 RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
1617
1618 func = RNA_def_function(srna, "menu", "rna_uiItemM");
1619 parm = RNA_def_string(func, "menu", nullptr, 0, "", "Identifier of the menu");
1620 api_ui_item_common(func);
1622 parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
1623 RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
1624
1625 func = RNA_def_function(srna, "menu_contents", "rna_uiItemM_contents");
1626 parm = RNA_def_string(func, "menu", nullptr, 0, "", "Identifier of the menu");
1628
1629 func = RNA_def_function(srna, "popover", "rna_uiItemPopoverPanel");
1631 parm = RNA_def_string(func, "panel", nullptr, 0, "", "Identifier of the panel");
1632 api_ui_item_common(func);
1634 parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
1635 RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
1636
1637 func = RNA_def_function(srna, "popover_group", "rna_uiItemPopoverPanelFromGroup");
1639 parm = RNA_def_enum(func, "space_type", rna_enum_space_type_items, 0, "Space Type", "");
1641 parm = RNA_def_enum(
1642 func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
1644 parm = RNA_def_string(func, "context", nullptr, 0, "", "panel type context");
1646 parm = RNA_def_string(func, "category", nullptr, 0, "", "panel type category");
1648
1649 func = RNA_def_function(srna, "separator", "rna_uiItemSeparator");
1651 "Item. Inserts empty space into the layout between items.");
1652 RNA_def_float(func,
1653 "factor",
1654 1.0f,
1655 0.0f,
1656 FLT_MAX,
1657 "Percentage",
1658 "Percentage of width to space (leave unset for default space)",
1659 0.0f,
1660 FLT_MAX);
1661 RNA_def_enum(func,
1662 "type",
1663 rna_enum_separator_type_items,
1665 "Type",
1666 "The type of the separator");
1667
1668 func = RNA_def_function(srna, "separator_spacer", "uiItemSpacer");
1670 func, "Item. Inserts horizontal spacing empty space into the layout between items.");
1671
1672 func = RNA_def_function(srna, "progress", "rna_uiItemProgress");
1673 RNA_def_function_ui_description(func, "Progress indicator");
1675 RNA_def_float(func,
1676 "factor",
1677 0.0f,
1678 0.0f,
1679 1.0f,
1680 "Factor",
1681 "Amount of progress from 0.0f to 1.0f",
1682 0.0f,
1683 1.0f);
1684 RNA_def_enum(func,
1685 "type",
1686 progress_type_items,
1688 "Type",
1689 "The type of progress indicator");
1690
1691 /* context */
1692 func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
1693 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "Name of entry in the context");
1695 parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
1697
1698 func = RNA_def_function(srna, "context_string_set", "uiLayoutSetContextString");
1699 parm = RNA_def_string(func, "name", nullptr, 0, "Name", "Name of entry in the context");
1701 parm = RNA_def_string(func, "value", nullptr, 0, "Value", "String to put in context");
1703
1704 /* templates */
1705 func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
1707 RNA_def_function_ui_description(func, "Inserts common Space header UI (editor type selector)");
1708
1709 func = RNA_def_function(srna, "template_ID", "rna_uiTemplateID");
1712 RNA_def_string(func, "new", nullptr, 0, "", "Operator identifier to create a new ID block");
1713 RNA_def_string(func,
1714 "open",
1715 nullptr,
1716 0,
1717 "",
1718 "Operator identifier to open a file for creating a new ID block");
1719 RNA_def_string(func, "unlink", nullptr, 0, "", "Operator identifier to unlink the ID block");
1720 RNA_def_enum(func,
1721 "filter",
1722 id_template_filter_items,
1724 "",
1725 "Optionally limit the items which can be selected");
1726 RNA_def_boolean(func, "live_icon", false, "", "Show preview instead of fixed icon");
1728
1729 func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
1732 RNA_def_string(func, "new", nullptr, 0, "", "Operator identifier to create a new ID block");
1733 RNA_def_string(func,
1734 "open",
1735 nullptr,
1736 0,
1737 "",
1738 "Operator identifier to open a file for creating a new ID block");
1739 RNA_def_string(func, "unlink", nullptr, 0, "", "Operator identifier to unlink the ID block");
1741 func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
1742 RNA_def_int(func,
1743 "cols",
1744 0,
1745 0,
1746 INT_MAX,
1747 "Number of thumbnail preview columns to display",
1748 "",
1749 0,
1750 INT_MAX);
1751 RNA_def_enum(func,
1752 "filter",
1753 id_template_filter_items,
1755 "",
1756 "Optionally limit the items which can be selected");
1757 RNA_def_boolean(func, "hide_buttons", false, "", "Show only list, no buttons");
1758
1759 func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
1760 parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
1762 parm = RNA_def_string(func, "property", nullptr, 0, "", "Identifier of property in data");
1764 parm = RNA_def_string(func,
1765 "type_property",
1766 nullptr,
1767 0,
1768 "",
1769 "Identifier of property in data giving the type of the ID-blocks to use");
1772
1773 func = RNA_def_function(srna, "template_ID_tabs", "uiTemplateIDTabs");
1776 RNA_def_string(func, "new", nullptr, 0, "", "Operator identifier to create a new ID block");
1777 RNA_def_string(func, "menu", nullptr, 0, "", "Context menu identifier");
1778 RNA_def_enum(func,
1779 "filter",
1780 id_template_filter_items,
1782 "",
1783 "Optionally limit the items which can be selected");
1784
1785 func = RNA_def_function(srna, "template_action", "rna_uiTemplateAction");
1787 parm = RNA_def_pointer(func, "id", "ID", "", "The data-block for which to select an Action");
1789 RNA_def_string(func, "new", nullptr, 0, "", "Operator identifier to create a new ID block");
1790 RNA_def_string(func, "unlink", nullptr, 0, "", "Operator identifier to unlink the ID block");
1792
1793 func = RNA_def_function(srna, "template_search", "rna_uiTemplateSearch");
1796 parm = RNA_def_pointer(
1797 func, "search_data", "AnyType", "", "Data from which to take collection to search in");
1799 parm = RNA_def_string(
1800 func, "search_property", nullptr, 0, "", "Identifier of search collection property");
1803 func, "new", nullptr, 0, "", "Operator identifier to create a new item for the collection");
1804 RNA_def_string(func,
1805 "unlink",
1806 nullptr,
1807 0,
1808 "",
1809 "Operator identifier to unlink or delete the active "
1810 "item from the collection");
1812
1813 func = RNA_def_function(srna, "template_search_preview", "rna_uiTemplateSearchPreview");
1816 parm = RNA_def_pointer(
1817 func, "search_data", "AnyType", "", "Data from which to take collection to search in");
1819 parm = RNA_def_string(
1820 func, "search_property", nullptr, 0, "", "Identifier of search collection property");
1823 func, "new", nullptr, 0, "", "Operator identifier to create a new item for the collection");
1824 RNA_def_string(func,
1825 "unlink",
1826 nullptr,
1827 0,
1828 "",
1829 "Operator identifier to unlink or delete the active "
1830 "item from the collection");
1833 func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
1834 RNA_def_int(func,
1835 "cols",
1836 0,
1837 0,
1838 INT_MAX,
1839 "Number of thumbnail preview columns to display",
1840 "",
1841 0,
1842 INT_MAX);
1843
1844 func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
1845 parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
1847 parm = RNA_def_string(func, "property", nullptr, 0, "", "Identifier of property in data");
1849 parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
1852
1853 func = RNA_def_function(srna, "template_modifiers", "uiTemplateModifiers");
1855 RNA_def_function_ui_description(func, "Generates the UI layout for the modifier stack");
1856
1857 func = RNA_def_function(srna, "template_collection_exporters", "uiTemplateCollectionExporters");
1859 RNA_def_function_ui_description(func, "Generates the UI layout for collection exporters");
1860
1861 func = RNA_def_function(srna, "template_constraints", "uiTemplateConstraints");
1863 RNA_def_function_ui_description(func, "Generates the panels for the constraint stack");
1864 RNA_def_boolean(func,
1865 "use_bone_constraints",
1866 true,
1867 "",
1868 "Add panels for bone constraints instead of object constraints");
1869
1870 func = RNA_def_function(srna, "template_shaderfx", "uiTemplateShaderFx");
1872 RNA_def_function_ui_description(func, "Generates the panels for the shader effect stack");
1873
1874 func = RNA_def_function(srna, "template_greasepencil_color", "uiTemplateGpencilColorPreview");
1878 func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
1879 RNA_def_int(func,
1880 "cols",
1881 0,
1882 0,
1883 INT_MAX,
1884 "Number of thumbnail preview columns to display",
1885 "",
1886 0,
1887 INT_MAX);
1888 RNA_def_float(func, "scale", 1.0f, 0.1f, 1.5f, "Scale of the image thumbnails", "", 0.5f, 1.0f);
1889 RNA_def_enum(func,
1890 "filter",
1891 id_template_filter_items,
1893 "",
1894 "Optionally limit the items which can be selected");
1895
1896 func = RNA_def_function(srna, "template_constraint_header", "uiTemplateConstraintHeader");
1897 RNA_def_function_ui_description(func, "Generates the header for constraint panels");
1898 parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
1900
1901 func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
1903 func, "Item. A preview window for materials, textures, lights or worlds.");
1905 parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block");
1907 RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?");
1908 RNA_def_pointer(func, "parent", "ID", "", "ID data-block");
1909 RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
1911 func,
1912 "preview_id",
1913 nullptr,
1914 0,
1915 "",
1916 "Identifier of this preview widget, if not set the ID type will be used "
1917 "(i.e. all previews of materials without explicit ID will have the same size...).");
1918
1919 func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
1921 func, "Item. A curve mapping widget used for e.g falloff curves for lights.");
1923 RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
1924 RNA_def_boolean(func, "levels", false, "", "Show black/white levels");
1925 RNA_def_boolean(func, "brush", false, "", "Show brush options");
1926 RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default");
1927 RNA_def_boolean(func, "show_tone", false, "", "Show tone options");
1928
1929 func = RNA_def_function(srna, "template_curveprofile", "uiTemplateCurveProfile");
1930 RNA_def_function_ui_description(func, "A profile path editor used for custom profiles");
1932
1933 func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
1934 RNA_def_function_ui_description(func, "Item. A color ramp widget.");
1936 RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
1937
1938 func = RNA_def_function(srna, "template_icon", "uiTemplateIcon");
1939 RNA_def_function_ui_description(func, "Display a large icon");
1940 parm = RNA_def_int(func, "icon_value", 0, 0, INT_MAX, "Icon to display", "", 0, INT_MAX);
1942 RNA_def_float(func,
1943 "scale",
1944 1.0f,
1945 1.0f,
1946 100.0f,
1947 "Scale",
1948 "Scale the icon size (by the button size)",
1949 1.0f,
1950 100.0f);
1951
1952 func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
1953 RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews.");
1955 RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons");
1956 RNA_def_float(func,
1957 "scale",
1958 6.0f,
1959 1.0f,
1960 100.0f,
1961 "UI Units",
1962 "Scale the button icon size (by the button size)",
1963 1.0f,
1964 100.0f);
1965 RNA_def_float(func,
1966 "scale_popup",
1967 5.0f,
1968 1.0f,
1969 100.0f,
1970 "Scale",
1971 "Scale the popup icon size (by the button size)",
1972 1.0f,
1973 100.0f);
1974
1975 func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
1976 RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data.");
1978
1979 func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
1980 RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data.");
1982
1983 func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
1984 RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data.");
1986
1987 func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
1989 parm = RNA_def_pointer(
1990 func, "used_layers_data", "AnyType", "", "Data from which to take property");
1992 parm = RNA_def_string(
1993 func, "used_layers_property", nullptr, 0, "", "Identifier of property in data");
1995 parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
1997
1998 func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker");
1999 RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors.");
2002 func, "value_slider", false, "", "Display the value slider to the right of the color wheel");
2003 RNA_def_boolean(func,
2004 "lock",
2005 false,
2006 "",
2007 "Lock the color wheel display to value 1.0 regardless of actual color");
2009 func, "lock_luminosity", false, "", "Keep the color at its original vector length");
2010 RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white");
2011
2012 func = RNA_def_function(srna, "template_palette", "uiTemplatePalette");
2013 RNA_def_function_ui_description(func, "Item. A palette used to pick colors.");
2015 RNA_def_boolean(func, "color", false, "", "Display the colors as colors or values");
2016
2017 func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
2019 parm = RNA_def_pointer(func, "image", "Image", "", "");
2021 parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
2023
2024 func = RNA_def_function(srna, "template_image", "uiTemplateImage");
2026 func, "Item(s). User interface for selecting images and their source paths.");
2029 parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
2031 RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
2032 RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options");
2033
2034 func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
2035 RNA_def_function_ui_description(func, "User interface for setting image format options");
2036 parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
2038 RNA_def_boolean(func, "color_management", false, "", "Show color management settings");
2039
2040 func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d");
2041 RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options");
2042 parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", "");
2044
2045 func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews");
2046 RNA_def_function_ui_description(func, "User interface for setting image views output options");
2047 parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
2049
2050 func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
2052 func, "Item(s). User interface for selecting movie clips and their source paths.");
2055 RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
2056
2057 func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
2058 RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
2060
2061 func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
2062 RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
2064 parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
2066 parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
2068 RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
2069
2070 func = RNA_def_function(
2071 srna, "template_movieclip_information", "uiTemplateMovieclipInformation");
2072 RNA_def_function_ui_description(func, "Item. Movie clip information data.");
2074 parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
2076
2077 func = RNA_def_function(srna, "template_list", "rna_uiTemplateList");
2078 RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups.");
2080 parm = RNA_def_string(
2081 func, "listtype_name", nullptr, 0, "", "Identifier of the list type to use");
2083 parm = RNA_def_string(
2084 func,
2085 "list_id",
2086 nullptr,
2087 0,
2088 "",
2089 "Identifier of this list widget. Necessary to tell apart different list widgets. Mandatory "
2090 "when using default \"" UI_UL_DEFAULT_CLASS_NAME
2091 "\" class. "
2092 "If this not an empty string, the uilist gets a custom ID, otherwise it takes the "
2093 "name of the class used to define the uilist (for example, if the "
2094 "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
2095 "script, then bl_idname = \"OBJECT_UL_vgroups\")");
2097 parm = RNA_def_pointer(
2098 func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
2100 parm = RNA_def_string(
2101 func, "propname", nullptr, 0, "", "Identifier of the Collection property in data");
2103 parm = RNA_def_pointer(func,
2104 "active_dataptr",
2105 "AnyType",
2106 "",
2107 "Data from which to take the integer property, index of the active item");
2109 parm = RNA_def_string(
2110 func,
2111 "active_propname",
2112 nullptr,
2113 0,
2114 "",
2115 "Identifier of the integer property in active_data, index of the active item");
2117 RNA_def_string(func,
2118 "item_dyntip_propname",
2119 nullptr,
2120 0,
2121 "",
2122 "Identifier of a string property in items, to use as tooltip content");
2123 RNA_def_int(func,
2124 "rows",
2125 5,
2126 0,
2127 INT_MAX,
2128 "",
2129 "Default and minimum number of rows to display",
2130 0,
2131 INT_MAX);
2133 func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX);
2134 RNA_def_enum(func,
2135 "type",
2138 "Type",
2139 "Type of layout to use");
2140 RNA_def_int(func,
2141 "columns",
2142 9,
2143 0,
2144 INT_MAX,
2145 "",
2146 "Number of items to display per row, for GRID layout",
2147 0,
2148 INT_MAX);
2149 RNA_def_boolean(func, "sort_reverse", false, "", "Display items in reverse order by default");
2150 RNA_def_boolean(func, "sort_lock", false, "", "Lock display order to default value");
2151
2152 func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
2154
2155 RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");
2156 RNA_def_function(srna, "template_menu_search", "uiTemplateMenuSearch");
2157
2158 func = RNA_def_function(srna, "template_header_3D_mode", "uiTemplateHeader3D_mode");
2161
2162 func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
2165 func, "Inserts common 3DView Edit modes header UI (selector for selection mode)");
2166
2167 func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
2169
2170 func = RNA_def_function(srna, "template_input_status", "uiTemplateInputStatus");
2172
2173 func = RNA_def_function(srna, "template_status_info", "uiTemplateStatusInfo");
2175
2176 func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
2178 parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
2180 parm = RNA_def_pointer(func, "node", "Node", "", "");
2182 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
2184
2185 func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
2187 parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
2189 parm = RNA_def_pointer(func, "node", "Node", "", "");
2191 parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
2193
2194 func = RNA_def_function(
2195 srna, "template_node_asset_menu_items", "rna_uiLayout_template_node_asset_menu_items");
2197 parm = RNA_def_string(func, "catalog_path", nullptr, 0, "", "");
2198
2199 func = RNA_def_function(srna,
2200 "template_modifier_asset_menu_items",
2201 "rna_uiLayout_template_modifier_asset_menu_items");
2202 parm = RNA_def_string(func, "catalog_path", nullptr, 0, "", "");
2203
2204 func = RNA_def_function(srna,
2205 "template_node_operator_asset_menu_items",
2206 "rna_uiLayout_template_node_operator_asset_menu_items");
2208 parm = RNA_def_string(func, "catalog_path", nullptr, 0, "", "");
2209
2210 func = RNA_def_function(srna,
2211 "template_node_operator_asset_root_items",
2212 "rna_uiLayout_template_node_operator_root_items");
2214
2215 func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
2217
2218 func = RNA_def_function(
2219 srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
2220 parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
2222
2223 func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
2224 RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
2225 parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
2227 parm = RNA_def_string(func, "property", nullptr, 0, "", "Identifier of property in data");
2229 RNA_def_string(func, "name", nullptr, 0, "", "");
2230
2231 /* color management templates */
2232 func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
2233 RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");
2235
2236 func = RNA_def_function(
2237 srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings");
2238 RNA_def_function_ui_description(func, "Item. A widget to control color managed view settings.");
2241# if 0
2242 RNA_def_boolean(func,
2243 "show_global_settings",
2244 false,
2245 "",
2246 "Show widgets to control global color management settings");
2247# endif
2248
2249 /* node socket icon */
2250 func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket");
2251 RNA_def_function_ui_description(func, "Node Socket Icon");
2254 func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
2255
2256 func = RNA_def_function(srna, "template_cache_file", "rna_uiTemplateCacheFile");
2258 func, "Item(s). User interface for selecting cache files and their source paths");
2261
2262 func = RNA_def_function(srna, "template_cache_file_velocity", "rna_uiTemplateCacheFileVelocity");
2263 RNA_def_function_ui_description(func, "Show cache files velocity properties");
2265
2266 func = RNA_def_function(
2267 srna, "template_cache_file_procedural", "rna_uiTemplateCacheFileProcedural");
2268 RNA_def_function_ui_description(func, "Show cache files render procedural properties");
2271
2272 func = RNA_def_function(
2273 srna, "template_cache_file_time_settings", "rna_uiTemplateCacheFileTimeSettings");
2274 RNA_def_function_ui_description(func, "Show cache files time settings");
2276
2277 func = RNA_def_function(srna, "template_cache_file_layers", "rna_uiTemplateCacheFileLayers");
2278 RNA_def_function_ui_description(func, "Show cache files override layers properties");
2281
2282 func = RNA_def_function(srna, "template_recent_files", "uiTemplateRecentFiles");
2283 RNA_def_function_ui_description(func, "Show list of recently saved .blend files");
2284 RNA_def_int(func, "rows", 5, 1, INT_MAX, "", "Maximum number of items to show", 1, INT_MAX);
2285 parm = RNA_def_int(func, "found", 0, 0, INT_MAX, "", "Number of items drawn", 0, INT_MAX);
2286 RNA_def_function_return(func, parm);
2287
2288 func = RNA_def_function(srna, "template_file_select_path", "uiTemplateFileSelectPath");
2290 "Item. A text button to set the active file browser path.");
2291 parm = RNA_def_pointer(func, "params", "FileSelectParams", "", "");
2294
2295 func = RNA_def_function(
2296 srna, "template_event_from_keymap_item", "rna_uiTemplateEventFromKeymapItem");
2297 RNA_def_function_ui_description(func, "Display keymap item as icons/text");
2298 parm = RNA_def_property(func, "item", PROP_POINTER, PROP_NONE);
2299 RNA_def_property_struct_type(parm, "KeyMapItem");
2300 RNA_def_property_ui_text(parm, "Item", "");
2303
2304 func = RNA_def_function(srna, "template_asset_view", "rna_uiTemplateAssetView");
2305 RNA_def_function_ui_description(func, "Item. A scrollable list of assets in a grid view");
2307 parm = RNA_def_string(func,
2308 "list_id",
2309 nullptr,
2310 0,
2311 "",
2312 "Identifier of this asset view. Necessary to tell apart different asset "
2313 "views and to identify an asset view read from a .blend");
2315 parm = RNA_def_pointer(func,
2316 "asset_library_dataptr",
2317 "AnyType",
2318 "",
2319 "Data from which to take the active asset library property");
2321 parm = RNA_def_string(
2322 func, "asset_library_propname", nullptr, 0, "", "Identifier of the asset library property");
2324 parm = RNA_def_pointer(
2325 func, "assets_dataptr", "AnyType", "", "Data from which to take the asset list property");
2327 parm = RNA_def_string(
2328 func, "assets_propname", nullptr, 0, "", "Identifier of the asset list property");
2330 parm = RNA_def_pointer(func,
2331 "active_dataptr",
2332 "AnyType",
2333 "",
2334 "Data from which to take the integer property, index of the active item");
2336 parm = RNA_def_string(
2337 func,
2338 "active_propname",
2339 nullptr,
2340 0,
2341 "",
2342 "Identifier of the integer property in active_data, index of the active item");
2344 parm = RNA_def_property(func, "filter_id_types", PROP_ENUM, PROP_NONE);
2347 parm, nullptr, nullptr, "rna_uiTemplateAssetView_filter_id_types_itemf");
2349 RNA_def_enum_flag(func,
2350 "display_options",
2351 asset_view_template_options,
2352 0,
2353 "",
2354 "Displaying options for the asset view");
2355 RNA_def_string(func,
2356 "activate_operator",
2357 nullptr,
2358 0,
2359 "",
2360 "Name of a custom operator to invoke when activating an item");
2361 parm = RNA_def_pointer(
2362 func,
2363 "activate_operator_properties",
2364 "OperatorProperties",
2365 "",
2366 "Operator properties to fill in for the custom activate operator passed to the template");
2368 RNA_def_function_output(func, parm);
2369 RNA_def_string(func,
2370 "drag_operator",
2371 nullptr,
2372 0,
2373 "",
2374 "Name of a custom operator to invoke when starting to drag an item. Never "
2375 "invoked together with the ``active_operator`` (if set), it's either the drag or "
2376 "the activate one");
2377 parm = RNA_def_pointer(
2378 func,
2379 "drag_operator_properties",
2380 "OperatorProperties",
2381 "",
2382 "Operator properties to fill in for the custom drag operator passed to the template");
2384 RNA_def_function_output(func, parm);
2385
2386 func = RNA_def_function(
2387 srna, "template_light_linking_collection", "uiTemplateLightLinkingCollection");
2389 "Visualization of a content of a light linking collection");
2391 parm = RNA_def_pointer(func,
2392 "context_layout",
2393 "UILayout",
2394 "",
2395 "Layout to set active list element as context properties");
2398
2399 func = RNA_def_function(srna, "template_bone_collection_tree", "uiTemplateBoneCollectionTree");
2400 RNA_def_function_ui_description(func, "Show bone collections tree");
2402
2403 func = RNA_def_function(
2404 srna, "template_grease_pencil_layer_tree", "uiTemplateGreasePencilLayerTree");
2405 RNA_def_function_ui_description(func, "View of the active Grease Pencil layer tree");
2407
2408 func = RNA_def_function(srna, "template_node_tree_interface", "uiTemplateNodeTreeInterface");
2409 RNA_def_function_ui_description(func, "Show a node tree interface");
2411 parm = RNA_def_pointer(func,
2412 "interface",
2413 "NodeTreeInterface",
2414 "Node Tree Interface",
2415 "Interface of a node tree to display");
2417
2418 func = RNA_def_function(srna, "template_node_inputs", "uiTemplateNodeInputs");
2419 RNA_def_function_ui_description(func, "Show a node settings and input socket values");
2421 parm = RNA_def_pointer(func, "node", "Node", "Node", "Display inputs of this node");
2423
2424 func = RNA_def_function(srna, "template_asset_shelf_popover", "rna_uiTemplateAssetShelfPopover");
2425 RNA_def_function_ui_description(func, "Create a button to open an asset shelf in a popover");
2427 parm = RNA_def_string(func,
2428 "asset_shelf",
2429 nullptr,
2430 0,
2431 "",
2432 "Identifier of the asset shelf to display (``bl_idname``)");
2434 parm = RNA_def_string(
2435 func, "name", nullptr, 0, "", "Optional name to indicate the active asset");
2437 parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
2439 RNA_def_property_ui_text(parm, "Icon", "Override automatic icon of the item");
2440 parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
2441 RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
2442
2443 /* A version of `operator` that defines a [Cancel, Confirm] pair of buttons. */
2444 func = RNA_def_function(srna, "template_popup_confirm", "rna_uiTemplatePopupConfirm");
2446 parm = RNA_def_string(func,
2447 "cancel_text",
2448 nullptr,
2449 0,
2450 "",
2451 "Optional text to use for the cancel, not shown when an empty string");
2452 RNA_def_boolean(func, "cancel_default", false, "", "Cancel button by default");
2454 func, "Add confirm & cancel buttons into a popup which will close the popup when pressed");
2456
2457 parm = RNA_def_pointer(
2458 func, "properties", "OperatorProperties", "", "Operator properties to fill in");
2460 RNA_def_function_return(func, parm);
2461}
2462
2463#endif
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BLI_kdtree_nd_ free(KDTree *tree)
#define ELEM(...)
bool BLT_translate_iface()
const char * BLT_pgettext(const char *msgctxt, const char *msgid)
#define BLT_I18NCONTEXT_DEFAULT
@ UILST_LAYOUT_DEFAULT
@ RGN_TYPE_WINDOW
int BIFIconID
Definition ED_asset.hh:29
#define RNA_warning(format,...)
@ PARM_RNAPTR
Definition RNA_types.hh:513
@ PARM_REQUIRED
Definition RNA_types.hh:511
@ FUNC_USE_REPORTS
Definition RNA_types.hh:805
@ FUNC_NO_SELF
Definition RNA_types.hh:798
@ FUNC_USE_CONTEXT
Definition RNA_types.hh:804
@ PROP_BOOLEAN
Definition RNA_types.hh:150
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_INT
Definition RNA_types.hh:151
@ PROP_POINTER
Definition RNA_types.hh:155
PropertyFlag
Definition RNA_types.hh:286
@ PROP_ENUM_FLAG
Definition RNA_types.hh:378
@ PROP_NEVER_NULL
Definition RNA_types.hh:351
@ PROP_COLOR
Definition RNA_types.hh:248
@ PROP_NONE
Definition RNA_types.hh:221
@ PROP_COLOR_GAMMA
Definition RNA_types.hh:260
@ PROP_UNSIGNED
Definition RNA_types.hh:237
#define C
Definition RandGen.cpp:29
void uiTemplateCacheFileProcedural(uiLayout *layout, const bContext *C, PointerRNA *fileptr)
void uiTemplateAssetView(uiLayout *layout, const bContext *C, const char *list_id, PointerRNA *asset_library_dataptr, const char *asset_library_propname, PointerRNA *assets_dataptr, const char *assets_propname, PointerRNA *active_dataptr, const char *active_propname, const blender::ed::asset::AssetFilterSettings *filter_settings, int display_flags, const char *activate_opname, PointerRNA *r_activate_op_properties, const char *drag_opname, PointerRNA *r_drag_op_properties)
void uiTemplateCacheFileLayers(uiLayout *layout, const bContext *C, PointerRNA *fileptr)
void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, blender::StringRefNull propname, blender::StringRefNull proptypename, std::optional< blender::StringRef > text)
bool uiTemplateCacheFilePointer(PointerRNA *ptr, blender::StringRefNull propname, PointerRNA *r_file_ptr)
#define UI_UL_DEFAULT_CLASS_NAME
bool uiTemplateEventFromKeymapItem(uiLayout *layout, blender::StringRefNull text, const wmKeyMapItem *kmi, bool text_fallback)
void uiTemplateCacheFileVelocity(uiLayout *layout, PointerRNA *fileptr)
void uiTemplateID(uiLayout *layout, const bContext *C, PointerRNA *ptr, blender::StringRefNull propname, const char *newop, const char *openop, const char *unlinkop, int filter=UI_TEMPLATE_ID_FILTER_ALL, bool live_icon=false, std::optional< blender::StringRef > text=std::nullopt)
void uiTemplateSearchPreview(uiLayout *layout, bContext *C, PointerRNA *ptr, blender::StringRefNull propname, PointerRNA *searchptr, const char *searchpropname, const char *newop, const char *unlinkop, int rows, int cols, std::optional< blender::StringRef > text=std::nullopt)
bool UI_popup_block_template_confirm_is_supported(const uiBlock *block)
void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, blender::StringRefNull propname, PointerRNA *root_ptr, std::optional< blender::StringRefNull > text)
void UI_popup_block_template_confirm_op(uiLayout *layout, wmOperatorType *ot, std::optional< blender::StringRef > confirm_text, std::optional< blender::StringRef > cancel_text, const int icon, bool cancel_default, PointerRNA *r_ptr)
void uiTemplateList(uiLayout *layout, const bContext *C, const char *listtype_name, const char *list_id, PointerRNA *dataptr, blender::StringRefNull propname, PointerRNA *active_dataptr, const char *active_propname, const char *item_dyntip_propname, int rows, int maxrows, int layout_type, int columns, enum uiTemplateListFlags flags)
void uiTemplateAction(uiLayout *layout, const bContext *C, ID *id, const char *newop, const char *unlinkop, std::optional< blender::StringRef > text)
@ UI_TEMPLATE_ID_FILTER_AVAILABLE
@ UI_TEMPLATE_ID_FILTER_ALL
@ UI_TEMPLATE_ASSET_DRAW_NO_NAMES
@ UI_TEMPLATE_ASSET_DRAW_NO_LIBRARY
@ UI_TEMPLATE_ASSET_DRAW_NO_FILTER
void uiTemplateCacheFileTimeSettings(uiLayout *layout, PointerRNA *fileptr)
void uiTemplateSearch(uiLayout *layout, const bContext *C, PointerRNA *ptr, blender::StringRefNull propname, PointerRNA *searchptr, const char *searchpropname, const char *newop, const char *unlinkop, std::optional< blender::StringRef > text=std::nullopt)
uiTemplateListFlags
@ UI_TEMPLATE_LIST_SORT_LOCK
@ UI_TEMPLATE_LIST_SORT_REVERSE
@ UI_TEMPLATE_LIST_FLAG_NONE
void uiTemplateCacheFile(uiLayout *layout, const bContext *C, PointerRNA *ptr, blender::StringRefNull propname)
int UI_icon_from_rnaptr(const bContext *C, PointerRNA *ptr, int rnaicon, bool big)
@ UI_ITEM_R_EVENT
@ UI_ITEM_R_TOGGLE
@ UI_ITEM_O_DEPRESS
@ UI_ITEM_R_ICON_NEVER
@ UI_ITEM_R_EXPAND
@ UI_ITEM_R_NO_BG
@ UI_ITEM_R_CHECKBOX_INVERT
@ UI_ITEM_R_ICON_ONLY
@ UI_ITEM_R_FULL_EVENT
@ UI_ITEM_R_SLIDER
void uiItemFullR_with_menu(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRefNull > name, int icon, const char *menu_type)
Panel * uiLayoutGetRootPanel(uiLayout *layout)
void uiItemMenuEnumFullO_ptr(uiLayout *layout, const bContext *C, wmOperatorType *ot, blender::StringRefNull propname, std::optional< blender::StringRefNull > name, int icon, PointerRNA *r_opptr)
void uiLayoutSetSearchWeight(uiLayout *layout, float weight)
void uiItemMenuEnumR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, std::optional< blender::StringRefNull >, int icon)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
@ UI_BUT_PROGRESS_TYPE_BAR
@ UI_BUT_PROGRESS_TYPE_RING
wmOperatorCallContext uiLayoutGetOperatorContext(uiLayout *layout)
void uiItemPopoverPanelFromGroup(uiLayout *layout, bContext *C, int space_id, int region_id, const char *context, const char *category)
float uiLayoutGetSearchWeight(uiLayout *layout)
#define UI_ITEM_NONE
LayoutSeparatorType
void uiItemProgressIndicator(uiLayout *layout, const char *text, float factor, eButProgressType progress_type)
void uiItemPointerR_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop, std::optional< blender::StringRefNull > name, int icon, bool results_are_suggestions)
void uiItemFullR_with_popover(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRefNull > name, int icon, const char *panel_type)
void uiItemMContents(uiLayout *layout, blender::StringRef menuname)
void uiItemFullOMenuHold_ptr(uiLayout *layout, wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, wmOperatorCallContext context, eUI_Item_Flag flag, const char *menu_id, PointerRNA *r_opptr)
void uiItemEnumR_string_prop(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, const char *value, std::optional< blender::StringRefNull > name, int icon)
void uiItemPopoverPanel(uiLayout *layout, const bContext *C, blender::StringRef panel_type, std::optional< blender::StringRef > name_opt, int icon)
void uiItemTabsEnumR_prop(uiLayout *layout, bContext *C, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_highlight, PropertyRNA *prop_highlight, bool icon_only)
void uiItemsFullEnumO(uiLayout *layout, blender::StringRefNull opname, blender::StringRefNull propname, IDProperty *properties, wmOperatorCallContext context, eUI_Item_Flag flag, const int active=-1)
#define UI_MAX_NAME_STR
ReportList * reports
Definition WM_types.hh:1025
BMesh const char void * data
#define row_major
#define filter
#define FILTER_ID_ALL
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
void ui_template_node_operator_asset_menu_items(uiLayout &layout, const bContext &C, const StringRef catalog_path)
void ui_template_node_operator_asset_root_items(uiLayout &layout, const bContext &C)
void ui_template_modifier_asset_menu_items(uiLayout &layout, StringRef catalog_path)
void ui_template_node_asset_menu_items(uiLayout &layout, const bContext &C, StringRef catalog_path)
void template_asset_shelf_popover(uiLayout &layout, const bContext &C, StringRefNull asset_shelf_id, StringRef name, int icon)
const IDFilterEnumPropertyItem rna_enum_id_type_filter_items[]
Definition rna_ID.cc:116
bool RNA_property_array_check(PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier)
PropertyType RNA_property_type(PropertyRNA *prop)
const PointerRNA PointerRNA_NULL
const char * RNA_struct_identifier(const StructRNA *type)
void RNA_property_enum_items_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
const char * RNA_property_translation_context(const PropertyRNA *prop)
int RNA_struct_ui_icon(const StructRNA *type)
bool RNA_pointer_is_null(const PointerRNA *ptr)
PropertySubType RNA_property_subtype(PropertyRNA *prop)
void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
const char * RNA_struct_translation_context(const StructRNA *type)
static const EnumPropertyItem curve_type_items[]
Definition rna_curve.cc:122
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_function_return(FunctionRNA *func, PropertyRNA *ret)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
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)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
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_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_function_flag(FunctionRNA *func, int flag)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
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)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
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)
std::optional< blender::StringRefNull > rna_translate_ui_text(const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
Definition rna_rna.cc:26
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_uilist_layout_type_items[]
Definition rna_ui.cc:45
static void api_ui_item_common_text(FunctionRNA *func)
static void api_ui_item_common(FunctionRNA *func)
static void api_ui_item_rna_common(FunctionRNA *func)
static void api_ui_item_op(FunctionRNA *func)
static void api_ui_item_op_common(FunctionRNA *func)
static void api_ui_item_common_heading(FunctionRNA *func)
const EnumPropertyItem rna_enum_icon_items[]
Definition rna_ui_api.cc:25
void RNA_api_ui_layout(StructRNA *srna)
void api_ui_item_common_translation(FunctionRNA *func)
#define FLT_MAX
Definition stdcycles.h:14
const char * identifier
Definition RNA_types.hh:623
const char * name
Definition RNA_types.hh:627
const char * description
Definition RNA_types.hh:629
Definition DNA_ID.h:404
StructRNA * type
Definition RNA_types.hh:52
PointerRNA op(wmOperatorType *ot, std::optional< blender::StringRef > name, int icon, wmOperatorCallContext context, eUI_Item_Flag flag)
PanelLayout panel(const bContext *C, blender::StringRef idname, bool default_closed)
uiLayout & column_flow(int number, bool align)
PanelLayout panel_prop(const bContext *C, PointerRNA *open_prop_owner, blender::StringRefNull open_prop_name)
void label(blender::StringRef name, int icon)
uiLayout & column(bool align)
uiLayout & grid_flow(bool row_major, int columns_len, bool even_columns, bool even_rows, bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
uiLayout & row(bool align)
uiLayout & split(float percentage, bool align)
uiLayout & box()
uiLayout & menu_pie()
void menu(MenuType *mt, std::optional< blender::StringRef > name, int icon)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
i
Definition text_draw.cc:230
PointerRNA * ptr
Definition wm_files.cc:4227
wmOperatorType * ot
Definition wm_files.cc:4226
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
uint8_t flag
Definition wm_window.cc:139