Blender  V2.93
interface_utils.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2009 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include <ctype.h>
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <string.h>
28 
29 #include "DNA_object_types.h"
30 #include "DNA_screen_types.h"
31 
32 #include "BLI_alloca.h"
33 #include "BLI_listbase.h"
34 #include "BLI_math.h"
35 #include "BLI_string.h"
36 #include "BLI_string_search.h"
37 #include "BLI_utildefines.h"
38 
39 #include "BLT_translation.h"
40 
41 #include "BKE_lib_id.h"
42 #include "BKE_report.h"
43 
44 #include "MEM_guardedalloc.h"
45 
46 #include "RNA_access.h"
47 
48 #include "UI_interface.h"
49 #include "UI_interface_icons.h"
50 #include "UI_resources.h"
51 
52 #include "WM_api.h"
53 #include "WM_types.h"
54 
55 #include "interface_intern.h"
56 
57 /*************************** RNA Utilities ******************************/
58 
60  PointerRNA *ptr,
61  PropertyRNA *prop,
62  int index,
63  const char *name,
64  int icon,
65  int x,
66  int y,
67  int width,
68  int height)
69 {
70  uiBut *but = NULL;
71 
72  switch (RNA_property_type(prop)) {
73  case PROP_BOOLEAN: {
74  if (RNA_property_array_check(prop) && index == -1) {
75  return NULL;
76  }
77 
78  if (icon && name && name[0] == '\0') {
79  but = uiDefIconButR_prop(block,
81  0,
82  icon,
83  x,
84  y,
85  width,
86  height,
87  ptr,
88  prop,
89  index,
90  0,
91  0,
92  -1,
93  -1,
94  NULL);
95  }
96  else if (icon) {
97  but = uiDefIconTextButR_prop(block,
99  0,
100  icon,
101  name,
102  x,
103  y,
104  width,
105  height,
106  ptr,
107  prop,
108  index,
109  0,
110  0,
111  -1,
112  -1,
113  NULL);
114  }
115  else {
116  but = uiDefButR_prop(block,
118  0,
119  name,
120  x,
121  y,
122  width,
123  height,
124  ptr,
125  prop,
126  index,
127  0,
128  0,
129  -1,
130  -1,
131  NULL);
132  }
133  break;
134  }
135  case PROP_INT:
136  case PROP_FLOAT: {
137  if (RNA_property_array_check(prop) && index == -1) {
139  but = uiDefButR_prop(block,
141  0,
142  name,
143  x,
144  y,
145  width,
146  height,
147  ptr,
148  prop,
149  -1,
150  0,
151  0,
152  0,
153  0,
154  NULL);
155  }
156  else {
157  return NULL;
158  }
159  }
160  else if (RNA_property_subtype(prop) == PROP_PERCENTAGE ||
162  but = uiDefButR_prop(block,
164  0,
165  name,
166  x,
167  y,
168  width,
169  height,
170  ptr,
171  prop,
172  index,
173  0,
174  0,
175  -1,
176  -1,
177  NULL);
178  }
179  else {
180  but = uiDefButR_prop(
181  block, UI_BTYPE_NUM, 0, name, x, y, width, height, ptr, prop, index, 0, 0, 0, 0, NULL);
182  }
183 
186  }
187  break;
188  }
189  case PROP_ENUM:
190  if (icon && name && name[0] == '\0') {
191  but = uiDefIconButR_prop(block,
193  0,
194  icon,
195  x,
196  y,
197  width,
198  height,
199  ptr,
200  prop,
201  index,
202  0,
203  0,
204  -1,
205  -1,
206  NULL);
207  }
208  else if (icon) {
209  but = uiDefIconTextButR_prop(block,
211  0,
212  icon,
213  NULL,
214  x,
215  y,
216  width,
217  height,
218  ptr,
219  prop,
220  index,
221  0,
222  0,
223  -1,
224  -1,
225  NULL);
226  }
227  else {
228  but = uiDefButR_prop(block,
230  0,
231  name,
232  x,
233  y,
234  width,
235  height,
236  ptr,
237  prop,
238  index,
239  0,
240  0,
241  -1,
242  -1,
243  NULL);
244  }
245  break;
246  case PROP_STRING:
247  if (icon && name && name[0] == '\0') {
248  but = uiDefIconButR_prop(block,
250  0,
251  icon,
252  x,
253  y,
254  width,
255  height,
256  ptr,
257  prop,
258  index,
259  0,
260  0,
261  -1,
262  -1,
263  NULL);
264  }
265  else if (icon) {
266  but = uiDefIconTextButR_prop(block,
268  0,
269  icon,
270  name,
271  x,
272  y,
273  width,
274  height,
275  ptr,
276  prop,
277  index,
278  0,
279  0,
280  -1,
281  -1,
282  NULL);
283  }
284  else {
285  but = uiDefButR_prop(block,
287  0,
288  name,
289  x,
290  y,
291  width,
292  height,
293  ptr,
294  prop,
295  index,
296  0,
297  0,
298  -1,
299  -1,
300  NULL);
301  }
302 
304  /* TEXTEDIT_UPDATE is usually used for search buttons. For these we also want
305  * the 'x' icon to clear search string, so setting VALUE_CLEAR flag, too. */
307  }
308  break;
309  case PROP_POINTER: {
310  if (icon == 0) {
311  const PointerRNA pptr = RNA_property_pointer_get(ptr, prop);
312  icon = RNA_struct_ui_icon(pptr.type ? pptr.type : RNA_property_pointer_type(ptr, prop));
313  }
314  if (icon == ICON_DOT) {
315  icon = 0;
316  }
317 
318  but = uiDefIconTextButR_prop(block,
320  0,
321  icon,
322  name,
323  x,
324  y,
325  width,
326  height,
327  ptr,
328  prop,
329  index,
330  0,
331  0,
332  -1,
333  -1,
334  NULL);
335  break;
336  }
337  case PROP_COLLECTION: {
338  char text[256];
339  BLI_snprintf(
340  text, sizeof(text), IFACE_("%d items"), RNA_property_collection_length(ptr, prop));
341  but = uiDefBut(block, UI_BTYPE_LABEL, 0, text, x, y, width, height, NULL, 0, 0, 0, 0, NULL);
343  break;
344  }
345  default:
346  but = NULL;
347  break;
348  }
349 
350  return but;
351 }
352 
360  PointerRNA *ptr,
361  bool (*check_prop)(PointerRNA *ptr,
362  PropertyRNA *prop,
363  void *user_data),
364  void *user_data,
365  PropertyRNA *prop_activate_init,
366  const eButLabelAlign label_align,
367  const bool compact)
368 {
370  uiLayout *col;
371  const char *name;
372 
373  RNA_STRUCT_BEGIN (ptr, prop) {
374  const int flag = RNA_property_flag(prop);
375 
376  if (flag & PROP_HIDDEN) {
377  continue;
378  }
379  if (check_prop && check_prop(ptr, prop, user_data) == 0) {
380  return_info |= UI_PROP_BUTS_ANY_FAILED_CHECK;
381  continue;
382  }
383 
384  const PropertyType type = RNA_property_type(prop);
385  switch (label_align) {
388  const bool is_boolean = (type == PROP_BOOLEAN && !RNA_property_array_check(prop));
389 
390  name = RNA_property_ui_name(prop);
391 
392  if (label_align == UI_BUT_LABEL_ALIGN_COLUMN) {
393  col = uiLayoutColumn(layout, true);
394 
395  if (!is_boolean) {
396  uiItemL(col, name, ICON_NONE);
397  }
398  }
399  else {
401  col = uiLayoutColumn(layout, true);
402  /* Let uiItemFullR() create the split layout. */
403  uiLayoutSetPropSep(col, true);
404  }
405 
406  break;
407  }
409  default:
410  col = layout;
411  name = NULL; /* no smart label alignment, show default name with button */
412  break;
413  }
414 
415  /* Only buttons that can be edited as text. */
416  const bool use_activate_init = ((prop == prop_activate_init) &&
418 
419  if (use_activate_init) {
421  }
422 
423  uiItemFullR(col, ptr, prop, -1, 0, compact ? UI_ITEM_R_COMPACT : 0, name, ICON_NONE);
424  return_info &= ~UI_PROP_BUTS_NONE_ADDED;
425 
426  if (use_activate_init) {
428  }
429  }
431 
432  return return_info;
433 }
434 
435 /* *** RNA collection search menu *** */
436 
437 typedef struct CollItemSearch {
439  void *data;
440  char *name;
441  int index;
442  int iconid;
443  bool is_id;
447 
449  const bool requires_exact_data_name,
450  const bool has_id_icon,
451  uiSearchItems *items)
452 {
453  char name_buf[UI_MAX_DRAW_STR];
454 
455  /* If no item has an own icon to display, libraries can use the library icons rather than the
456  * name prefix for showing the library status. */
458  if (!has_id_icon && cis->is_id && !requires_exact_data_name) {
459  cis->iconid = UI_icon_from_library(cis->data);
460  /* No need to re-allocate, string should be shorter than before (lib status prefix is
461  * removed). */
463  BLI_assert(strlen(name_buf) <= MEM_allocN_len(cis->name));
464  strcpy(cis->name, name_buf);
465  }
466 
467  return UI_search_item_add(items,
468  cis->name,
469  cis->data,
470  cis->iconid,
473 }
474 
476  void *arg,
477  const char *str,
478  uiSearchItems *items,
479  const bool is_first)
480 {
482  const int flag = RNA_property_flag(data->target_prop);
483  ListBase *items_list = MEM_callocN(sizeof(ListBase), "items_list");
484  const bool is_ptr_target = (RNA_property_type(data->target_prop) == PROP_POINTER);
485  /* For non-pointer properties, UI code acts entirely based on the item's name. So the name has to
486  * match the RNA name exactly. So only for pointer properties, the name can be modified to add
487  * further UI hints. */
488  const bool requires_exact_data_name = !is_ptr_target;
489  const bool skip_filter = is_first;
490  char name_buf[UI_MAX_DRAW_STR];
491  char *name;
492  bool has_id_icon = false;
493 
494  StringSearch *search = skip_filter ? NULL : BLI_string_search_new();
495 
496  /* build a temporary list of relevant items first */
497  int item_index = 0;
498  RNA_PROP_BEGIN (&data->search_ptr, itemptr, data->search_prop) {
499 
500  if (flag & PROP_ID_SELF_CHECK) {
501  if (itemptr.data == data->target_ptr.owner_id) {
502  continue;
503  }
504  }
505 
506  /* use filter */
507  if (is_ptr_target) {
508  if (RNA_property_pointer_poll(&data->target_ptr, data->target_prop, &itemptr) == 0) {
509  continue;
510  }
511  }
512 
513  int name_prefix_offset = 0;
514  int iconid = ICON_NONE;
515  bool has_sep_char = false;
516  const bool is_id = itemptr.type && RNA_struct_is_ID(itemptr.type);
517 
518  if (is_id) {
519  iconid = ui_id_icon_get(C, itemptr.data, false);
520  if (!ELEM(iconid, 0, ICON_BLANK1)) {
521  has_id_icon = true;
522  }
523 
524  if (requires_exact_data_name) {
525  name = RNA_struct_name_get_alloc(&itemptr, name_buf, sizeof(name_buf), NULL);
526  }
527  else {
528  const ID *id = itemptr.data;
530  name_buf, itemptr.data, true, UI_SEP_CHAR, &name_prefix_offset);
531  BLI_STATIC_ASSERT(sizeof(name_buf) >= MAX_ID_FULL_NAME_UI,
532  "Name string buffer should be big enough to hold full UI ID name");
533  name = name_buf;
534  has_sep_char = (id->lib != NULL);
535  }
536  }
537  else {
538  name = RNA_struct_name_get_alloc(&itemptr, name_buf, sizeof(name_buf), NULL);
539  }
540 
541  if (name) {
542  CollItemSearch *cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch");
543  cis->data = itemptr.data;
544  cis->name = BLI_strdup(name);
545  cis->index = item_index;
546  cis->iconid = iconid;
547  cis->is_id = is_id;
549  cis->has_sep_char = has_sep_char;
550  if (!skip_filter) {
551  BLI_string_search_add(search, name, cis);
552  }
553  BLI_addtail(items_list, cis);
554  if (name != name_buf) {
555  MEM_freeN(name);
556  }
557  }
558 
559  item_index++;
560  }
561  RNA_PROP_END;
562 
563  if (skip_filter) {
564  LISTBASE_FOREACH (CollItemSearch *, cis, items_list) {
565  if (!add_collection_search_item(cis, requires_exact_data_name, has_id_icon, items)) {
566  break;
567  }
568  }
569  }
570  else {
571  CollItemSearch **filtered_items;
572  int filtered_amount = BLI_string_search_query(search, str, (void ***)&filtered_items);
573 
574  for (int i = 0; i < filtered_amount; i++) {
575  CollItemSearch *cis = filtered_items[i];
576  if (!add_collection_search_item(cis, requires_exact_data_name, has_id_icon, items)) {
577  break;
578  }
579  }
580 
581  MEM_freeN(filtered_items);
582  BLI_string_search_free(search);
583  }
584 
585  LISTBASE_FOREACH (CollItemSearch *, cis, items_list) {
586  MEM_freeN(cis->name);
587  }
588  BLI_freelistN(items_list);
589  MEM_freeN(items_list);
590 }
591 
592 /***************************** ID Utilities *******************************/
593 int UI_icon_from_id(const ID *id)
594 {
595  if (id == NULL) {
596  return ICON_NONE;
597  }
598 
599  /* exception for objects */
600  if (GS(id->name) == ID_OB) {
601  Object *ob = (Object *)id;
602 
603  if (ob->type == OB_EMPTY) {
604  return ICON_EMPTY_DATA;
605  }
606  return UI_icon_from_id(ob->data);
607  }
608 
609  /* otherwise get it through RNA, creating the pointer
610  * will set the right type, also with subclassing */
611  PointerRNA ptr;
612  RNA_id_pointer_create((ID *)id, &ptr);
613 
614  return (ptr.type) ? RNA_struct_ui_icon(ptr.type) : ICON_NONE;
615 }
616 
617 /* see: report_type_str */
619 {
620  if (type & RPT_ERROR_ALL) {
621  return ICON_CANCEL;
622  }
623  if (type & RPT_WARNING_ALL) {
624  return ICON_ERROR;
625  }
626  if (type & RPT_INFO_ALL) {
627  return ICON_INFO;
628  }
629  if (type & RPT_DEBUG_ALL) {
630  return ICON_SYSTEM;
631  }
632  if (type & RPT_PROPERTY) {
633  return ICON_OPTIONS;
634  }
635  if (type & RPT_OPERATOR) {
636  return ICON_CHECKMARK;
637  }
638  return ICON_INFO;
639 }
640 
642 {
643  if (type & RPT_ERROR_ALL) {
644  return TH_INFO_ERROR;
645  }
646  if (type & RPT_WARNING_ALL) {
647  return TH_INFO_WARNING;
648  }
649  if (type & RPT_INFO_ALL) {
650  return TH_INFO_INFO;
651  }
652  if (type & RPT_DEBUG_ALL) {
653  return TH_INFO_DEBUG;
654  }
655  if (type & RPT_PROPERTY) {
656  return TH_INFO_PROPERTY;
657  }
658  if (type & RPT_OPERATOR) {
659  return TH_INFO_OPERATOR;
660  }
661  return TH_INFO_WARNING;
662 }
663 
665 {
666  if (type & RPT_ERROR_ALL) {
667  return TH_INFO_ERROR_TEXT;
668  }
669  if (type & RPT_WARNING_ALL) {
670  return TH_INFO_WARNING_TEXT;
671  }
672  if (type & RPT_INFO_ALL) {
673  return TH_INFO_INFO_TEXT;
674  }
675  if (type & RPT_DEBUG_ALL) {
676  return TH_INFO_DEBUG_TEXT;
677  }
678  if (type & RPT_PROPERTY) {
679  return TH_INFO_PROPERTY_TEXT;
680  }
681  if (type & RPT_OPERATOR) {
682  return TH_INFO_OPERATOR_TEXT;
683  }
684  return TH_INFO_WARNING_TEXT;
685 }
686 
687 /********************************** Misc **************************************/
688 
693 int UI_calc_float_precision(int prec, double value)
694 {
695  static const double pow10_neg[UI_PRECISION_FLOAT_MAX + 1] = {
696  1e0, 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6};
697  static const double max_pow = 10000000.0; /* pow(10, UI_PRECISION_FLOAT_MAX) */
698 
700  BLI_assert(fabs(pow10_neg[prec] - pow(10, -prec)) < 1e-16);
701 
702  /* Check on the number of decimal places need to display the number,
703  * this is so 0.00001 is not displayed as 0.00,
704  * _but_, this is only for small values si 10.0001 will not get the same treatment.
705  */
706  value = fabs(value);
707  if ((value < pow10_neg[prec]) && (value > (1.0 / max_pow))) {
708  int value_i = (int)((value * max_pow) + 0.5);
709  if (value_i != 0) {
710  const int prec_span = 3; /* show: 0.01001, 5 would allow 0.0100001 for eg. */
711  int test_prec;
712  int prec_min = -1;
713  int dec_flag = 0;
714  int i = UI_PRECISION_FLOAT_MAX;
715  while (i && value_i) {
716  if (value_i % 10) {
717  dec_flag |= 1 << i;
718  prec_min = i;
719  }
720  value_i /= 10;
721  i--;
722  }
723 
724  /* even though its a small value, if the second last digit is not 0, use it */
725  test_prec = prec_min;
726 
727  dec_flag = (dec_flag >> (prec_min + 1)) & ((1 << prec_span) - 1);
728 
729  while (dec_flag) {
730  test_prec++;
731  dec_flag = dec_flag >> 1;
732  }
733 
734  if (test_prec > prec) {
735  prec = test_prec;
736  }
737  }
738  }
739 
740  CLAMP(prec, 0, UI_PRECISION_FLOAT_MAX);
741 
742  return prec;
743 }
744 
745 bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
746 {
747  if (but->rnapoin.owner_id && but->rnapoin.data && but->rnaprop) {
748  BLI_snprintf(r_str,
749  maxlength,
750  "%s.%s",
753  return true;
754  }
755  if (but->optype) {
756  WM_operator_py_idname(r_str, but->optype->idname);
757  return true;
758  }
759 
760  *r_str = '\0';
761  return false;
762 }
763 
764 bool UI_but_online_manual_id_from_active(const struct bContext *C, char *r_str, size_t maxlength)
765 {
767 
768  if (but) {
769  return UI_but_online_manual_id(but, r_str, maxlength);
770  }
771 
772  *r_str = '\0';
773  return false;
774 }
775 
776 /* -------------------------------------------------------------------- */
788 struct uiButStore {
789  struct uiButStore *next, *prev;
792 };
793 
797 };
798 
803 {
804  uiButStore *bs_handle = MEM_callocN(sizeof(uiButStore), __func__);
805 
806  bs_handle->block = block;
807  BLI_addtail(&block->butstore, bs_handle);
808 
809  return bs_handle;
810 }
811 
812 void UI_butstore_free(uiBlock *block, uiButStore *bs_handle)
813 {
814  /* Workaround for button store being moved into new block,
815  * which then can't use the previous buttons state
816  * ('ui_but_update_from_old_block' fails to find a match),
817  * keeping the active button in the old block holding a reference
818  * to the button-state in the new block: see T49034.
819  *
820  * Ideally we would manage moving the 'uiButStore', keeping a correct state.
821  * All things considered this is the most straightforward fix - Campbell.
822  */
823  if (block != bs_handle->block && bs_handle->block != NULL) {
824  block = bs_handle->block;
825  }
826 
827  BLI_freelistN(&bs_handle->items);
828  BLI_assert(BLI_findindex(&block->butstore, bs_handle) != -1);
829  BLI_remlink(&block->butstore, bs_handle);
830 
831  MEM_freeN(bs_handle);
832 }
833 
835 {
836  return (bs->block != NULL);
837 }
838 
840 {
841  LISTBASE_FOREACH (uiButStore *, bs_handle, &block->butstore) {
842  LISTBASE_FOREACH (uiButStoreElem *, bs_elem, &bs_handle->items) {
843  if (*bs_elem->but_p == but) {
844  return true;
845  }
846  }
847  }
848 
849  return false;
850 }
851 
853 {
854  uiButStoreElem *bs_elem = MEM_callocN(sizeof(uiButStoreElem), __func__);
855  BLI_assert(*but_p);
856  bs_elem->but_p = but_p;
857 
858  BLI_addtail(&bs_handle->items, bs_elem);
859 }
860 
862 {
863  LISTBASE_FOREACH_MUTABLE (uiButStoreElem *, bs_elem, &bs_handle->items) {
864  if (bs_elem->but_p == but_p) {
865  BLI_remlink(&bs_handle->items, bs_elem);
866  MEM_freeN(bs_elem);
867  }
868  }
869 
870  BLI_assert(0);
871 }
872 
876 bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src)
877 {
878  bool found = false;
879 
880  LISTBASE_FOREACH (uiButStore *, bs_handle, &block->butstore) {
881  LISTBASE_FOREACH (uiButStoreElem *, bs_elem, &bs_handle->items) {
882  if (*bs_elem->but_p == but_src) {
883  *bs_elem->but_p = but_dst;
884  found = true;
885  }
886  }
887  }
888 
889  return found;
890 }
891 
896 {
897  LISTBASE_FOREACH (uiButStore *, bs_handle, &block->butstore) {
898  bs_handle->block = NULL;
899  LISTBASE_FOREACH (uiButStoreElem *, bs_elem, &bs_handle->items) {
900  *bs_elem->but_p = NULL;
901  }
902  }
903 }
904 
909 {
910  /* move this list to the new block */
911  if (block->oldblock) {
912  if (block->oldblock->butstore.first) {
913  BLI_movelisttolist(&block->butstore, &block->oldblock->butstore);
914  }
915  }
916 
917  if (LIKELY(block->butstore.first == NULL)) {
918  return;
919  }
920 
921  /* warning, loop-in-loop, in practice we only store <10 buttons at a time,
922  * so this isn't going to be a problem, if that changes old-new mapping can be cached first */
923  LISTBASE_FOREACH (uiButStore *, bs_handle, &block->butstore) {
924  BLI_assert(ELEM(bs_handle->block, NULL, block) ||
925  (block->oldblock && block->oldblock == bs_handle->block));
926 
927  if (bs_handle->block == block->oldblock) {
928  bs_handle->block = block;
929 
930  LISTBASE_FOREACH (uiButStoreElem *, bs_elem, &bs_handle->items) {
931  if (*bs_elem->but_p) {
932  uiBut *but_new = ui_but_find_new(block, *bs_elem->but_p);
933 
934  /* can be NULL if the buttons removed,
935  * note: we could allow passing in a callback when buttons are removed
936  * so the caller can cleanup */
937  *bs_elem->but_p = but_new;
938  }
939  }
940  }
941  }
942 }
943 
#define MAX_ID_FULL_NAME_UI
Definition: BKE_lib_id.h:294
void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const struct ID *id, const bool add_lib_hint, char separator_char, int *r_prefix_len)
#define BLI_STATIC_ASSERT(a, msg)
Definition: BLI_assert.h:86
#define BLI_assert(a)
Definition: BLI_assert.h:58
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:172
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:188
void void void BLI_movelisttolist(struct ListBase *dst, struct ListBase *src) ATTR_NONNULL(1
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:547
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:110
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:133
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:70
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void BLI_string_search_free(StringSearch *search)
void BLI_string_search_add(StringSearch *search, const char *str, void *user_data)
StringSearch * BLI_string_search_new(void)
int BLI_string_search_query(StringSearch *search, const char *query, void ***r_data)
unsigned int uint
Definition: BLI_sys_types.h:83
#define ELEM(...)
#define LIKELY(x)
#define IFACE_(msgid)
@ ID_OB
Definition: DNA_ID_enums.h:59
Object is a sort of wrapper for general info.
@ OB_EMPTY
#define RPT_ERROR_ALL
#define RPT_INFO_ALL
#define RPT_WARNING_ALL
#define RPT_DEBUG_ALL
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
#define RNA_PROP_END
Definition: RNA_access.h:1268
#define RNA_STRUCT_BEGIN(sptr, prop)
Definition: RNA_access.h:1274
#define RNA_STRUCT_END
Definition: RNA_access.h:1294
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
Definition: RNA_access.h:1261
PropertyType
Definition: RNA_types.h:72
@ PROP_FLOAT
Definition: RNA_types.h:75
@ PROP_BOOLEAN
Definition: RNA_types.h:73
@ PROP_ENUM
Definition: RNA_types.h:77
@ PROP_INT
Definition: RNA_types.h:74
@ PROP_STRING
Definition: RNA_types.h:76
@ PROP_POINTER
Definition: RNA_types.h:78
@ PROP_COLLECTION
Definition: RNA_types.h:79
@ PROP_ID_SELF_CHECK
Definition: RNA_types.h:218
@ PROP_TEXTEDIT_UPDATE
Definition: RNA_types.h:195
@ PROP_HIDDEN
Definition: RNA_types.h:202
@ PROP_COLOR
Definition: RNA_types.h:139
@ PROP_PERCENTAGE
Definition: RNA_types.h:130
@ PROP_FACTOR
Definition: RNA_types.h:131
@ PROP_COLOR_GAMMA
Definition: RNA_types.h:151
#define C
Definition: RandGen.cpp:39
eAutoPropButsReturn
@ UI_PROP_BUTS_ANY_FAILED_CHECK
@ UI_PROP_BUTS_NONE_ADDED
uiBut * uiDefIconTextButR_prop(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
Definition: interface.c:5951
@ UI_ITEM_R_COMPACT
@ UI_BUT_DISABLED
Definition: UI_interface.h:199
@ UI_BUT_HAS_SEP_CHAR
Definition: UI_interface.h:225
@ UI_BUT_VALUE_CLEAR
Definition: UI_interface.h:231
@ UI_BUT_TEXTEDIT_UPDATE
Definition: UI_interface.h:229
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
#define UI_SEP_CHAR
Definition: UI_interface.h:86
uiBut * uiDefBut(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
Definition: interface.c:4687
void uiItemL(uiLayout *layout, const char *name, int icon)
bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid, int state, const uint8_t name_prefix_offset)
uiBut * uiDefIconButR_prop(uiBlock *block, int type, int retval, int icon, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
Definition: interface.c:5549
uiBut * UI_context_active_but_get(const struct bContext *C)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
#define UI_PRECISION_FLOAT_MAX
eButLabelAlign
@ UI_BUT_LABEL_ALIGN_SPLIT_COLUMN
@ UI_BUT_LABEL_ALIGN_NONE
@ UI_BUT_LABEL_ALIGN_COLUMN
#define UI_MAX_DRAW_STR
Definition: UI_interface.h:90
uiBut * uiDefButR_prop(uiBlock *block, int type, int retval, const char *str, int x, int y, short width, short height, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, float min, float max, float a1, float a2, const char *tip)
Definition: interface.c:5166
void uiLayoutSetActivateInit(uiLayout *layout, bool activate_init)
void uiItemFullR(uiLayout *layout, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, int value, int flag, const char *name, int icon)
@ UI_BTYPE_NUM_SLIDER
Definition: UI_interface.h:343
@ UI_BTYPE_TEXT
Definition: UI_interface.h:336
@ UI_BTYPE_LABEL
Definition: UI_interface.h:358
@ UI_BTYPE_SEARCH_MENU
Definition: UI_interface.h:376
@ UI_BTYPE_NUM
Definition: UI_interface.h:341
@ UI_BTYPE_COLOR
Definition: UI_interface.h:353
@ UI_BTYPE_CHECKBOX
Definition: UI_interface.h:351
@ UI_BTYPE_MENU
Definition: UI_interface.h:338
@ UI_BTYPE_ICON_TOGGLE
Definition: UI_interface.h:346
void UI_but_flag_enable(uiBut *but, int flag)
Definition: interface.c:6077
int UI_icon_from_library(const struct ID *id)
@ TH_INFO_PROPERTY_TEXT
Definition: UI_resources.h:340
@ TH_INFO_WARNING_TEXT
Definition: UI_resources.h:334
@ TH_INFO_DEBUG
Definition: UI_resources.h:337
@ TH_INFO_INFO
Definition: UI_resources.h:335
@ TH_INFO_INFO_TEXT
Definition: UI_resources.h:336
@ TH_INFO_PROPERTY
Definition: UI_resources.h:339
@ TH_INFO_DEBUG_TEXT
Definition: UI_resources.h:338
@ TH_INFO_ERROR
Definition: UI_resources.h:331
@ TH_INFO_ERROR_TEXT
Definition: UI_resources.h:332
@ TH_INFO_OPERATOR
Definition: UI_resources.h:341
@ TH_INFO_WARNING
Definition: UI_resources.h:333
@ TH_INFO_OPERATOR_TEXT
Definition: UI_resources.h:342
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void * user_data
#define str(s)
uint col
uiBut * ui_but_find_new(uiBlock *block_new, const uiBut *but_old)
Definition: interface.c:736
int ui_id_icon_get(const bContext *C, ID *id, const bool big)
int UI_text_colorid_from_report_type(int type)
bool UI_but_online_manual_id_from_active(const struct bContext *C, char *r_str, size_t maxlength)
int UI_icon_from_report_type(int type)
eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, PointerRNA *ptr, bool(*check_prop)(PointerRNA *ptr, PropertyRNA *prop, void *user_data), void *user_data, PropertyRNA *prop_activate_init, const eButLabelAlign label_align, const bool compact)
bool UI_butstore_is_valid(uiButStore *bs)
int UI_icon_from_id(const ID *id)
int UI_icon_colorid_from_report_type(int type)
uiBut * uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, const char *name, int icon, int x, int y, int width, int height)
void UI_butstore_update(uiBlock *block)
void UI_butstore_unregister(uiButStore *bs_handle, uiBut **but_p)
bool UI_butstore_register_update(uiBlock *block, uiBut *but_dst, const uiBut *but_src)
static bool add_collection_search_item(CollItemSearch *cis, const bool requires_exact_data_name, const bool has_id_icon, uiSearchItems *items)
void ui_rna_collection_search_update_fn(const struct bContext *C, void *arg, const char *str, uiSearchItems *items, const bool is_first)
bool UI_butstore_is_registered(uiBlock *block, uiBut *but)
uiButStore * UI_butstore_create(uiBlock *block)
void UI_butstore_register(uiButStore *bs_handle, uiBut **but_p)
void UI_butstore_clear(uiBlock *block)
struct CollItemSearch CollItemSearch
bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength)
void UI_butstore_free(uiBlock *block, uiButStore *bs_handle)
int UI_calc_float_precision(int prec, double value)
#define GS(x)
Definition: iris.c:241
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
size_t(* MEM_allocN_len)(const void *vmemh)
Definition: mallocn.c:40
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
Definition: rall1d.h:359
const char * RNA_struct_identifier(const StructRNA *type)
Definition: rna_access.c:723
bool RNA_property_array_check(PropertyRNA *prop)
Definition: rna_access.c:1223
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
Definition: rna_access.c:122
bool RNA_struct_is_ID(const StructRNA *type)
Definition: rna_access.c:797
const char * RNA_property_identifier(const PropertyRNA *prop)
Definition: rna_access.c:1145
char * RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
Definition: rna_access.c:1049
PropertyType RNA_property_type(PropertyRNA *prop)
Definition: rna_access.c:1155
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3641
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:1567
bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value)
Definition: rna_access.c:1593
int RNA_property_flag(PropertyRNA *prop)
Definition: rna_access.c:1192
int RNA_struct_ui_icon(const StructRNA *type)
Definition: rna_access.c:738
PropertySubType RNA_property_subtype(PropertyRNA *prop)
Definition: rna_access.c:1160
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3903
const char * RNA_property_ui_name(const PropertyRNA *prop)
Definition: rna_access.c:2043
struct CollItemSearch * next
struct CollItemSearch * prev
Definition: DNA_ID.h:273
char name[66]
Definition: DNA_ID.h:283
void * first
Definition: DNA_listBase.h:47
void * data
struct StructRNA * type
Definition: RNA_types.h:51
void * data
Definition: RNA_types.h:52
struct ID * owner_id
Definition: RNA_types.h:50
uiBlock * oldblock
ListBase butstore
struct uiButStoreElem * prev
struct uiButStoreElem * next
uiBlock * block
struct uiButStore * next
struct uiButStore * prev
ListBase items
struct wmOperatorType * optype
struct PropertyRNA * rnaprop
struct PointerRNA rnapoin
const char * idname
Definition: WM_types.h:723
ccl_device_inline float2 fabs(const float2 &a)
PointerRNA * ptr
Definition: wm_files.c:3157
void WM_operator_py_idname(char *to, const char *from)
Definition: wm_operators.c:123