Blender  V3.3
wm_operators.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2007 Blender Foundation. All rights reserved. */
3 
11 #include <ctype.h>
12 #include <errno.h>
13 #include <float.h>
14 #include <stddef.h>
15 #include <stdio.h>
16 #include <string.h>
17 
18 #ifdef WIN32
19 # include "GHOST_C-api.h"
20 #endif
21 
22 #include "MEM_guardedalloc.h"
23 
24 #include "CLG_log.h"
25 
26 #include "DNA_ID.h"
27 #include "DNA_armature_types.h"
28 #include "DNA_brush_types.h"
29 #include "DNA_object_types.h"
30 #include "DNA_scene_types.h"
31 #include "DNA_screen_types.h"
32 #include "DNA_userdef_types.h"
34 
35 #include "BLT_translation.h"
36 
37 #include "PIL_time.h"
38 
39 #include "BLI_blenlib.h"
40 #include "BLI_dial_2d.h"
41 #include "BLI_dynstr.h" /* For #WM_operator_pystring. */
42 #include "BLI_math.h"
43 #include "BLI_string_utils.h"
44 #include "BLI_utildefines.h"
45 
46 #include "BKE_anim_data.h"
47 #include "BKE_brush.h"
48 #include "BKE_colortools.h"
49 #include "BKE_context.h"
50 #include "BKE_global.h"
51 #include "BKE_icons.h"
52 #include "BKE_idprop.h"
53 #include "BKE_image.h"
54 #include "BKE_image_format.h"
55 #include "BKE_lib_id.h"
56 #include "BKE_lib_query.h"
57 #include "BKE_main.h"
58 #include "BKE_material.h"
59 #include "BKE_report.h"
60 #include "BKE_scene.h"
61 #include "BKE_screen.h" /* BKE_ST_MAXNAME */
62 #include "BKE_unit.h"
63 
64 #include "BKE_idtype.h"
65 
66 #include "BLF_api.h"
67 
68 #include "GPU_immediate.h"
69 #include "GPU_immediate_util.h"
70 #include "GPU_matrix.h"
71 #include "GPU_state.h"
72 
73 #include "IMB_imbuf_types.h"
74 
75 #include "ED_fileselect.h"
76 #include "ED_numinput.h"
77 #include "ED_screen.h"
78 #include "ED_undo.h"
79 #include "ED_view3d.h"
80 
81 #include "RNA_access.h"
82 #include "RNA_define.h"
83 #include "RNA_enum_types.h"
84 #include "RNA_path.h"
85 #include "RNA_prototypes.h"
86 
87 #include "UI_interface.h"
88 #include "UI_interface_icons.h"
89 #include "UI_resources.h"
90 
91 #include "WM_api.h"
92 #include "WM_types.h"
93 
94 #include "wm.h"
95 #include "wm_draw.h"
96 #include "wm_event_system.h"
97 #include "wm_event_types.h"
98 #include "wm_files.h"
99 #include "wm_window.h"
100 #ifdef WITH_XR_OPENXR
101 # include "wm_xr.h"
102 #endif
103 
104 #define UNDOCUMENTED_OPERATOR_TIP N_("(undocumented operator)")
105 
106 /* -------------------------------------------------------------------- */
110 size_t WM_operator_py_idname(char *dst, const char *src)
111 {
112  const char *sep = strstr(src, "_OT_");
113  if (sep) {
114  int ofs = (sep - src);
115 
116  /* NOTE: we use ascii `tolower` instead of system `tolower`, because the
117  * latter depends on the locale, and can lead to `idname` mismatch. */
118  memcpy(dst, src, sizeof(char) * ofs);
119  BLI_str_tolower_ascii(dst, ofs);
120 
121  dst[ofs] = '.';
122  return BLI_strncpy_rlen(dst + (ofs + 1), sep + 4, OP_MAX_TYPENAME - (ofs + 1)) + (ofs + 1);
123  }
124  /* Should not happen but support just in case. */
125  return BLI_strncpy_rlen(dst, src, OP_MAX_TYPENAME);
126 }
127 
128 size_t WM_operator_bl_idname(char *dst, const char *src)
129 {
130  const char *sep = strchr(src, '.');
131  int from_len;
132  if (sep && (from_len = strlen(src)) < OP_MAX_TYPENAME - 3) {
133  const int ofs = (sep - src);
134  memcpy(dst, src, sizeof(char) * ofs);
135  BLI_str_toupper_ascii(dst, ofs);
136  memcpy(dst + ofs, "_OT_", 4);
137  memcpy(dst + (ofs + 4), sep + 1, (from_len - ofs));
138  return (from_len - ofs) - 1;
139  }
140  /* Should not happen but support just in case. */
141  return BLI_strncpy_rlen(dst, src, OP_MAX_TYPENAME);
142 }
143 
145  const char *classname,
146  const char *idname)
147 {
148  const char *ch = idname;
149  int dot = 0;
150  int i;
151  for (i = 0; *ch; i++, ch++) {
152  if ((*ch >= 'a' && *ch <= 'z') || (*ch >= '0' && *ch <= '9') || *ch == '_') {
153  /* pass */
154  }
155  else if (*ch == '.') {
156  dot++;
157  }
158  else {
159  BKE_reportf(reports,
160  RPT_ERROR,
161  "Registering operator class: '%s', invalid bl_idname '%s', at position %d",
162  classname,
163  idname,
164  i);
165  return false;
166  }
167  }
168 
169  if (i > (MAX_NAME - 3)) {
170  BKE_reportf(reports,
171  RPT_ERROR,
172  "Registering operator class: '%s', invalid bl_idname '%s', "
173  "is too long, maximum length is %d",
174  classname,
175  idname,
176  MAX_NAME - 3);
177  return false;
178  }
179 
180  if (dot != 1) {
181  BKE_reportf(
182  reports,
183  RPT_ERROR,
184  "Registering operator class: '%s', invalid bl_idname '%s', must contain 1 '.' character",
185  classname,
186  idname);
187  return false;
188  }
189  return true;
190 }
191 
193  wmOperator *op,
194  const bool all_args,
195  const bool macro_args,
197  PointerRNA *opptr)
198 {
199  char idname_py[OP_MAX_TYPENAME];
200 
201  /* for building the string */
202  DynStr *dynstr = BLI_dynstr_new();
203 
204  /* arbitrary, but can get huge string with stroke painting otherwise */
205  int max_prop_length = 10;
206 
207  WM_operator_py_idname(idname_py, ot->idname);
208  BLI_dynstr_appendf(dynstr, "bpy.ops.%s(", idname_py);
209 
210  if (op && op->macro.first) {
211  /* Special handling for macros, else we only get default values in this case... */
212  wmOperator *opm;
213  bool first_op = true;
214 
215  opm = macro_args ? op->macro.first : NULL;
216 
217  for (; opm; opm = opm->next) {
218  PointerRNA *opmptr = opm->ptr;
219  PointerRNA opmptr_default;
220  if (opmptr == NULL) {
221  WM_operator_properties_create_ptr(&opmptr_default, opm->type);
222  opmptr = &opmptr_default;
223  }
224 
225  char *cstring_args = RNA_pointer_as_string_id(C, opmptr);
226  if (first_op) {
227  BLI_dynstr_appendf(dynstr, "%s=%s", opm->type->idname, cstring_args);
228  first_op = false;
229  }
230  else {
231  BLI_dynstr_appendf(dynstr, ", %s=%s", opm->type->idname, cstring_args);
232  }
233  MEM_freeN(cstring_args);
234 
235  if (opmptr == &opmptr_default) {
236  WM_operator_properties_free(&opmptr_default);
237  }
238  }
239  }
240  else {
241  /* only to get the original props for comparisons */
242  PointerRNA opptr_default;
243  const bool macro_args_test = ot->macro.first ? macro_args : true;
244 
245  if (opptr == NULL) {
246  WM_operator_properties_create_ptr(&opptr_default, ot);
247  opptr = &opptr_default;
248  }
249 
250  char *cstring_args = RNA_pointer_as_string_keywords(
251  C, opptr, false, all_args, macro_args_test, max_prop_length);
252  BLI_dynstr_append(dynstr, cstring_args);
253  MEM_freeN(cstring_args);
254 
255  if (opptr == &opptr_default) {
256  WM_operator_properties_free(&opptr_default);
257  }
258  }
259 
260  BLI_dynstr_append(dynstr, ")");
261 
262  char *cstring = BLI_dynstr_get_cstring(dynstr);
263  BLI_dynstr_free(dynstr);
264  return cstring;
265 }
266 
267 char *WM_operator_pystring(bContext *C, wmOperator *op, const bool all_args, const bool macro_args)
268 {
269  return WM_operator_pystring_ex(C, op, all_args, macro_args, op->type, op->ptr);
270 }
271 
272 bool WM_operator_pystring_abbreviate(char *str, int str_len_max)
273 {
274  const int str_len = strlen(str);
275  const char *parens_start = strchr(str, '(');
276 
277  if (parens_start) {
278  const int parens_start_pos = parens_start - str;
279  const char *parens_end = strrchr(parens_start + 1, ')');
280 
281  if (parens_end) {
282  const int parens_len = parens_end - parens_start;
283 
284  if (parens_len > str_len_max) {
285  const char *comma_first = strchr(parens_start, ',');
286 
287  /* Truncate after the first comma. */
288  if (comma_first) {
289  const char end_str[] = " ... )";
290  const int end_str_len = sizeof(end_str) - 1;
291 
292  /* Leave a place for the first argument. */
293  const int new_str_len = (comma_first - parens_start) + 1;
294 
295  if (str_len >= new_str_len + parens_start_pos + end_str_len + 1) {
296  /* Append " ... )" to the string after the comma. */
297  memcpy(str + new_str_len + parens_start_pos, end_str, end_str_len + 1);
298 
299  return true;
300  }
301  }
302  }
303  }
304  }
305 
306  return false;
307 }
308 
309 /* return NULL if no match is found */
310 #if 0
311 static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr, bool *r_is_id)
312 {
313  /* loop over all context items and do 2 checks
314  *
315  * - see if the pointer is in the context.
316  * - see if the pointers ID is in the context.
317  */
318 
319  /* Don't get from the context store since this is normally
320  * set only for the UI and not usable elsewhere. */
321  ListBase lb = CTX_data_dir_get_ex(C, false, true, true);
322  LinkData *link;
323 
324  const char *member_found = NULL;
325  const char *member_id = NULL;
326  bool member_found_is_id = false;
327 
328  for (link = lb.first; link; link = link->next) {
329  const char *identifier = link->data;
330  PointerRNA ctx_item_ptr = {
331  {0}}; /* CTX_data_pointer_get(C, identifier); */ /* XXX, this isn't working. */
332 
333  if (ctx_item_ptr.type == NULL) {
334  continue;
335  }
336 
337  if (ptr->owner_id == ctx_item_ptr.owner_id) {
338  const bool is_id = RNA_struct_is_ID(ctx_item_ptr.type);
339  if ((ptr->data == ctx_item_ptr.data) && (ptr->type == ctx_item_ptr.type)) {
340  /* found! */
341  member_found = identifier;
342  member_found_is_id = is_id;
343  break;
344  }
345  if (is_id) {
346  /* Found a reference to this ID, so fallback to it if there is no direct reference. */
347  member_id = identifier;
348  }
349  }
350  }
351  BLI_freelistN(&lb);
352 
353  if (member_found) {
354  *r_is_id = member_found_is_id;
355  return member_found;
356  }
357  else if (member_id) {
358  *r_is_id = true;
359  return member_id;
360  }
361  else {
362  return NULL;
363  }
364 }
365 
366 #else
367 
368 /* use hard coded checks for now */
369 
384 static const char *wm_context_member_from_ptr(const bContext *C,
385  const PointerRNA *ptr,
386  bool *r_is_id)
387 {
388  const char *member_id = NULL;
389  bool is_id = false;
390 
391 # define CTX_TEST_PTR_ID(C, member, idptr) \
392  { \
393  const char *ctx_member = member; \
394  PointerRNA ctx_item_ptr = CTX_data_pointer_get(C, ctx_member); \
395  if (ctx_item_ptr.owner_id == idptr) { \
396  member_id = ctx_member; \
397  is_id = true; \
398  break; \
399  } \
400  } \
401  (void)0
402 
403 # define CTX_TEST_PTR_ID_CAST(C, member, member_full, cast, idptr) \
404  { \
405  const char *ctx_member = member; \
406  const char *ctx_member_full = member_full; \
407  PointerRNA ctx_item_ptr = CTX_data_pointer_get(C, ctx_member); \
408  if (ctx_item_ptr.owner_id && (ID *)cast(ctx_item_ptr.owner_id) == idptr) { \
409  member_id = ctx_member_full; \
410  is_id = true; \
411  break; \
412  } \
413  } \
414  (void)0
415 
416 # define TEST_PTR_DATA_TYPE(member, rna_type, rna_ptr, dataptr_cmp) \
417  { \
418  const char *ctx_member = member; \
419  if (RNA_struct_is_a((rna_ptr)->type, &(rna_type)) && (rna_ptr)->data == (dataptr_cmp)) { \
420  member_id = ctx_member; \
421  break; \
422  } \
423  } \
424  (void)0
425 
426  /* A version of #TEST_PTR_DATA_TYPE that calls `CTX_data_pointer_get_type(C, member)`. */
427 # define TEST_PTR_DATA_TYPE_FROM_CONTEXT(member, rna_type, rna_ptr) \
428  { \
429  const char *ctx_member = member; \
430  if (RNA_struct_is_a((rna_ptr)->type, &(rna_type)) && \
431  (rna_ptr)->data == (CTX_data_pointer_get_type(C, ctx_member, &(rna_type)).data)) { \
432  member_id = ctx_member; \
433  break; \
434  } \
435  } \
436  (void)0
437 
438  /* General checks (multiple ID types). */
439  if (ptr->owner_id) {
440  const ID_Type ptr_id_type = GS(ptr->owner_id->name);
441 
442  /* Support break in the macros for an early exit. */
443  do {
444  /* Animation Data. */
445  if (id_type_can_have_animdata(ptr_id_type)) {
446  TEST_PTR_DATA_TYPE_FROM_CONTEXT("active_nla_track", RNA_NlaTrack, ptr);
447  TEST_PTR_DATA_TYPE_FROM_CONTEXT("active_nla_strip", RNA_NlaStrip, ptr);
448  }
449  } while (0);
450  }
451 
452  /* Specific ID type checks. */
453  if (ptr->owner_id && (member_id == NULL)) {
454 
455  const ID_Type ptr_id_type = GS(ptr->owner_id->name);
456  switch (ptr_id_type) {
457  case ID_SCE: {
458  TEST_PTR_DATA_TYPE_FROM_CONTEXT("active_sequence_strip", RNA_Sequence, ptr);
459 
460  CTX_TEST_PTR_ID(C, "scene", ptr->owner_id);
461  break;
462  }
463  case ID_OB: {
464  TEST_PTR_DATA_TYPE_FROM_CONTEXT("active_pose_bone", RNA_PoseBone, ptr);
465 
466  CTX_TEST_PTR_ID(C, "object", ptr->owner_id);
467  break;
468  }
469  /* from rna_Main_objects_new */
471 
472  if (ptr_id_type == ID_AR) {
473  const bArmature *arm = (bArmature *)ptr->owner_id;
474  if (arm->edbo != NULL) {
475  TEST_PTR_DATA_TYPE("active_bone", RNA_EditBone, ptr, arm->act_edbone);
476  }
477  else {
478  TEST_PTR_DATA_TYPE("active_bone", RNA_Bone, ptr, arm->act_bone);
479  }
480  }
481 
482 # define ID_CAST_OBDATA(id_pt) (((Object *)(id_pt))->data)
483  CTX_TEST_PTR_ID_CAST(C, "object", "object.data", ID_CAST_OBDATA, ptr->owner_id);
484  break;
485 # undef ID_CAST_OBDATA
486  }
487  case ID_MA: {
488 # define ID_CAST_OBMATACT(id_pt) \
489  (BKE_object_material_get(((Object *)id_pt), ((Object *)id_pt)->actcol))
491  C, "object", "object.active_material", ID_CAST_OBMATACT, ptr->owner_id);
492  break;
493 # undef ID_CAST_OBMATACT
494  }
495  case ID_WO: {
496 # define ID_CAST_SCENEWORLD(id_pt) (((Scene *)(id_pt))->world)
497  CTX_TEST_PTR_ID_CAST(C, "scene", "scene.world", ID_CAST_SCENEWORLD, ptr->owner_id);
498  break;
499 # undef ID_CAST_SCENEWORLD
500  }
501  case ID_SCR: {
502  CTX_TEST_PTR_ID(C, "screen", ptr->owner_id);
503 
504  TEST_PTR_DATA_TYPE("area", RNA_Area, ptr, CTX_wm_area(C));
505  TEST_PTR_DATA_TYPE("region", RNA_Region, ptr, CTX_wm_region(C));
506 
507  SpaceLink *space_data = CTX_wm_space_data(C);
508  if (space_data != NULL) {
509  TEST_PTR_DATA_TYPE("space_data", RNA_Space, ptr, space_data);
510 
511  switch (space_data->spacetype) {
512  case SPACE_VIEW3D: {
513  const View3D *v3d = (View3D *)space_data;
514  const View3DShading *shading = &v3d->shading;
515 
516  TEST_PTR_DATA_TYPE("space_data.overlay", RNA_View3DOverlay, ptr, v3d);
517  TEST_PTR_DATA_TYPE("space_data.shading", RNA_View3DShading, ptr, shading);
518  break;
519  }
520  case SPACE_GRAPH: {
521  const SpaceGraph *sipo = (SpaceGraph *)space_data;
522  const bDopeSheet *ads = sipo->ads;
523  TEST_PTR_DATA_TYPE("space_data.dopesheet", RNA_DopeSheet, ptr, ads);
524  break;
525  }
526  case SPACE_FILE: {
527  const SpaceFile *sfile = (SpaceFile *)space_data;
529  TEST_PTR_DATA_TYPE("space_data.params", RNA_FileSelectParams, ptr, params);
530  break;
531  }
532  case SPACE_IMAGE: {
533  const SpaceImage *sima = (SpaceImage *)space_data;
534  TEST_PTR_DATA_TYPE("space_data.overlay", RNA_SpaceImageOverlay, ptr, sima);
535  TEST_PTR_DATA_TYPE("space_data.uv_editor", RNA_SpaceUVEditor, ptr, sima);
536  break;
537  }
538  case SPACE_NLA: {
539  const SpaceNla *snla = (SpaceNla *)space_data;
540  const bDopeSheet *ads = snla->ads;
541  TEST_PTR_DATA_TYPE("space_data.dopesheet", RNA_DopeSheet, ptr, ads);
542  break;
543  }
544  case SPACE_ACTION: {
545  const SpaceAction *sact = (SpaceAction *)space_data;
546  const bDopeSheet *ads = &sact->ads;
547  TEST_PTR_DATA_TYPE("space_data.dopesheet", RNA_DopeSheet, ptr, ads);
548  break;
549  }
550  }
551  }
552 
553  break;
554  }
555  default:
556  break;
557  }
558 # undef CTX_TEST_PTR_ID
559 # undef CTX_TEST_PTR_ID_CAST
560 # undef TEST_PTR_DATA_TYPE
561  }
562 
563  *r_is_id = is_id;
564 
565  return member_id;
566 }
567 #endif
568 
570  const PointerRNA *ptr,
571  PropertyRNA *prop,
572  int index)
573 {
574  bool is_id;
575  const char *member_id = wm_context_member_from_ptr(C, ptr, &is_id);
576  char *member_id_data_path = NULL;
577  if (member_id != NULL) {
578  if (is_id && !RNA_struct_is_ID(ptr->type)) {
579  char *data_path = RNA_path_from_ID_to_struct(ptr);
580  if (data_path != NULL) {
581  if (prop != NULL) {
582  char *prop_str = RNA_path_property_py(ptr, prop, index);
583  if (prop_str[0] == '[') {
584  member_id_data_path = BLI_string_joinN(member_id, ".", data_path, prop_str);
585  }
586  else {
587  member_id_data_path = BLI_string_join_by_sep_charN(
588  '.', member_id, data_path, prop_str);
589  }
590  MEM_freeN(prop_str);
591  }
592  else {
593  member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, data_path);
594  }
595  MEM_freeN(data_path);
596  }
597  }
598  else {
599  if (prop != NULL) {
600  char *prop_str = RNA_path_property_py(ptr, prop, index);
601  if (prop_str[0] == '[') {
602  member_id_data_path = BLI_string_joinN(member_id, prop_str);
603  }
604  else {
605  member_id_data_path = BLI_string_join_by_sep_charN('.', member_id, prop_str);
606  }
607  MEM_freeN(prop_str);
608  }
609  else {
610  member_id_data_path = BLI_strdup(member_id);
611  }
612  }
613  }
614  return member_id_data_path;
615 }
616 
618 {
620 }
621 
623  PointerRNA *ptr,
624  PropertyRNA *prop,
625  int index)
626 {
627  char *member_id_data_path = WM_context_path_resolve_property_full(C, ptr, prop, index);
628  char *ret = NULL;
629  if (member_id_data_path != NULL) {
630  ret = BLI_sprintfN("bpy.context.%s", member_id_data_path);
631  MEM_freeN(member_id_data_path);
632  }
633  return ret;
634 }
635 
637 {
638  char *lhs = C ? wm_prop_pystring_from_context(C, ptr, prop, index) : NULL;
639 
640  if (lhs == NULL) {
641  /* Fallback to `bpy.data.foo[id]` if we don't find in the context. */
642  lhs = RNA_path_full_property_py(CTX_data_main(C), ptr, prop, index);
643  }
644 
645  if (!lhs) {
646  return NULL;
647  }
648 
649  char *rhs = RNA_property_as_string(C, ptr, prop, index, INT_MAX);
650  if (!rhs) {
651  MEM_freeN(lhs);
652  return NULL;
653  }
654 
655  char *ret = BLI_sprintfN("%s = %s", lhs, rhs);
656  MEM_freeN(lhs);
657  MEM_freeN(rhs);
658  return ret;
659 }
660 
662 {
663  /* Set the ID so the context can be accessed: see #STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID. */
664  RNA_pointer_create(G_MAIN->wm.first, ot->srna, NULL, ptr);
665 }
666 
667 void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
668 {
669  wmOperatorType *ot = WM_operatortype_find(opstring, false);
670 
671  if (ot) {
673  }
674  else {
675  /* Set the ID so the context can be accessed: see #STRUCT_NO_CONTEXT_WITHOUT_OWNER_ID. */
676  RNA_pointer_create(G_MAIN->wm.first, &RNA_OperatorProperties, NULL, ptr);
677  }
678 }
679 
680 void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring)
681 {
682  IDProperty *tmp_properties = NULL;
683  /* Allow passing NULL for properties, just create the properties here then. */
684  if (properties == NULL) {
685  properties = &tmp_properties;
686  }
687 
688  if (*properties == NULL) {
689  IDPropertyTemplate val = {0};
690  *properties = IDP_New(IDP_GROUP, &val, "wmOpItemProp");
691  }
692 
693  if (*ptr == NULL) {
694  *ptr = MEM_callocN(sizeof(PointerRNA), "wmOpItemPtr");
696  }
697 
698  (*ptr)->data = *properties;
699 }
700 
701 void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context)
702 {
703  RNA_STRUCT_BEGIN (ptr, prop) {
704  switch (RNA_property_type(prop)) {
705  case PROP_ENUM:
706  if (no_context) {
708  }
709  else {
711  }
712  break;
713  case PROP_POINTER: {
714  StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
715 
716  /* recurse into operator properties */
717  if (RNA_struct_is_a(ptype, &RNA_OperatorProperties)) {
718  PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
719  WM_operator_properties_sanitize(&opptr, no_context);
720  }
721  break;
722  }
723  default:
724  break;
725  }
726  }
728 }
729 
730 bool WM_operator_properties_default(PointerRNA *ptr, const bool do_update)
731 {
732  bool changed = false;
733  RNA_STRUCT_BEGIN (ptr, prop) {
734  switch (RNA_property_type(prop)) {
735  case PROP_POINTER: {
736  StructRNA *ptype = RNA_property_pointer_type(ptr, prop);
737  if (ptype != &RNA_Struct) {
738  PointerRNA opptr = RNA_property_pointer_get(ptr, prop);
739  changed |= WM_operator_properties_default(&opptr, do_update);
740  }
741  break;
742  }
743  default:
744  if ((do_update == false) || (RNA_property_is_set(ptr, prop) == false)) {
745  if (RNA_property_reset(ptr, prop, -1)) {
746  changed = true;
747  }
748  }
749  break;
750  }
751  }
753 
754  return changed;
755 }
756 
758 {
759  if (op->ptr->data) {
761 
762  RNA_PROP_BEGIN (op->ptr, itemptr, iterprop) {
763  PropertyRNA *prop = itemptr.data;
764 
765  if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
766  const char *identifier = RNA_property_identifier(prop);
767  RNA_struct_idprops_unset(op->ptr, identifier);
768  }
769  }
770  RNA_PROP_END;
771  }
772 }
773 
775 {
776  IDProperty *properties = ptr->data;
777 
778  if (properties) {
779  IDP_ClearProperty(properties);
780  }
781 }
782 
784 {
785  IDProperty *properties = ptr->data;
786 
787  if (properties) {
788  IDP_FreeProperty(properties);
789  ptr->data = NULL; /* just in case */
790  }
791 }
792 
795 /* -------------------------------------------------------------------- */
799 #if 1 /* may want to disable operator remembering previous state for testing */
800 
801 static bool operator_last_properties_init_impl(wmOperator *op, IDProperty *last_properties)
802 {
803  bool changed = false;
804  IDPropertyTemplate val = {0};
805  IDProperty *replaceprops = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
806 
807  CLOG_INFO(WM_LOG_OPERATORS, 1, "loading previous properties for '%s'", op->type->idname);
808 
810 
811  RNA_PROP_BEGIN (op->ptr, itemptr, iterprop) {
812  PropertyRNA *prop = itemptr.data;
813  if ((RNA_property_flag(prop) & PROP_SKIP_SAVE) == 0) {
814  if (!RNA_property_is_set(op->ptr, prop)) { /* don't override a setting already set */
815  const char *identifier = RNA_property_identifier(prop);
816  IDProperty *idp_src = IDP_GetPropertyFromGroup(last_properties, identifier);
817  if (idp_src) {
818  IDProperty *idp_dst = IDP_CopyProperty(idp_src);
819 
820  /* NOTE: in the future this may need to be done recursively,
821  * but for now RNA doesn't access nested operators */
822  idp_dst->flag |= IDP_FLAG_GHOST;
823 
824  /* add to temporary group instead of immediate replace,
825  * because we are iterating over this group */
826  IDP_AddToGroup(replaceprops, idp_dst);
827  changed = true;
828  }
829  }
830  }
831  }
832  RNA_PROP_END;
833 
834  IDP_MergeGroup(op->properties, replaceprops, true);
835  IDP_FreeProperty(replaceprops);
836  return changed;
837 }
838 
840 {
841  bool changed = false;
842  if (op->type->last_properties) {
844  LISTBASE_FOREACH (wmOperator *, opm, &op->macro) {
845  IDProperty *idp_src = IDP_GetPropertyFromGroup(op->type->last_properties, opm->idname);
846  if (idp_src) {
847  changed |= operator_last_properties_init_impl(opm, idp_src);
848  }
849  }
850  }
851  return changed;
852 }
853 
855 {
856  if (op->type->last_properties) {
858  op->type->last_properties = NULL;
859  }
860 
861  if (op->properties) {
862  CLOG_INFO(WM_LOG_OPERATORS, 1, "storing properties for '%s'", op->type->idname);
864  }
865 
866  if (op->macro.first != NULL) {
867  LISTBASE_FOREACH (wmOperator *, opm, &op->macro) {
868  if (opm->properties) {
869  if (op->type->last_properties == NULL) {
871  IDP_GROUP, &(IDPropertyTemplate){0}, "wmOperatorProperties");
872  }
873  IDProperty *idp_macro = IDP_CopyProperty(opm->properties);
874  STRNCPY(idp_macro->name, opm->type->idname);
875  IDP_ReplaceInGroup(op->type->last_properties, idp_macro);
876  }
877  }
878  }
879 
880  return (op->type->last_properties != NULL);
881 }
882 
883 #else
884 
886 {
887  return false;
888 }
889 
891 {
892  return false;
893 }
894 
895 #endif
896 
899 /* -------------------------------------------------------------------- */
904 {
905  PropertyRNA *wait_to_deselect_prop = RNA_struct_find_property(op->ptr,
906  "wait_to_deselect_others");
907  const short init_event_type = (short)POINTER_AS_INT(op->customdata);
908  int ret_value = 0;
909 
910  /* get settings from RNA properties for operator */
911  const int mval[2] = {RNA_int_get(op->ptr, "mouse_x"), RNA_int_get(op->ptr, "mouse_y")};
912 
913  if (init_event_type == 0) {
914  if (event->val == KM_PRESS) {
915  RNA_property_boolean_set(op->ptr, wait_to_deselect_prop, true);
916 
917  ret_value = op->type->exec(C, op);
918  OPERATOR_RETVAL_CHECK(ret_value);
919  op->customdata = POINTER_FROM_INT((int)event->type);
920  if (ret_value & OPERATOR_RUNNING_MODAL) {
922  }
923  return ret_value | OPERATOR_PASS_THROUGH;
924  }
925  /* If we are in init phase, and cannot validate init of modal operations,
926  * just fall back to basic exec.
927  */
928  RNA_property_boolean_set(op->ptr, wait_to_deselect_prop, false);
929 
930  ret_value = op->type->exec(C, op);
931  OPERATOR_RETVAL_CHECK(ret_value);
932 
933  return ret_value | OPERATOR_PASS_THROUGH;
934  }
935  if (event->type == init_event_type && event->val == KM_RELEASE) {
936  RNA_property_boolean_set(op->ptr, wait_to_deselect_prop, false);
937 
938  ret_value = op->type->exec(C, op);
939  OPERATOR_RETVAL_CHECK(ret_value);
940 
941  return ret_value | OPERATOR_PASS_THROUGH;
942  }
943  if (ISMOUSE_MOTION(event->type)) {
944  const int drag_delta[2] = {
945  mval[0] - event->mval[0],
946  mval[1] - event->mval[1],
947  };
948  /* If user moves mouse more than defined threshold, we consider select operator as
949  * finished. Otherwise, it is still running until we get an 'release' event. In any
950  * case, we pass through event, but select op is not finished yet. */
951  if (WM_event_drag_test_with_delta(event, drag_delta)) {
953  }
954  /* Important not to return anything other than PASS_THROUGH here,
955  * otherwise it prevents underlying drag detection code to work properly. */
956  return OPERATOR_PASS_THROUGH;
957  }
958 
960 }
961 
963 {
964  ARegion *region = CTX_wm_region(C);
965 
966  int mval[2];
967  WM_event_drag_start_mval(event, region, mval);
968 
969  RNA_int_set(op->ptr, "mouse_x", mval[0]);
970  RNA_int_set(op->ptr, "mouse_y", mval[1]);
971 
972  op->customdata = POINTER_FROM_INT(0);
973 
974  return op->type->modal(C, op, event);
975 }
976 
978 {
979  if (op->flag & OP_IS_INVOKE) {
981  View3D *v3d = CTX_wm_view3d(C);
982 
983  const float dia = v3d ? ED_view3d_grid_scale(scene, v3d, NULL) :
985 
986  /* always run, so the values are initialized,
987  * otherwise we may get differ behavior when (dia != 1.0) */
988  RNA_STRUCT_BEGIN (op->ptr, prop) {
989  if (RNA_property_type(prop) == PROP_FLOAT) {
990  PropertySubType pstype = RNA_property_subtype(prop);
991  if (pstype == PROP_DISTANCE) {
992  /* we don't support arrays yet */
993  BLI_assert(RNA_property_array_check(prop) == false);
994  /* initialize */
995  if (!RNA_property_is_set_ex(op->ptr, prop, false)) {
996  const float value = RNA_property_float_get_default(op->ptr, prop) * dia;
997  RNA_property_float_set(op->ptr, prop, value);
998  }
999  }
1000  }
1001  }
1003  }
1004 }
1005 
1007 {
1008  return (op->flag & OP_IS_INVOKE) ? U.smooth_viewtx : 0;
1009 }
1010 
1012 {
1013  PropertyRNA *prop = op->type->prop;
1014 
1015  if (prop == NULL) {
1016  CLOG_ERROR(WM_LOG_OPERATORS, "'%s' has no enum property set", op->type->idname);
1017  }
1018  else if (RNA_property_type(prop) != PROP_ENUM) {
1020  "'%s', '%s' is not an enum property",
1021  op->type->idname,
1022  RNA_property_identifier(prop));
1023  }
1024  else if (RNA_property_is_set(op->ptr, prop)) {
1025  const int retval = op->type->exec(C, op);
1026  OPERATOR_RETVAL_CHECK(retval);
1027  return retval;
1028  }
1029  else {
1030  uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
1031  uiLayout *layout = UI_popup_menu_layout(pup);
1032  /* set this so the default execution context is the same as submenus */
1033  uiLayoutSetOperatorContext(layout, opcontext);
1035  layout, op->type->idname, RNA_property_identifier(prop), op->ptr->data, opcontext, 0);
1036  UI_popup_menu_end(C, pup);
1037  return OPERATOR_INTERFACE;
1038  }
1039 
1040  return OPERATOR_CANCELLED;
1041 }
1042 
1044 {
1046 }
1047 
1049  wmOperator *op; /* the operator that will be executed when selecting an item */
1050 
1053 };
1054 
1056 static uiBlock *wm_enum_search_menu(bContext *C, ARegion *region, void *arg)
1057 {
1058  struct EnumSearchMenu *search_menu = arg;
1059  wmWindow *win = CTX_wm_window(C);
1060  wmOperator *op = search_menu->op;
1061  /* template_ID uses 4 * widget_unit for width,
1062  * we use a bit more, some items may have a suffix to show. */
1063  const int width = search_menu->use_previews ? 5 * U.widget_unit * search_menu->prv_cols :
1065  const int height = search_menu->use_previews ? 5 * U.widget_unit * search_menu->prv_rows :
1067  static char search[256] = "";
1068 
1069  uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
1072 
1073  search[0] = '\0';
1074  BLI_assert(search_menu->use_previews ||
1075  (search_menu->prv_cols == 0 && search_menu->prv_rows == 0));
1076 #if 0 /* ok, this isn't so easy... */
1077  uiDefBut(block,
1079  0,
1081  10,
1082  10,
1084  UI_UNIT_Y,
1085  NULL,
1086  0.0,
1087  0.0,
1088  0,
1089  0,
1090  "");
1091 #endif
1092  uiBut *but = uiDefSearchButO_ptr(block,
1093  op->type,
1094  op->ptr->data,
1095  search,
1096  0,
1097  ICON_VIEWZOOM,
1098  sizeof(search),
1099  10,
1100  10,
1101  width,
1102  UI_UNIT_Y,
1103  search_menu->prv_rows,
1104  search_menu->prv_cols,
1105  "");
1106 
1107  /* fake button, it holds space for search items */
1108  uiDefBut(block,
1110  0,
1111  "",
1112  10,
1113  10 - UI_searchbox_size_y(),
1114  width,
1115  height,
1116  NULL,
1117  0,
1118  0,
1119  0,
1120  0,
1121  NULL);
1122 
1123  /* Move it downwards, mouse over button. */
1124  UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, (const int[2]){0, -UI_UNIT_Y});
1125 
1126  UI_but_focus_on_enter_event(win, but);
1127 
1128  return block;
1129 }
1130 
1132 {
1133  static struct EnumSearchMenu search_menu;
1134 
1135  search_menu.op = op;
1136  search_menu.use_previews = true;
1137  search_menu.prv_cols = prv_cols;
1138  search_menu.prv_rows = prv_rows;
1139 
1141 
1142  return OPERATOR_INTERFACE;
1143 }
1144 
1146 {
1147  static struct EnumSearchMenu search_menu;
1148  search_menu.op = op;
1150  return OPERATOR_INTERFACE;
1151 }
1152 
1154  wmOperator *op,
1155  const char *title,
1156  const int icon,
1157  const char *message,
1158  const wmOperatorCallContext opcontext)
1159 {
1160  IDProperty *properties = op->ptr->data;
1161 
1162  if (properties && properties->len) {
1163  properties = IDP_CopyProperty(op->ptr->data);
1164  }
1165  else {
1166  properties = NULL;
1167  }
1168 
1169  uiPopupMenu *pup = UI_popup_menu_begin(C, title, icon);
1170  uiLayout *layout = UI_popup_menu_layout(pup);
1171  uiItemFullO_ptr(layout, op->type, message, ICON_NONE, properties, opcontext, 0, NULL);
1172  UI_popup_menu_end(C, pup);
1173 
1174  return OPERATOR_INTERFACE;
1175 }
1176 
1178 {
1180  C, op, IFACE_("OK?"), ICON_QUESTION, message, WM_OP_EXEC_REGION_WIN);
1181 }
1182 
1184 {
1186 }
1187 
1189 {
1190  const bool confirm = RNA_boolean_get(op->ptr, "confirm");
1191  if (confirm) {
1193  }
1194  return op->type->exec(C, op);
1195 }
1196 
1198 {
1199  if (RNA_struct_property_is_set(op->ptr, "filepath")) {
1200  return WM_operator_call_notest(C, op); /* call exec direct */
1201  }
1203  return OPERATOR_RUNNING_MODAL;
1204 }
1205 
1207 {
1208  char filepath[FILE_MAX];
1209  /* Don't NULL check prop, this can only run on ops with a 'filepath'. */
1210  PropertyRNA *prop = RNA_struct_find_property(op->ptr, "filepath");
1211  RNA_property_string_get(op->ptr, prop, filepath);
1212  if (BKE_image_path_ensure_ext_from_imformat(filepath, im_format)) {
1213  RNA_property_string_set(op->ptr, prop, filepath);
1214  /* NOTE: we could check for and update 'filename' here,
1215  * but so far nothing needs this. */
1216  return true;
1217  }
1218  return false;
1219 }
1220 
1222 {
1223  if (CTX_wm_window(C) == NULL) {
1224  return 0;
1225  }
1226  return 1;
1227 }
1228 
1229 bool WM_operator_check_ui_enabled(const bContext *C, const char *idname)
1230 {
1233 
1234  return !((ED_undo_is_valid(C, idname) == false) || WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY));
1235 }
1236 
1238 {
1240 
1241  /* only for operators that are registered and did an undo push */
1243  if ((op->type->flag & OPTYPE_REGISTER) && (op->type->flag & OPTYPE_UNDO)) {
1244  return op;
1245  }
1246  }
1247 
1248  return NULL;
1249 }
1250 
1252 {
1253  if (ot->last_properties == NULL) {
1254  IDPropertyTemplate val = {0};
1255  ot->last_properties = IDP_New(IDP_GROUP, &val, "wmOperatorProperties");
1256  }
1257  return ot->last_properties;
1258 }
1259 
1261 {
1263  RNA_pointer_create(G_MAIN->wm.first, ot->srna, props, ptr);
1264 }
1265 
1266 ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short idcode)
1267 {
1268  Main *bmain = CTX_data_main(C);
1269  ID *id = NULL;
1270 
1271  /* check input variables */
1272  if (RNA_struct_property_is_set(op->ptr, "filepath")) {
1273  const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path");
1274  char path[FILE_MAX];
1275  bool exists = false;
1276 
1277  RNA_string_get(op->ptr, "filepath", path);
1278 
1279  errno = 0;
1280 
1281  if (idcode == ID_IM) {
1282  id = (ID *)BKE_image_load_exists_ex(bmain, path, &exists);
1283  }
1284  else {
1286  }
1287 
1288  if (!id) {
1290  RPT_ERROR,
1291  "Cannot read %s '%s': %s",
1292  BKE_idtype_idcode_to_name(idcode),
1293  path,
1294  errno ? strerror(errno) : TIP_("unsupported format"));
1295  return NULL;
1296  }
1297 
1298  if (is_relative_path) {
1299  if (exists == false) {
1300  if (idcode == ID_IM) {
1301  BLI_path_rel(((Image *)id)->filepath, BKE_main_blendfile_path(bmain));
1302  }
1303  else {
1305  }
1306  }
1307  }
1308 
1309  return id;
1310  }
1311 
1313  return NULL;
1314  }
1315 
1316  /* Lookup an already existing ID. */
1318 
1319  if (!id) {
1320  /* Print error with the name if the name is available. */
1321 
1322  if (RNA_struct_property_is_set(op->ptr, "name")) {
1323  char name[MAX_ID_NAME - 2];
1324  RNA_string_get(op->ptr, "name", name);
1325  BKE_reportf(
1326  op->reports, RPT_ERROR, "%s '%s' not found", BKE_idtype_idcode_to_name(idcode), name);
1327  return NULL;
1328  }
1329 
1330  BKE_reportf(op->reports, RPT_ERROR, "%s not found", BKE_idtype_idcode_to_name(idcode));
1331  return NULL;
1332  }
1333 
1334  id_us_plus(id);
1335  return id;
1336 }
1337 
1338 static void wm_block_redo_cb(bContext *C, void *arg_op, int UNUSED(arg_event))
1339 {
1340  wmOperator *op = arg_op;
1341 
1342  if (op == WM_operator_last_redo(C)) {
1343  /* operator was already executed once? undo & repeat */
1345  }
1346  else {
1347  /* operator not executed yet, call it */
1348  ED_undo_push_op(C, op);
1350 
1352  }
1353 }
1354 
1355 static void wm_block_redo_cancel_cb(bContext *C, void *arg_op)
1356 {
1357  wmOperator *op = arg_op;
1358 
1359  /* if operator never got executed, free it */
1360  if (op != WM_operator_last_redo(C)) {
1362  }
1363 }
1364 
1365 static uiBlock *wm_block_create_redo(bContext *C, ARegion *region, void *arg_op)
1366 {
1367  wmOperator *op = arg_op;
1368  const uiStyle *style = UI_style_get_dpi();
1369  int width = 15 * UI_UNIT_X;
1370 
1371  uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
1374 
1375  /* UI_BLOCK_NUMSELECT for layer buttons */
1377 
1378  /* if register is not enabled, the operator gets freed on OPERATOR_FINISHED
1379  * ui_apply_but_funcs_after calls ED_undo_operator_repeate_cb and crashes */
1381 
1383  uiLayout *layout = UI_block_layout(
1384  block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, 0, style);
1385 
1386  if (op == WM_operator_last_redo(C)) {
1388  uiLayoutSetEnabled(layout, false);
1389  }
1390  }
1391 
1392  uiLayout *col = uiLayoutColumn(layout, false);
1395 
1396  UI_block_bounds_set_popup(block, 6 * U.dpi_fac, NULL);
1397 
1398  return block;
1399 }
1400 
1401 typedef struct wmOpPopUp {
1403  int width;
1404  int height;
1405  int free_op;
1407 
1408 /* Only invoked by OK button in popups created with wm_block_dialog_create() */
1409 static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
1410 {
1411  wmOperator *op;
1412  {
1413  /* Execute will free the operator.
1414  * In this case, wm_operator_ui_popup_cancel won't run. */
1415  wmOpPopUp *data = arg1;
1416  op = data->op;
1417  MEM_freeN(data);
1418  }
1419 
1420  uiBlock *block = arg2;
1421  /* Explicitly set UI_RETURN_OK flag, otherwise the menu might be canceled
1422  * in case WM_operator_call_ex exits/reloads the current file (T49199). */
1423 
1424  UI_popup_menu_retval_set(block, UI_RETURN_OK, true);
1425 
1426  /* Get context data *after* WM_operator_call_ex
1427  * which might have closed the current file and changed context. */
1428  wmWindow *win = CTX_wm_window(C);
1429  UI_popup_block_close(C, win, block);
1430 
1431  WM_operator_call_ex(C, op, true);
1432 }
1433 
1434 /* Dialogs are popups that require user verification (click OK) before exec */
1435 static uiBlock *wm_block_dialog_create(bContext *C, ARegion *region, void *userData)
1436 {
1437  wmOpPopUp *data = userData;
1438  wmOperator *op = data->op;
1439  const uiStyle *style = UI_style_get_dpi();
1440 
1441  uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
1444 
1445  /* intentionally don't use 'UI_BLOCK_MOVEMOUSE_QUIT', some dialogues have many items
1446  * where quitting by accident is very annoying */
1448 
1449  uiLayout *layout = UI_block_layout(
1450  block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
1451 
1454 
1455  /* clear so the OK button is left alone */
1456  UI_block_func_set(block, NULL, NULL, NULL);
1457 
1458  /* new column so as not to interfere with custom layouts T26436. */
1459  {
1460  uiLayout *col = uiLayoutColumn(layout, false);
1461  uiBlock *col_block = uiLayoutGetBlock(col);
1462  /* Create OK button, the callback of which will execute op */
1463  uiBut *but = uiDefBut(
1464  col_block, UI_BTYPE_BUT, 0, IFACE_("OK"), 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, "");
1466  UI_but_func_set(but, dialog_exec_cb, data, col_block);
1467  }
1468 
1469  /* center around the mouse */
1471  block, 6 * U.dpi_fac, (const int[2]){data->width / -2, data->height / 2});
1472 
1473  return block;
1474 }
1475 
1476 static uiBlock *wm_operator_ui_create(bContext *C, ARegion *region, void *userData)
1477 {
1478  wmOpPopUp *data = userData;
1479  wmOperator *op = data->op;
1480  const uiStyle *style = UI_style_get_dpi();
1481 
1482  uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS);
1486 
1487  uiLayout *layout = UI_block_layout(
1488  block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, data->height, 0, style);
1489 
1490  /* since ui is defined the auto-layout args are not used */
1492 
1493  UI_block_func_set(block, NULL, NULL, NULL);
1494 
1495  UI_block_bounds_set_popup(block, 6 * U.dpi_fac, NULL);
1496 
1497  return block;
1498 }
1499 
1500 static void wm_operator_ui_popup_cancel(struct bContext *C, void *userData)
1501 {
1502  wmOpPopUp *data = userData;
1503  wmOperator *op = data->op;
1504 
1505  if (op) {
1506  if (op->type->cancel) {
1507  op->type->cancel(C, op);
1508  }
1509 
1510  if (data->free_op) {
1511  WM_operator_free(op);
1512  }
1513  }
1514 
1515  MEM_freeN(data);
1516 }
1517 
1518 static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
1519 {
1520  wmOpPopUp *data = arg;
1521  wmOperator *op = data->op;
1522 
1523  if (op && retval > 0) {
1524  WM_operator_call_ex(C, op, true);
1525  }
1526 
1527  MEM_freeN(data);
1528 }
1529 
1531 {
1532  wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup");
1533  data->op = op;
1534  data->width = width * U.dpi_fac;
1535  /* Actual used height depends on the content. */
1536  data->height = 0;
1537  data->free_op = true; /* if this runs and gets registered we may want not to free it */
1539  return OPERATOR_RUNNING_MODAL;
1540 }
1541 
1547  wmOperator *op,
1548  const bool do_call,
1549  const bool do_redo)
1550 {
1551  if ((op->type->flag & OPTYPE_REGISTER) == 0) {
1552  BKE_reportf(op->reports,
1553  RPT_ERROR,
1554  "Operator '%s' does not have register enabled, incorrect invoke function",
1555  op->type->idname);
1556  return OPERATOR_CANCELLED;
1557  }
1558 
1559  if (do_redo) {
1560  if ((op->type->flag & OPTYPE_UNDO) == 0) {
1561  BKE_reportf(op->reports,
1562  RPT_ERROR,
1563  "Operator '%s' does not have undo enabled, incorrect invoke function",
1564  op->type->idname);
1565  return OPERATOR_CANCELLED;
1566  }
1567  }
1568 
1569  /* if we don't have global undo, we can't do undo push for automatic redo,
1570  * so we require manual OK clicking in this popup */
1571  if (!do_redo || !(U.uiflag & USER_GLOBALUNDO)) {
1572  return WM_operator_props_dialog_popup(C, op, 300);
1573  }
1574 
1576 
1577  if (do_call) {
1578  wm_block_redo_cb(C, op, 0);
1579  }
1580 
1581  return OPERATOR_RUNNING_MODAL;
1582 }
1583 
1585 {
1586  return wm_operator_props_popup_ex(C, op, false, false);
1587 }
1588 
1590 {
1591  return wm_operator_props_popup_ex(C, op, true, true);
1592 }
1593 
1595 {
1596  return wm_operator_props_popup_ex(C, op, false, true);
1597 }
1598 
1600 {
1601  wmOpPopUp *data = MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup");
1602 
1603  data->op = op;
1604  data->width = width * U.dpi_fac;
1605  /* Actual height depends on the content. */
1606  data->height = 0;
1607  data->free_op = true; /* if this runs and gets registered we may want not to free it */
1608 
1609  /* op is not executed until popup OK but is clicked */
1612 
1613  return OPERATOR_RUNNING_MODAL;
1614 }
1615 
1617 {
1618  /* CTX_wm_reports(C) because operator is on stack, not active in event system */
1619  if ((op->type->flag & OPTYPE_REGISTER) == 0) {
1621  RPT_ERROR,
1622  "Operator redo '%s' does not have register enabled, incorrect invoke function",
1623  op->type->idname);
1624  return OPERATOR_CANCELLED;
1625  }
1626  if (op->type->poll && op->type->poll(C) == 0) {
1627  BKE_reportf(
1628  CTX_wm_reports(C), RPT_ERROR, "Operator redo '%s': wrong context", op->type->idname);
1629  return OPERATOR_CANCELLED;
1630  }
1631 
1633 
1634  return OPERATOR_CANCELLED;
1635 }
1636 
1639 /* -------------------------------------------------------------------- */
1646 {
1647  G.debug_value = RNA_int_get(op->ptr, "debug_value");
1650 
1651  return OPERATOR_FINISHED;
1652 }
1653 
1654 static int wm_debug_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
1655 {
1656  RNA_int_set(op->ptr, "debug_value", G.debug_value);
1657  return WM_operator_props_dialog_popup(C, op, 250);
1658 }
1659 
1661 {
1662  ot->name = "Debug Menu";
1663  ot->idname = "WM_OT_debug_menu";
1664  ot->description = "Open a popup to set the debug level";
1665 
1669 
1670  RNA_def_int(ot->srna, "debug_value", 0, SHRT_MIN, SHRT_MAX, "Debug Value", "", -10000, 10000);
1671 }
1672 
1675 /* -------------------------------------------------------------------- */
1680 {
1681  PointerRNA ptr = CTX_data_pointer_get_type(C, "active_operator", &RNA_Operator);
1682 
1683  if (!ptr.data) {
1684  BKE_report(op->reports, RPT_ERROR, "No operator in context");
1685  return OPERATOR_CANCELLED;
1686  }
1687 
1689  return OPERATOR_FINISHED;
1690 }
1691 
1692 /* used by operator preset menu. pre-2.65 this was a 'Reset' button */
1694 {
1695  ot->name = "Restore Operator Defaults";
1696  ot->idname = "WM_OT_operator_defaults";
1697  ot->description = "Set the active operator to its default values";
1698 
1700 
1701  ot->flag = OPTYPE_INTERNAL;
1702 }
1703 
1706 /* -------------------------------------------------------------------- */
1711  enum {
1715 
1716  int size[2];
1717 };
1718 
1719 static uiBlock *wm_block_search_menu(bContext *C, ARegion *region, void *userdata)
1720 {
1721  const struct SearchPopupInit_Data *init_data = userdata;
1722  static char search[256] = "";
1723 
1724  uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS);
1727 
1728  uiBut *but = uiDefSearchBut(block,
1729  search,
1730  0,
1731  ICON_VIEWZOOM,
1732  sizeof(search),
1733  10,
1734  10,
1735  init_data->size[0],
1736  UI_UNIT_Y,
1737  0,
1738  0,
1739  "");
1740 
1741  if (init_data->search_type == SEARCH_TYPE_OPERATOR) {
1743  }
1744  else if (init_data->search_type == SEARCH_TYPE_MENU) {
1746  }
1747  else {
1749  }
1750 
1752 
1753  /* fake button, it holds space for search items */
1754  uiDefBut(block,
1756  0,
1757  "",
1758  10,
1759  10 - init_data->size[1],
1760  init_data->size[0],
1761  init_data->size[1],
1762  NULL,
1763  0,
1764  0,
1765  0,
1766  0,
1767  NULL);
1768 
1769  /* Move it downwards, mouse over button. */
1770  UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, (const int[2]){0, -UI_UNIT_Y});
1771 
1772  return block;
1773 }
1774 
1776 {
1777  return OPERATOR_FINISHED;
1778 }
1779 
1780 static int wm_search_menu_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1781 {
1782  /* Exception for launching via spacebar */
1783  if (event->type == EVT_SPACEKEY) {
1784  bool ok = true;
1785  ScrArea *area = CTX_wm_area(C);
1786  if (area) {
1787  if (area->spacetype == SPACE_CONSOLE) {
1788  /* So we can use the shortcut in the console. */
1789  ok = false;
1790  }
1791  else if (area->spacetype == SPACE_TEXT) {
1792  /* So we can use the spacebar in the text editor. */
1793  ok = false;
1794  }
1795  }
1796  else {
1797  Object *editob = CTX_data_edit_object(C);
1798  if (editob && editob->type == OB_FONT) {
1799  /* So we can use the spacebar for entering text. */
1800  ok = false;
1801  }
1802  }
1803  if (!ok) {
1804  return OPERATOR_PASS_THROUGH;
1805  }
1806  }
1807 
1808  int search_type;
1809  if (STREQ(op->type->idname, "WM_OT_search_menu")) {
1811  }
1812  else {
1814  }
1815 
1816  static struct SearchPopupInit_Data data;
1817  data = (struct SearchPopupInit_Data){
1818  .search_type = search_type,
1819  .size = {UI_searchbox_size_x() * 2, UI_searchbox_size_y()},
1820  };
1821 
1823 
1824  return OPERATOR_INTERFACE;
1825 }
1826 
1828 {
1829  ot->name = "Search Menu";
1830  ot->idname = "WM_OT_search_menu";
1831  ot->description = "Pop-up a search over all menus in the current context";
1832 
1836 }
1837 
1839 {
1840  ot->name = "Search Operator";
1841  ot->idname = "WM_OT_search_operator";
1842  ot->description = "Pop-up a search over all available operators in current context";
1843 
1847 }
1848 
1850 {
1851  char idname[BKE_ST_MAXNAME];
1852  RNA_string_get(op->ptr, "name", idname);
1853 
1854  return UI_popup_menu_invoke(C, idname, op->reports);
1855 }
1856 
1858 {
1859  char idname[BKE_ST_MAXNAME];
1860  RNA_string_get(ptr, "name", idname);
1861  MenuType *mt = WM_menutype_find(idname, true);
1862  return (mt) ? CTX_IFACE_(mt->translation_context, mt->label) :
1864 }
1865 
1867 {
1868  ot->name = "Call Menu";
1869  ot->idname = "WM_OT_call_menu";
1870  ot->description = "Open a predefined menu";
1871 
1875 
1876  ot->flag = OPTYPE_INTERNAL;
1877 
1878  PropertyRNA *prop;
1879 
1880  prop = RNA_def_string(ot->srna, "name", NULL, BKE_ST_MAXNAME, "Name", "Name of the menu");
1882  prop,
1884  /* Only a suggestion as menu items may be referenced from add-ons that have been disabled. */
1886 }
1887 
1888 static int wm_call_pie_menu_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1889 {
1890  char idname[BKE_ST_MAXNAME];
1891  RNA_string_get(op->ptr, "name", idname);
1892 
1893  return UI_pie_menu_invoke(C, idname, event);
1894 }
1895 
1897 {
1898  char idname[BKE_ST_MAXNAME];
1899  RNA_string_get(op->ptr, "name", idname);
1900 
1901  return UI_pie_menu_invoke(C, idname, CTX_wm_window(C)->eventstate);
1902 }
1903 
1905 {
1906  ot->name = "Call Pie Menu";
1907  ot->idname = "WM_OT_call_menu_pie";
1908  ot->description = "Open a predefined pie menu";
1909 
1914 
1915  ot->flag = OPTYPE_INTERNAL;
1916 
1917  PropertyRNA *prop;
1918 
1919  prop = RNA_def_string(ot->srna, "name", NULL, BKE_ST_MAXNAME, "Name", "Name of the pie menu");
1921  prop,
1923  /* Only a suggestion as menu items may be referenced from add-ons that have been disabled. */
1925 }
1926 
1928 {
1929  char idname[BKE_ST_MAXNAME];
1930  RNA_string_get(op->ptr, "name", idname);
1931  const bool keep_open = RNA_boolean_get(op->ptr, "keep_open");
1932 
1933  return UI_popover_panel_invoke(C, idname, keep_open, op->reports);
1934 }
1935 
1937 {
1938  char idname[BKE_ST_MAXNAME];
1939  RNA_string_get(ptr, "name", idname);
1940  PanelType *pt = WM_paneltype_find(idname, true);
1941  return (pt) ? CTX_IFACE_(pt->translation_context, pt->label) :
1943 }
1944 
1946 {
1947  ot->name = "Call Panel";
1948  ot->idname = "WM_OT_call_panel";
1949  ot->description = "Open a predefined panel";
1950 
1954 
1955  ot->flag = OPTYPE_INTERNAL;
1956 
1957  PropertyRNA *prop;
1958 
1959  prop = RNA_def_string(ot->srna, "name", NULL, BKE_ST_MAXNAME, "Name", "Name of the menu");
1961  prop,
1963  /* Only a suggestion as menu items may be referenced from add-ons that have been disabled. */
1966  prop = RNA_def_boolean(ot->srna, "keep_open", true, "Keep Open", "");
1968 }
1969 
1972 /* -------------------------------------------------------------------- */
1976 /* this poll functions is needed in place of WM_operator_winactive
1977  * while it crashes on full screen */
1979 {
1980  wmWindow *win = CTX_wm_window(C);
1981  bScreen *screen;
1982 
1983  if (win == NULL) {
1984  return 0;
1985  }
1986  if (!((screen = WM_window_get_active_screen(win)) && (screen->state == SCREENNORMAL))) {
1987  return 0;
1988  }
1989  if (G.background) {
1990  return 0;
1991  }
1992 
1993  return 1;
1994 }
1995 
1996 /* included for script-access */
1998 {
1999  ot->name = "Close Window";
2000  ot->idname = "WM_OT_window_close";
2001  ot->description = "Close the current window";
2002 
2005 }
2006 
2008 {
2009  ot->name = "New Window";
2010  ot->idname = "WM_OT_window_new";
2011  ot->description = "Create a new window";
2012 
2015 }
2016 
2018 {
2019  ot->name = "New Main Window";
2020  ot->idname = "WM_OT_window_new_main";
2021  ot->description = "Create a new main window with its own workspace and scene selection";
2022 
2025 }
2026 
2028 {
2029  ot->name = "Toggle Window Fullscreen";
2030  ot->idname = "WM_OT_window_fullscreen_toggle";
2031  ot->description = "Toggle the current window full-screen";
2032 
2035 }
2036 
2038 {
2040  return OPERATOR_FINISHED;
2041 }
2042 
2044  wmOperator *UNUSED(op),
2045  const wmEvent *UNUSED(event))
2046 {
2047  if (U.uiflag & USER_SAVE_PROMPT) {
2049  }
2050  else {
2052  }
2053  return OPERATOR_FINISHED;
2054 }
2055 
2057 {
2058  ot->name = "Quit Blender";
2059  ot->idname = "WM_OT_quit_blender";
2060  ot->description = "Quit Blender";
2061 
2064 }
2065 
2068 /* -------------------------------------------------------------------- */
2072 #if defined(WIN32)
2073 
2074 static int wm_console_toggle_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
2075 {
2077  return OPERATOR_FINISHED;
2078 }
2079 
2080 static void WM_OT_console_toggle(wmOperatorType *ot)
2081 {
2082  /* XXX Have to mark these for xgettext, as under linux they do not exists... */
2083  ot->name = CTX_N_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Toggle System Console");
2084  ot->idname = "WM_OT_console_toggle";
2085  ot->description = N_("Toggle System Console");
2086 
2087  ot->exec = wm_console_toggle_exec;
2089 }
2090 
2091 #endif
2092 
2095 /* -------------------------------------------------------------------- */
2105  short region_type,
2106  bool (*poll)(bContext *C),
2107  wmPaintCursorDraw draw,
2108  void *customdata)
2109 {
2110  wmWindowManager *wm = G_MAIN->wm.first;
2111 
2112  wmPaintCursor *pc = MEM_callocN(sizeof(wmPaintCursor), "paint cursor");
2113 
2114  BLI_addtail(&wm->paintcursors, pc);
2115 
2116  pc->customdata = customdata;
2117  pc->poll = poll;
2118  pc->draw = draw;
2119 
2120  pc->space_type = space_type;
2121  pc->region_type = region_type;
2122 
2123  return pc;
2124 }
2125 
2127 {
2128  wmWindowManager *wm = G_MAIN->wm.first;
2130  if (pc == (wmPaintCursor *)handle) {
2131  BLI_remlink(&wm->paintcursors, pc);
2132  MEM_freeN(pc);
2133  return true;
2134  }
2135  }
2136  return false;
2137 }
2138 
2139 void WM_paint_cursor_remove_by_type(wmWindowManager *wm, void *draw_fn, void (*free)(void *))
2140 {
2142  if (pc->draw == draw_fn) {
2143  if (free) {
2144  free(pc->customdata);
2145  }
2146  BLI_remlink(&wm->paintcursors, pc);
2147  MEM_freeN(pc);
2148  }
2149  }
2150 }
2151 
2154 /* -------------------------------------------------------------------- */
2158 #define WM_RADIAL_CONTROL_DISPLAY_SIZE (200 * UI_DPI_FAC)
2159 #define WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE (35 * UI_DPI_FAC)
2160 #define WM_RADIAL_CONTROL_DISPLAY_WIDTH \
2161  (WM_RADIAL_CONTROL_DISPLAY_SIZE - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE)
2162 #define WM_RADIAL_MAX_STR 10
2163 
2164 typedef struct {
2167  PointerRNA ptr, col_ptr, fill_col_ptr, rot_ptr, zoom_ptr, image_id_ptr;
2168  PointerRNA fill_col_override_ptr, fill_col_override_test_ptr;
2169  PropertyRNA *prop, *col_prop, *fill_col_prop, *rot_prop, *zoom_prop;
2170  PropertyRNA *fill_col_override_prop, *fill_col_override_test_prop;
2172  float initial_value, current_value, min_value, max_value;
2173  int initial_mouse[2];
2174  int initial_co[2];
2175  int slow_mouse[2];
2181  void *cursor;
2184 } RadialControl;
2185 
2187 {
2188  RadialControl *rc = op->customdata;
2189  char msg[UI_MAX_DRAW_STR];
2190  ScrArea *area = CTX_wm_area(C);
2192 
2193  if (hasNumInput(&rc->num_input)) {
2194  char num_str[NUM_STR_REP_LEN];
2195  outputNumInput(&rc->num_input, num_str, &scene->unit);
2196  BLI_snprintf(msg, sizeof(msg), "%s: %s", RNA_property_ui_name(rc->prop), num_str);
2197  }
2198  else {
2199  const char *ui_name = RNA_property_ui_name(rc->prop);
2200  switch (rc->subtype) {
2201  case PROP_NONE:
2202  case PROP_DISTANCE:
2203  BLI_snprintf(msg, sizeof(msg), "%s: %0.4f", ui_name, rc->current_value);
2204  break;
2205  case PROP_PIXEL:
2206  BLI_snprintf(msg,
2207  sizeof(msg),
2208  "%s: %d",
2209  ui_name,
2210  (int)rc->current_value); /* XXX: round to nearest? */
2211  break;
2212  case PROP_PERCENTAGE:
2213  BLI_snprintf(msg, sizeof(msg), "%s: %3.1f%%", ui_name, rc->current_value);
2214  break;
2215  case PROP_FACTOR:
2216  BLI_snprintf(msg, sizeof(msg), "%s: %1.3f", ui_name, rc->current_value);
2217  break;
2218  case PROP_ANGLE:
2219  BLI_snprintf(msg, sizeof(msg), "%s: %3.2f", ui_name, RAD2DEGF(rc->current_value));
2220  break;
2221  default:
2222  BLI_snprintf(msg, sizeof(msg), "%s", ui_name); /* XXX: No value? */
2223  break;
2224  }
2225  }
2226 
2227  ED_area_status_text(area, msg);
2228 }
2229 
2231 {
2232  float d[2] = {0, 0};
2233  float zoom[2] = {1, 1};
2234 
2235  copy_v2_v2_int(rc->initial_mouse, event->xy);
2236  copy_v2_v2_int(rc->initial_co, event->xy);
2237 
2238  switch (rc->subtype) {
2239  case PROP_NONE:
2240  case PROP_DISTANCE:
2241  case PROP_PIXEL:
2242  d[0] = rc->initial_value;
2243  break;
2244  case PROP_PERCENTAGE:
2245  d[0] = (rc->initial_value) / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH +
2247  break;
2248  case PROP_FACTOR:
2251  break;
2252  case PROP_ANGLE:
2255  break;
2256  default:
2257  return;
2258  }
2259 
2260  if (rc->zoom_prop) {
2262  d[0] *= zoom[0];
2263  d[1] *= zoom[1];
2264  }
2265 
2266  rc->initial_mouse[0] -= d[0];
2267  rc->initial_mouse[1] -= d[1];
2268 }
2269 
2271 {
2272  ImBuf *ibuf;
2273 
2274  switch (RNA_type_to_ID_code(rc->image_id_ptr.type)) {
2275  case ID_BR:
2277  rc->image_id_ptr.data,
2278  rc->use_secondary_tex,
2280 
2282  "radial_control", ibuf->x, ibuf->y, 1, GPU_R8, ibuf->rect_float);
2283 
2284  GPU_texture_filter_mode(rc->texture, true);
2285  GPU_texture_swizzle_set(rc->texture, "111r");
2286 
2287  MEM_freeN(ibuf->rect_float);
2288  MEM_freeN(ibuf);
2289  }
2290  break;
2291  default:
2292  break;
2293  }
2294 }
2295 
2296 static void radial_control_paint_tex(RadialControl *rc, float radius, float alpha)
2297 {
2298 
2299  /* set fill color */
2300  float col[3] = {0, 0, 0};
2301  if (rc->fill_col_prop) {
2302  PointerRNA *fill_ptr;
2303  PropertyRNA *fill_prop;
2304 
2307  fill_ptr = &rc->fill_col_override_ptr;
2308  fill_prop = rc->fill_col_override_prop;
2309  }
2310  else {
2311  fill_ptr = &rc->fill_col_ptr;
2312  fill_prop = rc->fill_col_prop;
2313  }
2314 
2315  RNA_property_float_get_array(fill_ptr, fill_prop, col);
2316  }
2317 
2320 
2321  if (rc->texture) {
2322  uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
2323 
2324  /* set up rotation if available */
2325  if (rc->rot_prop) {
2326  float rot = RNA_property_float_get(&rc->rot_ptr, rc->rot_prop);
2327  GPU_matrix_push();
2329  }
2330 
2332 
2333  immUniformColor3fvAlpha(col, alpha);
2334  immBindTexture("image", rc->texture);
2335 
2336  /* draw textured quad */
2338 
2339  immAttr2f(texCoord, 0, 0);
2340  immVertex2f(pos, -radius, -radius);
2341 
2342  immAttr2f(texCoord, 1, 0);
2343  immVertex2f(pos, radius, -radius);
2344 
2345  immAttr2f(texCoord, 1, 1);
2346  immVertex2f(pos, radius, radius);
2347 
2348  immAttr2f(texCoord, 0, 1);
2349  immVertex2f(pos, -radius, radius);
2350 
2351  immEnd();
2352 
2354 
2355  /* undo rotation */
2356  if (rc->rot_prop) {
2357  GPU_matrix_pop();
2358  }
2359  }
2360  else {
2361  /* flat color if no texture available */
2363  immUniformColor3fvAlpha(col, alpha);
2364  imm_draw_circle_fill_2d(pos, 0.0f, 0.0f, radius, 40);
2365  }
2366 
2367  immUnbindProgram();
2368 }
2369 
2370 static void radial_control_paint_curve(uint pos, Brush *br, float radius, int line_segments)
2371 {
2372  GPU_line_width(2.0f);
2373  immUniformColor4f(0.8f, 0.8f, 0.8f, 0.85f);
2374  float step = (radius * 2.0f) / (float)line_segments;
2376  immBegin(GPU_PRIM_LINES, line_segments * 2);
2377  for (int i = 0; i < line_segments; i++) {
2378  float h1 = BKE_brush_curve_strength_clamped(br, fabsf((i * step) - radius), radius);
2379  immVertex2f(pos, -radius + (i * step), h1 * radius);
2380  float h2 = BKE_brush_curve_strength_clamped(br, fabsf(((i + 1) * step) - radius), radius);
2381  immVertex2f(pos, -radius + ((i + 1) * step), h2 * radius);
2382  }
2383  immEnd();
2384 }
2385 
2386 static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void *customdata)
2387 {
2388  RadialControl *rc = customdata;
2389  const uiStyle *style = UI_style_get();
2390  const uiFontStyle *fstyle = &style->widget;
2391  const int fontid = fstyle->uifont_id;
2392  short fstyle_points = fstyle->points;
2393  char str[WM_RADIAL_MAX_STR];
2394  short strdrawlen = 0;
2395  float strwidth, strheight;
2396  float r1 = 0.0f, r2 = 0.0f, rmin = 0.0, tex_radius, alpha;
2397  float zoom[2], col[4] = {1.0f, 1.0f, 1.0f, 1.0f};
2398  float text_color[4];
2399 
2400  switch (rc->subtype) {
2401  case PROP_NONE:
2402  case PROP_DISTANCE:
2403  case PROP_PIXEL:
2404  r1 = rc->current_value;
2405  r2 = rc->initial_value;
2406  tex_radius = r1;
2407  alpha = 0.75;
2408  break;
2409  case PROP_PERCENTAGE:
2410  r1 = rc->current_value / 100.0f * WM_RADIAL_CONTROL_DISPLAY_WIDTH +
2412  r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
2414  BLI_snprintf(str, WM_RADIAL_MAX_STR, "%3.1f%%", rc->current_value);
2415  strdrawlen = BLI_strlen_utf8(str);
2416  tex_radius = r1;
2417  alpha = 0.75;
2418  break;
2419  case PROP_FACTOR:
2422  r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
2424  alpha = rc->current_value / 2.0f + 0.5f;
2426  strdrawlen = BLI_strlen_utf8(str);
2427  break;
2428  case PROP_ANGLE:
2429  r1 = r2 = tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE;
2430  alpha = 0.75;
2433  strdrawlen = BLI_strlen_utf8(str);
2434  break;
2435  default:
2436  tex_radius = WM_RADIAL_CONTROL_DISPLAY_SIZE; /* NOTE: this is a dummy value. */
2437  alpha = 0.75;
2438  break;
2439  }
2440 
2441  if (rc->subtype == PROP_ANGLE) {
2442  /* Use the initial mouse position to draw the rotation preview. This avoids starting the
2443  * rotation in a random direction */
2444  x = rc->initial_mouse[0];
2445  y = rc->initial_mouse[1];
2446  }
2447  else {
2448  /* Keep cursor in the original place */
2449  x = rc->initial_co[0];
2450  y = rc->initial_co[1];
2451  }
2452  GPU_matrix_translate_2f((float)x, (float)y);
2453 
2455  GPU_line_smooth(true);
2456 
2457  /* apply zoom if available */
2458  if (rc->zoom_prop) {
2460  GPU_matrix_scale_2fv(zoom);
2461  }
2462 
2463  /* draw rotated texture */
2464  radial_control_paint_tex(rc, tex_radius, alpha);
2465 
2466  /* set line color */
2467  if (rc->col_prop) {
2469  }
2470 
2473 
2475 
2476  if (rc->subtype == PROP_ANGLE) {
2477  GPU_matrix_push();
2478 
2479  /* draw original angle line */
2480  GPU_matrix_rotate_3f(RAD2DEGF(rc->initial_value), 0.0f, 0.0f, 1.0f);
2484  immEnd();
2485 
2486  /* draw new angle line */
2487  GPU_matrix_rotate_3f(RAD2DEGF(rc->current_value - rc->initial_value), 0.0f, 0.0f, 1.0f);
2491  immEnd();
2492 
2493  GPU_matrix_pop();
2494  }
2495 
2496  /* draw circles on top */
2497  GPU_line_width(2.0f);
2499  imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, r1, 80);
2500 
2501  GPU_line_width(1.0f);
2503  imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, r2, 80);
2504  if (rmin > 0.0f) {
2505  /* Inner fill circle to increase the contrast of the value */
2506  const float black[3] = {0.0f};
2507  immUniformColor3fvAlpha(black, 0.2f);
2508  imm_draw_circle_fill_2d(pos, 0.0, 0.0f, rmin, 80);
2509 
2511  imm_draw_circle_wire_2d(pos, 0.0, 0.0f, rmin, 80);
2512  }
2513 
2514  /* draw curve falloff preview */
2516  Brush *br = rc->image_id_ptr.data;
2517  if (br) {
2518  radial_control_paint_curve(pos, br, r2, 120);
2519  }
2520  }
2521 
2522  immUnbindProgram();
2523 
2524  BLF_size(fontid, 1.75f * fstyle_points * U.pixelsize, U.dpi);
2525  UI_GetThemeColor4fv(TH_TEXT_HI, text_color);
2526  BLF_color4fv(fontid, text_color);
2527 
2528  /* draw value */
2529  BLF_width_and_height(fontid, str, strdrawlen, &strwidth, &strheight);
2530  BLF_position(fontid, -0.5f * strwidth, -0.5f * strheight, 0.0f);
2531  BLF_draw(fontid, str, strdrawlen);
2532 
2534  GPU_line_smooth(false);
2535 }
2536 
2537 typedef enum {
2541 } RCPropFlags;
2542 
2549  wmOperator *op,
2550  const char *name,
2551  PointerRNA *r_ptr,
2552  PropertyRNA **r_prop,
2553  int req_length,
2554  RCPropFlags flags)
2555 {
2556  PropertyRNA *unused_prop;
2557 
2558  /* check flags */
2559  if ((flags & RC_PROP_REQUIRE_BOOL) && (flags & RC_PROP_REQUIRE_FLOAT)) {
2560  BKE_report(op->reports, RPT_ERROR, "Property cannot be both boolean and float");
2561  return 0;
2562  }
2563 
2564  /* get an rna string path from the operator's properties */
2565  char *str;
2566  if (!(str = RNA_string_get_alloc(op->ptr, name, NULL, 0, NULL))) {
2567  return 1;
2568  }
2569 
2570  if (str[0] == '\0') {
2571  if (r_prop) {
2572  *r_prop = NULL;
2573  }
2574  MEM_freeN(str);
2575  return 1;
2576  }
2577 
2578  if (!r_prop) {
2579  r_prop = &unused_prop;
2580  }
2581 
2582  /* get rna from path */
2583  if (!RNA_path_resolve(ctx_ptr, str, r_ptr, r_prop)) {
2584  MEM_freeN(str);
2585  if (flags & RC_PROP_ALLOW_MISSING) {
2586  return 1;
2587  }
2588  BKE_reportf(op->reports, RPT_ERROR, "Could not resolve path '%s'", name);
2589  return 0;
2590  }
2591 
2592  /* check property type */
2593  if (flags & (RC_PROP_REQUIRE_BOOL | RC_PROP_REQUIRE_FLOAT)) {
2594  PropertyType prop_type = RNA_property_type(*r_prop);
2595 
2596  if (((flags & RC_PROP_REQUIRE_BOOL) && (prop_type != PROP_BOOLEAN)) ||
2597  ((flags & RC_PROP_REQUIRE_FLOAT) && (prop_type != PROP_FLOAT))) {
2598  MEM_freeN(str);
2599  BKE_reportf(op->reports, RPT_ERROR, "Property from path '%s' is not a float", name);
2600  return 0;
2601  }
2602  }
2603 
2604  /* check property's array length */
2605  int len;
2606  if (*r_prop && (len = RNA_property_array_length(r_ptr, *r_prop)) != req_length) {
2607  MEM_freeN(str);
2608  BKE_reportf(op->reports,
2609  RPT_ERROR,
2610  "Property from path '%s' has length %d instead of %d",
2611  name,
2612  len,
2613  req_length);
2614  return 0;
2615  }
2616 
2617  /* success */
2618  MEM_freeN(str);
2619  return 1;
2620 }
2621 
2622 /* initialize the rna pointers and properties using rna paths */
2624 {
2625  RadialControl *rc = op->customdata;
2626 
2627  PointerRNA ctx_ptr;
2628  RNA_pointer_create(NULL, &RNA_Context, C, &ctx_ptr);
2629 
2630  /* check if we use primary or secondary path */
2631  PointerRNA use_secondary_ptr;
2632  PropertyRNA *use_secondary_prop = NULL;
2633  if (!radial_control_get_path(&ctx_ptr,
2634  op,
2635  "use_secondary",
2636  &use_secondary_ptr,
2637  &use_secondary_prop,
2638  0,
2640  return 0;
2641  }
2642 
2643  const char *data_path;
2644  if (use_secondary_prop && RNA_property_boolean_get(&use_secondary_ptr, use_secondary_prop)) {
2645  data_path = "data_path_secondary";
2646  }
2647  else {
2648  data_path = "data_path_primary";
2649  }
2650 
2651  if (!radial_control_get_path(&ctx_ptr, op, data_path, &rc->ptr, &rc->prop, 0, 0)) {
2652  return 0;
2653  }
2654 
2655  /* data path is required */
2656  if (!rc->prop) {
2657  return 0;
2658  }
2659 
2661  &ctx_ptr, op, "rotation_path", &rc->rot_ptr, &rc->rot_prop, 0, RC_PROP_REQUIRE_FLOAT)) {
2662  return 0;
2663  }
2664 
2666  &ctx_ptr, op, "color_path", &rc->col_ptr, &rc->col_prop, 4, RC_PROP_REQUIRE_FLOAT)) {
2667  return 0;
2668  }
2669 
2670  if (!radial_control_get_path(&ctx_ptr,
2671  op,
2672  "fill_color_path",
2673  &rc->fill_col_ptr,
2674  &rc->fill_col_prop,
2675  3,
2677  return 0;
2678  }
2679 
2680  if (!radial_control_get_path(&ctx_ptr,
2681  op,
2682  "fill_color_override_path",
2683  &rc->fill_col_override_ptr,
2685  3,
2687  return 0;
2688  }
2689  if (!radial_control_get_path(&ctx_ptr,
2690  op,
2691  "fill_color_override_test_path",
2694  0,
2696  return 0;
2697  }
2698 
2699  /* slightly ugly; allow this property to not resolve
2700  * correctly. needed because 3d texture paint shares the same
2701  * keymap as 2d image paint */
2702  if (!radial_control_get_path(&ctx_ptr,
2703  op,
2704  "zoom_path",
2705  &rc->zoom_ptr,
2706  &rc->zoom_prop,
2707  2,
2709  return 0;
2710  }
2711 
2712  if (!radial_control_get_path(&ctx_ptr, op, "image_id", &rc->image_id_ptr, NULL, 0, 0)) {
2713  return 0;
2714  }
2715  if (rc->image_id_ptr.data) {
2716  /* extra check, pointer must be to an ID */
2717  if (!RNA_struct_is_ID(rc->image_id_ptr.type)) {
2718  BKE_report(op->reports, RPT_ERROR, "Pointer from path image_id is not an ID");
2719  return 0;
2720  }
2721  }
2722 
2723  rc->use_secondary_tex = RNA_boolean_get(op->ptr, "secondary_tex");
2724 
2725  return 1;
2726 }
2727 
2728 static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *event)
2729 {
2730  wmWindowManager *wm;
2731  RadialControl *rc;
2732 
2733  if (!(op->customdata = rc = MEM_callocN(sizeof(RadialControl), "RadialControl"))) {
2734  return OPERATOR_CANCELLED;
2735  }
2736 
2737  if (!radial_control_get_properties(C, op)) {
2738  MEM_freeN(rc);
2739  return OPERATOR_CANCELLED;
2740  }
2741 
2742  /* get type, initial, min, and max values of the property */
2743  switch ((rc->type = RNA_property_type(rc->prop))) {
2744  case PROP_INT: {
2745  int value, min, max, step;
2746 
2747  value = RNA_property_int_get(&rc->ptr, rc->prop);
2748  RNA_property_int_ui_range(&rc->ptr, rc->prop, &min, &max, &step);
2749 
2750  rc->initial_value = value;
2751  rc->min_value = min_ii(value, min);
2752  rc->max_value = max_ii(value, max);
2753  break;
2754  }
2755  case PROP_FLOAT: {
2756  float value, min, max, step, precision;
2757 
2758  value = RNA_property_float_get(&rc->ptr, rc->prop);
2759  RNA_property_float_ui_range(&rc->ptr, rc->prop, &min, &max, &step, &precision);
2760 
2761  rc->initial_value = value;
2762  rc->min_value = min_ff(value, min);
2763  rc->max_value = max_ff(value, max);
2764  break;
2765  }
2766  default:
2767  BKE_report(op->reports, RPT_ERROR, "Property must be an integer or a float");
2768  MEM_freeN(rc);
2769  return OPERATOR_CANCELLED;
2770  }
2771 
2772  /* initialize numerical input */
2773  initNumInput(&rc->num_input);
2774  rc->num_input.idx_max = 0;
2778 
2779  /* get subtype of property */
2780  rc->subtype = RNA_property_subtype(rc->prop);
2781  if (!ELEM(rc->subtype,
2782  PROP_NONE,
2783  PROP_DISTANCE,
2784  PROP_FACTOR,
2786  PROP_ANGLE,
2787  PROP_PIXEL)) {
2788  BKE_report(op->reports,
2789  RPT_ERROR,
2790  "Property must be a none, distance, factor, percentage, angle, or pixel");
2791  MEM_freeN(rc);
2792  return OPERATOR_CANCELLED;
2793  }
2794 
2795  rc->current_value = rc->initial_value;
2798 
2800 
2801  /* temporarily disable other paint cursors */
2802  wm = CTX_wm_manager(C);
2803  rc->orig_paintcursors = wm->paintcursors;
2805 
2806  /* add radial control paint cursor */
2809 
2811 
2812  return OPERATOR_RUNNING_MODAL;
2813 }
2814 
2815 static void radial_control_set_value(RadialControl *rc, float val)
2816 {
2817  switch (rc->type) {
2818  case PROP_INT:
2819  RNA_property_int_set(&rc->ptr, rc->prop, val);
2820  break;
2821  case PROP_FLOAT:
2822  RNA_property_float_set(&rc->ptr, rc->prop, val);
2823  break;
2824  default:
2825  break;
2826  }
2827 }
2828 
2830 {
2831  RadialControl *rc = op->customdata;
2833  ScrArea *area = CTX_wm_area(C);
2834 
2835  MEM_SAFE_FREE(rc->dial);
2836 
2838 
2840 
2841  /* restore original paint cursors */
2842  wm->paintcursors = rc->orig_paintcursors;
2843 
2844  /* not sure if this is a good notifier to use;
2845  * intended purpose is to update the UI so that the
2846  * new value is displayed in sliders/numfields */
2848 
2849  if (rc->texture != NULL) {
2851  }
2852 
2853  MEM_freeN(rc);
2854 }
2855 
2856 static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *event)
2857 {
2858  RadialControl *rc = op->customdata;
2859  float new_value, dist = 0.0f, zoom[2];
2860  float delta[2];
2862  float angle_precision = 0.0f;
2863  const bool has_numInput = hasNumInput(&rc->num_input);
2864  bool handled = false;
2865  float numValue;
2866  /* TODO: fix hardcoded events */
2867 
2868  bool snap = (event->modifier & KM_CTRL) != 0;
2869 
2870  /* Modal numinput active, try to handle numeric inputs first... */
2871  if (event->val == KM_PRESS && has_numInput && handleNumInput(C, &rc->num_input, event)) {
2872  handled = true;
2873  applyNumInput(&rc->num_input, &numValue);
2874 
2875  if (rc->subtype == PROP_ANGLE) {
2876  numValue = fmod(numValue, 2.0f * (float)M_PI);
2877  if (numValue < 0.0f) {
2878  numValue += 2.0f * (float)M_PI;
2879  }
2880  }
2881 
2882  CLAMP(numValue, rc->min_value, rc->max_value);
2883  new_value = numValue;
2884 
2885  radial_control_set_value(rc, new_value);
2886  rc->current_value = new_value;
2888  return OPERATOR_RUNNING_MODAL;
2889  }
2890 
2891  handled = false;
2892  switch (event->type) {
2893  case EVT_ESCKEY:
2894  case RIGHTMOUSE:
2895  /* canceled; restore original value */
2898  break;
2899 
2900  case LEFTMOUSE:
2901  case EVT_PADENTER:
2902  case EVT_RETKEY:
2903  /* done; value already set */
2904  RNA_property_update(C, &rc->ptr, rc->prop);
2906  break;
2907 
2908  case MOUSEMOVE:
2909  if (!has_numInput) {
2910  if (rc->slow_mode) {
2911  if (rc->subtype == PROP_ANGLE) {
2912  /* calculate the initial angle here first */
2913  delta[0] = rc->initial_mouse[0] - rc->slow_mouse[0];
2914  delta[1] = rc->initial_mouse[1] - rc->slow_mouse[1];
2915 
2916  /* precision angle gets calculated from dial and gets added later */
2917  angle_precision = -0.1f * BLI_dial_angle(rc->dial, (float[2]){UNPACK2(event->xy)});
2918  }
2919  else {
2920  delta[0] = rc->initial_mouse[0] - rc->slow_mouse[0];
2921  delta[1] = 0.0f;
2922 
2923  if (rc->zoom_prop) {
2925  delta[0] /= zoom[0];
2926  }
2927 
2928  dist = len_v2(delta);
2929 
2930  delta[0] = event->xy[0] - rc->slow_mouse[0];
2931 
2932  if (rc->zoom_prop) {
2933  delta[0] /= zoom[0];
2934  }
2935 
2936  dist = dist + 0.1f * (delta[0]);
2937  }
2938  }
2939  else {
2940  delta[0] = (float)(rc->initial_mouse[0] - event->xy[0]);
2941  delta[1] = (float)(rc->initial_mouse[1] - event->xy[1]);
2942  if (rc->zoom_prop) {
2944  delta[0] /= zoom[0];
2945  delta[1] /= zoom[1];
2946  }
2947  if (rc->subtype == PROP_ANGLE) {
2948  dist = len_v2(delta);
2949  }
2950  else {
2951  dist = clamp_f(-delta[0], 0.0f, FLT_MAX);
2952  }
2953  }
2954 
2955  /* Calculate new value and apply snapping. */
2956  switch (rc->subtype) {
2957  case PROP_NONE:
2958  case PROP_DISTANCE:
2959  case PROP_PIXEL:
2960  new_value = dist;
2961  if (snap) {
2962  new_value = ((int)new_value + 5) / 10 * 10;
2963  }
2964  break;
2965  case PROP_PERCENTAGE:
2966  new_value = ((dist - WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE) /
2968  100.0f;
2969  if (snap) {
2970  new_value = ((int)(new_value + 2.5f)) / 5 * 5;
2971  }
2972  break;
2973  case PROP_FACTOR:
2975  if (snap) {
2976  new_value = ((int)ceil(new_value * 10.0f) * 10.0f) / 100.0f;
2977  }
2978  /* Invert new value to increase the factor moving the mouse to the right */
2979  new_value = 1 - new_value;
2980  break;
2981  case PROP_ANGLE:
2982  new_value = atan2f(delta[1], delta[0]) + (float)M_PI + angle_precision;
2983  new_value = fmod(new_value, 2.0f * (float)M_PI);
2984  if (new_value < 0.0f) {
2985  new_value += 2.0f * (float)M_PI;
2986  }
2987  if (snap) {
2988  new_value = DEG2RADF(((int)RAD2DEGF(new_value) + 5) / 10 * 10);
2989  }
2990  break;
2991  default:
2992  new_value = dist; /* dummy value, should this ever happen? - campbell */
2993  break;
2994  }
2995 
2996  /* clamp and update */
2997  CLAMP(new_value, rc->min_value, rc->max_value);
2998  radial_control_set_value(rc, new_value);
2999  rc->current_value = new_value;
3000  handled = true;
3001  break;
3002  }
3003  break;
3004 
3005  case EVT_LEFTSHIFTKEY:
3006  case EVT_RIGHTSHIFTKEY: {
3007  if (event->val == KM_PRESS) {
3008  rc->slow_mouse[0] = event->xy[0];
3009  rc->slow_mouse[1] = event->xy[1];
3010  rc->slow_mode = true;
3011  if (rc->subtype == PROP_ANGLE) {
3012  const float initial_position[2] = {UNPACK2(rc->initial_mouse)};
3013  const float current_position[2] = {UNPACK2(rc->slow_mouse)};
3014  rc->dial = BLI_dial_init(initial_position, 0.0f);
3015  /* immediately set the position to get a an initial direction */
3016  BLI_dial_angle(rc->dial, current_position);
3017  }
3018  handled = true;
3019  }
3020  if (event->val == KM_RELEASE) {
3021  rc->slow_mode = false;
3022  handled = true;
3023  MEM_SAFE_FREE(rc->dial);
3024  }
3025  break;
3026  }
3027  }
3028 
3029  /* Modal numinput inactive, try to handle numeric inputs last... */
3030  if (!handled && event->val == KM_PRESS && handleNumInput(C, &rc->num_input, event)) {
3031  applyNumInput(&rc->num_input, &numValue);
3032 
3033  if (rc->subtype == PROP_ANGLE) {
3034  numValue = fmod(numValue, 2.0f * (float)M_PI);
3035  if (numValue < 0.0f) {
3036  numValue += 2.0f * (float)M_PI;
3037  }
3038  }
3039 
3040  CLAMP(numValue, rc->min_value, rc->max_value);
3041  new_value = numValue;
3042 
3043  radial_control_set_value(rc, new_value);
3044 
3045  rc->current_value = new_value;
3047  return OPERATOR_RUNNING_MODAL;
3048  }
3049 
3050  if (!handled && (event->val == KM_RELEASE) && (rc->init_event == event->type) &&
3051  RNA_boolean_get(op->ptr, "release_confirm")) {
3053  }
3054 
3057 
3058  if (ret & OPERATOR_FINISHED) {
3060  if (wm->op_undo_depth == 0) {
3061  ID *id = rc->ptr.owner_id;
3063  ED_undo_push(C, op->type->name);
3064  }
3065  }
3066  }
3067 
3068  if (ret != OPERATOR_RUNNING_MODAL) {
3069  radial_control_cancel(C, op);
3070  }
3071 
3072  return ret;
3073 }
3074 
3076 {
3077  ot->name = "Radial Control";
3078  ot->idname = "WM_OT_radial_control";
3079  ot->description = "Set some size property (e.g. brush size) with mouse wheel";
3080 
3084 
3086 
3087  /* all paths relative to the context */
3088  PropertyRNA *prop;
3089  prop = RNA_def_string(ot->srna,
3090  "data_path_primary",
3091  NULL,
3092  0,
3093  "Primary Data Path",
3094  "Primary path of property to be set by the radial control");
3096 
3097  prop = RNA_def_string(ot->srna,
3098  "data_path_secondary",
3099  NULL,
3100  0,
3101  "Secondary Data Path",
3102  "Secondary path of property to be set by the radial control");
3104 
3105  prop = RNA_def_string(ot->srna,
3106  "use_secondary",
3107  NULL,
3108  0,
3109  "Use Secondary",
3110  "Path of property to select between the primary and secondary data paths");
3112 
3113  prop = RNA_def_string(ot->srna,
3114  "rotation_path",
3115  NULL,
3116  0,
3117  "Rotation Path",
3118  "Path of property used to rotate the texture display");
3120 
3121  prop = RNA_def_string(ot->srna,
3122  "color_path",
3123  NULL,
3124  0,
3125  "Color Path",
3126  "Path of property used to set the color of the control");
3128 
3129  prop = RNA_def_string(ot->srna,
3130  "fill_color_path",
3131  NULL,
3132  0,
3133  "Fill Color Path",
3134  "Path of property used to set the fill color of the control");
3136 
3137  prop = RNA_def_string(
3138  ot->srna, "fill_color_override_path", NULL, 0, "Fill Color Override Path", "");
3140  prop = RNA_def_string(
3141  ot->srna, "fill_color_override_test_path", NULL, 0, "Fill Color Override Test", "");
3143 
3144  prop = RNA_def_string(ot->srna,
3145  "zoom_path",
3146  NULL,
3147  0,
3148  "Zoom Path",
3149  "Path of property used to set the zoom level for the control");
3151 
3152  prop = RNA_def_string(ot->srna,
3153  "image_id",
3154  NULL,
3155  0,
3156  "Image ID",
3157  "Path of ID that is used to generate an image for the control");
3159 
3160  prop = RNA_def_boolean(
3161  ot->srna, "secondary_tex", false, "Secondary Texture", "Tweak brush secondary/mask texture");
3163 
3164  prop = RNA_def_boolean(
3165  ot->srna, "release_confirm", false, "Confirm On Release", "Finish operation on key release");
3167 }
3168 
3171 /* -------------------------------------------------------------------- */
3177 /* uses no type defines, fully local testing function anyway... ;) */
3178 
3180 {
3181  wmWindow *win = CTX_wm_window(C);
3182  bScreen *screen = CTX_wm_screen(C);
3183 
3185 
3186  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3188  }
3189  wm_draw_update(C);
3190 
3191  CTX_wm_window_set(C, win); /* XXX context manipulation warning! */
3192 }
3193 
3194 enum {
3201  eRTUndo = 6,
3202 };
3203 
3205  {eRTDrawRegion, "DRAW", 0, "Draw Region", "Draw region"},
3206  {eRTDrawRegionSwap, "DRAW_SWAP", 0, "Draw Region & Swap", "Draw region and swap"},
3207  {eRTDrawWindow, "DRAW_WIN", 0, "Draw Window", "Draw window"},
3208  {eRTDrawWindowSwap, "DRAW_WIN_SWAP", 0, "Draw Window & Swap", "Draw window and swap"},
3209  {eRTAnimationStep, "ANIM_STEP", 0, "Animation Step", "Animation steps"},
3210  {eRTAnimationPlay, "ANIM_PLAY", 0, "Animation Play", "Animation playback"},
3211  {eRTUndo, "UNDO", 0, "Undo/Redo", "Undo and redo"},
3212  {0, NULL, 0, NULL, NULL},
3213 };
3214 
3216  Scene *scene,
3217  struct Depsgraph *depsgraph,
3218  wmWindow *win,
3219  ScrArea *area,
3220  ARegion *region,
3221  const int type,
3222  const int cfra)
3223 {
3224  if (type == eRTDrawRegion) {
3225  if (region) {
3226  wm_draw_region_test(C, area, region);
3227  }
3228  }
3229  else if (type == eRTDrawRegionSwap) {
3231 
3232  ED_region_tag_redraw(region);
3233  wm_draw_update(C);
3234 
3235  CTX_wm_window_set(C, win); /* XXX context manipulation warning! */
3236  }
3237  else if (type == eRTDrawWindow) {
3238  bScreen *screen = WM_window_get_active_screen(win);
3239 
3241 
3242  LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) {
3243  CTX_wm_area_set(C, area_iter);
3244  LISTBASE_FOREACH (ARegion *, region_iter, &area_iter->regionbase) {
3245  if (!region_iter->visible) {
3246  continue;
3247  }
3248  CTX_wm_region_set(C, region_iter);
3249  wm_draw_region_test(C, area_iter, region_iter);
3250  }
3251  }
3252 
3253  CTX_wm_window_set(C, win); /* XXX context manipulation warning! */
3254 
3256  CTX_wm_region_set(C, region);
3257  }
3258  else if (type == eRTDrawWindowSwap) {
3260  }
3261  else if (type == eRTAnimationStep) {
3262  scene->r.cfra += (cfra == scene->r.cfra) ? 1 : -1;
3264  }
3265  else if (type == eRTAnimationPlay) {
3266  /* play anim, return on same frame as started with */
3267  int tot = (scene->r.efra - scene->r.sfra) + 1;
3268 
3269  while (tot--) {
3270  /* TODO: ability to escape! */
3271  scene->r.cfra++;
3272  if (scene->r.cfra > scene->r.efra) {
3273  scene->r.cfra = scene->r.sfra;
3274  }
3275 
3278  }
3279  }
3280  else { /* eRTUndo */
3281  /* Undo and redo, including depsgraph update since that can be a
3282  * significant part of the cost. */
3283  ED_undo_pop(C);
3285  ED_undo_redo(C);
3287  }
3288 }
3289 
3291 {
3292  /* Check background mode as many of these actions use redrawing.
3293  * NOTE(@campbellbarton): if it's useful to support undo or animation step this could
3294  * be allowed at the moment this seems like a corner case that isn't needed. */
3295  return !G.background && WM_operator_winactive(C);
3296 }
3297 
3299 {
3301  wmWindow *win = CTX_wm_window(C);
3302  ScrArea *area = CTX_wm_area(C);
3303  ARegion *region = CTX_wm_region(C);
3305  const int type = RNA_enum_get(op->ptr, "type");
3306  const int iter = RNA_int_get(op->ptr, "iterations");
3307  const double time_limit = (double)RNA_float_get(op->ptr, "time_limit");
3308  const int cfra = scene->r.cfra;
3309  const char *infostr = "";
3310 
3311  /* NOTE: Depsgraph is used to update scene for a new state, so no need to ensure evaluation here.
3312  */
3314 
3315  WM_cursor_wait(true);
3316 
3317  double time_start = PIL_check_seconds_timer();
3318 
3319  wm_window_make_drawable(wm, win);
3320 
3321  int iter_steps = 0;
3322  for (int a = 0; a < iter; a++) {
3323  redraw_timer_step(C, scene, depsgraph, win, area, region, type, cfra);
3324  iter_steps += 1;
3325 
3326  if (time_limit != 0.0) {
3327  if ((PIL_check_seconds_timer() - time_start) > time_limit) {
3328  break;
3329  }
3330  a = 0;
3331  }
3332  }
3333 
3334  double time_delta = (PIL_check_seconds_timer() - time_start) * 1000;
3335 
3337 
3338  WM_cursor_wait(false);
3339 
3340  BKE_reportf(op->reports,
3341  RPT_WARNING,
3342  "%d x %s: %.4f ms, average: %.8f ms",
3343  iter_steps,
3344  infostr,
3345  time_delta,
3346  time_delta / iter_steps);
3347 
3348  return OPERATOR_FINISHED;
3349 }
3350 
3352 {
3353  ot->name = "Redraw Timer";
3354  ot->idname = "WM_OT_redraw_timer";
3355  ot->description = "Simple redraw timer to test the speed of updating the interface";
3356 
3360 
3361  ot->prop = RNA_def_enum(ot->srna, "type", redraw_timer_type_items, eRTDrawRegion, "Type", "");
3362  RNA_def_int(
3363  ot->srna, "iterations", 10, 1, INT_MAX, "Iterations", "Number of times to redraw", 1, 1000);
3365  "time_limit",
3366  0.0,
3367  0.0,
3368  FLT_MAX,
3369  "Time Limit",
3370  "Seconds to run the test for (override iterations)",
3371  0.0,
3372  60.0);
3373 }
3374 
3377 /* -------------------------------------------------------------------- */
3384 {
3386  return OPERATOR_FINISHED;
3387 }
3388 
3390 {
3391  ot->name = "Memory Statistics";
3392  ot->idname = "WM_OT_memory_statistics";
3393  ot->description = "Print memory statistics to the console";
3394 
3396 }
3397 
3400 /* -------------------------------------------------------------------- */
3406 typedef struct PreviewsIDEnsureData {
3410 
3412 {
3414 
3415  /* Only preview non-library datablocks, lib ones do not pertain to this .blend file!
3416  * Same goes for ID with no user. */
3417  if (!ID_IS_LINKED(id) && (id->us != 0)) {
3418  UI_icon_render_id(C, scene, id, ICON_SIZE_ICON, false);
3420  }
3421 }
3422 
3424 {
3425  const int cb_flag = cb_data->cb_flag;
3426 
3427  if (cb_flag & IDWALK_CB_EMBEDDED) {
3428  return IDWALK_RET_NOP;
3429  }
3430 
3431  PreviewsIDEnsureData *data = cb_data->user_data;
3432  ID *id = *cb_data->id_pointer;
3433 
3434  if (id && (id->tag & LIB_TAG_DOIT)) {
3436  previews_id_ensure(data->C, data->scene, id);
3437  id->tag &= ~LIB_TAG_DOIT;
3438  }
3439 
3440  return IDWALK_RET_NOP;
3441 }
3442 
3444 {
3445  Main *bmain = CTX_data_main(C);
3446  ListBase *lb[] = {
3447  &bmain->materials, &bmain->textures, &bmain->images, &bmain->worlds, &bmain->lights, NULL};
3448  PreviewsIDEnsureData preview_id_data;
3449 
3450  /* We use LIB_TAG_DOIT to check whether we have already handled a given ID or not. */
3451  BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false);
3452  for (int i = 0; lb[i]; i++) {
3453  BKE_main_id_tag_listbase(lb[i], LIB_TAG_DOIT, true);
3454  }
3455 
3456  preview_id_data.C = C;
3457  LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
3458  preview_id_data.scene = scene;
3459  ID *id = (ID *)scene;
3460 
3462  NULL, id, previews_id_ensure_callback, &preview_id_data, IDWALK_RECURSE);
3463  }
3464 
3465  /* Check a last time for ID not used (fake users only, in theory), and
3466  * do our best for those, using current scene... */
3467  for (int i = 0; lb[i]; i++) {
3468  LISTBASE_FOREACH (ID *, id, lb[i]) {
3469  if (id->tag & LIB_TAG_DOIT) {
3470  previews_id_ensure(C, NULL, id);
3471  id->tag &= ~LIB_TAG_DOIT;
3472  }
3473  }
3474  }
3475 
3476  return OPERATOR_FINISHED;
3477 }
3478 
3480 {
3481  ot->name = "Refresh Data-Block Previews";
3482  ot->idname = "WM_OT_previews_ensure";
3483  ot->description =
3484  "Ensure data-block previews are available and up-to-date "
3485  "(to be saved in .blend file, only for some types like materials, textures, etc.)";
3486 
3488 }
3489 
3492 /* -------------------------------------------------------------------- */
3496 typedef enum PreviewFilterID {
3509 
3510 /* Only types supporting previews currently. */
3512  {PREVIEW_FILTER_ALL, "ALL", 0, "All Types", ""},
3514  "GEOMETRY",
3515  0,
3516  "All Geometry Types",
3517  "Clear previews for scenes, collections and objects"},
3519  "SHADING",
3520  0,
3521  "All Shading Types",
3522  "Clear previews for materials, lights, worlds, textures and images"},
3523  {PREVIEW_FILTER_SCENE, "SCENE", 0, "Scenes", ""},
3524  {PREVIEW_FILTER_COLLECTION, "COLLECTION", 0, "Collections", ""},
3525  {PREVIEW_FILTER_OBJECT, "OBJECT", 0, "Objects", ""},
3526  {PREVIEW_FILTER_MATERIAL, "MATERIAL", 0, "Materials", ""},
3527  {PREVIEW_FILTER_LIGHT, "LIGHT", 0, "Lights", ""},
3528  {PREVIEW_FILTER_WORLD, "WORLD", 0, "Worlds", ""},
3529  {PREVIEW_FILTER_TEXTURE, "TEXTURE", 0, "Textures", ""},
3530  {PREVIEW_FILTER_IMAGE, "IMAGE", 0, "Images", ""},
3531 #if 0 /* XXX TODO */
3532  {PREVIEW_FILTER_BRUSH, "BRUSH", 0, "Brushes", ""},
3533 #endif
3534  {0, NULL, 0, NULL, NULL},
3535 };
3536 
3538 {
3539  switch (filter) {
3540  case PREVIEW_FILTER_ALL:
3547  case PREVIEW_FILTER_SCENE:
3548  return FILTER_ID_SCE;
3550  return FILTER_ID_GR;
3551  case PREVIEW_FILTER_OBJECT:
3552  return FILTER_ID_OB;
3554  return FILTER_ID_MA;
3555  case PREVIEW_FILTER_LIGHT:
3556  return FILTER_ID_LA;
3557  case PREVIEW_FILTER_WORLD:
3558  return FILTER_ID_WO;
3560  return FILTER_ID_TE;
3561  case PREVIEW_FILTER_IMAGE:
3562  return FILTER_ID_IM;
3563  }
3564 
3565  return 0;
3566 }
3567 
3569 {
3570  Main *bmain = CTX_data_main(C);
3571  ListBase *lb[] = {
3572  &bmain->objects,
3573  &bmain->collections,
3574  &bmain->materials,
3575  &bmain->worlds,
3576  &bmain->lights,
3577  &bmain->textures,
3578  &bmain->images,
3579  NULL,
3580  };
3581 
3582  const int id_filters = preview_filter_to_idfilter(RNA_enum_get(op->ptr, "id_type"));
3583 
3584  for (int i = 0; lb[i]; i++) {
3585  ID *id = lb[i]->first;
3586  if (!id) {
3587  continue;
3588  }
3589 
3590 #if 0
3591  printf("%s: %d, %d, %d -> %d\n",
3592  id->name,
3593  GS(id->name),
3595  id_filters,
3596  BKE_idtype_idcode_to_idfilter(GS(id->name)) & id_filters);
3597 #endif
3598 
3599  if (!(BKE_idtype_idcode_to_idfilter(GS(id->name)) & id_filters)) {
3600  continue;
3601  }
3602 
3603  for (; id; id = id->next) {
3604  PreviewImage *prv_img = BKE_previewimg_id_ensure(id);
3605 
3606  BKE_previewimg_clear(prv_img);
3607  }
3608  }
3609 
3610  return OPERATOR_FINISHED;
3611 }
3612 
3614 {
3615  ot->name = "Clear Data-Block Previews";
3616  ot->idname = "WM_OT_previews_clear";
3617  ot->description =
3618  "Clear data-block previews (only for some types like objects, materials, textures, etc.)";
3619 
3622 
3624  "id_type",
3627  "Data-Block Type",
3628  "Which data-block previews to clear");
3629 }
3630 
3633 /* -------------------------------------------------------------------- */
3638 {
3639  PointerRNA ptr_props;
3640  char buf[512];
3641  short retval = OPERATOR_CANCELLED;
3642 
3643  if (UI_but_online_manual_id_from_active(C, buf, sizeof(buf))) {
3644  WM_operator_properties_create(&ptr_props, "WM_OT_doc_view_manual");
3645  RNA_string_set(&ptr_props, "doc_id", buf);
3646 
3647  retval = WM_operator_name_call_ptr(C,
3648  WM_operatortype_find("WM_OT_doc_view_manual", false),
3650  &ptr_props,
3651  NULL);
3652 
3653  WM_operator_properties_free(&ptr_props);
3654  }
3655 
3656  return retval;
3657 }
3658 
3660 {
3661  /* identifiers */
3662  ot->name = "View Online Manual";
3663  ot->idname = "WM_OT_doc_view_manual_ui_context";
3664  ot->description = "View a context based online manual in a web browser";
3665 
3666  /* callbacks */
3669 }
3670 
3673 /* -------------------------------------------------------------------- */
3680 {
3681  PropertyRNA *prop;
3682 
3683  ot->name = "Set Stereo 3D";
3684  ot->idname = "WM_OT_set_stereo_3d";
3685  ot->description = "Toggle 3D stereo support for current window (or change the display mode)";
3686 
3693 
3694  prop = RNA_def_enum(ot->srna,
3695  "display_mode",
3698  "Display Mode",
3699  "");
3701  prop = RNA_def_enum(ot->srna,
3702  "anaglyph_type",
3705  "Anaglyph Type",
3706  "");
3708  prop = RNA_def_enum(ot->srna,
3709  "interlace_type",
3712  "Interlace Type",
3713  "");
3715  prop = RNA_def_boolean(ot->srna,
3716  "use_interlace_swap",
3717  false,
3718  "Swap Left/Right",
3719  "Swap left and right stereo channels");
3721  prop = RNA_def_boolean(ot->srna,
3722  "use_sidebyside_crosseyed",
3723  false,
3724  "Cross-Eyed",
3725  "Right eye should see left image and vice versa");
3727 }
3728 
3731 /* -------------------------------------------------------------------- */
3736 {
3772 #if defined(WIN32)
3773  WM_operatortype_append(WM_OT_console_toggle);
3774 #endif
3778 
3779 #ifdef WITH_XR_OPENXR
3781 #endif
3782 
3783  /* gizmos */
3786 }
3787 
3788 /* circleselect-like modal operators */
3790 {
3791  static const EnumPropertyItem modal_items[] = {
3792  {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
3793  {GESTURE_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
3794  {GESTURE_MODAL_CIRCLE_ADD, "ADD", 0, "Add", ""},
3795  {GESTURE_MODAL_CIRCLE_SUB, "SUBTRACT", 0, "Subtract", ""},
3796  {GESTURE_MODAL_CIRCLE_SIZE, "SIZE", 0, "Size", ""},
3797 
3798  {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
3799  {GESTURE_MODAL_DESELECT, "DESELECT", 0, "Deselect", ""},
3800  {GESTURE_MODAL_NOP, "NOP", 0, "No Operation", ""},
3801 
3802  {0, NULL, 0, NULL, NULL},
3803  };
3804 
3805  /* WARNING: Name is incorrect, use for non-3d views. */
3806  wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "View3D Gesture Circle");
3807 
3808  /* this function is called for each spacetype, only needs to add map once */
3809  if (keymap && keymap->modal_items) {
3810  return;
3811  }
3812 
3813  keymap = WM_modalkeymap_ensure(keyconf, "View3D Gesture Circle", modal_items);
3814 
3815  /* assign map to operators */
3816  WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_circle");
3817  WM_modalkeymap_assign(keymap, "UV_OT_select_circle");
3818  WM_modalkeymap_assign(keymap, "CLIP_OT_select_circle");
3819  WM_modalkeymap_assign(keymap, "MASK_OT_select_circle");
3820  WM_modalkeymap_assign(keymap, "NODE_OT_select_circle");
3821  WM_modalkeymap_assign(keymap, "GPENCIL_OT_select_circle");
3822  WM_modalkeymap_assign(keymap, "GRAPH_OT_select_circle");
3823  WM_modalkeymap_assign(keymap, "ACTION_OT_select_circle");
3824 }
3825 
3826 /* straight line modal operators */
3828 {
3829  static const EnumPropertyItem modal_items[] = {
3830  {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
3831  {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
3832  {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
3833  {GESTURE_MODAL_MOVE, "MOVE", 0, "Move", ""},
3834  {GESTURE_MODAL_SNAP, "SNAP", 0, "Snap", ""},
3835  {GESTURE_MODAL_FLIP, "FLIP", 0, "Flip", ""},
3836  {0, NULL, 0, NULL, NULL},
3837  };
3838 
3839  wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Gesture Straight Line");
3840 
3841  /* this function is called for each spacetype, only needs to add map once */
3842  if (keymap && keymap->modal_items) {
3843  return;
3844  }
3845 
3846  keymap = WM_modalkeymap_ensure(keyconf, "Gesture Straight Line", modal_items);
3847 
3848  /* assign map to operators */
3849  WM_modalkeymap_assign(keymap, "IMAGE_OT_sample_line");
3850  WM_modalkeymap_assign(keymap, "PAINT_OT_weight_gradient");
3851  WM_modalkeymap_assign(keymap, "MESH_OT_bisect");
3852  WM_modalkeymap_assign(keymap, "PAINT_OT_mask_line_gesture");
3853  WM_modalkeymap_assign(keymap, "SCULPT_OT_project_line_gesture");
3854 }
3855 
3856 /* box_select-like modal operators */
3858 {
3859  static const EnumPropertyItem modal_items[] = {
3860  {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
3861  {GESTURE_MODAL_SELECT, "SELECT", 0, "Select", ""},
3862  {GESTURE_MODAL_DESELECT, "DESELECT", 0, "Deselect", ""},
3863  {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
3864  {GESTURE_MODAL_MOVE, "MOVE", 0, "Move", ""},
3865  {0, NULL, 0, NULL, NULL},
3866  };
3867 
3868  wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Gesture Box");
3869 
3870  /* this function is called for each spacetype, only needs to add map once */
3871  if (keymap && keymap->modal_items) {
3872  return;
3873  }
3874 
3875  keymap = WM_modalkeymap_ensure(keyconf, "Gesture Box", modal_items);
3876 
3877  /* assign map to operators */
3878  WM_modalkeymap_assign(keymap, "ACTION_OT_select_box");
3879  WM_modalkeymap_assign(keymap, "ANIM_OT_channels_select_box");
3880  WM_modalkeymap_assign(keymap, "ANIM_OT_previewrange_set");
3881  WM_modalkeymap_assign(keymap, "INFO_OT_select_box");
3882  WM_modalkeymap_assign(keymap, "FILE_OT_select_box");
3883  WM_modalkeymap_assign(keymap, "GRAPH_OT_select_box");
3884  WM_modalkeymap_assign(keymap, "MARKER_OT_select_box");
3885  WM_modalkeymap_assign(keymap, "NLA_OT_select_box");
3886  WM_modalkeymap_assign(keymap, "NODE_OT_select_box");
3887  WM_modalkeymap_assign(keymap, "NODE_OT_viewer_border");
3888  WM_modalkeymap_assign(keymap, "PAINT_OT_hide_show");
3889  WM_modalkeymap_assign(keymap, "OUTLINER_OT_select_box");
3890 #if 0 /* Template. */
3891  WM_modalkeymap_assign(keymap, "SCREEN_OT_box_select");
3892 #endif
3893  WM_modalkeymap_assign(keymap, "SEQUENCER_OT_select_box");
3894  WM_modalkeymap_assign(keymap, "SEQUENCER_OT_view_ghost_border");
3895  WM_modalkeymap_assign(keymap, "UV_OT_select_box");
3896  WM_modalkeymap_assign(keymap, "CLIP_OT_select_box");
3897  WM_modalkeymap_assign(keymap, "CLIP_OT_graph_select_box");
3898  WM_modalkeymap_assign(keymap, "MASK_OT_select_box");
3899  WM_modalkeymap_assign(keymap, "PAINT_OT_mask_box_gesture");
3900  WM_modalkeymap_assign(keymap, "SCULPT_OT_face_set_box_gesture");
3901  WM_modalkeymap_assign(keymap, "SCULPT_OT_trim_box_gesture");
3902  WM_modalkeymap_assign(keymap, "VIEW2D_OT_zoom_border");
3903  WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border");
3904  WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border");
3905  WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_box");
3906  /* XXX TODO: zoom border should perhaps map right-mouse to zoom out instead of in+cancel. */
3907  WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border");
3908  WM_modalkeymap_assign(keymap, "IMAGE_OT_render_border");
3909  WM_modalkeymap_assign(keymap, "IMAGE_OT_view_zoom_border");
3910  WM_modalkeymap_assign(keymap, "GPENCIL_OT_select_box");
3911 }
3912 
3913 /* lasso modal operators */
3915 {
3916  static const EnumPropertyItem modal_items[] = {
3917  {GESTURE_MODAL_MOVE, "MOVE", 0, "Move", ""},
3918  {0, NULL, 0, NULL, NULL},
3919  };
3920 
3921  wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Gesture Lasso");
3922 
3923  /* this function is called for each spacetype, only needs to add map once */
3924  if (keymap && keymap->modal_items) {
3925  return;
3926  }
3927 
3928  keymap = WM_modalkeymap_ensure(keyconf, "Gesture Lasso", modal_items);
3929 
3930  /* assign map to operators */
3931  WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_lasso");
3932  WM_modalkeymap_assign(keymap, "GPENCIL_OT_stroke_cutter");
3933  WM_modalkeymap_assign(keymap, "GPENCIL_OT_select_lasso");
3934  WM_modalkeymap_assign(keymap, "MASK_OT_select_lasso");
3935  WM_modalkeymap_assign(keymap, "PAINT_OT_mask_lasso_gesture");
3936  WM_modalkeymap_assign(keymap, "SCULPT_OT_face_set_lasso_gesture");
3937  WM_modalkeymap_assign(keymap, "SCULPT_OT_trim_lasso_gesture");
3938  WM_modalkeymap_assign(keymap, "ACTION_OT_select_lasso");
3939  WM_modalkeymap_assign(keymap, "CLIP_OT_select_lasso");
3940  WM_modalkeymap_assign(keymap, "GRAPH_OT_select_lasso");
3941  WM_modalkeymap_assign(keymap, "NODE_OT_select_lasso");
3942  WM_modalkeymap_assign(keymap, "UV_OT_select_lasso");
3943 }
3944 
3945 /* zoom to border modal operators */
3947 {
3948  static const EnumPropertyItem modal_items[] = {
3949  {GESTURE_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
3950  {GESTURE_MODAL_IN, "IN", 0, "In", ""},
3951  {GESTURE_MODAL_OUT, "OUT", 0, "Out", ""},
3952  {GESTURE_MODAL_BEGIN, "BEGIN", 0, "Begin", ""},
3953  {0, NULL, 0, NULL, NULL},
3954  };
3955 
3956  wmKeyMap *keymap = WM_modalkeymap_find(keyconf, "Gesture Zoom Border");
3957 
3958  /* this function is called for each spacetype, only needs to add map once */
3959  if (keymap && keymap->modal_items) {
3960  return;
3961  }
3962 
3963  keymap = WM_modalkeymap_ensure(keyconf, "Gesture Zoom Border", modal_items);
3964 
3965  /* assign map to operators */
3966  WM_modalkeymap_assign(keymap, "VIEW2D_OT_zoom_border");
3967  WM_modalkeymap_assign(keymap, "VIEW3D_OT_zoom_border");
3968  WM_modalkeymap_assign(keymap, "IMAGE_OT_view_zoom_border");
3969 }
3970 
3972 {
3973  WM_keymap_ensure(keyconf, "Window", 0, 0);
3974 
3975  wm_gizmos_keymap(keyconf);
3976  gesture_circle_modal_keymap(keyconf);
3977  gesture_box_modal_keymap(keyconf);
3980  gesture_lasso_modal_keymap(keyconf);
3981 
3983 }
3984 
3987 /* -------------------------------------------------------------------- */
3995 static bool rna_id_enum_filter_single(const ID *id, void *user_data)
3996 {
3997  return (id != user_data);
3998 }
3999 
4000 /* Generic itemf's for operators that take library args */
4001 static const EnumPropertyItem *rna_id_itemf(bool *r_free,
4002  ID *id,
4003  bool local,
4004  bool (*filter_ids)(const ID *id, void *user_data),
4005  void *user_data)
4006 {
4007  EnumPropertyItem item_tmp = {0}, *item = NULL;
4008  int totitem = 0;
4009  int i = 0;
4010 
4011  if (id != NULL) {
4012  const short id_type = GS(id->name);
4013  for (; id; id = id->next) {
4014  if ((filter_ids != NULL) && filter_ids(id, user_data) == false) {
4015  i++;
4016  continue;
4017  }
4018  if (local == false || !ID_IS_LINKED(id)) {
4019  item_tmp.identifier = item_tmp.name = id->name + 2;
4020  item_tmp.value = i++;
4021 
4022  /* Show collection color tag icons in menus. */
4023  if (id_type == ID_GR) {
4024  item_tmp.icon = UI_icon_color_from_collection((struct Collection *)id);
4025  }
4026 
4027  RNA_enum_item_add(&item, &totitem, &item_tmp);
4028  }
4029  }
4030  }
4031 
4032  RNA_enum_item_end(&item, &totitem);
4033  *r_free = true;
4034 
4035  return item;
4036 }
4037 
4038 /* Can add more ID types as needed. */
4039 
4041  PointerRNA *UNUSED(ptr),
4042  PropertyRNA *UNUSED(prop),
4043  bool *r_free)
4044 {
4045 
4046  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->actions.first : NULL, false, NULL, NULL);
4047 }
4048 #if 0 /* UNUSED */
4049 const EnumPropertyItem *RNA_action_local_itemf(bContext *C,
4050  PointerRNA *UNUSED(ptr),
4051  PropertyRNA *UNUSED(prop),
4052  bool *r_free)
4053 {
4054  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->action.first : NULL, true);
4055 }
4056 #endif
4057 
4059  PointerRNA *UNUSED(ptr),
4060  PropertyRNA *UNUSED(prop),
4061  bool *r_free)
4062 {
4063  return rna_id_itemf(
4064  r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, false, NULL, NULL);
4065 }
4067  PointerRNA *UNUSED(ptr),
4068  PropertyRNA *UNUSED(prop),
4069  bool *r_free)
4070 {
4071  return rna_id_itemf(
4072  r_free, C ? (ID *)CTX_data_main(C)->collections.first : NULL, true, NULL, NULL);
4073 }
4074 
4076  PointerRNA *UNUSED(ptr),
4077  PropertyRNA *UNUSED(prop),
4078  bool *r_free)
4079 {
4080  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, false, NULL, NULL);
4081 }
4083  PointerRNA *UNUSED(ptr),
4084  PropertyRNA *UNUSED(prop),
4085  bool *r_free)
4086 {
4087  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->images.first : NULL, true, NULL, NULL);
4088 }
4089 
4091  PointerRNA *UNUSED(ptr),
4092  PropertyRNA *UNUSED(prop),
4093  bool *r_free)
4094 {
4095  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, false, NULL, NULL);
4096 }
4098  PointerRNA *UNUSED(ptr),
4099  PropertyRNA *UNUSED(prop),
4100  bool *r_free)
4101 {
4102  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->scenes.first : NULL, true, NULL, NULL);
4103 }
4105  PointerRNA *UNUSED(ptr),
4106  PropertyRNA *UNUSED(prop),
4107  bool *r_free)
4108 {
4109  Scene *scene_active = C ? CTX_data_scene(C) : NULL;
4110  return rna_id_itemf(r_free,
4111  C ? (ID *)CTX_data_main(C)->scenes.first : NULL,
4112  false,
4114  scene_active);
4115 }
4117  PointerRNA *UNUSED(ptr),
4118  PropertyRNA *UNUSED(prop),
4119  bool *r_free)
4120 {
4121  return rna_id_itemf(
4122  r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, false, NULL, NULL);
4123 }
4125  PointerRNA *UNUSED(ptr),
4126  PropertyRNA *UNUSED(prop),
4127  bool *r_free)
4128 {
4129  return rna_id_itemf(
4130  r_free, C ? (ID *)CTX_data_main(C)->movieclips.first : NULL, true, NULL, NULL);
4131 }
4132 
4134  PointerRNA *UNUSED(ptr),
4135  PropertyRNA *UNUSED(prop),
4136  bool *r_free)
4137 {
4138  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, false, NULL, NULL);
4139 }
4141  PointerRNA *UNUSED(ptr),
4142  PropertyRNA *UNUSED(prop),
4143  bool *r_free)
4144 {
4145  return rna_id_itemf(r_free, C ? (ID *)CTX_data_main(C)->masks.first : NULL, true, NULL, NULL);
4146 }
4147 
typedef float(TangentPoint)[2]
bool id_type_can_have_animdata(short id_type)
Definition: anim_data.c:57
float BKE_brush_curve_strength_clamped(const struct Brush *br, float p, float len)
struct ImBuf * BKE_brush_gen_radial_control_imbuf(struct Brush *br, bool secondary, bool display_gradient)
Definition: brush.cc:2500
void BKE_curvemapping_init(struct CurveMapping *cumap)
Definition: colortools.c:1235
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:738
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
void CTX_wm_region_set(bContext *C, struct ARegion *region)
Definition: context.c:1009
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1370
void CTX_wm_menu_set(bContext *C, struct ARegion *menu)
Definition: context.c:1020
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Definition: context.c:473
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:784
ListBase CTX_data_dir_get_ex(const bContext *C, bool use_store, bool use_rna, bool use_all)
Definition: context.c:552
struct bScreen * CTX_wm_screen(const bContext *C)
Definition: context.c:733
void CTX_wm_window_set(bContext *C, struct wmWindow *win)
Definition: context.c:966
struct SpaceLink * CTX_wm_space_data(const bContext *C)
Definition: context.c:743
struct ReportList * CTX_wm_reports(const bContext *C)
Definition: context.c:775
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Definition: context.c:1505
void CTX_wm_area_set(bContext *C, struct ScrArea *area)
Definition: context.c:997
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
#define G_MAIN
Definition: BKE_global.h:267
struct PreviewImage * BKE_previewimg_id_ensure(struct ID *id)
Definition: icons.cc:385
void BKE_previewimg_clear(struct PreviewImage *prv)
Definition: icons.cc:303
void IDP_ReplaceInGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL()
Definition: idprop.c:578
struct IDProperty * IDP_New(char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: idprop.c:887
void IDP_MergeGroup(struct IDProperty *dest, const struct IDProperty *src, bool do_overwrite) ATTR_NONNULL()
void IDP_FreeProperty(struct IDProperty *prop)
Definition: idprop.c:1093
bool IDP_AddToGroup(struct IDProperty *group, struct IDProperty *prop) ATTR_NONNULL()
Definition: idprop.c:631
struct IDProperty * IDP_GetPropertyFromGroup(const struct IDProperty *prop, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_ClearProperty(struct IDProperty *prop)
Definition: idprop.c:1099
struct IDProperty * IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
const char * BKE_idtype_idcode_to_name(short idcode)
Definition: idtype.c:142
uint64_t BKE_idtype_idcode_to_idfilter(short idcode)
Definition: idtype.c:206
struct Image * BKE_image_load_exists_ex(struct Main *bmain, const char *filepath, bool *r_exists)
int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format)
void BKE_main_id_tag_all(struct Main *mainvar, int tag, bool value)
Definition: lib_id.c:930
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
void BKE_main_id_tag_listbase(struct ListBase *lb, int tag, bool value)
Definition: lib_id.c:904
void BKE_library_foreach_ID_link(struct Main *bmain, struct ID *id, LibraryIDLinkCallback callback, void *user_data, int flag)
Definition: lib_query.c:350
@ IDWALK_RECURSE
@ IDWALK_CB_EMBEDDED
Definition: BKE_lib_query.h:48
@ IDWALK_RET_NOP
Definition: BKE_lib_query.h:83
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
General operations, lookup, etc. for materials.
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition: report.c:83
void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph)
Definition: scene.cc:2728
#define BKE_ST_MAXNAME
Definition: BKE_screen.h:53
void BLF_width_and_height(int fontid, const char *str, size_t str_len, float *r_width, float *r_height) ATTR_NONNULL()
Definition: blf.c:662
void BLF_color4fv(int fontid, const float rgba[4])
Definition: blf.c:437
void BLF_draw(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2)
Definition: blf.c:538
void BLF_size(int fontid, float size, int dpi)
Definition: blf.c:363
void BLF_position(int fontid, float x, float y, float z)
Definition: blf.c:308
#define BLI_assert_unreachable()
Definition: BLI_assert.h:93
#define BLI_assert(a)
Definition: BLI_assert.h:46
Dial * BLI_dial_init(const float start_position[2], float threshold)
Definition: BLI_dial_2d.c:34
float BLI_dial_angle(Dial *dial, const float current_position[2])
Definition: BLI_dial_2d.c:44
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
Definition: BLI_dynstr.c:50
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: BLI_dynstr.c:256
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
Definition: BLI_dynstr.c:281
void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format,...) ATTR_PRINTF_FORMAT(2
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
Definition: BLI_dynstr.c:75
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:102
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
Definition: BLI_listbase.h:348
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
Definition: BLI_listbase.h:273
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition: listbase.c:466
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:80
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition: listbase.c:100
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE float clamp_f(float value, float min, float max)
MINLINE float min_ff(float a, float b)
MINLINE int max_ii(int a, int b)
#define M_PI
Definition: BLI_math_base.h:20
#define DEG2RADF(_deg)
#define RAD2DEGF(_rad)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
#define FILE_MAX
void BLI_path_rel(char *file, const char *relfile) ATTR_NONNULL()
Definition: path_util.c:450
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
#define STRNCPY(dst, src)
Definition: BLI_string.h:483
size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: string.c:120
void BLI_str_tolower_ascii(char *str, size_t len) ATTR_NONNULL()
Definition: string.c:927
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
Definition: string.c:42
void BLI_str_toupper_ascii(char *str, size_t len) ATTR_NONNULL()
Definition: string.c:936
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
size_t BLI_strlen_utf8(const char *strc) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: string_utf8.c:317
#define BLI_string_joinN(...)
#define BLI_string_join_by_sep_charN(sep,...)
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNPACK2(a)
#define POINTER_FROM_INT(i)
#define UNUSED(x)
#define POINTER_AS_INT(i)
#define ELEM(...)
#define STREQ(a, b)
#define CTX_N_(context, msgid)
#define TIP_(msgid)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define IFACE_(msgid)
typedef double(DMatrix)[4][4]
#define CLOG_ERROR(clg_ref,...)
Definition: CLG_log.h:190
#define CLOG_INFO(clg_ref, level,...)
Definition: CLG_log.h:187
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
ID and Library types, which are fundamental for sdna.
#define FILTER_ID_OB
Definition: DNA_ID.h:916
@ IDP_GROUP
Definition: DNA_ID.h:141
#define FILTER_ID_MA
Definition: DNA_ID.h:910
@ IDP_FLAG_GHOST
Definition: DNA_ID.h:181
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:566
#define MAX_ID_NAME
Definition: DNA_ID.h:337
#define FILTER_ID_LA
Definition: DNA_ID.h:907
#define FILTER_ID_GR
Definition: DNA_ID.h:905
#define FILTER_ID_TE
Definition: DNA_ID.h:922
@ LIB_TAG_DOIT
Definition: DNA_ID.h:707
#define FILTER_ID_IM
Definition: DNA_ID.h:906
#define FILTER_ID_SCE
Definition: DNA_ID.h:919
#define FILTER_ID_WO
Definition: DNA_ID.h:925
@ ICON_SIZE_PREVIEW
Definition: DNA_ID_enums.h:16
@ ICON_SIZE_ICON
Definition: DNA_ID_enums.h:15
ID_Type
Definition: DNA_ID_enums.h:44
@ ID_AR
Definition: DNA_ID_enums.h:66
@ ID_TE
Definition: DNA_ID_enums.h:52
@ ID_IM
Definition: DNA_ID_enums.h:53
@ ID_LA
Definition: DNA_ID_enums.h:55
@ ID_SCE
Definition: DNA_ID_enums.h:45
@ ID_BR
Definition: DNA_ID_enums.h:69
@ ID_WO
Definition: DNA_ID_enums.h:59
@ ID_MA
Definition: DNA_ID_enums.h:51
@ ID_SCR
Definition: DNA_ID_enums.h:60
@ ID_GR
Definition: DNA_ID_enums.h:65
@ ID_OB
Definition: DNA_ID_enums.h:47
#define MAX_NAME
Definition: DNA_defs.h:48
Object is a sort of wrapper for general info.
@ OB_FONT
#define OB_DATA_SUPPORT_ID_CASE
#define USER_UNIT_NONE
@ S3D_ANAGLYPH_REDCYAN
@ S3D_DISPLAY_ANAGLYPH
@ S3D_INTERLACE_ROW
@ SCREENNORMAL
#define RGN_TYPE_ANY
@ SPACE_TEXT
@ SPACE_ACTION
@ SPACE_CONSOLE
@ SPACE_FILE
@ SPACE_NLA
@ SPACE_IMAGE
@ SPACE_GRAPH
@ SPACE_VIEW3D
#define SPACE_TYPE_ANY
@ USER_SAVE_PROMPT
@ USER_GLOBALUNDO
#define OP_MAX_TYPENAME
@ OPERATOR_CANCELLED
@ OPERATOR_INTERFACE
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
#define OPERATOR_RETVAL_CHECK(ret)
struct FileSelectParams * ED_fileselect_get_active_params(const struct SpaceFile *sfile)
void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings)
Definition: numinput.c:87
void initNumInput(NumInput *n)
Definition: numinput.c:69
#define NUM_STR_REP_LEN
Definition: ED_numinput.h:13
@ NUM_NO_NEGATIVE
Definition: ED_numinput.h:56
bool applyNumInput(NumInput *n, float *vec)
Definition: numinput.c:189
bool hasNumInput(const NumInput *n)
Definition: numinput.c:170
bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event)
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
void ED_area_status_text(ScrArea *area, const char *str)
Definition: area.c:792
bool ED_operator_regionactive(struct bContext *C)
Definition: screen_ops.c:91
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
void ED_screen_refresh(struct wmWindowManager *wm, struct wmWindow *win)
Definition: screen_edit.c:611
void ED_undo_redo(struct bContext *C)
Definition: ed_undo.c:399
void ED_undo_pop(struct bContext *C)
Definition: ed_undo.c:395
bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, struct ID *id)
Definition: ed_undo.c:448
int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op)
Definition: ed_undo.c:662
void ED_undo_push(struct bContext *C, const char *str)
Definition: ed_undo.c:100
void ED_undo_push_op(struct bContext *C, struct wmOperator *op)
Definition: ed_undo.c:404
bool ED_undo_is_valid(const struct bContext *C, const char *undoname)
float ED_scene_grid_scale(const struct Scene *scene, const char **r_grid_unit)
float ED_view3d_grid_scale(const struct Scene *scene, struct View3D *v3d, const char **r_grid_unit)
GHOST C-API function and type declarations.
bool GHOST_setConsoleWindowState(GHOST_TConsoleWindowState action)
@ GHOST_kConsoleWindowStateToggle
Definition: GHOST_Types.h:142
void immUniformColor4f(float r, float g, float b, float a)
void immUnbindProgram(void)
void immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immBindTexture(const char *name, GPUTexture *tex)
GPUVertFormat * immVertexFormat(void)
void immAttr2f(uint attr_id, float x, float y)
void immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fvAlpha(const float rgb[3], float a)
void immEnd(void)
void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float radius, int nsegments)
_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
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
void GPU_matrix_pop(void)
Definition: gpu_matrix.cc:126
void GPU_matrix_scale_2fv(const float vec[2])
Definition: gpu_matrix.cc:226
void GPU_matrix_push(void)
Definition: gpu_matrix.cc:119
void GPU_matrix_rotate_2d(float deg)
Definition: gpu_matrix.cc:253
void GPU_matrix_rotate_3f(float deg, float x, float y, float z)
Definition: gpu_matrix.cc:261
void GPU_matrix_translate_2f(float x, float y)
Definition: gpu_matrix.cc:174
@ GPU_PRIM_TRI_FAN
Definition: GPU_primitive.h:25
@ GPU_PRIM_LINES
Definition: GPU_primitive.h:20
@ GPU_SHADER_2D_UNIFORM_COLOR
Definition: GPU_shader.h:201
@ GPU_SHADER_2D_IMAGE_COLOR
Definition: GPU_shader.h:217
@ GPU_BLEND_NONE
Definition: GPU_state.h:60
@ GPU_BLEND_ALPHA
Definition: GPU_state.h:62
void GPU_blend(eGPUBlend blend)
Definition: gpu_state.cc:39
void GPU_line_width(float width)
Definition: gpu_state.cc:158
void GPU_line_smooth(bool enable)
Definition: gpu_state.cc:75
void GPU_texture_swizzle_set(GPUTexture *tex, const char swizzle[4])
Definition: gpu_texture.cc:553
struct GPUTexture GPUTexture
Definition: GPU_texture.h:17
void GPU_texture_free(GPUTexture *tex)
Definition: gpu_texture.cc:564
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter)
Definition: gpu_texture.cc:518
void GPU_texture_unbind(GPUTexture *tex)
Definition: gpu_texture.cc:472
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
Definition: gpu_texture.cc:291
@ GPU_R8
Definition: GPU_texture.h:107
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
static void init_data(ModifierData *md)
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
Platform independent time functions.
#define RNA_PROP_END
Definition: RNA_access.h:563
#define RNA_STRUCT_BEGIN(sptr, prop)
Definition: RNA_access.h:569
#define RNA_STRUCT_END
Definition: RNA_access.h:589
short RNA_type_to_ID_code(const StructRNA *type)
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
Definition: RNA_access.h:556
#define RNA_SUBTYPE_UNIT_VALUE(subtype)
Definition: RNA_types.h:113
@ PROP_STRING_SEARCH_SUGGESTION
Definition: RNA_types.h:561
@ PROP_STRING_SEARCH_SORT
Definition: RNA_types.h:554
PropertyType
Definition: RNA_types.h:58
@ PROP_FLOAT
Definition: RNA_types.h:61
@ PROP_BOOLEAN
Definition: RNA_types.h:59
@ PROP_ENUM
Definition: RNA_types.h:63
@ PROP_INT
Definition: RNA_types.h:60
@ PROP_POINTER
Definition: RNA_types.h:64
@ PROP_ENUM_NO_CONTEXT
Definition: RNA_types.h:292
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
PropertySubType
Definition: RNA_types.h:125
@ PROP_DISTANCE
Definition: RNA_types.h:149
@ PROP_PIXEL
Definition: RNA_types.h:141
@ PROP_ANGLE
Definition: RNA_types.h:145
@ PROP_NONE
Definition: RNA_types.h:126
@ PROP_PERCENTAGE
Definition: RNA_types.h:143
@ PROP_FACTOR
Definition: RNA_types.h:144
#define C
Definition: RandGen.cpp:25
@ UI_LAYOUT_VERTICAL
#define UI_UNIT_Y
int UI_searchbox_size_x(void)
uiBlock * uiLayoutGetBlock(uiLayout *layout)
@ UI_BUT_ACTIVE_DEFAULT
Definition: UI_interface.h:212
@ UI_BUT_ACTIVATE_ON_INIT
Definition: UI_interface.h:219
void uiTemplateOperatorPropertyButs(const struct bContext *C, uiLayout *layout, struct wmOperator *op, eButLabelAlign label_align, short flag)
@ UI_EMBOSS
Definition: UI_interface.h:108
const struct uiStyle * UI_style_get_dpi(void)
void UI_block_theme_style_set(uiBlock *block, char theme_style)
Definition: interface.cc:3634
int UI_searchbox_size_y(void)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block)
void UI_popup_block_invoke_ex(struct bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free, bool can_refresh)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
@ UI_RETURN_OK
Definition: UI_interface.h:175
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.cc:4806
void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2])
Definition: interface.cc:598
const struct uiStyle * UI_style_get(void)
@ UI_BLOCK_THEME_STYLE_REGULAR
Definition: UI_interface.h:769
@ UI_BLOCK_THEME_STYLE_POPUP
Definition: UI_interface.h:770
@ UI_LAYOUT_PANEL
void UI_block_flag_disable(uiBlock *block, int flag)
Definition: interface.cc:5853
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
@ UI_TEMPLATE_OP_PROPS_SHOW_TITLE
void UI_block_func_handle_set(uiBlock *block, uiBlockHandleFunc func, void *arg)
Definition: interface.cc:5953
void UI_but_func_menu_search(uiBut *but)
@ UI_BUT_LABEL_ALIGN_SPLIT_COLUMN
@ UI_BUT_LABEL_ALIGN_NONE
@ UI_BUT_LABEL_ALIGN_COLUMN
void uiItemFullO_ptr(uiLayout *layout, struct wmOperatorType *ot, const char *name, int icon, struct IDProperty *properties, wmOperatorCallContext context, int flag, struct PointerRNA *r_opptr)
void UI_but_func_operator_search(uiBut *but)
uiBut * uiDefSearchButO_ptr(uiBlock *block, struct wmOperatorType *ot, struct IDProperty *properties, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip)
Definition: interface.cc:6406
#define UI_MAX_DRAW_STR
Definition: UI_interface.h:91
void UI_popup_block_ex(struct bContext *C, uiBlockCreateFunc func, uiBlockHandleFunc popup_func, uiBlockCancelFunc cancel_func, void *arg, struct wmOperator *op)
void UI_block_func_set(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2)
Definition: interface.cc:5965
uiLayout * UI_block_layout(uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, const struct uiStyle *style)
void UI_but_func_set(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2)
Definition: interface.cc:6000
uiBlock * UI_block_begin(const struct bContext *C, struct ARegion *region, const char *name, eUIEmbossType emboss)
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup)
uiBut * uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x, int y, short width, short height, float a1, float a2, const char *tip)
Definition: interface.cc:6217
void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but)
Definition: interface.cc:6474
int UI_popover_panel_invoke(struct bContext *C, const char *idname, bool keep_open, struct ReportList *reports)
#define UI_UNIT_X
void UI_block_flag_enable(uiBlock *block, int flag)
Definition: interface.cc:5848
@ UI_BTYPE_BUT
Definition: UI_interface.h:330
@ UI_BTYPE_LABEL
Definition: UI_interface.h:354
void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free)
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext)
int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportList *reports) ATTR_NONNULL(1
void UI_but_flag_enable(uiBut *but, int flag)
Definition: interface.cc:5858
void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname, struct IDProperty *properties, wmOperatorCallContext context, int flag)
uiPopupMenu * UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL()
int UI_pie_menu_invoke(struct bContext *C, const char *idname, const struct wmEvent *event)
bool UI_but_online_manual_id_from_active(const struct bContext *C, char *r_str, size_t maxlength) ATTR_WARN_UNUSED_RESULT
int void UI_popup_menu_retval_set(const uiBlock *block, int retval, bool enable)
@ UI_BLOCK_SEARCH_MENU
Definition: UI_interface.h:147
@ UI_BLOCK_NUMSELECT
Definition: UI_interface.h:138
@ UI_BLOCK_LOOP
Definition: UI_interface.h:135
@ UI_BLOCK_MOVEMOUSE_QUIT
Definition: UI_interface.h:143
@ UI_BLOCK_KEEP_OPEN
Definition: UI_interface.h:144
int UI_icon_color_from_collection(const struct Collection *collection)
void UI_icon_render_id(const struct bContext *C, struct Scene *scene, struct ID *id, enum eIconSizes size, bool use_job)
@ TH_TEXT_HI
Definition: UI_resources.h:43
void UI_GetThemeColor4fv(int colorid, float col[4])
Definition: resources.c:1173
@ WM_JOB_TYPE_ANY
Definition: WM_api.h:1347
@ KM_PRESS
Definition: WM_types.h:267
@ KM_RELEASE
Definition: WM_types.h:268
@ OPTYPE_INTERNAL
Definition: WM_types.h:168
@ OPTYPE_BLOCKING
Definition: WM_types.h:150
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define NC_WINDOW
Definition: WM_types.h:325
void(* wmPaintCursorDraw)(struct bContext *C, int, int, void *customdata)
Definition: WM_types.h:1039
wmOperatorCallContext
Definition: WM_types.h:199
@ WM_OP_INVOKE_REGION_WIN
Definition: WM_types.h:202
@ WM_OP_EXEC_REGION_WIN
Definition: WM_types.h:209
@ WM_OP_EXEC_DEFAULT
Definition: WM_types.h:208
@ KM_CTRL
Definition: WM_types.h:239
struct CLG_LogRef * WM_LOG_OPERATORS
unsigned int U
Definition: btGjkEpa3.h:78
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
Scene scene
const Depsgraph * depsgraph
void * user_data
SyclQueue void void * src
int len
Definition: draw_manager.c:108
#define rot(x, k)
#define str(s)
uint pos
uint col
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define GS(x)
Definition: iris.c:225
format
Definition: logImageCore.h:38
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void(* MEM_printmemlist_stats)(void)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
#define G(x, y, z)
#define atan2f(x, y)
Definition: metal/compat.h:227
#define fabsf(x)
Definition: metal/compat.h:219
static unsigned a[3]
Definition: RandGen.cpp:78
static void area(int d1, int d2, int e1, int e2, float weights[2])
vector snap(vector a, vector b)
Definition: node_math.h:59
return ret
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2767
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
Definition: rna_access.c:2449
void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step)
Definition: rna_access.c:1227
bool RNA_property_array_check(PropertyRNA *prop)
Definition: rna_access.c:1080
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
Definition: rna_access.c:695
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
Definition: rna_access.c:2879
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
Definition: rna_access.c:136
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
Definition: rna_access.c:5155
char * RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index, int max_prop_length)
Definition: rna_access.c:5615
bool RNA_struct_is_ID(const StructRNA *type)
Definition: rna_access.c:655
const char * RNA_property_identifier(const PropertyRNA *prop)
Definition: rna_access.c:1000
void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax, float *step, float *precision)
Definition: rna_access.c:1311
char * RNA_pointer_as_string_keywords(bContext *C, PointerRNA *ptr, const bool as_function, const bool all_args, const bool nested_args, const int max_prop_length)
Definition: rna_access.c:5477
PropertyUnit RNA_property_unit(PropertyRNA *prop)
Definition: rna_access.c:1032
bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
Definition: rna_access.c:6649
bool RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, bool use_ghost)
Definition: rna_access.c:5261
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:5271
PropertyType RNA_property_type(PropertyRNA *prop)
Definition: rna_access.c:1010
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3493
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2138
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2153
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2429
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
Definition: rna_access.c:5116
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
Definition: rna_access.c:3149
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:1405
int RNA_property_flag(PropertyRNA *prop)
Definition: rna_access.c:1055
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Definition: rna_access.c:2180
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4957
char * RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen, int *r_len)
Definition: rna_access.c:5129
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:1075
bool RNA_enum_description(const EnumPropertyItem *item, const int value, const char **r_description)
Definition: rna_access.c:1702
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
Definition: rna_access.c:2790
char * RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr)
Definition: rna_access.c:5336
PropertySubType RNA_property_subtype(PropertyRNA *prop)
Definition: rna_access.c:1015
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
bool RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:680
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
PropertyRNA * RNA_struct_iterator_property(StructRNA *type)
Definition: rna_access.c:634
float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
Definition: rna_access.c:3062
const char * RNA_property_ui_name(const PropertyRNA *prop)
Definition: rna_access.c:1875
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
Definition: rna_access.c:3239
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:3836
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3806
void RNA_def_property_string_search_func_runtime(PropertyRNA *prop, StringPropertySearchFunc search_fn, const eStringPropertySearchFlag search_flag)
Definition: rna_define.c:3373
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
Definition: rna_define.c:4487
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1495
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
Definition: rna_define.c:4436
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3687
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3597
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3783
char * RNA_path_from_ID_to_struct(const PointerRNA *ptr)
Definition: rna_path.cc:981
char * RNA_path_full_property_py(Main *bmain, const PointerRNA *ptr, PropertyRNA *prop, int index)
Definition: rna_path.cc:1293
char * RNA_path_property_py(const PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index)
Definition: rna_path.cc:1335
bool RNA_path_resolve(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
Definition: rna_path.cc:503
const EnumPropertyItem rna_enum_stereo3d_display_items[]
Definition: rna_scene.c:501
const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[]
Definition: rna_scene.c:533
const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[]
Definition: rna_scene.c:540
#define min(a, b)
Definition: sort.c:35
struct CurveMapping * curve
const char * identifier
Definition: RNA_types.h:461
const char * name
Definition: RNA_types.h:465
wmOperator * op
short flag
Definition: DNA_ID.h:109
int len
Definition: DNA_ID.h:121
char name[64]
Definition: DNA_ID.h:111
Definition: DNA_ID.h:368
int tag
Definition: DNA_ID.h:387
int us
Definition: DNA_ID.h:388
void * next
Definition: DNA_ID.h:369
char name[66]
Definition: DNA_ID.h:378
float * rect_float
void * data
Definition: DNA_listBase.h:26
struct LinkData * next
Definition: DNA_listBase.h:25
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase scenes
Definition: BKE_main.h:168
ListBase textures
Definition: BKE_main.h:175
ListBase lights
Definition: BKE_main.h:178
ListBase materials
Definition: BKE_main.h:174
ListBase worlds
Definition: BKE_main.h:182
ListBase collections
Definition: BKE_main.h:189
ListBase images
Definition: BKE_main.h:176
ListBase objects
Definition: BKE_main.h:170
char label[BKE_ST_MAXNAME]
Definition: BKE_screen.h:362
char translation_context[BKE_ST_MAXNAME]
Definition: BKE_screen.h:363
short idx_max
Definition: ED_numinput.h:20
short val_flag[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:29
int unit_sys
Definition: ED_numinput.h:21
int unit_type[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:23
char translation_context[BKE_ST_MAXNAME]
Definition: BKE_screen.h:226
char label[BKE_ST_MAXNAME]
Definition: BKE_screen.h:224
struct StructRNA * type
Definition: RNA_types.h:37
void * data
Definition: RNA_types.h:38
struct ID * owner_id
Definition: RNA_types.h:36
PropertySubType subtype
int initial_mouse[2]
GPUTexture * texture
PropertyRNA * prop
PointerRNA fill_col_override_test_ptr
PropertyRNA * zoom_prop
PointerRNA fill_col_ptr
NumInput num_input
ListBase orig_paintcursors
PropertyRNA * rot_prop
PointerRNA ptr
PointerRNA rot_ptr
PropertyRNA * col_prop
PropertyRNA * fill_col_override_test_prop
bool use_secondary_tex
PropertyRNA * fill_col_override_prop
PointerRNA fill_col_override_ptr
PointerRNA col_ptr
PropertyType type
PointerRNA zoom_ptr
PropertyRNA * fill_col_prop
StructRNA * image_id_srna
PointerRNA image_id_ptr
struct RenderData r
struct UnitSettings unit
enum SearchPopupInit_Data::@1198 search_type
bDopeSheet ads
struct bDopeSheet * ads
struct bDopeSheet * ads
View3DShading shading
struct EditBone * act_edbone
ListBase * edbo
ListBase areabase
uiFontStyle widget
short val
Definition: WM_types.h:680
int xy[2]
Definition: WM_types.h:682
short type
Definition: WM_types.h:678
const void * modal_items
wmOperator * op
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
struct IDProperty * last_properties
Definition: WM_types.h:972
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:927
struct StructRNA * srna
Definition: WM_types.h:969
const char * translation_context
Definition: WM_types.h:891
const char * description
Definition: WM_types.h:893
void(* ui)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:954
bool(* check)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:911
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
PropertyRNA * prop
Definition: WM_types.h:981
const char *(* get_name)(struct wmOperatorType *, struct PointerRNA *)
Definition: WM_types.h:960
ListBase macro
Definition: WM_types.h:984
struct ReportList * reports
IDProperty * properties
struct wmOperator * next
struct wmOperatorType * type
struct PointerRNA * ptr
void(* draw)(bContext *C, int, int, void *customdata)
Definition: wm.h:24
void * customdata
Definition: wm.h:21
bool(* poll)(struct bContext *C)
Definition: wm.h:23
short region_type
Definition: wm.h:27
short space_type
Definition: wm.h:26
double PIL_check_seconds_timer(void)
Definition: time.c:64
float max
#define N_(msgid)
void wm_operator_register(bContext *C, wmOperator *op)
Definition: wm.c:365
void WM_operator_free(wmOperator *op)
Definition: wm.c:290
void WM_cursor_wait(bool val)
Definition: wm_cursors.c:209
void wm_draw_region_test(bContext *C, ScrArea *area, ARegion *region)
Definition: wm_draw.c:1368
void wm_draw_update(bContext *C)
Definition: wm_draw.c:1302
bool WM_event_drag_test_with_delta(const wmEvent *event, const int drag_delta[2])
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
int WM_userdef_event_type_from_keymap_type(int kmitype)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void wm_event_do_refresh_wm_and_depsgraph(bContext *C)
int WM_operator_repeat(bContext *C, wmOperator *op)
int WM_operator_call_notest(bContext *C, wmOperator *op)
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_call_ex(bContext *C, wmOperator *op, const bool store)
#define ISMOUSE_MOTION(event_type)
@ RIGHTMOUSE
@ EVT_PADENTER
@ EVT_SPACEKEY
@ MOUSEMOVE
@ LEFTMOUSE
@ EVT_ESCKEY
@ EVT_RIGHTSHIFTKEY
@ EVT_LEFTSHIFTKEY
@ EVT_RETKEY
@ GESTURE_MODAL_CIRCLE_SIZE
@ GESTURE_MODAL_OUT
@ GESTURE_MODAL_SNAP
@ GESTURE_MODAL_CIRCLE_ADD
@ GESTURE_MODAL_CANCEL
@ GESTURE_MODAL_CIRCLE_SUB
@ GESTURE_MODAL_MOVE
@ GESTURE_MODAL_NOP
@ GESTURE_MODAL_DESELECT
@ GESTURE_MODAL_CONFIRM
@ GESTURE_MODAL_IN
@ GESTURE_MODAL_FLIP
@ GESTURE_MODAL_BEGIN
@ GESTURE_MODAL_SELECT
void WM_OT_read_history(wmOperatorType *ot)
Definition: wm_files.c:2328
void WM_OT_save_as_mainfile(wmOperatorType *ot)
Definition: wm_files.c:3192
void WM_OT_open_mainfile(wmOperatorType *ot)
Definition: wm_files.c:2800
PointerRNA * ptr
Definition: wm_files.c:3480
void WM_OT_recover_last_session(wmOperatorType *ot)
Definition: wm_files.c:2931
void WM_OT_read_userpref(wmOperatorType *ot)
Definition: wm_files.c:2293
void WM_OT_save_homefile(wmOperatorType *ot)
Definition: wm_files.c:2136
void WM_OT_read_factory_userpref(wmOperatorType *ot)
Definition: wm_files.c:2303
void WM_OT_save_mainfile(wmOperatorType *ot)
Definition: wm_files.c:3272
void WM_OT_recover_auto_save(wmOperatorType *ot)
Definition: wm_files.c:2990
void WM_OT_read_factory_settings(wmOperatorType *ot)
Definition: wm_files.c:2501
wmOperatorType * ot
Definition: wm_files.c:3479
void WM_OT_read_homefile(wmOperatorType *ot)
Definition: wm_files.c:2467
void WM_OT_save_userpref(wmOperatorType *ot)
Definition: wm_files.c:2165
void WM_OT_revert_mainfile(wmOperatorType *ot)
Definition: wm_files.c:2864
void GIZMOGROUP_OT_gizmo_select(wmOperatorType *ot)
void GIZMOGROUP_OT_gizmo_tweak(wmOperatorType *ot)
void wm_gizmos_keymap(wmKeyConfig *keyconf)
void wm_exit_schedule_delayed(const bContext *C)
Definition: wm_init_exit.c:421
bool WM_jobs_test(const wmWindowManager *wm, const void *owner, int job_type)
Definition: wm_jobs.c:214
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
Definition: wm_keymap.c:914
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition: wm_keymap.c:852
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
Definition: wm_keymap.c:985
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition: wm_keymap.c:888
void WM_keymap_fix_linking(void)
void WM_menutype_idname_visit_for_search(const bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), const char *UNUSED(edit_text), StringPropertySearchVisitFunc visit_fn, void *visit_user_data)
Definition: wm_menu_type.c:103
MenuType * WM_menutype_find(const char *idname, bool quiet)
Definition: wm_menu_type.c:30
ID * WM_operator_properties_id_lookup_from_name_or_session_uuid(Main *bmain, PointerRNA *ptr, const ID_Type type)
bool WM_operator_properties_id_lookup_is_set(PointerRNA *ptr)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
const char * WM_operatortype_name(struct wmOperatorType *ot, struct PointerRNA *properties)
int WM_menu_invoke_ex(bContext *C, wmOperator *op, wmOperatorCallContext opcontext)
char * WM_prop_pystring_assign(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
Definition: wm_operators.c:636
static void WM_OT_call_menu_pie(wmOperatorType *ot)
static void gesture_box_modal_keymap(wmKeyConfig *keyconf)
static int wm_exit_blender_exec(bContext *C, wmOperator *UNUSED(op))
const EnumPropertyItem * RNA_mask_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
#define CTX_TEST_PTR_ID_CAST(C, member, member_full, cast, idptr)
static void WM_OT_search_menu(wmOperatorType *ot)
IDProperty * WM_operator_last_properties_ensure_idprops(wmOperatorType *ot)
#define ID_CAST_SCENEWORLD(id_pt)
static const EnumPropertyItem * rna_id_itemf(bool *r_free, ID *id, bool local, bool(*filter_ids)(const ID *id, void *user_data), void *user_data)
static void WM_OT_doc_view_manual_ui_context(wmOperatorType *ot)
char * WM_context_path_resolve_property_full(const bContext *C, const PointerRNA *ptr, PropertyRNA *prop, int index)
Definition: wm_operators.c:569
bool WM_operator_pystring_abbreviate(char *str, int str_len_max)
Definition: wm_operators.c:272
static char * wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index)
Definition: wm_operators.c:622
static uiBlock * wm_block_search_menu(bContext *C, ARegion *region, void *userdata)
int WM_operator_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void radial_control_paint_tex(RadialControl *rc, float radius, float alpha)
size_t WM_operator_py_idname(char *dst, const char *src)
Definition: wm_operators.c:110
const EnumPropertyItem * RNA_collection_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
int WM_operator_redo_popup(bContext *C, wmOperator *op)
static void wm_block_redo_cancel_cb(bContext *C, void *arg_op)
int WM_operator_props_popup_call(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int wm_call_panel_exec(bContext *C, wmOperator *op)
static void gesture_straightline_modal_keymap(wmKeyConfig *keyconf)
static void radial_control_set_tex(RadialControl *rc)
static void gesture_zoom_border_modal_keymap(wmKeyConfig *keyconf)
static void wm_block_redo_cb(bContext *C, void *arg_op, int UNUSED(arg_event))
static void radial_control_cancel(bContext *C, wmOperator *op)
static void previews_id_ensure(bContext *C, Scene *scene, ID *id)
static int wm_debug_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
int WM_operator_ui_popup(bContext *C, wmOperator *op, int width)
static uiBlock * wm_block_dialog_create(bContext *C, ARegion *region, void *userData)
@ eRTDrawWindowSwap
@ eRTAnimationStep
@ eRTDrawRegionSwap
@ eRTDrawWindow
@ eRTUndo
@ eRTDrawRegion
@ eRTAnimationPlay
void wm_window_keymap(wmKeyConfig *keyconf)
static void redraw_timer_step(bContext *C, Scene *scene, struct Depsgraph *depsgraph, wmWindow *win, ScrArea *area, ARegion *region, const int type, const int cfra)
static int wm_operator_props_popup_ex(bContext *C, wmOperator *op, const bool do_call, const bool do_redo)
void WM_operator_last_properties_ensure(wmOperatorType *ot, PointerRNA *ptr)
static int radial_control_get_path(PointerRNA *ctx_ptr, wmOperator *op, const char *name, PointerRNA *r_ptr, PropertyRNA **r_prop, int req_length, RCPropFlags flags)
static void WM_OT_memory_statistics(wmOperatorType *ot)
#define CTX_TEST_PTR_ID(C, member, idptr)
static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int doc_view_manual_ui_context_exec(bContext *C, wmOperator *UNUSED(op))
#define ID_CAST_OBDATA(id_pt)
static int wm_call_pie_menu_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void radial_control_update_header(wmOperator *op, bContext *C)
static void wm_operator_ui_popup_cancel(struct bContext *C, void *userData)
#define TEST_PTR_DATA_TYPE_FROM_CONTEXT(member, rna_type, rna_ptr)
int WM_operator_confirm_or_exec(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static const char * wm_context_member_from_ptr(const bContext *C, const PointerRNA *ptr, bool *r_is_id)
Definition: wm_operators.c:384
size_t WM_operator_bl_idname(char *dst, const char *src)
Definition: wm_operators.c:128
const EnumPropertyItem * RNA_collection_local_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static const char * wm_call_panel_get_name(wmOperatorType *ot, PointerRNA *ptr)
void WM_operator_properties_reset(wmOperator *op)
Definition: wm_operators.c:757
static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void *customdata)
static void WM_OT_debug_menu(wmOperatorType *ot)
char * WM_operator_pystring(bContext *C, wmOperator *op, const bool all_args, const bool macro_args)
Definition: wm_operators.c:267
static int previews_clear_exec(bContext *C, wmOperator *op)
#define ID_CAST_OBMATACT(id_pt)
static void gesture_lasso_modal_keymap(wmKeyConfig *keyconf)
static void WM_OT_radial_control(wmOperatorType *ot)
int WM_operator_confirm_message(bContext *C, wmOperator *op, const char *message)
static bool rna_id_enum_filter_single(const ID *id, void *user_data)
bool WM_operator_last_properties_store(wmOperator *op)
Definition: wm_operators.c:854
void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring)
Definition: wm_operators.c:680
static int wm_exit_blender_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
#define WM_RADIAL_CONTROL_DISPLAY_WIDTH
bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format)
int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
struct PreviewsIDEnsureData PreviewsIDEnsureData
static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *event)
static int radial_control_get_properties(bContext *C, wmOperator *op)
static int wm_call_pie_menu_exec(bContext *C, wmOperator *op)
void wm_operatortypes_register(void)
static bool redraw_timer_poll(bContext *C)
static void WM_OT_call_menu(wmOperatorType *ot)
static void wm_operator_ui_popup_ok(struct bContext *C, void *arg, int retval)
static int wm_call_menu_exec(bContext *C, wmOperator *op)
bool WM_operator_winactive(bContext *C)
const EnumPropertyItem * RNA_scene_without_active_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
int WM_operator_smooth_viewtx_get(const wmOperator *op)
bool WM_operator_check_ui_enabled(const bContext *C, const char *idname)
bool WM_paint_cursor_end(wmPaintCursor *handle)
static int previews_id_ensure_callback(LibraryIDLinkCallbackData *cb_data)
int WM_enum_search_invoke_previews(bContext *C, wmOperator *op, short prv_cols, short prv_rows)
void WM_paint_cursor_remove_by_type(wmWindowManager *wm, void *draw_fn, void(*free)(void *))
char * WM_operator_pystring_ex(bContext *C, wmOperator *op, const bool all_args, const bool macro_args, wmOperatorType *ot, PointerRNA *opptr)
Definition: wm_operators.c:192
static uiBlock * wm_block_create_redo(bContext *C, ARegion *region, void *arg_op)
int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void WM_OT_redraw_timer(wmOperatorType *ot)
const EnumPropertyItem * RNA_scene_local_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static void WM_OT_search_operator(wmOperatorType *ot)
static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *event)
static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
const EnumPropertyItem * RNA_movieclip_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static void WM_OT_previews_clear(wmOperatorType *ot)
static uiBlock * wm_operator_ui_create(bContext *C, ARegion *region, void *userData)
static bool wm_operator_winactive_normal(bContext *C)
int WM_operator_props_popup(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
const EnumPropertyItem * RNA_mask_local_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
bool WM_operator_last_properties_init(wmOperator *op)
Definition: wm_operators.c:839
static void WM_OT_stereo3d_set(wmOperatorType *ot)
static void redraw_timer_window_swap(bContext *C)
int WM_generic_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: wm_operators.c:962
static void WM_OT_call_panel(wmOperatorType *ot)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
Definition: wm_operators.c:661
int WM_operator_confirm_message_ex(bContext *C, wmOperator *op, const char *title, const int icon, const char *message, const wmOperatorCallContext opcontext)
static void WM_OT_quit_blender(wmOperatorType *ot)
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)
bool WM_operator_properties_default(PointerRNA *ptr, const bool do_update)
Definition: wm_operators.c:730
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static const EnumPropertyItem preview_id_type_items[]
static void WM_OT_window_new_main(wmOperatorType *ot)
static bool operator_last_properties_init_impl(wmOperator *op, IDProperty *last_properties)
Definition: wm_operators.c:801
static int wm_operator_defaults_exec(bContext *C, wmOperator *op)
static int previews_ensure_exec(bContext *C, wmOperator *UNUSED(op))
static void WM_OT_window_new(wmOperatorType *ot)
static int redraw_timer_exec(bContext *C, wmOperator *op)
void WM_operator_properties_clear(PointerRNA *ptr)
Definition: wm_operators.c:774
RCPropFlags
@ RC_PROP_REQUIRE_FLOAT
@ RC_PROP_REQUIRE_BOOL
@ RC_PROP_ALLOW_MISSING
#define TEST_PTR_DATA_TYPE(member, rna_type, rna_ptr, dataptr_cmp)
static const char * wm_call_menu_get_name(wmOperatorType *ot, PointerRNA *ptr)
static int wm_debug_menu_exec(bContext *C, wmOperator *op)
static int memory_statistics_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
int WM_generic_select_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: wm_operators.c:903
static void WM_OT_previews_ensure(wmOperatorType *ot)
ID * WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short idcode)
static uint preview_filter_to_idfilter(enum PreviewFilterID filter)
static const EnumPropertyItem redraw_timer_type_items[]
static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
static void radial_control_set_value(RadialControl *rc, float val)
void WM_operator_properties_create(PointerRNA *ptr, const char *opstring)
Definition: wm_operators.c:667
int WM_enum_search_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
wmPaintCursor * WM_paint_cursor_activate(short space_type, short region_type, bool(*poll)(bContext *C), wmPaintCursorDraw draw, void *customdata)
static void dialog_exec_cb(bContext *C, void *arg1, void *arg2)
#define WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE
const EnumPropertyItem * RNA_action_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static void radial_control_paint_curve(uint pos, Brush *br, float radius, int line_segments)
static void WM_OT_window_close(wmOperatorType *ot)
void WM_operator_properties_free(PointerRNA *ptr)
Definition: wm_operators.c:783
const EnumPropertyItem * RNA_scene_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
const EnumPropertyItem * RNA_image_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
PreviewFilterID
@ PREVIEW_FILTER_WORLD
@ PREVIEW_FILTER_TEXTURE
@ PREVIEW_FILTER_GEOMETRY
@ PREVIEW_FILTER_LIGHT
@ PREVIEW_FILTER_MATERIAL
@ PREVIEW_FILTER_COLLECTION
@ PREVIEW_FILTER_ALL
@ PREVIEW_FILTER_IMAGE
@ PREVIEW_FILTER_OBJECT
@ PREVIEW_FILTER_SCENE
@ PREVIEW_FILTER_SHADING
void WM_operator_properties_sanitize(PointerRNA *ptr, const bool no_context)
Definition: wm_operators.c:701
bool WM_operator_py_idname_ok_or_report(ReportList *reports, const char *classname, const char *idname)
Definition: wm_operators.c:144
#define WM_RADIAL_MAX_STR
char * WM_context_path_resolve_full(bContext *C, const PointerRNA *ptr)
Definition: wm_operators.c:617
#define WM_RADIAL_CONTROL_DISPLAY_SIZE
void WM_operator_view3d_unit_defaults(struct bContext *C, struct wmOperator *op)
Definition: wm_operators.c:977
static int wm_search_menu_invoke(bContext *C, wmOperator *op, const wmEvent *event)
wmOperator * WM_operator_last_redo(const bContext *C)
static void WM_OT_operator_defaults(wmOperatorType *ot)
const EnumPropertyItem * RNA_movieclip_local_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
static uiBlock * wm_enum_search_menu(bContext *C, ARegion *region, void *arg)
struct wmOpPopUp wmOpPopUp
const EnumPropertyItem * RNA_image_local_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
PanelType * WM_paneltype_find(const char *idname, bool quiet)
Definition: wm_panel_type.c:28
void WM_paneltype_idname_visit_for_search(const bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), const char *UNUSED(edit_text), StringPropertySearchVisitFunc visit_fn, void *visit_user_data)
Definition: wm_panel_type.c:69
void WM_OT_splash_about(wmOperatorType *ot)
void WM_OT_splash(wmOperatorType *ot)
int wm_stereo3d_set_exec(bContext *C, wmOperator *op)
Definition: wm_stereo.c:255
bool wm_stereo3d_set_check(bContext *UNUSED(C), wmOperator *UNUSED(op))
Definition: wm_stereo.c:390
int wm_stereo3d_set_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: wm_stereo.c:343
void wm_stereo3d_set_draw(bContext *UNUSED(C), wmOperator *op)
Definition: wm_stereo.c:353
void wm_stereo3d_set_cancel(bContext *UNUSED(C), wmOperator *op)
Definition: wm_stereo.c:398
int wm_window_new_main_exec(bContext *C, wmOperator *op)
Definition: wm_window.c:897
int wm_window_close_exec(bContext *C, wmOperator *UNUSED(op))
Definition: wm_window.c:865
void wm_quit_with_optional_confirmation_prompt(bContext *C, wmWindow *win)
Definition: wm_window.c:339
bScreen * WM_window_get_active_screen(const wmWindow *win)
Definition: wm_window.c:2300
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
Definition: wm_window.c:1028
int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op))
Definition: wm_window.c:909
int wm_window_new_exec(bContext *C, wmOperator *op)
Definition: wm_window.c:873
void wm_xr_operatortypes_register(void)