Blender  V3.3
screen_ops.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #include <math.h>
9 #include <string.h>
10 
11 #include "MEM_guardedalloc.h"
12 
13 #include "BLI_blenlib.h"
14 #include "BLI_dlrbTree.h"
15 #include "BLI_math.h"
16 #include "BLI_utildefines.h"
17 
18 #include "BLT_translation.h"
19 
20 #include "DNA_anim_types.h"
21 #include "DNA_armature_types.h"
22 #include "DNA_curve_types.h"
23 #include "DNA_lattice_types.h"
24 #include "DNA_mask_types.h"
25 #include "DNA_mesh_types.h"
26 #include "DNA_meta_types.h"
27 #include "DNA_node_types.h"
28 #include "DNA_object_types.h"
29 #include "DNA_scene_types.h"
30 #include "DNA_userdef_types.h"
31 #include "DNA_workspace_types.h"
32 
33 #include "BKE_context.h"
34 #include "BKE_editmesh.h"
35 #include "BKE_fcurve.h"
36 #include "BKE_global.h"
37 #include "BKE_icons.h"
38 #include "BKE_lib_id.h"
39 #include "BKE_main.h"
40 #include "BKE_mask.h"
41 #include "BKE_object.h"
42 #include "BKE_report.h"
43 #include "BKE_scene.h"
44 #include "BKE_screen.h"
45 #include "BKE_sound.h"
46 #include "BKE_workspace.h"
47 
48 #include "WM_api.h"
49 #include "WM_types.h"
50 
51 #include "DEG_depsgraph.h"
52 #include "DEG_depsgraph_query.h"
53 
54 #include "ED_anim_api.h"
55 #include "ED_armature.h"
56 #include "ED_clip.h"
57 #include "ED_fileselect.h"
58 #include "ED_image.h"
59 #include "ED_keyframes_keylist.h"
60 #include "ED_mesh.h"
61 #include "ED_object.h"
62 #include "ED_screen.h"
63 #include "ED_screen_types.h"
64 #include "ED_sequencer.h"
65 #include "ED_undo.h"
66 #include "ED_util.h"
67 #include "ED_view3d.h"
68 
69 #include "RNA_access.h"
70 #include "RNA_define.h"
71 #include "RNA_enum_types.h"
72 #include "RNA_prototypes.h"
73 
74 #include "UI_interface.h"
75 #include "UI_resources.h"
76 #include "UI_view2d.h"
77 
78 #include "GPU_capabilities.h"
79 
80 #include "screen_intern.h" /* own module include */
81 
82 #define KM_MODAL_CANCEL 1
83 #define KM_MODAL_APPLY 2
84 #define KM_MODAL_SNAP_ON 3
85 #define KM_MODAL_SNAP_OFF 4
86 
87 /* -------------------------------------------------------------------- */
92 {
93  if (CTX_wm_window(C) == NULL) {
94  return false;
95  }
96  if (CTX_wm_screen(C) == NULL) {
97  return false;
98  }
99  if (CTX_wm_region(C) == NULL) {
100  return false;
101  }
102  return true;
103 }
104 
106 {
107  if (CTX_wm_window(C) == NULL) {
108  return false;
109  }
110  if (CTX_wm_screen(C) == NULL) {
111  return false;
112  }
113  if (CTX_wm_area(C) == NULL) {
114  return false;
115  }
116  return true;
117 }
118 
120 {
121  if (CTX_wm_window(C) == NULL) {
122  return false;
123  }
124  if (CTX_wm_screen(C) == NULL) {
125  return false;
126  }
127  return true;
128 }
129 
131 {
132  if (G.background) {
133  return false;
134  }
135  return ED_operator_screenactive(C);
136 }
137 
138 /* XXX added this to prevent anim state to change during renders */
140 {
141  if (G.is_rendering) {
142  return false;
143  }
144  if (CTX_wm_window(C) == NULL) {
145  return false;
146  }
147  if (CTX_wm_screen(C) == NULL) {
148  return false;
149  }
150  return true;
151 }
152 
154 {
155  if (CTX_wm_window(C) == NULL) {
156  return false;
157  }
158  bScreen *screen = CTX_wm_screen(C);
159  if (screen == NULL) {
160  return false;
161  }
162  if (screen->active_region != NULL) {
163  return false;
164  }
165  return true;
166 }
167 
169 {
171  if (scene) {
172  return true;
173  }
174  return false;
175 }
176 
178 {
180  if (scene == NULL || !BKE_id_is_editable(CTX_data_main(C), &scene->id)) {
181  return false;
182  }
183  return true;
184 }
185 
187 {
189  Object *obact = CTX_data_active_object(C);
190 
191  if (scene == NULL || ID_IS_LINKED(scene)) {
192  return false;
193  }
194  if (CTX_data_edit_object(C)) {
195  return false;
196  }
197 
198  /* add a check for ob->mode too? */
199  if (obact && (obact->mode != OB_MODE_OBJECT)) {
200  return false;
201  }
202 
203  return true;
204 }
205 
207 {
208  if (!ED_operator_objectmode(C)) {
209  CTX_wm_operator_poll_msg_set(C, "Only supported in object mode");
210  return false;
211  }
212 
213  return true;
214 }
215 
216 static bool ed_spacetype_test(bContext *C, int type)
217 {
218  if (ED_operator_areaactive(C)) {
220  return sl && (sl->spacetype == type);
221  }
222  return false;
223 }
224 
226 {
228 }
229 
231 {
232  if (CTX_wm_region_view3d(C)) {
233  return true;
234  }
235 
236  CTX_wm_operator_poll_msg_set(C, "expected a view3d region");
237  return false;
238 }
239 
241 {
242  if (ED_operator_areaactive(C)) {
244  if (sl && (ELEM(sl->spacetype, SPACE_SEQ, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH))) {
245  return true;
246  }
247  }
248 
249  CTX_wm_operator_poll_msg_set(C, "expected a timeline/animation area to be active");
250  return false;
251 }
252 
254 {
256 }
257 
259 {
262  Object *obedit = CTX_data_edit_object(C);
263  if (ob && ob == obedit) {
264  return false;
265  }
266  return true;
267  }
268  return false;
269 }
270 
272 {
273  return ed_spacetype_test(C, SPACE_FILE);
274 }
275 
277 {
280  }
281  return false;
282 }
283 
285 {
288  }
289  return false;
290 }
291 
293 {
295 }
296 
298 {
300 }
301 
303 {
305 }
306 
308 {
309  SpaceNode *snode = CTX_wm_space_node(C);
310 
311  if (snode && snode->edittree) {
312  return true;
313  }
314 
315  return false;
316 }
317 
319 {
320  SpaceNode *snode = CTX_wm_space_node(C);
321 
322  if (snode && snode->edittree && BKE_id_is_editable(CTX_data_main(C), &snode->edittree->id)) {
323  return true;
324  }
325 
326  return false;
327 }
328 
330 {
332 }
333 
335 {
336  return ed_spacetype_test(C, SPACE_SEQ);
337 }
338 
340 {
342 }
343 
345 {
347 }
348 
350 {
351  return ed_spacetype_test(C, SPACE_NLA);
352 }
353 
355 {
356  return ed_spacetype_test(C, SPACE_INFO);
357 }
358 
360 {
362 }
363 
364 static bool ed_object_hidden(const Object *ob)
365 {
366  /* if hidden but in edit mode, we still display, can happen with animation */
367  return ((ob->visibility_flag & OB_HIDE_VIEWPORT) && !(ob->mode & OB_MODE_EDIT));
368 }
369 
371 {
373  return ((ob != NULL) && !ed_object_hidden(ob));
374 }
375 
377 {
378  if (ob == NULL) {
379  CTX_wm_operator_poll_msg_set(C, "Context missing active object");
380  return false;
381  }
382 
383  if (!BKE_id_is_editable(CTX_data_main(C), (ID *)ob)) {
384  CTX_wm_operator_poll_msg_set(C, "Cannot edit library linked or non-editable override object");
385  return false;
386  }
387 
388  if (ed_object_hidden(ob)) {
389  CTX_wm_operator_poll_msg_set(C, "Cannot edit hidden object");
390  return false;
391  }
392 
393  return true;
394 }
395 
397 {
400 }
401 
403 {
405 }
406 
408 {
411 }
412 
414 {
416  return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_MESH) &&
418 }
419 
421 {
423  return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_FONT) &&
425 }
426 
428 {
430  return (mesh != NULL) && !ID_IS_LINKED(mesh) && !ID_IS_OVERRIDE_LIBRARY(mesh);
431 }
432 
434 {
435  Object *obedit = CTX_data_edit_object(C);
436  if (obedit && obedit->type == OB_MESH) {
437  return NULL != BKE_editmesh_from_object(obedit);
438  }
439  return false;
440 }
441 
443 {
445 }
446 
448 {
450  return true;
451  }
452 
453  CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editmesh");
454  return false;
455 }
456 
458 {
459  Object *obedit = CTX_data_edit_object(C);
460  if (obedit && obedit->type == OB_MESH && (((Mesh *)(obedit->data))->flag & ME_AUTOSMOOTH)) {
461  return NULL != BKE_editmesh_from_object(obedit);
462  }
463  return false;
464 }
465 
467 {
468  Object *obedit = CTX_data_edit_object(C);
469  if (obedit && obedit->type == OB_ARMATURE) {
470  return NULL != ((bArmature *)obedit->data)->edbo;
471  }
472  return false;
473 }
474 
483 {
484  if (obact != NULL && !(obact->mode & OB_MODE_EDIT)) {
485  if (obact == BKE_object_pose_armature_get(obact)) {
486  return true;
487  }
488  }
489 
490  CTX_wm_operator_poll_msg_set(C, "No object, or not exclusively in pose mode");
491  return false;
492 }
493 
495 {
497 
498  return ed_operator_posemode_exclusive_ex(C, obact);
499 }
500 
502 {
504 
505  if (!ed_operator_posemode_exclusive_ex(C, obact)) {
506  return false;
507  }
508 
509  if (ID_IS_OVERRIDE_LIBRARY(obact)) {
510  CTX_wm_operator_poll_msg_set(C, "Object is a local library override");
511  return false;
512  }
513 
514  return true;
515 }
516 
518 {
520 
521  if (obpose && !(obpose->mode & OB_MODE_EDIT)) {
522  if (BKE_object_pose_context_check(obpose)) {
523  return true;
524  }
525  }
526 
527  return false;
528 }
529 
531 {
532  Object *obact = CTX_data_active_object(C);
533 
534  if (obact && !(obact->mode & OB_MODE_EDIT)) {
535  Object *obpose = BKE_object_pose_armature_get(obact);
536  if (obpose != NULL) {
537  if ((obact == obpose) || (obact->mode & OB_MODE_ALL_WEIGHT_PAINT)) {
538  return true;
539  }
540  }
541  }
542 
543  return false;
544 }
545 
547 {
548  if (ED_operator_posemode(C)) {
549  Main *bmain = CTX_data_main(C);
551  bArmature *arm = ob->data;
552  return (BKE_id_is_editable(bmain, &ob->id) && BKE_id_is_editable(bmain, &arm->id));
553  }
554  return false;
555 }
556 
558 {
560  Object *obedit = CTX_data_edit_object(C);
561  return ED_space_image_show_uvedit(sima, obedit);
562 }
563 
565 {
567  Object *obedit = CTX_data_edit_object(C);
568  return sima && ED_space_image_show_uvedit(sima, obedit);
569 }
570 
572 {
573  Object *obedit = CTX_data_edit_object(C);
574  BMEditMesh *em = NULL;
575 
576  if (obedit && obedit->type == OB_MESH) {
577  em = BKE_editmesh_from_object(obedit);
578  }
579 
580  if (em && (em->bm->totface)) {
581  return true;
582  }
583 
584  return false;
585 }
586 
588 {
589  Object *obedit = CTX_data_edit_object(C);
590  if (obedit && ELEM(obedit->type, OB_CURVES_LEGACY, OB_SURF)) {
591  return NULL != ((Curve *)obedit->data)->editnurb;
592  }
593  return false;
594 }
595 
597 {
599  return true;
600  }
601 
602  CTX_wm_operator_poll_msg_set(C, "expected a view3d region & editcurve");
603  return false;
604 }
605 
607 {
608  Object *obedit = CTX_data_edit_object(C);
609  if (obedit && obedit->type == OB_CURVES_LEGACY) {
610  return NULL != ((Curve *)obedit->data)->editnurb;
611  }
612  return false;
613 }
614 
616 {
617  Object *obedit = CTX_data_edit_object(C);
618  if (obedit && obedit->type == OB_CURVES_LEGACY) {
619  Curve *cu = (Curve *)obedit->data;
620 
621  return (cu->flag & CU_3D) && (NULL != cu->editnurb);
622  }
623  return false;
624 }
625 
627 {
628  Object *obedit = CTX_data_edit_object(C);
629  if (obedit && obedit->type == OB_SURF) {
630  return NULL != ((Curve *)obedit->data)->editnurb;
631  }
632  return false;
633 }
634 
636 {
637  Object *obedit = CTX_data_edit_object(C);
638  if (obedit && obedit->type == OB_FONT) {
639  return NULL != ((Curve *)obedit->data)->editfont;
640  }
641  return false;
642 }
643 
645 {
646  Object *obedit = CTX_data_edit_object(C);
647  if (obedit && obedit->type == OB_LATTICE) {
648  return NULL != ((Lattice *)obedit->data)->editlatt;
649  }
650  return false;
651 }
652 
654 {
655  Object *obedit = CTX_data_edit_object(C);
656  if (obedit && obedit->type == OB_MBALL) {
657  return NULL != ((MetaBall *)obedit->data)->editelems;
658  }
659  return false;
660 }
661 
663 {
664  struct Camera *cam = CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data;
665  return (cam != NULL && !ID_IS_LINKED(cam));
666 }
667 
670 /* -------------------------------------------------------------------- */
675 {
677  /* no full window splitting allowed */
678  if (CTX_wm_screen(C)->state != SCREENNORMAL) {
679  return false;
680  }
681  return true;
682  }
683  return false;
684 }
685 
688 /* -------------------------------------------------------------------- */
692 /* operator state vars used:
693  * none
694  *
695  * functions:
696  *
697  * apply() set action-zone event
698  *
699  * exit() free customdata
700  *
701  * callbacks:
702  *
703  * exec() never used
704  *
705  * invoke() check if in zone
706  * add customdata, put mouseco and area in it
707  * add modal handler
708  *
709  * modal() accept modal events while doing it
710  * call apply() with gesture info, active window, nonactive window
711  * call exit() and remove handler when LMB confirm
712  */
713 
714 typedef struct sActionzoneData {
717  int x, y;
719  int modifier;
721 
722 /* quick poll to save operators to be created and handled */
724 {
725  wmWindow *win = CTX_wm_window(C);
726  if (win && win->eventstate) {
727  bScreen *screen = WM_window_get_active_screen(win);
728  if (screen) {
729  const int *xy = &win->eventstate->xy[0];
730 
731  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
732  LISTBASE_FOREACH (AZone *, az, &area->actionzones) {
733  if (BLI_rcti_isect_pt_v(&az->rect, xy)) {
734  return true;
735  }
736  }
737  }
738  }
739  }
740  return false;
741 }
742 
743 /* the debug drawing of the click_rect is in area_draw_azone_fullscreen, keep both in sync */
745  rcti *rect, const short UNUSED(x1), const short UNUSED(y1), const short x2, const short y2)
746 {
747  BLI_rcti_init(rect, x2 - U.widget_unit, x2, y2 - U.widget_unit, y2);
748 }
749 
750 static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)
751 {
752  const ARegion *region = az->region;
753  *r_rect_clip = az->rect;
754  if (az->type == AZONE_REGION) {
755  if (region->overlap && (region->v2d.keeptot != V2D_KEEPTOT_STRICT) &&
756  /* Only when this isn't hidden (where it's displayed as an button that expands). */
757  ((az->region->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) == 0)) {
758  /* A floating region to be resized, clip by the visible region. */
759  switch (az->edge) {
761  case AE_BOTTOM_TO_TOPLEFT: {
762  r_rect_clip->xmin = max_ii(
763  r_rect_clip->xmin,
764  (region->winrct.xmin +
765  UI_view2d_view_to_region_x(&region->v2d, region->v2d.tot.xmin)) -
767  r_rect_clip->xmax = min_ii(
768  r_rect_clip->xmax,
769  (region->winrct.xmin +
770  UI_view2d_view_to_region_x(&region->v2d, region->v2d.tot.xmax)) +
772  return true;
773  }
774  case AE_LEFT_TO_TOPRIGHT:
775  case AE_RIGHT_TO_TOPLEFT: {
776  r_rect_clip->ymin = max_ii(
777  r_rect_clip->ymin,
778  (region->winrct.ymin +
779  UI_view2d_view_to_region_y(&region->v2d, region->v2d.tot.ymin)) -
781  r_rect_clip->ymax = min_ii(
782  r_rect_clip->ymax,
783  (region->winrct.ymin +
784  UI_view2d_view_to_region_y(&region->v2d, region->v2d.tot.ymax)) +
786  return true;
787  }
788  }
789  }
790  }
791  return false;
792 }
793 
794 static AZone *area_actionzone_refresh_xy(ScrArea *area, const int xy[2], const bool test_only)
795 {
796  AZone *az = NULL;
797 
798  for (az = area->actionzones.first; az; az = az->next) {
799  rcti az_rect_clip;
800  if (BLI_rcti_isect_pt_v(&az->rect, xy) &&
801  /* Check clipping if this is clipped */
802  (!azone_clipped_rect_calc(az, &az_rect_clip) || BLI_rcti_isect_pt_v(&az_rect_clip, xy))) {
803 
804  if (az->type == AZONE_AREA) {
805  break;
806  }
807  if (az->type == AZONE_REGION) {
808  break;
809  }
810  if (az->type == AZONE_FULLSCREEN) {
811  rcti click_rect;
812  fullscreen_click_rcti_init(&click_rect, az->x1, az->y1, az->x2, az->y2);
813  const bool click_isect = BLI_rcti_isect_pt_v(&click_rect, xy);
814 
815  if (test_only) {
816  if (click_isect) {
817  break;
818  }
819  }
820  else {
821  if (click_isect) {
822  az->alpha = 1.0f;
823  }
824  else {
825  const int mouse_sq = square_i(xy[0] - az->x2) + square_i(xy[1] - az->y2);
826  const int spot_sq = square_i(AZONESPOTW);
827  const int fadein_sq = square_i(AZONEFADEIN);
828  const int fadeout_sq = square_i(AZONEFADEOUT);
829 
830  if (mouse_sq < spot_sq) {
831  az->alpha = 1.0f;
832  }
833  else if (mouse_sq < fadein_sq) {
834  az->alpha = 1.0f;
835  }
836  else if (mouse_sq < fadeout_sq) {
837  az->alpha = 1.0f -
838  ((float)(mouse_sq - fadein_sq)) / ((float)(fadeout_sq - fadein_sq));
839  }
840  else {
841  az->alpha = 0.0f;
842  }
843 
844  /* fade in/out but no click */
845  az = NULL;
846  }
847 
848  /* XXX force redraw to show/hide the action zone */
850  break;
851  }
852  }
853  else if (az->type == AZONE_REGION_SCROLL) {
854  ARegion *region = az->region;
855  View2D *v2d = &region->v2d;
856  int scroll_flag = 0;
857  const int isect_value = UI_view2d_mouse_in_scrollers_ex(region, v2d, xy, &scroll_flag);
858 
859  /* Check if we even have scroll bars. */
860  if (((az->direction == AZ_SCROLL_HOR) && !(scroll_flag & V2D_SCROLL_HORIZONTAL)) ||
861  ((az->direction == AZ_SCROLL_VERT) && !(scroll_flag & V2D_SCROLL_VERTICAL))) {
862  /* no scrollbars, do nothing. */
863  }
864  else if (test_only) {
865  if (isect_value != 0) {
866  break;
867  }
868  }
869  else {
870  bool redraw = false;
871 
872  if (isect_value == 'h') {
873  if (az->direction == AZ_SCROLL_HOR) {
874  az->alpha = 1.0f;
875  v2d->alpha_hor = 255;
876  redraw = true;
877  }
878  }
879  else if (isect_value == 'v') {
880  if (az->direction == AZ_SCROLL_VERT) {
881  az->alpha = 1.0f;
882  v2d->alpha_vert = 255;
883  redraw = true;
884  }
885  }
886  else {
887  const int local_xy[2] = {xy[0] - region->winrct.xmin, xy[1] - region->winrct.ymin};
888  float dist_fac = 0.0f, alpha = 0.0f;
889 
890  if (az->direction == AZ_SCROLL_HOR) {
891  float hide_width = (az->y2 - az->y1) / 2.0f;
892  dist_fac = BLI_rcti_length_y(&v2d->hor, local_xy[1]) / hide_width;
893  CLAMP(dist_fac, 0.0f, 1.0f);
894  alpha = 1.0f - dist_fac;
895 
896  v2d->alpha_hor = alpha * 255;
897  }
898  else if (az->direction == AZ_SCROLL_VERT) {
899  float hide_width = (az->x2 - az->x1) / 2.0f;
900  dist_fac = BLI_rcti_length_x(&v2d->vert, local_xy[0]) / hide_width;
901  CLAMP(dist_fac, 0.0f, 1.0f);
902  alpha = 1.0f - dist_fac;
903 
904  v2d->alpha_vert = alpha * 255;
905  }
906  az->alpha = alpha;
907  redraw = true;
908  }
909 
910  if (redraw) {
912  }
913  /* Don't return! */
914  }
915  }
916  }
917  else if (!test_only && !IS_EQF(az->alpha, 0.0f)) {
918  if (az->type == AZONE_FULLSCREEN) {
919  az->alpha = 0.0f;
922  }
923  else if (az->type == AZONE_REGION_SCROLL) {
924  if (az->direction == AZ_SCROLL_VERT) {
925  az->alpha = az->region->v2d.alpha_vert = 0;
928  }
929  else if (az->direction == AZ_SCROLL_HOR) {
930  az->alpha = az->region->v2d.alpha_hor = 0;
933  }
934  else {
935  BLI_assert(false);
936  }
937  }
938  }
939  }
940 
941  return az;
942 }
943 
944 /* Finds an action-zone by position in entire screen so azones can overlap. */
945 static AZone *screen_actionzone_find_xy(bScreen *screen, const int xy[2])
946 {
947  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
948  AZone *az = area_actionzone_refresh_xy(area, xy, true);
949  if (az != NULL) {
950  return az;
951  }
952  }
953  return NULL;
954 }
955 
956 /* Returns the area that the azone belongs to */
957 static ScrArea *screen_actionzone_area(bScreen *screen, const AZone *az)
958 {
959  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
960  LISTBASE_FOREACH (AZone *, zone, &area->actionzones) {
961  if (zone == az) {
962  return area;
963  }
964  }
965  }
966  return NULL;
967 }
968 
970 {
971  return area_actionzone_refresh_xy(area, xy, true);
972 }
973 
975 {
976  return area_actionzone_refresh_xy(area, xy, false);
977 }
978 
979 static void actionzone_exit(wmOperator *op)
980 {
982 
983  G.moving &= ~G_TRANSFORM_WM;
984 }
985 
986 /* send EVT_ACTIONZONE event */
987 static void actionzone_apply(bContext *C, wmOperator *op, int type)
988 {
989  wmWindow *win = CTX_wm_window(C);
990 
991  wmEvent event;
992  wm_event_init_from_window(win, &event);
993 
994  if (type == AZONE_AREA) {
995  event.type = EVT_ACTIONZONE_AREA;
996  }
997  else if (type == AZONE_FULLSCREEN) {
998  event.type = EVT_ACTIONZONE_FULLSCREEN;
999  }
1000  else {
1001  event.type = EVT_ACTIONZONE_REGION;
1002  }
1003 
1004  event.val = KM_NOTHING;
1005  event.flag = 0;
1006  event.customdata = op->customdata;
1007  event.customdata_free = true;
1008  op->customdata = NULL;
1009 
1010  wm_event_add(win, &event);
1011 }
1012 
1013 static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1014 {
1015  bScreen *screen = CTX_wm_screen(C);
1016  AZone *az = screen_actionzone_find_xy(screen, event->xy);
1017 
1018  /* Quick escape - Scroll azones only hide/unhide the scroll-bars,
1019  * they have their own handling. */
1020  if (az == NULL || ELEM(az->type, AZONE_REGION_SCROLL)) {
1021  return OPERATOR_PASS_THROUGH;
1022  }
1023 
1024  /* ok we do the action-zone */
1025  sActionzoneData *sad = op->customdata = MEM_callocN(sizeof(sActionzoneData), "sActionzoneData");
1026  sad->sa1 = screen_actionzone_area(screen, az);
1027  sad->az = az;
1028  sad->x = event->xy[0];
1029  sad->y = event->xy[1];
1030  sad->modifier = RNA_int_get(op->ptr, "modifier");
1031 
1032  /* region azone directly reacts on mouse clicks */
1033  if (ELEM(sad->az->type, AZONE_REGION, AZONE_FULLSCREEN)) {
1034  actionzone_apply(C, op, sad->az->type);
1035  actionzone_exit(op);
1036  return OPERATOR_FINISHED;
1037  }
1038 
1040 
1041  /* add modal handler */
1042  G.moving |= G_TRANSFORM_WM;
1044  return OPERATOR_RUNNING_MODAL;
1045 }
1046 
1047 static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
1048 {
1049  bScreen *screen = CTX_wm_screen(C);
1050  sActionzoneData *sad = op->customdata;
1051 
1052  switch (event->type) {
1053  case MOUSEMOVE: {
1054  const int delta_x = (event->xy[0] - sad->x);
1055  const int delta_y = (event->xy[1] - sad->y);
1056 
1057  /* Movement in dominant direction. */
1058  const int delta_max = max_ii(abs(delta_x), abs(delta_y));
1059 
1060  /* Movement in dominant direction before action taken. */
1061  const int join_threshold = (0.6 * U.widget_unit);
1062  const int split_threshold = (1.2 * U.widget_unit);
1063  const int area_threshold = (0.1 * U.widget_unit);
1064 
1065  /* Calculate gesture cardinal direction. */
1066  if (delta_y > abs(delta_x)) {
1067  sad->gesture_dir = SCREEN_DIR_N;
1068  }
1069  else if (delta_x >= abs(delta_y)) {
1070  sad->gesture_dir = SCREEN_DIR_E;
1071  }
1072  else if (delta_y < -abs(delta_x)) {
1073  sad->gesture_dir = SCREEN_DIR_S;
1074  }
1075  else {
1076  sad->gesture_dir = SCREEN_DIR_W;
1077  }
1078 
1079  bool is_gesture;
1080  if (sad->az->type == AZONE_AREA) {
1081  wmWindow *win = CTX_wm_window(C);
1082 
1083  rcti screen_rect;
1084  WM_window_screen_rect_calc(win, &screen_rect);
1085 
1086  /* Have we dragged off the zone and are not on an edge? */
1087  if ((ED_area_actionzone_find_xy(sad->sa1, event->xy) != sad->az) &&
1089  AREAMAP_FROM_SCREEN(screen), &screen_rect, event->xy[0], event->xy[1]) == NULL)) {
1090 
1091  /* What area are we now in? */
1093 
1094  if (sad->modifier == 1) {
1095  /* Duplicate area into new window. */
1097  is_gesture = (delta_max > area_threshold);
1098  }
1099  else if (sad->modifier == 2) {
1100  /* Swap areas. */
1102  is_gesture = true;
1103  }
1104  else if (area == sad->sa1) {
1105  /* Same area, so possible split. */
1106  WM_cursor_set(win,
1109  is_gesture = (delta_max > split_threshold);
1110  }
1111  else if (!area || area->global) {
1112  /* No area or Top bar or Status bar. */
1114  is_gesture = false;
1115  }
1116  else {
1117  /* Different area, so possible join. */
1118  if (sad->gesture_dir == SCREEN_DIR_N) {
1120  }
1121  else if (sad->gesture_dir == SCREEN_DIR_S) {
1123  }
1124  else if (sad->gesture_dir == SCREEN_DIR_E) {
1126  }
1127  else {
1130  }
1131  is_gesture = (delta_max > join_threshold);
1132  }
1133  }
1134  else {
1136  is_gesture = false;
1137  }
1138  }
1139  else {
1140  is_gesture = (delta_max > area_threshold);
1141  }
1142 
1143  /* gesture is large enough? */
1144  if (is_gesture) {
1145  /* second area, for join when (sa1 != sa2) */
1146  sad->sa2 = BKE_screen_find_area_xy(screen, SPACE_TYPE_ANY, event->xy);
1147  /* apply sends event */
1148  actionzone_apply(C, op, sad->az->type);
1149  actionzone_exit(op);
1150 
1151  return OPERATOR_FINISHED;
1152  }
1153  break;
1154  }
1155  case EVT_ESCKEY:
1156  actionzone_exit(op);
1157  return OPERATOR_CANCELLED;
1158  case LEFTMOUSE:
1159  actionzone_exit(op);
1160  return OPERATOR_CANCELLED;
1161  }
1162 
1163  return OPERATOR_RUNNING_MODAL;
1164 }
1165 
1167 {
1168  actionzone_exit(op);
1169 }
1170 
1172 {
1173  /* identifiers */
1174  ot->name = "Handle Area Action Zones";
1175  ot->description = "Handle area action zones for mouse actions/gestures";
1176  ot->idname = "SCREEN_OT_actionzone";
1177 
1182 
1183  /* flags */
1185 
1186  RNA_def_int(ot->srna, "modifier", 0, 0, 2, "Modifier", "Modifier state", 0, 2);
1187 }
1188 
1191 /* -------------------------------------------------------------------- */
1196  const int cursor[2],
1197  ScrArea **r_sa1,
1198  ScrArea **r_sa2)
1199 {
1200  wmWindow *win = CTX_wm_window(C);
1201  bScreen *screen = CTX_wm_screen(C);
1202  rcti window_rect;
1203  WM_window_rect_calc(win, &window_rect);
1205  AREAMAP_FROM_SCREEN(screen), &window_rect, cursor[0], cursor[1]);
1206  *r_sa1 = NULL;
1207  *r_sa2 = NULL;
1208  if (actedge == NULL) {
1209  return NULL;
1210  }
1211  int borderwidth = (4 * UI_DPI_FAC);
1212  ScrArea *sa1, *sa2;
1213  if (screen_geom_edge_is_horizontal(actedge)) {
1215  screen, SPACE_TYPE_ANY, (const int[2]){cursor[0], cursor[1] + borderwidth});
1217  screen, SPACE_TYPE_ANY, (const int[2]){cursor[0], cursor[1] - borderwidth});
1218  }
1219  else {
1221  screen, SPACE_TYPE_ANY, (const int[2]){cursor[0] + borderwidth, cursor[1]});
1223  screen, SPACE_TYPE_ANY, (const int[2]){cursor[0] - borderwidth, cursor[1]});
1224  }
1225  bool isGlobal = ((sa1 && ED_area_is_global(sa1)) || (sa2 && ED_area_is_global(sa2)));
1226  if (!isGlobal) {
1227  *r_sa1 = sa1;
1228  *r_sa2 = sa2;
1229  }
1230  return actedge;
1231 }
1232 
1235 /* -------------------------------------------------------------------- */
1239 /* operator state vars used:
1240  * sa1 start area
1241  * sa2 area to swap with
1242  *
1243  * functions:
1244  *
1245  * init() set custom data for operator, based on action-zone event custom data
1246  *
1247  * cancel() cancel the operator
1248  *
1249  * exit() cleanup, send notifier
1250  *
1251  * callbacks:
1252  *
1253  * invoke() gets called on Shift-LMB drag in action-zone
1254  * exec() execute without any user interaction, based on properties
1255  * call init(), add handler
1256  *
1257  * modal() accept modal events while doing it
1258  */
1259 
1260 typedef struct sAreaSwapData {
1263 
1264 static bool area_swap_init(wmOperator *op, const wmEvent *event)
1265 {
1266  sActionzoneData *sad = event->customdata;
1267 
1268  if (sad == NULL || sad->sa1 == NULL) {
1269  return false;
1270  }
1271 
1272  sAreaSwapData *sd = MEM_callocN(sizeof(sAreaSwapData), "sAreaSwapData");
1273  sd->sa1 = sad->sa1;
1274  sd->sa2 = sad->sa2;
1275  op->customdata = sd;
1276 
1277  return true;
1278 }
1279 
1281 {
1284 }
1285 
1287 {
1288  area_swap_exit(C, op);
1289 }
1290 
1291 static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1292 {
1293  if (!area_swap_init(op, event)) {
1294  return OPERATOR_PASS_THROUGH;
1295  }
1296 
1297  /* add modal handler */
1300 
1301  return OPERATOR_RUNNING_MODAL;
1302 }
1303 
1304 static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event)
1305 {
1306  sActionzoneData *sad = op->customdata;
1307 
1308  switch (event->type) {
1309  case MOUSEMOVE:
1310  /* Second area to swap with. */
1311  sad->sa2 = ED_area_find_under_cursor(C, SPACE_TYPE_ANY, event->xy);
1313  break;
1314  case LEFTMOUSE: /* release LMB */
1315  if (event->val == KM_RELEASE) {
1316  if (!sad->sa2 || sad->sa1 == sad->sa2) {
1317  area_swap_cancel(C, op);
1318  return OPERATOR_CANCELLED;
1319  }
1320 
1321  ED_area_tag_redraw(sad->sa1);
1322  ED_area_tag_redraw(sad->sa2);
1323 
1324  ED_area_swapspace(C, sad->sa1, sad->sa2);
1325 
1326  area_swap_exit(C, op);
1327 
1329 
1330  return OPERATOR_FINISHED;
1331  }
1332  break;
1333 
1334  case EVT_ESCKEY:
1335  area_swap_cancel(C, op);
1336  return OPERATOR_CANCELLED;
1337  }
1338  return OPERATOR_RUNNING_MODAL;
1339 }
1340 
1342 {
1343  ScrArea *sa1, *sa2;
1344  int cursor[2];
1345  RNA_int_get_array(op->ptr, "cursor", cursor);
1346  screen_area_edge_from_cursor(C, cursor, &sa1, &sa2);
1347  if (sa1 == NULL || sa2 == NULL) {
1348  return OPERATOR_CANCELLED;
1349  }
1350  ED_area_swapspace(C, sa1, sa2);
1351  return OPERATOR_FINISHED;
1352 }
1353 
1355 {
1356  ot->name = "Swap Areas";
1357  ot->description = "Swap selected areas screen positions";
1358  ot->idname = "SCREEN_OT_area_swap";
1359 
1362  ot->exec = area_swap_exec;
1365 
1366  ot->flag = OPTYPE_BLOCKING;
1367 
1368  /* rna */
1370  ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX);
1371 }
1372 
1375 /* -------------------------------------------------------------------- */
1381 /* operator callback */
1382 static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1383 {
1384  ScrArea *area = CTX_wm_area(C);
1385 
1386  if (event && event->customdata) {
1387  sActionzoneData *sad = event->customdata;
1388  if (sad == NULL) {
1389  return OPERATOR_PASS_THROUGH;
1390  }
1391  area = sad->sa1;
1392  }
1393 
1394  /* Create new window. No need to set space_type since it will be copied over. */
1395  wmWindow *newwin = WM_window_open(C,
1396  "Blender",
1397  area->totrct.xmin,
1398  area->totrct.ymin,
1399  area->winx,
1400  area->winy,
1401  SPACE_EMPTY,
1402  false,
1403  false,
1404  false,
1406 
1407  if (newwin) {
1408  /* copy area to new screen */
1409  bScreen *newsc = WM_window_get_active_screen(newwin);
1410  ED_area_data_copy((ScrArea *)newsc->areabase.first, area, true);
1412 
1413  /* screen, areas init */
1415  }
1416  else {
1417  BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
1418  }
1419 
1420  if (event && event->customdata) {
1421  actionzone_exit(op);
1422  }
1423 
1424  return newwin ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
1425 }
1426 
1428 {
1429  ot->name = "Duplicate Area into New Window";
1430  ot->description = "Duplicate selected area into new window";
1431  ot->idname = "SCREEN_OT_area_dupli";
1432 
1435 }
1436 
1439 /* -------------------------------------------------------------------- */
1453 {
1454  bScreen *screen = CTX_wm_screen(C);
1455  ScrArea *area = CTX_wm_area(C);
1456 
1457  /* This operator is script-able, so the area passed could be invalid. */
1458  if (BLI_findindex(&screen->areabase, area) == -1) {
1459  BKE_report(op->reports, RPT_ERROR, "Area not found in the active screen");
1460  return OPERATOR_CANCELLED;
1461  }
1462 
1463  if (!screen_area_close(C, screen, area)) {
1464  BKE_report(op->reports, RPT_ERROR, "Unable to close area");
1465  return OPERATOR_CANCELLED;
1466  }
1467 
1468  /* Ensure the event loop doesn't attempt to continue handling events.
1469  *
1470  * This causes execution from the Python console fail to return to the prompt as it should.
1471  * This glitch could be solved in the event loop handling as other operators may also
1472  * destructively manipulate windowing data. */
1474 
1476 
1477  return OPERATOR_FINISHED;
1478 }
1479 
1481 {
1482  if (!ED_operator_areaactive(C)) {
1483  return false;
1484  }
1485 
1486  ScrArea *area = CTX_wm_area(C);
1487 
1488  if (ED_area_is_global(area)) {
1489  return false;
1490  }
1491 
1492  bScreen *screen = CTX_wm_screen(C);
1493 
1494  /* Can this area join with ANY other area? */
1495  LISTBASE_FOREACH (ScrArea *, ar, &screen->areabase) {
1496  if (area_getorientation(ar, area) != -1) {
1497  return true;
1498  }
1499  }
1500 
1501  return false;
1502 }
1503 
1505 {
1506  ot->name = "Close Area";
1507  ot->description = "Close selected area";
1508  ot->idname = "SCREEN_OT_area_close";
1509  ot->exec = area_close_exec;
1510  ot->poll = area_close_poll;
1511 }
1512 
1515 /* -------------------------------------------------------------------- */
1519 /* operator state vars used:
1520  * x, y mouse coord near edge
1521  * delta movement of edge
1522  *
1523  * functions:
1524  *
1525  * init() set default property values, find edge based on mouse coords, test
1526  * if the edge can be moved, select edges, calculate min and max movement
1527  *
1528  * apply() apply delta on selection
1529  *
1530  * exit() cleanup, send notifier
1531  *
1532  * cancel() cancel moving
1533  *
1534  * callbacks:
1535  *
1536  * exec() execute without any user interaction, based on properties
1537  * call init(), apply(), exit()
1538  *
1539  * invoke() gets called on mouse click near edge
1540  * call init(), add handler
1541  *
1542  * modal() accept modal events while doing it
1543  * call apply() with delta motion
1544  * call exit() and remove handler
1545  */
1546 
1547 typedef struct sAreaMoveData {
1551  /* Snapping disabled */
1553  /* Snap to an invisible grid with a unit defined in AREAGRID */
1555  /* Snap to fraction (half, third.. etc) and adjacent edges. */
1557  /* Snap to either bigger or smaller, nothing in-between (used for
1558  * global areas). This has priority over other snap types, if it is
1559  * used, toggling SNAP_FRACTION_AND_ADJACENT doesn't work. */
1563 
1564 /* helper call to move area-edge, sets limits
1565  * need window bounds in order to get correct limits */
1567  bScreen *screen,
1568  const eScreenAxis dir_axis,
1569  int *bigger,
1570  int *smaller,
1571  bool *use_bigger_smaller_snap)
1572 {
1573  /* we check all areas and test for free space with MINSIZE */
1574  *bigger = *smaller = 100000;
1575 
1576  if (use_bigger_smaller_snap != NULL) {
1577  *use_bigger_smaller_snap = false;
1579  int size_min = ED_area_global_min_size_y(area) - 1;
1580  int size_max = ED_area_global_max_size_y(area) - 1;
1581 
1582  size_min = max_ii(size_min, 0);
1583  BLI_assert(size_min <= size_max);
1584 
1585  /* logic here is only tested for lower edge :) */
1586  /* left edge */
1587  if ((area->v1->editflag && area->v2->editflag)) {
1588  *smaller = area->v4->vec.x - size_max;
1589  *bigger = area->v4->vec.x - size_min;
1590  *use_bigger_smaller_snap = true;
1591  return;
1592  }
1593  /* top edge */
1594  if ((area->v2->editflag && area->v3->editflag)) {
1595  *smaller = area->v1->vec.y + size_min;
1596  *bigger = area->v1->vec.y + size_max;
1597  *use_bigger_smaller_snap = true;
1598  return;
1599  }
1600  /* right edge */
1601  if ((area->v3->editflag && area->v4->editflag)) {
1602  *smaller = area->v1->vec.x + size_min;
1603  *bigger = area->v1->vec.x + size_max;
1604  *use_bigger_smaller_snap = true;
1605  return;
1606  }
1607  /* lower edge */
1608  if ((area->v4->editflag && area->v1->editflag)) {
1609  *smaller = area->v2->vec.y - size_max;
1610  *bigger = area->v2->vec.y - size_min;
1611  *use_bigger_smaller_snap = true;
1612  return;
1613  }
1614  }
1615  }
1616 
1617  rcti window_rect;
1618  WM_window_rect_calc(win, &window_rect);
1619 
1620  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
1621  if (dir_axis == SCREEN_AXIS_H) {
1622  int areamin = ED_area_headersize();
1623 
1624  if (area->v1->vec.y > window_rect.ymin) {
1625  areamin += U.pixelsize;
1626  }
1627  if (area->v2->vec.y < (window_rect.ymax - 1)) {
1628  areamin += U.pixelsize;
1629  }
1630 
1631  int y1 = screen_geom_area_height(area) - areamin;
1632 
1633  /* if top or down edge selected, test height */
1634  if (area->v1->editflag && area->v4->editflag) {
1635  *bigger = min_ii(*bigger, y1);
1636  }
1637  else if (area->v2->editflag && area->v3->editflag) {
1638  *smaller = min_ii(*smaller, y1);
1639  }
1640  }
1641  else {
1642  int areamin = AREAMINX;
1643 
1644  if (area->v1->vec.x > window_rect.xmin) {
1645  areamin += U.pixelsize;
1646  }
1647  if (area->v4->vec.x < (window_rect.xmax - 1)) {
1648  areamin += U.pixelsize;
1649  }
1650 
1651  int x1 = screen_geom_area_width(area) - areamin;
1652 
1653  /* if left or right edge selected, test width */
1654  if (area->v1->editflag && area->v2->editflag) {
1655  *bigger = min_ii(*bigger, x1);
1656  }
1657  else if (area->v3->editflag && area->v4->editflag) {
1658  *smaller = min_ii(*smaller, x1);
1659  }
1660  }
1661  }
1662 }
1663 
1664 /* validate selection inside screen, set variables OK */
1665 /* return false: init failed */
1667 {
1668  bScreen *screen = CTX_wm_screen(C);
1669  wmWindow *win = CTX_wm_window(C);
1670 
1671  /* required properties */
1672  int x = RNA_int_get(op->ptr, "x");
1673  int y = RNA_int_get(op->ptr, "y");
1674 
1675  /* setup */
1676  ScrEdge *actedge = screen_geom_find_active_scredge(win, screen, x, y);
1677  if (actedge == NULL) {
1678  return false;
1679  }
1680 
1681  sAreaMoveData *md = MEM_callocN(sizeof(sAreaMoveData), "sAreaMoveData");
1682  op->customdata = md;
1683 
1685  if (md->dir_axis == SCREEN_AXIS_H) {
1686  md->origval = actedge->v1->vec.y;
1687  }
1688  else {
1689  md->origval = actedge->v1->vec.x;
1690  }
1691 
1692  screen_geom_select_connected_edge(win, actedge);
1693  /* now all vertices with 'flag == 1' are the ones that can be moved. Move this to editflag */
1694  ED_screen_verts_iter(win, screen, v1)
1695  {
1696  v1->editflag = v1->flag;
1697  }
1698 
1699  bool use_bigger_smaller_snap = false;
1701  win, screen, md->dir_axis, &md->bigger, &md->smaller, &use_bigger_smaller_snap);
1702 
1703  md->snap_type = use_bigger_smaller_snap ? SNAP_BIGGER_SMALLER_ONLY : SNAP_AREAGRID;
1704 
1705  return true;
1706 }
1707 
1708 static int area_snap_calc_location(const bScreen *screen,
1709  const enum AreaMoveSnapType snap_type,
1710  const int delta,
1711  const int origval,
1712  const eScreenAxis dir_axis,
1713  const int bigger,
1714  const int smaller)
1715 {
1716  BLI_assert(snap_type != SNAP_NONE);
1717  int m_cursor_final = -1;
1718  const int m_cursor = origval + delta;
1719  const int m_span = (float)(bigger + smaller);
1720  const int m_min = origval - smaller;
1721  // const int axis_max = axis_min + m_span;
1722 
1723  switch (snap_type) {
1724  case SNAP_AREAGRID:
1725  m_cursor_final = m_cursor;
1726  if (!ELEM(delta, bigger, -smaller)) {
1727  m_cursor_final -= (m_cursor % AREAGRID);
1728  CLAMP(m_cursor_final, origval - smaller, origval + bigger);
1729  }
1730  break;
1731 
1732  case SNAP_BIGGER_SMALLER_ONLY:
1733  m_cursor_final = (m_cursor >= bigger) ? bigger : smaller;
1734  break;
1735 
1736  case SNAP_FRACTION_AND_ADJACENT: {
1737  const int axis = (dir_axis == SCREEN_AXIS_V) ? 0 : 1;
1738  int snap_dist_best = INT_MAX;
1739  {
1740  const float div_array[] = {
1741  0.0f,
1742  1.0f / 12.0f,
1743  2.0f / 12.0f,
1744  3.0f / 12.0f,
1745  4.0f / 12.0f,
1746  5.0f / 12.0f,
1747  6.0f / 12.0f,
1748  7.0f / 12.0f,
1749  8.0f / 12.0f,
1750  9.0f / 12.0f,
1751  10.0f / 12.0f,
1752  11.0f / 12.0f,
1753  1.0f,
1754  };
1755  /* Test the snap to the best division. */
1756  for (int i = 0; i < ARRAY_SIZE(div_array); i++) {
1757  const int m_cursor_test = m_min + round_fl_to_int(m_span * div_array[i]);
1758  const int snap_dist_test = abs(m_cursor - m_cursor_test);
1759  if (snap_dist_best >= snap_dist_test) {
1760  snap_dist_best = snap_dist_test;
1761  m_cursor_final = m_cursor_test;
1762  }
1763  }
1764  }
1765 
1766  LISTBASE_FOREACH (const ScrVert *, v1, &screen->vertbase) {
1767  if (!v1->editflag) {
1768  continue;
1769  }
1770  const int v_loc = (&v1->vec.x)[!axis];
1771 
1772  LISTBASE_FOREACH (const ScrVert *, v2, &screen->vertbase) {
1773  if (v2->editflag) {
1774  continue;
1775  }
1776  if (v_loc == (&v2->vec.x)[!axis]) {
1777  const int v_loc2 = (&v2->vec.x)[axis];
1778  /* Do not snap to the vertices at the ends. */
1779  if ((origval - smaller) < v_loc2 && v_loc2 < (origval + bigger)) {
1780  const int snap_dist_test = abs(m_cursor - v_loc2);
1781  if (snap_dist_best >= snap_dist_test) {
1782  snap_dist_best = snap_dist_test;
1783  m_cursor_final = v_loc2;
1784  }
1785  }
1786  }
1787  }
1788  }
1789  break;
1790  }
1791  case SNAP_NONE:
1792  break;
1793  }
1794 
1795  BLI_assert(ELEM(snap_type, SNAP_BIGGER_SMALLER_ONLY) ||
1796  IN_RANGE_INCL(m_cursor_final, origval - smaller, origval + bigger));
1797 
1798  return m_cursor_final;
1799 }
1800 
1801 /* moves selected screen edge amount of delta, used by split & move */
1802 static void area_move_apply_do(const bContext *C,
1803  int delta,
1804  const int origval,
1805  const eScreenAxis dir_axis,
1806  const int bigger,
1807  const int smaller,
1808  const enum AreaMoveSnapType snap_type)
1809 {
1810  wmWindow *win = CTX_wm_window(C);
1811  bScreen *screen = CTX_wm_screen(C);
1812  short final_loc = -1;
1813  bool doredraw = false;
1814 
1815  if (snap_type != SNAP_BIGGER_SMALLER_ONLY) {
1816  CLAMP(delta, -smaller, bigger);
1817  }
1818 
1819  if (snap_type == SNAP_NONE) {
1820  final_loc = origval + delta;
1821  }
1822  else {
1823  final_loc = area_snap_calc_location(
1824  screen, snap_type, delta, origval, dir_axis, bigger, smaller);
1825  }
1826 
1827  BLI_assert(final_loc != -1);
1828  short axis = (dir_axis == SCREEN_AXIS_V) ? 0 : 1;
1829 
1830  ED_screen_verts_iter(win, screen, v1)
1831  {
1832  if (v1->editflag) {
1833  short oldval = (&v1->vec.x)[axis];
1834  (&v1->vec.x)[axis] = final_loc;
1835 
1836  if (oldval == final_loc) {
1837  /* nothing will change to the other vertices either. */
1838  break;
1839  }
1840  doredraw = true;
1841  }
1842  }
1843 
1844  /* only redraw if we actually moved a screen vert, for AREAGRID */
1845  if (doredraw) {
1846  bool redraw_all = false;
1847  ED_screen_areas_iter (win, screen, area) {
1848  if (area->v1->editflag || area->v2->editflag || area->v3->editflag || area->v4->editflag) {
1849  if (ED_area_is_global(area)) {
1850  /* Snap to minimum or maximum for global areas. */
1852  if (abs(height - area->global->size_min) < abs(height - area->global->size_max)) {
1853  area->global->cur_fixed_height = area->global->size_min;
1854  }
1855  else {
1856  area->global->cur_fixed_height = area->global->size_max;
1857  }
1858 
1859  screen->do_refresh = true;
1860  redraw_all = true;
1861  }
1863  }
1864  }
1865  if (redraw_all) {
1866  ED_screen_areas_iter (win, screen, area) {
1868  }
1869  }
1870 
1872 
1873  WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL); /* redraw everything */
1874  /* Update preview thumbnail */
1875  BKE_icon_changed(screen->id.icon_id);
1876  }
1877 }
1878 
1880 {
1881  sAreaMoveData *md = op->customdata;
1882  int delta = RNA_int_get(op->ptr, "delta");
1883 
1884  area_move_apply_do(C, delta, md->origval, md->dir_axis, md->bigger, md->smaller, md->snap_type);
1885 }
1886 
1888 {
1890 
1891  /* this makes sure aligned edges will result in aligned grabbing */
1894 
1895  G.moving &= ~G_TRANSFORM_WM;
1896 }
1897 
1899 {
1900  if (!area_move_init(C, op)) {
1901  return OPERATOR_CANCELLED;
1902  }
1903 
1904  area_move_apply(C, op);
1905  area_move_exit(C, op);
1906 
1907  return OPERATOR_FINISHED;
1908 }
1909 
1910 /* interaction callback */
1911 static int area_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
1912 {
1913  RNA_int_set(op->ptr, "x", event->xy[0]);
1914  RNA_int_set(op->ptr, "y", event->xy[1]);
1915 
1916  if (!area_move_init(C, op)) {
1917  return OPERATOR_PASS_THROUGH;
1918  }
1919 
1920  /* add temp handler */
1921  G.moving |= G_TRANSFORM_WM;
1923 
1924  return OPERATOR_RUNNING_MODAL;
1925 }
1926 
1928 {
1929 
1930  RNA_int_set(op->ptr, "delta", 0);
1931  area_move_apply(C, op);
1932  area_move_exit(C, op);
1933 }
1934 
1935 /* modal callback for while moving edges */
1936 static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event)
1937 {
1938  sAreaMoveData *md = op->customdata;
1939 
1940  /* execute the events */
1941  switch (event->type) {
1942  case MOUSEMOVE: {
1943  int x = RNA_int_get(op->ptr, "x");
1944  int y = RNA_int_get(op->ptr, "y");
1945 
1946  const int delta = (md->dir_axis == SCREEN_AXIS_V) ? event->xy[0] - x : event->xy[1] - y;
1947  RNA_int_set(op->ptr, "delta", delta);
1948 
1949  area_move_apply(C, op);
1950  break;
1951  }
1952  case EVT_MODAL_MAP: {
1953  switch (event->val) {
1954  case KM_MODAL_APPLY:
1955  area_move_exit(C, op);
1956  return OPERATOR_FINISHED;
1957 
1958  case KM_MODAL_CANCEL:
1959  area_move_cancel(C, op);
1960  return OPERATOR_CANCELLED;
1961 
1962  case KM_MODAL_SNAP_ON:
1963  if (md->snap_type != SNAP_BIGGER_SMALLER_ONLY) {
1964  md->snap_type = SNAP_FRACTION_AND_ADJACENT;
1965  }
1966  break;
1967 
1968  case KM_MODAL_SNAP_OFF:
1969  if (md->snap_type != SNAP_BIGGER_SMALLER_ONLY) {
1970  md->snap_type = SNAP_AREAGRID;
1971  }
1972  break;
1973  }
1974  break;
1975  }
1976  }
1977 
1978  return OPERATOR_RUNNING_MODAL;
1979 }
1980 
1982 {
1983  /* identifiers */
1984  ot->name = "Move Area Edges";
1985  ot->description = "Move selected area edges";
1986  ot->idname = "SCREEN_OT_area_move";
1987 
1988  ot->exec = area_move_exec;
1992  ot->poll = ED_operator_screen_mainwinactive; /* when mouse is over area-edge */
1993 
1994  /* flags */
1996 
1997  /* rna */
1998  RNA_def_int(ot->srna, "x", 0, INT_MIN, INT_MAX, "X", "", INT_MIN, INT_MAX);
1999  RNA_def_int(ot->srna, "y", 0, INT_MIN, INT_MAX, "Y", "", INT_MIN, INT_MAX);
2000  RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
2001 }
2002 
2005 /* -------------------------------------------------------------------- */
2009 /*
2010  * operator state vars:
2011  * fac spit point
2012  * dir direction #SCREEN_AXIS_V or #SCREEN_AXIS_H
2013  *
2014  * operator customdata:
2015  * area pointer to (active) area
2016  * x, y last used mouse pos
2017  * (more, see below)
2018  *
2019  * functions:
2020  *
2021  * init() set default property values, find area based on context
2022  *
2023  * apply() split area based on state vars
2024  *
2025  * exit() cleanup, send notifier
2026  *
2027  * cancel() remove duplicated area
2028  *
2029  * callbacks:
2030  *
2031  * exec() execute without any user interaction, based on state vars
2032  * call init(), apply(), exit()
2033  *
2034  * invoke() gets called on mouse click in action-widget
2035  * call init(), add modal handler
2036  * call apply() with initial motion
2037  *
2038  * modal() accept modal events while doing it
2039  * call move-areas code with delta motion
2040  * call exit() or cancel() and remove handler
2041  */
2042 
2043 typedef struct sAreaSplitData {
2044  int origval; /* for move areas */
2045  int bigger, smaller; /* constraints for moving new edge */
2046  int delta; /* delta move edge */
2047  int origmin, origsize; /* to calculate fac, for property storage */
2048  int previewmode; /* draw preview-line, then split. */
2049  void *draw_callback; /* call `screen_draw_split_preview` */
2050  bool do_snap;
2051 
2052  ScrEdge *nedge; /* new edge */
2053  ScrArea *sarea; /* start area */
2054  ScrArea *narea; /* new area */
2055 
2057 
2058 static bool area_split_allowed(const ScrArea *area, const eScreenAxis dir_axis)
2059 {
2060  if (!area || area->global) {
2061  /* Must be a non-global area. */
2062  return false;
2063  }
2064 
2065  if ((dir_axis == SCREEN_AXIS_V && area->winx <= 2 * AREAMINX) ||
2066  (dir_axis == SCREEN_AXIS_H && area->winy <= 2 * ED_area_headersize())) {
2067  /* Must be at least double minimum sizes to split into two. */
2068  return false;
2069  }
2070 
2071  return true;
2072 }
2073 
2074 static void area_split_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
2075 {
2076  const wmOperator *op = userdata;
2077 
2078  sAreaSplitData *sd = op->customdata;
2079  const eScreenAxis dir_axis = RNA_enum_get(op->ptr, "direction");
2080 
2081  if (area_split_allowed(sd->sarea, dir_axis)) {
2082  float fac = RNA_float_get(op->ptr, "factor");
2083  screen_draw_split_preview(sd->sarea, dir_axis, fac);
2084  }
2085 }
2086 
2087 /* generic init, menu case, doesn't need active area */
2089 {
2090  /* custom data */
2091  sAreaSplitData *sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split");
2092  op->customdata = sd;
2093 
2094  sd->sarea = CTX_wm_area(C);
2095 
2096  return true;
2097 }
2098 
2099 /* generic init, no UI stuff here, assumes active area */
2101 {
2102  ScrArea *area = CTX_wm_area(C);
2103 
2104  /* required context */
2105  if (area == NULL) {
2106  return false;
2107  }
2108 
2109  /* required properties */
2110  const eScreenAxis dir_axis = RNA_enum_get(op->ptr, "direction");
2111 
2112  /* custom data */
2113  sAreaSplitData *sd = (sAreaSplitData *)MEM_callocN(sizeof(sAreaSplitData), "op_area_split");
2114  op->customdata = sd;
2115 
2116  sd->sarea = area;
2117  if (dir_axis == SCREEN_AXIS_V) {
2118  sd->origmin = area->v1->vec.x;
2119  sd->origsize = area->v4->vec.x - sd->origmin;
2120  }
2121  else {
2122  sd->origmin = area->v1->vec.y;
2123  sd->origsize = area->v2->vec.y - sd->origmin;
2124  }
2125 
2126  return true;
2127 }
2128 
2129 /* with area as center, sb is located at: 0=W, 1=N, 2=E, 3=S */
2130 /* used with split operator */
2132 {
2133  ScrVert *sav1 = area->v1;
2134  ScrVert *sav2 = area->v2;
2135  ScrVert *sav3 = area->v3;
2136  ScrVert *sav4 = area->v4;
2137  ScrVert *sbv1 = sb->v1;
2138  ScrVert *sbv2 = sb->v2;
2139  ScrVert *sbv3 = sb->v3;
2140  ScrVert *sbv4 = sb->v4;
2141 
2142  if (sav1 == sbv4 && sav2 == sbv3) { /* Area to right of sb = W. */
2143  return BKE_screen_find_edge(screen, sav1, sav2);
2144  }
2145  if (sav2 == sbv1 && sav3 == sbv4) { /* Area to bottom of sb = N. */
2146  return BKE_screen_find_edge(screen, sav2, sav3);
2147  }
2148  if (sav3 == sbv2 && sav4 == sbv1) { /* Area to left of sb = E. */
2149  return BKE_screen_find_edge(screen, sav3, sav4);
2150  }
2151  if (sav1 == sbv2 && sav4 == sbv3) { /* Area on top of sb = S. */
2152  return BKE_screen_find_edge(screen, sav1, sav4);
2153  }
2154 
2155  return NULL;
2156 }
2157 
2158 /* do the split, return success */
2160 {
2161  const wmWindow *win = CTX_wm_window(C);
2162  bScreen *screen = CTX_wm_screen(C);
2164 
2165  float fac = RNA_float_get(op->ptr, "factor");
2166  const eScreenAxis dir_axis = RNA_enum_get(op->ptr, "direction");
2167 
2168  if (!area_split_allowed(sd->sarea, dir_axis)) {
2169  return false;
2170  }
2171 
2172  sd->narea = area_split(win, screen, sd->sarea, dir_axis, fac, false); /* false = no merge */
2173 
2174  if (sd->narea == NULL) {
2175  return false;
2176  }
2177 
2178  sd->nedge = area_findsharededge(screen, sd->sarea, sd->narea);
2179 
2180  /* select newly created edge, prepare for moving edge */
2181  ED_screen_verts_iter(win, screen, sv)
2182  {
2183  sv->editflag = 0;
2184  }
2185 
2186  sd->nedge->v1->editflag = 1;
2187  sd->nedge->v2->editflag = 1;
2188 
2189  if (dir_axis == SCREEN_AXIS_H) {
2190  sd->origval = sd->nedge->v1->vec.y;
2191  }
2192  else {
2193  sd->origval = sd->nedge->v1->vec.x;
2194  }
2195 
2198 
2200  /* Update preview thumbnail */
2201  BKE_icon_changed(screen->id.icon_id);
2202 
2203  return true;
2204 }
2205 
2207 {
2208  if (op->customdata) {
2210  if (sd->sarea) {
2212  }
2213  if (sd->narea) {
2215  }
2216 
2217  if (sd->draw_callback) {
2219  }
2220 
2221  MEM_freeN(op->customdata);
2222  op->customdata = NULL;
2223  }
2224 
2227 
2228  /* this makes sure aligned edges will result in aligned grabbing */
2231 
2232  G.moving &= ~G_TRANSFORM_WM;
2233 }
2234 
2236 {
2238  const eScreenAxis dir_axis = RNA_enum_get(op->ptr, "direction");
2239  if (area_split_allowed(sd->sarea, dir_axis)) {
2242  }
2243  else {
2245  }
2246 }
2247 
2248 /* UI callback, adds new handler */
2249 static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
2250 {
2251  wmWindow *win = CTX_wm_window(C);
2252  bScreen *screen = CTX_wm_screen(C);
2253 
2254  /* no full window splitting allowed */
2255  BLI_assert(screen->state == SCREENNORMAL);
2256 
2257  PropertyRNA *prop_dir = RNA_struct_find_property(op->ptr, "direction");
2258  PropertyRNA *prop_factor = RNA_struct_find_property(op->ptr, "factor");
2259  PropertyRNA *prop_cursor = RNA_struct_find_property(op->ptr, "cursor");
2260 
2261  eScreenAxis dir_axis;
2262  if (event->type == EVT_ACTIONZONE_AREA) {
2263  sActionzoneData *sad = event->customdata;
2264 
2265  if (sad == NULL || sad->modifier > 0) {
2266  return OPERATOR_PASS_THROUGH;
2267  }
2268 
2269  /* verify *sad itself */
2270  if (sad->sa1 == NULL || sad->az == NULL) {
2271  return OPERATOR_PASS_THROUGH;
2272  }
2273 
2274  /* is this our *sad? if areas not equal it should be passed on */
2275  if (CTX_wm_area(C) != sad->sa1 || sad->sa1 != sad->sa2) {
2276  return OPERATOR_PASS_THROUGH;
2277  }
2278 
2279  /* The factor will be close to 1.0f when near the top-left and the bottom-right corners. */
2280  const float factor_v = ((float)(event->xy[1] - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy;
2281  const float factor_h = ((float)(event->xy[0] - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx;
2282  const bool is_left = factor_v < 0.5f;
2283  const bool is_bottom = factor_h < 0.5f;
2284  const bool is_right = !is_left;
2285  const bool is_top = !is_bottom;
2286  float factor;
2287 
2288  /* Prepare operator state vars. */
2289  if (SCREEN_DIR_IS_VERTICAL(sad->gesture_dir)) {
2290  dir_axis = SCREEN_AXIS_H;
2291  factor = factor_h;
2292  }
2293  else {
2294  dir_axis = SCREEN_AXIS_V;
2295  factor = factor_v;
2296  }
2297 
2298  if ((is_top && is_left) || (is_bottom && is_right)) {
2299  factor = 1.0f - factor;
2300  }
2301 
2302  RNA_property_float_set(op->ptr, prop_factor, factor);
2303 
2304  RNA_property_enum_set(op->ptr, prop_dir, dir_axis);
2305 
2306  /* general init, also non-UI case, adds customdata, sets area and defaults */
2307  if (!area_split_init(C, op)) {
2308  return OPERATOR_PASS_THROUGH;
2309  }
2310  }
2311  else if (RNA_property_is_set(op->ptr, prop_dir)) {
2312  ScrArea *area = CTX_wm_area(C);
2313  if (area == NULL) {
2314  return OPERATOR_CANCELLED;
2315  }
2316  dir_axis = RNA_property_enum_get(op->ptr, prop_dir);
2317  if (dir_axis == SCREEN_AXIS_H) {
2319  op->ptr, prop_factor, ((float)(event->xy[0] - area->v1->vec.x)) / (float)area->winx);
2320  }
2321  else {
2323  op->ptr, prop_factor, ((float)(event->xy[1] - area->v1->vec.y)) / (float)area->winy);
2324  }
2325 
2326  if (!area_split_init(C, op)) {
2327  return OPERATOR_CANCELLED;
2328  }
2329  }
2330  else {
2331  int event_co[2];
2332 
2333  /* retrieve initial mouse coord, so we can find the active edge */
2334  if (RNA_property_is_set(op->ptr, prop_cursor)) {
2335  RNA_property_int_get_array(op->ptr, prop_cursor, event_co);
2336  }
2337  else {
2338  copy_v2_v2_int(event_co, event->xy);
2339  }
2340 
2341  rcti window_rect;
2342  WM_window_rect_calc(win, &window_rect);
2343 
2345  AREAMAP_FROM_SCREEN(screen), &window_rect, event_co[0], event_co[1]);
2346  if (actedge == NULL) {
2347  return OPERATOR_CANCELLED;
2348  }
2349 
2351 
2352  RNA_property_enum_set(op->ptr, prop_dir, dir_axis);
2353 
2354  /* special case, adds customdata, sets defaults */
2355  if (!area_split_menu_init(C, op)) {
2356  return OPERATOR_CANCELLED;
2357  }
2358  }
2359 
2361 
2362  if (event->type == EVT_ACTIONZONE_AREA) {
2363  /* do the split */
2364  if (area_split_apply(C, op)) {
2365  area_move_set_limits(win, screen, dir_axis, &sd->bigger, &sd->smaller, NULL);
2366 
2367  /* add temp handler for edge move or cancel */
2368  G.moving |= G_TRANSFORM_WM;
2370 
2371  return OPERATOR_RUNNING_MODAL;
2372  }
2373  }
2374  else {
2375  sd->previewmode = 1;
2377  /* add temp handler for edge move or cancel */
2380 
2381  return OPERATOR_RUNNING_MODAL;
2382  }
2383 
2384  return OPERATOR_PASS_THROUGH;
2385 }
2386 
2387 /* function to be called outside UI context, or for redo */
2389 {
2390  if (!area_split_init(C, op)) {
2391  return OPERATOR_CANCELLED;
2392  }
2393 
2394  area_split_apply(C, op);
2395  area_split_exit(C, op);
2396 
2397  return OPERATOR_FINISHED;
2398 }
2399 
2401 {
2403 
2404  if (sd->previewmode) {
2405  /* pass */
2406  }
2407  else {
2408  if (screen_area_join(C, CTX_wm_screen(C), sd->sarea, sd->narea)) {
2409  if (CTX_wm_area(C) == sd->narea) {
2412  }
2413  sd->narea = NULL;
2414  }
2415  }
2416  area_split_exit(C, op);
2417 }
2418 
2419 static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
2420 {
2422  PropertyRNA *prop_dir = RNA_struct_find_property(op->ptr, "direction");
2423  bool update_factor = false;
2424 
2425  /* execute the events */
2426  switch (event->type) {
2427  case MOUSEMOVE:
2428  update_factor = true;
2429  break;
2430 
2431  case LEFTMOUSE:
2432  if (sd->previewmode) {
2433  area_split_apply(C, op);
2434  area_split_exit(C, op);
2435  return OPERATOR_FINISHED;
2436  }
2437  else {
2438  if (event->val == KM_RELEASE) { /* mouse up */
2439  area_split_exit(C, op);
2440  return OPERATOR_FINISHED;
2441  }
2442  }
2443  break;
2444 
2445  case MIDDLEMOUSE:
2446  case EVT_TABKEY:
2447  if (sd->previewmode == 0) {
2448  /* pass */
2449  }
2450  else {
2451  if (event->val == KM_PRESS) {
2452  if (sd->sarea) {
2453  const eScreenAxis dir_axis = RNA_property_enum_get(op->ptr, prop_dir);
2455  op->ptr, prop_dir, (dir_axis == SCREEN_AXIS_V) ? SCREEN_AXIS_H : SCREEN_AXIS_V);
2457  update_factor = true;
2458  }
2459  }
2460  }
2461 
2462  break;
2463 
2464  case RIGHTMOUSE: /* cancel operation */
2465  case EVT_ESCKEY:
2466  area_split_cancel(C, op);
2467  return OPERATOR_CANCELLED;
2468 
2469  case EVT_LEFTCTRLKEY:
2470  case EVT_RIGHTCTRLKEY:
2471  sd->do_snap = event->val == KM_PRESS;
2472  update_factor = true;
2473  break;
2474  }
2475 
2476  if (update_factor) {
2477  const eScreenAxis dir_axis = RNA_property_enum_get(op->ptr, prop_dir);
2478 
2479  sd->delta = (dir_axis == SCREEN_AXIS_V) ? event->xy[0] - sd->origval :
2480  event->xy[1] - sd->origval;
2481 
2482  if (sd->previewmode == 0) {
2483  if (sd->do_snap) {
2484  const int snap_loc = area_snap_calc_location(CTX_wm_screen(C),
2485  SNAP_FRACTION_AND_ADJACENT,
2486  sd->delta,
2487  sd->origval,
2488  dir_axis,
2489  sd->bigger,
2490  sd->smaller);
2491  sd->delta = snap_loc - sd->origval;
2492  }
2493  area_move_apply_do(C, sd->delta, sd->origval, dir_axis, sd->bigger, sd->smaller, SNAP_NONE);
2494  }
2495  else {
2496  if (sd->sarea) {
2498  }
2499 
2501 
2502  /* area context not set */
2504 
2505  if (sd->sarea) {
2506  ScrArea *area = sd->sarea;
2507  if (dir_axis == SCREEN_AXIS_V) {
2508  sd->origmin = area->v1->vec.x;
2509  sd->origsize = area->v4->vec.x - sd->origmin;
2510  }
2511  else {
2512  sd->origmin = area->v1->vec.y;
2513  sd->origsize = area->v2->vec.y - sd->origmin;
2514  }
2515 
2516  if (sd->do_snap) {
2517  area->v1->editflag = area->v2->editflag = area->v3->editflag = area->v4->editflag = 1;
2518 
2519  const int snap_loc = area_snap_calc_location(CTX_wm_screen(C),
2520  SNAP_FRACTION_AND_ADJACENT,
2521  sd->delta,
2522  sd->origval,
2523  dir_axis,
2524  sd->origmin + sd->origsize,
2525  -sd->origmin);
2526 
2527  area->v1->editflag = area->v2->editflag = area->v3->editflag = area->v4->editflag = 0;
2528  sd->delta = snap_loc - sd->origval;
2529  }
2530 
2532  }
2533 
2534  CTX_wm_screen(C)->do_draw = true;
2535  }
2536 
2537  float fac = (float)(sd->delta + sd->origval - sd->origmin) / sd->origsize;
2538  RNA_float_set(op->ptr, "factor", fac);
2539  }
2540 
2541  return OPERATOR_RUNNING_MODAL;
2542 }
2543 
2545  {SCREEN_AXIS_H, "HORIZONTAL", 0, "Horizontal", ""},
2546  {SCREEN_AXIS_V, "VERTICAL", 0, "Vertical", ""},
2547  {0, NULL, 0, NULL, NULL},
2548 };
2549 
2551 {
2552  ot->name = "Split Area";
2553  ot->description = "Split selected area into new windows";
2554  ot->idname = "SCREEN_OT_area_split";
2555 
2556  ot->exec = area_split_exec;
2560 
2562 
2563  /* flags */
2565 
2566  /* rna */
2567  RNA_def_enum(ot->srna, "direction", prop_direction_items, SCREEN_AXIS_H, "Direction", "");
2568  RNA_def_float(ot->srna, "factor", 0.5f, 0.0, 1.0, "Factor", "", 0.0, 1.0);
2570  ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX);
2571 }
2572 
2575 /* -------------------------------------------------------------------- */
2579 typedef struct RegionMoveData {
2584  int orig_xy[2];
2585  int maxsize;
2587 
2589 
2590 static int area_max_regionsize(ScrArea *area, ARegion *scalear, AZEdge edge)
2591 {
2592  int dist;
2593 
2594  /* regions in regions. */
2595  if (scalear->alignment & RGN_SPLIT_PREV) {
2596  const int align = RGN_ALIGN_ENUM_FROM_MASK(scalear->alignment);
2597 
2598  if (ELEM(align, RGN_ALIGN_TOP, RGN_ALIGN_BOTTOM)) {
2599  ARegion *region = scalear->prev;
2600  dist = region->winy + scalear->winy - U.pixelsize;
2601  }
2602  else /* if (ELEM(align, RGN_ALIGN_LEFT, RGN_ALIGN_RIGHT)) */ {
2603  ARegion *region = scalear->prev;
2604  dist = region->winx + scalear->winx - U.pixelsize;
2605  }
2606  }
2607  else {
2609  dist = BLI_rcti_size_x(&area->totrct);
2610  }
2611  else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */
2612  dist = BLI_rcti_size_y(&area->totrct);
2613  }
2614 
2615  /* Subtract the width of regions on opposite side
2616  * prevents dragging regions into other opposite regions. */
2617  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
2618  if (region == scalear) {
2619  continue;
2620  }
2621 
2622  if (scalear->alignment == RGN_ALIGN_LEFT && region->alignment == RGN_ALIGN_RIGHT) {
2623  dist -= region->winx;
2624  }
2625  else if (scalear->alignment == RGN_ALIGN_RIGHT && region->alignment == RGN_ALIGN_LEFT) {
2626  dist -= region->winx;
2627  }
2628  else if (scalear->alignment == RGN_ALIGN_TOP &&
2629  (region->alignment == RGN_ALIGN_BOTTOM ||
2630  ELEM(
2631  region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
2632  dist -= region->winy;
2633  }
2634  else if (scalear->alignment == RGN_ALIGN_BOTTOM &&
2635  (region->alignment == RGN_ALIGN_TOP ||
2636  ELEM(
2637  region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER, RGN_TYPE_FOOTER))) {
2638  dist -= region->winy;
2639  }
2640  }
2641  }
2642 
2643  dist /= UI_DPI_FAC;
2644  return dist;
2645 }
2646 
2647 static bool is_split_edge(const int alignment, const AZEdge edge)
2648 {
2649  return ((alignment == RGN_ALIGN_BOTTOM) && (edge == AE_TOP_TO_BOTTOMRIGHT)) ||
2650  ((alignment == RGN_ALIGN_TOP) && (edge == AE_BOTTOM_TO_TOPLEFT)) ||
2651  ((alignment == RGN_ALIGN_LEFT) && (edge == AE_RIGHT_TO_TOPLEFT)) ||
2652  ((alignment == RGN_ALIGN_RIGHT) && (edge == AE_LEFT_TO_TOPRIGHT));
2653 }
2654 
2656 {
2657  MEM_freeN(op->customdata);
2658  op->customdata = NULL;
2659 
2660  G.moving &= ~G_TRANSFORM_WM;
2661 }
2662 
2663 static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event)
2664 {
2665  sActionzoneData *sad = event->customdata;
2666 
2667  if (event->type != EVT_ACTIONZONE_REGION) {
2668  BKE_report(op->reports, RPT_ERROR, "Can only scale region size from an action zone");
2669  return OPERATOR_CANCELLED;
2670  }
2671 
2672  AZone *az = sad->az;
2673 
2674  if (az->region) {
2675  RegionMoveData *rmd = MEM_callocN(sizeof(RegionMoveData), "RegionMoveData");
2676 
2677  op->customdata = rmd;
2678 
2679  rmd->az = az;
2680  /* special case for region within region - this allows the scale of
2681  * the parent region if the azone edge is not the edge splitting
2682  * both regions */
2683  if ((az->region->alignment & RGN_SPLIT_PREV) && az->region->prev &&
2685  rmd->region = az->region->prev;
2686  }
2687  else {
2688  rmd->region = az->region;
2689  }
2690  rmd->area = sad->sa1;
2691  rmd->edge = az->edge;
2692  copy_v2_v2_int(rmd->orig_xy, event->xy);
2693  rmd->maxsize = area_max_regionsize(rmd->area, rmd->region, rmd->edge);
2694 
2695  /* if not set we do now, otherwise it uses type */
2696  if (rmd->region->sizex == 0) {
2697  rmd->region->sizex = rmd->region->winx;
2698  }
2699  if (rmd->region->sizey == 0) {
2700  rmd->region->sizey = rmd->region->winy;
2701  }
2702 
2703  /* Now copy to region-move-data. */
2705  rmd->origval = rmd->region->sizex;
2706  }
2707  else {
2708  rmd->origval = rmd->region->sizey;
2709  }
2710 
2711  CLAMP(rmd->maxsize, 0, 1000);
2712 
2713  /* add temp handler */
2714  G.moving |= G_TRANSFORM_WM;
2716 
2717  return OPERATOR_RUNNING_MODAL;
2718  }
2719 
2720  return OPERATOR_FINISHED;
2721 }
2722 
2724 {
2725  if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) {
2726  short *size, maxsize = -1;
2727 
2729  size = &rmd->region->sizex;
2730  }
2731  else {
2732  size = &rmd->region->sizey;
2733  }
2734 
2735  maxsize = rmd->maxsize - (UI_UNIT_Y / UI_DPI_FAC);
2736 
2737  if (*size > maxsize && maxsize > 0) {
2738  *size = maxsize;
2739  }
2740  }
2741 }
2742 
2744 {
2745  /* hidden areas may have bad 'View2D.cur' value,
2746  * correct before displaying. see T45156 */
2747  if (rmd->region->flag & RGN_FLAG_HIDDEN) {
2749  }
2750 
2751  region_toggle_hidden(C, rmd->region, 0);
2753 
2754  if ((rmd->region->flag & RGN_FLAG_HIDDEN) == 0) {
2755  if (rmd->region->regiontype == RGN_TYPE_HEADER) {
2756  ARegion *region_tool_header = BKE_area_find_region_type(rmd->area, RGN_TYPE_TOOL_HEADER);
2757  if (region_tool_header != NULL) {
2758  if ((region_tool_header->flag & RGN_FLAG_HIDDEN_BY_USER) == 0 &&
2759  (region_tool_header->flag & RGN_FLAG_HIDDEN) != 0) {
2760  region_toggle_hidden(C, region_tool_header, 0);
2761  }
2762  }
2763  }
2764  }
2765 }
2766 
2767 static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
2768 {
2769  RegionMoveData *rmd = op->customdata;
2770  int delta;
2771 
2772  /* execute the events */
2773  switch (event->type) {
2774  case MOUSEMOVE: {
2775  const float aspect = BLI_rctf_size_x(&rmd->region->v2d.cur) /
2776  (BLI_rcti_size_x(&rmd->region->v2d.mask) + 1);
2777  const int snap_size_threshold = (U.widget_unit * 2) / aspect;
2779  delta = event->xy[0] - rmd->orig_xy[0];
2780  if (rmd->edge == AE_LEFT_TO_TOPRIGHT) {
2781  delta = -delta;
2782  }
2783 
2784  /* region sizes now get multiplied */
2785  delta /= UI_DPI_FAC;
2786 
2787  const int size_no_snap = rmd->origval + delta;
2788  rmd->region->sizex = size_no_snap;
2789 
2790  if (rmd->region->type->snap_size) {
2791  short sizex_test = rmd->region->type->snap_size(rmd->region, rmd->region->sizex, 0);
2792  if (abs(rmd->region->sizex - sizex_test) < snap_size_threshold) {
2793  rmd->region->sizex = sizex_test;
2794  }
2795  }
2796  CLAMP(rmd->region->sizex, 0, rmd->maxsize);
2797 
2798  if (size_no_snap < UI_UNIT_X / aspect) {
2799  rmd->region->sizex = rmd->origval;
2800  if (!(rmd->region->flag & RGN_FLAG_HIDDEN)) {
2802  }
2803  }
2804  else if (rmd->region->flag & RGN_FLAG_HIDDEN) {
2806  }
2807  else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) {
2808  rmd->region->sizex = rmd->origval;
2809  }
2810  }
2811  else {
2812  delta = event->xy[1] - rmd->orig_xy[1];
2813  if (rmd->edge == AE_BOTTOM_TO_TOPLEFT) {
2814  delta = -delta;
2815  }
2816 
2817  /* region sizes now get multiplied */
2818  delta /= UI_DPI_FAC;
2819 
2820  const int size_no_snap = rmd->origval + delta;
2821  rmd->region->sizey = size_no_snap;
2822 
2823  if (rmd->region->type->snap_size) {
2824  short sizey_test = rmd->region->type->snap_size(rmd->region, rmd->region->sizey, 1);
2825  if (abs(rmd->region->sizey - sizey_test) < snap_size_threshold) {
2826  rmd->region->sizey = sizey_test;
2827  }
2828  }
2829  CLAMP(rmd->region->sizey, 0, rmd->maxsize);
2830 
2831  /* NOTE: `UI_UNIT_Y / 4` means you need to drag the footer and execute region
2832  * almost all the way down for it to become hidden, this is done
2833  * otherwise its too easy to do this by accident. */
2834  if (size_no_snap < (UI_UNIT_Y / 4) / aspect) {
2835  rmd->region->sizey = rmd->origval;
2836  if (!(rmd->region->flag & RGN_FLAG_HIDDEN)) {
2838  }
2839  }
2840  else if (rmd->region->flag & RGN_FLAG_HIDDEN) {
2842  }
2843  else if (rmd->region->flag & RGN_FLAG_DYNAMIC_SIZE) {
2844  rmd->region->sizey = rmd->origval;
2845  }
2846  }
2847  ED_area_tag_redraw(rmd->area);
2849 
2850  break;
2851  }
2852  case LEFTMOUSE:
2853  if (event->val == KM_RELEASE) {
2855  if (rmd->region->flag & RGN_FLAG_HIDDEN) {
2857  }
2858  else if (rmd->region->flag & RGN_FLAG_TOO_SMALL) {
2860  }
2861 
2862  ED_area_tag_redraw(rmd->area);
2864  }
2865 
2866  region_scale_exit(op);
2867 
2868  return OPERATOR_FINISHED;
2869  }
2870  break;
2871 
2872  case EVT_ESCKEY:
2873  break;
2874  }
2875 
2876  return OPERATOR_RUNNING_MODAL;
2877 }
2878 
2880 {
2881  region_scale_exit(op);
2882 }
2883 
2885 {
2886  /* identifiers */
2887  ot->name = "Scale Region Size";
2888  ot->description = "Scale selected area";
2889  ot->idname = "SCREEN_OT_region_scale";
2890 
2894 
2896 
2897  /* flags */
2899 }
2900 
2903 /* -------------------------------------------------------------------- */
2907 static void areas_do_frame_follow(bContext *C, bool middle)
2908 {
2909  bScreen *screen_ctx = CTX_wm_screen(C);
2912  LISTBASE_FOREACH (wmWindow *, window, &wm->windows) {
2913  const bScreen *screen = WM_window_get_active_screen(window);
2914 
2915  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
2916  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
2917  /* do follow here if editor type supports it */
2918  if (screen_ctx->redraws_flag & TIME_FOLLOW) {
2919  if ((region->regiontype == RGN_TYPE_WINDOW &&
2920  ELEM(area->spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
2921  (area->spacetype == SPACE_CLIP && region->regiontype == RGN_TYPE_PREVIEW)) {
2922  float w = BLI_rctf_size_x(&region->v2d.cur);
2923 
2924  if (middle) {
2925  if ((scene->r.cfra < region->v2d.cur.xmin) ||
2926  (scene->r.cfra > region->v2d.cur.xmax)) {
2927  region->v2d.cur.xmax = scene->r.cfra + (w / 2);
2928  region->v2d.cur.xmin = scene->r.cfra - (w / 2);
2929  }
2930  }
2931  else {
2932  if (scene->r.cfra < region->v2d.cur.xmin) {
2933  region->v2d.cur.xmax = scene->r.cfra;
2934  region->v2d.cur.xmin = region->v2d.cur.xmax - w;
2935  }
2936  else if (scene->r.cfra > region->v2d.cur.xmax) {
2937  region->v2d.cur.xmin = scene->r.cfra;
2938  region->v2d.cur.xmax = region->v2d.cur.xmin + w;
2939  }
2940  }
2941  }
2942  }
2943  }
2944  }
2945  }
2946 }
2947 
2948 /* function to be called outside UI context, or for redo */
2950 {
2952 
2953  int delta = RNA_int_get(op->ptr, "delta");
2954 
2955  scene->r.cfra += delta;
2957  scene->r.subframe = 0.0f;
2958 
2959  areas_do_frame_follow(C, false);
2960 
2962 
2964 
2965  return OPERATOR_FINISHED;
2966 }
2967 
2969 {
2970  ot->name = "Frame Offset";
2971  ot->idname = "SCREEN_OT_frame_offset";
2972  ot->description = "Move current frame forward/backward by a given number";
2973 
2975 
2978  ot->undo_group = "Frame Change";
2979 
2980  /* rna */
2981  RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX);
2982 }
2983 
2986 /* -------------------------------------------------------------------- */
2990 /* function to be called outside UI context, or for redo */
2992 {
2994  wmTimer *animtimer = CTX_wm_screen(C)->animtimer;
2995 
2996  /* Don't change scene->r.cfra directly if animtimer is running as this can cause
2997  * first/last frame not to be actually shown (bad since for example physics
2998  * simulations aren't reset properly).
2999  */
3000  if (animtimer) {
3001  ScreenAnimData *sad = animtimer->customdata;
3002 
3004 
3005  if (RNA_boolean_get(op->ptr, "end")) {
3006  sad->nextfra = PEFRA;
3007  }
3008  else {
3009  sad->nextfra = PSFRA;
3010  }
3011  }
3012  else {
3013  if (RNA_boolean_get(op->ptr, "end")) {
3014  scene->r.cfra = PEFRA;
3015  }
3016  else {
3017  scene->r.cfra = PSFRA;
3018  }
3019 
3020  areas_do_frame_follow(C, true);
3021 
3023 
3025  }
3026 
3027  return OPERATOR_FINISHED;
3028 }
3029 
3031 {
3032  ot->name = "Jump to Endpoint";
3033  ot->description = "Jump to first/last frame in frame range";
3034  ot->idname = "SCREEN_OT_frame_jump";
3035 
3036  ot->exec = frame_jump_exec;
3037 
3040  ot->undo_group = "Frame Change";
3041 
3042  /* rna */
3043  RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range");
3044 }
3045 
3048 /* -------------------------------------------------------------------- */
3052 /* function to be called outside UI context, or for redo */
3054 {
3057  bDopeSheet ads = {NULL};
3058  const bool next = RNA_boolean_get(op->ptr, "next");
3059  bool done = false;
3060 
3061  /* sanity checks */
3062  if (scene == NULL) {
3063  return OPERATOR_CANCELLED;
3064  }
3065 
3066  float cfra = (float)(scene->r.cfra);
3067 
3068  /* Initialize binary-tree-list for getting keyframes. */
3069  struct AnimKeylist *keylist = ED_keylist_create();
3070 
3071  /* Speed up dummy dope-sheet context with flags to perform necessary filtering. */
3072  if ((scene->flag & SCE_KEYS_NO_SELONLY) == 0) {
3073  /* Only selected channels are included. */
3075  }
3076 
3077  /* populate tree with keyframe nodes */
3078  scene_to_keylist(&ads, scene, keylist, 0);
3079 
3080  if (ob) {
3081  ob_to_keylist(&ads, ob, keylist, 0);
3082 
3083  if (ob->type == OB_GPENCIL) {
3084  const bool active = !(scene->flag & SCE_KEYS_NO_SELONLY);
3085  gpencil_to_keylist(&ads, ob->data, keylist, active);
3086  }
3087  }
3088 
3089  {
3091  if (mask) {
3092  MaskLayer *masklay = BKE_mask_layer_active(mask);
3093  mask_to_keylist(&ads, masklay, keylist);
3094  }
3095  }
3097 
3098  /* find matching keyframe in the right direction */
3099  const ActKeyColumn *ak;
3100  if (next) {
3101  ak = ED_keylist_find_next(keylist, cfra);
3102  }
3103  else {
3104  ak = ED_keylist_find_prev(keylist, cfra);
3105  }
3106 
3107  while ((ak != NULL) && (done == false)) {
3108  if (scene->r.cfra != (int)ak->cfra) {
3109  /* this changes the frame, so set the frame and we're done */
3110  scene->r.cfra = (int)ak->cfra;
3111  done = true;
3112  }
3113  else {
3114  /* take another step... */
3115  if (next) {
3116  ak = ak->next;
3117  }
3118  else {
3119  ak = ak->prev;
3120  }
3121  }
3122  }
3123 
3124  /* free temp stuff */
3125  ED_keylist_free(keylist);
3126 
3127  /* any success? */
3128  if (done == false) {
3129  BKE_report(op->reports, RPT_INFO, "No more keyframes to jump to in this direction");
3130 
3131  return OPERATOR_CANCELLED;
3132  }
3133 
3134  areas_do_frame_follow(C, true);
3135 
3137 
3139 
3140  return OPERATOR_FINISHED;
3141 }
3142 
3144 {
3145  ot->name = "Jump to Keyframe";
3146  ot->description = "Jump to previous/next keyframe";
3147  ot->idname = "SCREEN_OT_keyframe_jump";
3148 
3150 
3153  ot->undo_group = "Frame Change";
3154 
3155  /* properties */
3156  RNA_def_boolean(ot->srna, "next", true, "Next Keyframe", "");
3157 }
3158 
3161 /* -------------------------------------------------------------------- */
3165 /* function to be called outside UI context, or for redo */
3167 {
3169  int closest = scene->r.cfra;
3170  const bool next = RNA_boolean_get(op->ptr, "next");
3171  bool found = false;
3172 
3173  /* find matching marker in the right direction */
3174  LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) {
3175  if (next) {
3176  if ((marker->frame > scene->r.cfra) && (!found || closest > marker->frame)) {
3177  closest = marker->frame;
3178  found = true;
3179  }
3180  }
3181  else {
3182  if ((marker->frame < scene->r.cfra) && (!found || closest < marker->frame)) {
3183  closest = marker->frame;
3184  found = true;
3185  }
3186  }
3187  }
3188 
3189  /* any success? */
3190  if (!found) {
3191  BKE_report(op->reports, RPT_INFO, "No more markers to jump to in this direction");
3192 
3193  return OPERATOR_CANCELLED;
3194  }
3195 
3196  scene->r.cfra = closest;
3197 
3198  areas_do_frame_follow(C, true);
3199 
3201 
3203 
3204  return OPERATOR_FINISHED;
3205 }
3206 
3208 {
3209  ot->name = "Jump to Marker";
3210  ot->description = "Jump to previous/next marker";
3211  ot->idname = "SCREEN_OT_marker_jump";
3212 
3214 
3217  ot->undo_group = "Frame Change";
3218 
3219  /* properties */
3220  RNA_def_boolean(ot->srna, "next", true, "Next Marker", "");
3221 }
3222 
3225 /* -------------------------------------------------------------------- */
3229 /* function to be called outside UI context, or for redo */
3231 {
3232  WorkSpace *workspace = CTX_wm_workspace(C);
3233  int delta = RNA_int_get(op->ptr, "delta");
3234 
3235  if (ED_workspace_layout_cycle(workspace, delta, C)) {
3236  return OPERATOR_FINISHED;
3237  }
3238 
3239  return OPERATOR_CANCELLED;
3240 }
3241 
3243 {
3244  ot->name = "Set Screen";
3245  ot->description = "Cycle through available screens";
3246  ot->idname = "SCREEN_OT_screen_set";
3247 
3248  ot->exec = screen_set_exec;
3250 
3251  /* rna */
3252  RNA_def_int(ot->srna, "delta", 1, -1, 1, "Delta", "", -1, 1);
3253 }
3254 
3257 /* -------------------------------------------------------------------- */
3261 /* function to be called outside UI context, or for redo */
3263 {
3264  bScreen *screen = CTX_wm_screen(C);
3265  ScrArea *area = NULL;
3266  const bool hide_panels = RNA_boolean_get(op->ptr, "use_hide_panels");
3267 
3268  BLI_assert(!screen->temp);
3269 
3270  /* search current screen for 'fullscreen' areas */
3271  /* prevents restoring info header, when mouse is over it */
3272  LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) {
3273  if (area_iter->full) {
3274  area = area_iter;
3275  break;
3276  }
3277  }
3278 
3279  if (area == NULL) {
3280  area = CTX_wm_area(C);
3281  }
3282 
3283  if (hide_panels) {
3284  if (!ELEM(screen->state, SCREENNORMAL, SCREENFULL)) {
3285  return OPERATOR_CANCELLED;
3286  }
3288  }
3289  else {
3290  if (!ELEM(screen->state, SCREENNORMAL, SCREENMAXIMIZED)) {
3291  return OPERATOR_CANCELLED;
3292  }
3294  }
3295 
3296  return OPERATOR_FINISHED;
3297 }
3298 
3300 {
3301  const wmWindow *win = CTX_wm_window(C);
3302  const bScreen *screen = CTX_wm_screen(C);
3303  const ScrArea *area = CTX_wm_area(C);
3304  return ED_operator_areaactive(C) &&
3305  /* Don't allow maximizing global areas but allow minimizing from them. */
3306  ((screen->state != SCREENNORMAL) || !ED_area_is_global(area)) &&
3307  /* Don't change temporary screens. */
3309 }
3310 
3312 {
3313  PropertyRNA *prop;
3314 
3315  ot->name = "Toggle Maximize Area";
3316  ot->description = "Toggle display selected area as fullscreen/maximized";
3317  ot->idname = "SCREEN_OT_screen_full_area";
3318 
3321  ot->flag = 0;
3322 
3323  prop = RNA_def_boolean(ot->srna, "use_hide_panels", false, "Hide Panels", "Hide all the panels");
3325 }
3326 
3329 /* -------------------------------------------------------------------- */
3333 /* operator state vars used:
3334  * x1, y1 mouse coord in first area, which will disappear
3335  * x2, y2 mouse coord in 2nd area, which will become joined
3336  *
3337  * functions:
3338  *
3339  * init() find edge based on state vars
3340  * test if the edge divides two areas,
3341  * store active and nonactive area,
3342  *
3343  * apply() do the actual join
3344  *
3345  * exit() cleanup, send notifier
3346  *
3347  * callbacks:
3348  *
3349  * exec() calls init, apply, exit
3350  *
3351  * invoke() sets mouse coords in x,y
3352  * call init()
3353  * add modal handler
3354  *
3355  * modal() accept modal events while doing it
3356  * call apply() with active window and nonactive window
3357  * call exit() and remove handler when LMB confirm
3358  */
3359 
3360 typedef struct sAreaJoinData {
3361  ScrArea *sa1; /* Potential source area (kept). */
3362  ScrArea *sa2; /* Potential target area (removed or reduced). */
3363  eScreenDir dir; /* Direction of potential join. */
3364  void *draw_callback; /* call #screen_draw_join_highlight */
3365 
3367 
3368 static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
3369 {
3370  const wmOperator *op = userdata;
3371 
3372  sAreaJoinData *sd = op->customdata;
3373  if (sd->sa1 && sd->sa2 && (sd->dir != SCREEN_DIR_NONE)) {
3375  }
3376 }
3377 
3378 /* validate selection inside screen, set variables OK */
3379 /* return false: init failed */
3380 static bool area_join_init(bContext *C, wmOperator *op, ScrArea *sa1, ScrArea *sa2)
3381 {
3382  if (sa1 == NULL || sa2 == NULL) {
3383  /* Get areas from cursor location if not specified. */
3384  int cursor[2];
3385  RNA_int_get_array(op->ptr, "cursor", cursor);
3386  screen_area_edge_from_cursor(C, cursor, &sa1, &sa2);
3387  }
3388  if (sa1 == NULL || sa2 == NULL) {
3389  return false;
3390  }
3391 
3392  sAreaJoinData *jd = MEM_callocN(sizeof(sAreaJoinData), "op_area_join");
3393 
3394  jd->sa1 = sa1;
3395  jd->sa2 = sa2;
3396  jd->dir = SCREEN_DIR_NONE;
3397 
3398  op->customdata = jd;
3399 
3401 
3402  return true;
3403 }
3404 
3405 /* apply the join of the areas (space types) */
3407 {
3408  sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
3409  if (!jd || (jd->dir == SCREEN_DIR_NONE)) {
3410  return false;
3411  }
3412 
3413  if (!screen_area_join(C, CTX_wm_screen(C), jd->sa1, jd->sa2)) {
3414  return false;
3415  }
3416  if (CTX_wm_area(C) == jd->sa2) {
3419  }
3420 
3421  return true;
3422 }
3423 
3424 /* finish operation */
3426 {
3427  sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
3428 
3429  if (jd) {
3430  if (jd->draw_callback) {
3432  }
3433 
3434  MEM_freeN(jd);
3435  op->customdata = NULL;
3436  }
3437 
3438  /* this makes sure aligned edges will result in aligned grabbing */
3442 }
3443 
3445 {
3446  if (!area_join_init(C, op, NULL, NULL)) {
3447  return OPERATOR_CANCELLED;
3448  }
3449 
3450  area_join_apply(C, op);
3451  area_join_exit(C, op);
3452 
3453  return OPERATOR_FINISHED;
3454 }
3455 
3456 /* interaction callback */
3457 static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
3458 {
3459  if (event->type == EVT_ACTIONZONE_AREA) {
3460  sActionzoneData *sad = event->customdata;
3461 
3462  if (sad == NULL || sad->modifier > 0) {
3463  return OPERATOR_PASS_THROUGH;
3464  }
3465 
3466  /* verify *sad itself */
3467  if (sad->sa1 == NULL || sad->sa2 == NULL) {
3468  return OPERATOR_PASS_THROUGH;
3469  }
3470 
3471  /* is this our *sad? if areas equal it should be passed on */
3472  if (sad->sa1 == sad->sa2) {
3473  return OPERATOR_PASS_THROUGH;
3474  }
3475  if (!area_join_init(C, op, sad->sa1, sad->sa2)) {
3476  return OPERATOR_CANCELLED;
3477  }
3478  }
3479 
3480  /* add temp handler */
3482 
3483  return OPERATOR_RUNNING_MODAL;
3484 }
3485 
3487 {
3489 
3490  area_join_exit(C, op);
3491 }
3492 
3493 /* modal callback while selecting area (space) that will be removed */
3494 static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
3495 {
3496  bScreen *screen = CTX_wm_screen(C);
3497  wmWindow *win = CTX_wm_window(C);
3498 
3499  if (op->customdata == NULL) {
3500  if (!area_join_init(C, op, NULL, NULL)) {
3501  return OPERATOR_CANCELLED;
3502  }
3503  }
3504  sAreaJoinData *jd = (sAreaJoinData *)op->customdata;
3505 
3506  /* execute the events */
3507  switch (event->type) {
3508 
3509  case MOUSEMOVE: {
3511  jd->dir = area_getorientation(jd->sa1, jd->sa2);
3512 
3513  if (area == jd->sa1) {
3514  /* Hovering current source, so change direction. */
3515  jd->sa1 = jd->sa2;
3516  jd->sa2 = area;
3517  jd->dir = area_getorientation(jd->sa1, jd->sa2);
3518  }
3519  else if (area != jd->sa2) {
3520  jd->dir = SCREEN_DIR_NONE;
3521  }
3522 
3524 
3525  if (jd->dir == SCREEN_DIR_N) {
3527  }
3528  else if (jd->dir == SCREEN_DIR_S) {
3530  }
3531  else if (jd->dir == SCREEN_DIR_E) {
3533  }
3534  else if (jd->dir == SCREEN_DIR_W) {
3536  }
3537  else {
3539  }
3540 
3541  break;
3542  }
3543  case LEFTMOUSE:
3544  if (event->val == KM_RELEASE) {
3545  if (jd->dir == SCREEN_DIR_NONE) {
3546  area_join_cancel(C, op);
3547  return OPERATOR_CANCELLED;
3548  }
3549  ED_area_tag_redraw(jd->sa1);
3550  ED_area_tag_redraw(jd->sa2);
3551 
3552  area_join_apply(C, op);
3554  area_join_exit(C, op);
3555  return OPERATOR_FINISHED;
3556  }
3557  break;
3558 
3559  case RIGHTMOUSE:
3560  case EVT_ESCKEY:
3561  area_join_cancel(C, op);
3562  return OPERATOR_CANCELLED;
3563  }
3564 
3565  return OPERATOR_RUNNING_MODAL;
3566 }
3567 
3568 /* Operator for joining two areas (space types) */
3570 {
3571  /* identifiers */
3572  ot->name = "Join Area";
3573  ot->description = "Join selected areas into new window";
3574  ot->idname = "SCREEN_OT_area_join";
3575 
3576  /* api callbacks */
3577  ot->exec = area_join_exec;
3582 
3583  /* flags */
3585 
3586  /* rna */
3588  ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX);
3589 }
3590 
3593 /* -------------------------------------------------------------------- */
3597 static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent *event)
3598 {
3599  ScrArea *sa1, *sa2;
3600  if (screen_area_edge_from_cursor(C, event->xy, &sa1, &sa2) == NULL) {
3601  return OPERATOR_CANCELLED;
3602  }
3603 
3604  uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
3605  uiLayout *layout = UI_popup_menu_layout(pup);
3606 
3607  /* Vertical Split */
3608  PointerRNA ptr;
3609  uiItemFullO(layout,
3610  "SCREEN_OT_area_split",
3611  IFACE_("Vertical Split"),
3612  ICON_NONE,
3613  NULL,
3615  0,
3616  &ptr);
3617  /* store initial mouse cursor position. */
3618  RNA_int_set_array(&ptr, "cursor", event->xy);
3619  RNA_enum_set(&ptr, "direction", SCREEN_AXIS_V);
3620 
3621  /* Horizontal Split */
3622  uiItemFullO(layout,
3623  "SCREEN_OT_area_split",
3624  IFACE_("Horizontal Split"),
3625  ICON_NONE,
3626  NULL,
3628  0,
3629  &ptr);
3630  /* store initial mouse cursor position. */
3631  RNA_int_set_array(&ptr, "cursor", event->xy);
3632  RNA_enum_set(&ptr, "direction", SCREEN_AXIS_H);
3633 
3634  if (sa1 && sa2) {
3635  uiItemS(layout);
3636  }
3637 
3638  /* Join needs two very similar areas. */
3639  if (sa1 && sa2 && (area_getorientation(sa1, sa2) != -1)) {
3640  uiItemFullO(layout,
3641  "SCREEN_OT_area_join",
3642  IFACE_("Join Areas"),
3643  ICON_NONE,
3644  NULL,
3646  0,
3647  &ptr);
3648  RNA_int_set_array(&ptr, "cursor", event->xy);
3649  }
3650 
3651  /* Swap just needs two areas. */
3652  if (sa1 && sa2) {
3653  uiItemFullO(layout,
3654  "SCREEN_OT_area_swap",
3655  IFACE_("Swap Areas"),
3656  ICON_NONE,
3657  NULL,
3659  0,
3660  &ptr);
3661  RNA_int_set_array(&ptr, "cursor", event->xy);
3662  }
3663 
3664  UI_popup_menu_end(C, pup);
3665 
3666  return OPERATOR_INTERFACE;
3667 }
3668 
3670 {
3671  /* identifiers */
3672  ot->name = "Area Options";
3673  ot->description = "Operations for splitting and merging";
3674  ot->idname = "SCREEN_OT_area_options";
3675 
3676  /* api callbacks */
3678 
3680 
3681  /* flags */
3682  ot->flag = OPTYPE_INTERNAL;
3683 }
3684 
3687 /* -------------------------------------------------------------------- */
3692 {
3693  Main *bmain = CTX_data_main(C);
3694  int tot = 0;
3695 
3696  LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
3697  LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
3698  if (area->spacedata.first != area->spacedata.last) {
3699  SpaceLink *sl = area->spacedata.first;
3700 
3701  BLI_remlink(&area->spacedata, sl);
3702  tot += BLI_listbase_count(&area->spacedata);
3703  BKE_spacedata_freelist(&area->spacedata);
3704  BLI_addtail(&area->spacedata, sl);
3705  }
3706  }
3707  }
3708  BKE_reportf(op->reports, RPT_INFO, "Removed amount of editors: %d", tot);
3709 
3710  return OPERATOR_FINISHED;
3711 }
3712 
3714 {
3715  /* identifiers */
3716  ot->name = "Clean Up Space Data";
3717  ot->description = "Remove unused settings for invisible editors";
3718  ot->idname = "SCREEN_OT_spacedata_cleanup";
3719 
3720  /* api callbacks */
3723 }
3724 
3727 /* -------------------------------------------------------------------- */
3732 {
3733  if (!ED_operator_screenactive(C)) {
3734  return false;
3735  }
3737  return !BLI_listbase_is_empty(&wm->operators);
3738 }
3739 
3741 {
3743  wmOperator *lastop = wm->operators.last;
3744 
3745  /* Seek last registered operator */
3746  while (lastop) {
3747  if (lastop->type->flag & OPTYPE_REGISTER) {
3748  break;
3749  }
3750  lastop = lastop->prev;
3751  }
3752 
3753  if (lastop) {
3754  WM_operator_free_all_after(wm, lastop);
3755  WM_operator_repeat_last(C, lastop);
3756  }
3757 
3758  return OPERATOR_CANCELLED;
3759 }
3760 
3762 {
3763  /* identifiers */
3764  ot->name = "Repeat Last";
3765  ot->description = "Repeat last action";
3766  ot->idname = "SCREEN_OT_repeat_last";
3767 
3768  /* api callbacks */
3770 
3772 }
3773 
3776 /* -------------------------------------------------------------------- */
3780 static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
3781 {
3783 
3784  int items = BLI_listbase_count(&wm->operators);
3785  if (items == 0) {
3786  return OPERATOR_CANCELLED;
3787  }
3788 
3789  uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(op->type, op->ptr), ICON_NONE);
3790  uiLayout *layout = UI_popup_menu_layout(pup);
3791 
3792  wmOperator *lastop;
3793  int i;
3794  for (i = items - 1, lastop = wm->operators.last; lastop; lastop = lastop->prev, i--) {
3795  if ((lastop->type->flag & OPTYPE_REGISTER) && WM_operator_repeat_check(C, lastop)) {
3796  uiItemIntO(layout,
3797  WM_operatortype_name(lastop->type, lastop->ptr),
3798  ICON_NONE,
3799  op->type->idname,
3800  "index",
3801  i);
3802  }
3803  }
3804 
3805  UI_popup_menu_end(C, pup);
3806 
3807  return OPERATOR_INTERFACE;
3808 }
3809 
3811 {
3813 
3814  op = BLI_findlink(&wm->operators, RNA_int_get(op->ptr, "index"));
3815  if (op) {
3816  /* let's put it as last operator in list */
3817  BLI_remlink(&wm->operators, op);
3818  BLI_addtail(&wm->operators, op);
3819 
3820  WM_operator_repeat(C, op);
3821  }
3822 
3823  return OPERATOR_FINISHED;
3824 }
3825 
3827 {
3828  /* identifiers */
3829  ot->name = "Repeat History";
3830  ot->description = "Display menu for previous actions performed";
3831  ot->idname = "SCREEN_OT_repeat_history";
3832 
3833  /* api callbacks */
3837 
3838  RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, 1000);
3839 }
3840 
3843 /* -------------------------------------------------------------------- */
3847 static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
3848 {
3849  wmOperator *lastop = WM_operator_last_redo(C);
3850 
3851  if (lastop) {
3852  WM_operator_redo_popup(C, lastop);
3853  }
3854 
3855  return OPERATOR_CANCELLED;
3856 }
3857 
3859 {
3860  /* identifiers */
3861  ot->name = "Redo Last";
3862  ot->description = "Display parameters for last action performed";
3863  ot->idname = "SCREEN_OT_redo_last";
3864 
3865  /* api callbacks */
3868 }
3869 
3872 /* -------------------------------------------------------------------- */
3877 {
3878  if (rv3d->localvd) {
3879  rv3d->localvd->view = rv3d->view;
3880  rv3d->localvd->persp = rv3d->persp;
3881  copy_qt_qt(rv3d->localvd->viewquat, rv3d->viewquat);
3882  }
3883 }
3884 
3886  ScrArea *area, ARegion *region, const char viewlock, const char view, const char persp)
3887 {
3888  RegionView3D *rv3d = region->regiondata;
3889 
3890  if (persp == RV3D_CAMOB) {
3892  }
3893 
3894  rv3d->viewlock = viewlock;
3895  rv3d->runtime_viewlock = 0;
3896  rv3d->view = view;
3898  rv3d->persp = persp;
3899 
3900  ED_view3d_lock(rv3d);
3902  if ((viewlock & RV3D_BOXCLIP) && (persp == RV3D_ORTHO)) {
3903  ED_view3d_quadview_update(area, region, true);
3904  }
3905 }
3906 
3907 /* insert a region in the area region list */
3909 {
3910  ARegion *region = CTX_wm_region(C);
3911 
3912  /* some rules... */
3913  if (region->regiontype != RGN_TYPE_WINDOW) {
3914  BKE_report(op->reports, RPT_ERROR, "Only window region can be 4-split");
3915  }
3916  else if (region->alignment == RGN_ALIGN_QSPLIT) {
3917  /* Exit quad-view */
3918  ScrArea *area = CTX_wm_area(C);
3919 
3920  /* keep current region */
3921  region->alignment = 0;
3922 
3923  if (area->spacetype == SPACE_VIEW3D) {
3924  RegionView3D *rv3d = region->regiondata;
3925 
3926  /* if this is a locked view, use settings from 'User' view */
3927  if (rv3d->viewlock) {
3928  View3D *v3d_user;
3929  ARegion *region_user;
3930 
3931  if (ED_view3d_context_user_region(C, &v3d_user, &region_user)) {
3932  if (region != region_user) {
3933  SWAP(void *, region->regiondata, region_user->regiondata);
3934  rv3d = region->regiondata;
3935  }
3936  }
3937  }
3938 
3940  rv3d->viewlock = 0;
3941 
3942  /* FIXME: This fixes missing update to workbench TAA. (see T76216)
3943  * However, it would be nice if the tagging should be done in a more conventional way. */
3944  rv3d->rflag |= RV3D_GPULIGHT_UPDATE;
3945 
3946  /* Accumulate locks, in case they're mixed. */
3947  LISTBASE_FOREACH (ARegion *, region_iter, &area->regionbase) {
3948  if (region_iter->regiontype == RGN_TYPE_WINDOW) {
3949  RegionView3D *rv3d_iter = region_iter->regiondata;
3950  rv3d->viewlock_quad |= rv3d_iter->viewlock;
3951  }
3952  }
3953  }
3954 
3955  LISTBASE_FOREACH_MUTABLE (ARegion *, region_iter, &area->regionbase) {
3956  if (region_iter->alignment == RGN_ALIGN_QSPLIT) {
3957  ED_region_remove(C, area, region_iter);
3958  }
3959  }
3962  }
3963  else if (region->next) {
3964  BKE_report(op->reports, RPT_ERROR, "Only last region can be 4-split");
3965  }
3966  else {
3967  /* Enter quad-view */
3968  ScrArea *area = CTX_wm_area(C);
3969 
3970  region->alignment = RGN_ALIGN_QSPLIT;
3971 
3972  for (int count = 0; count < 3; count++) {
3973  ARegion *new_region = BKE_area_region_copy(area->type, region);
3974  BLI_addtail(&area->regionbase, new_region);
3975  }
3976 
3977  /* lock views and set them */
3978  if (area->spacetype == SPACE_VIEW3D) {
3979  View3D *v3d = area->spacedata.first;
3980  int index_qsplit = 0;
3981 
3982  /* run ED_view3d_lock() so the correct 'rv3d->viewquat' is set,
3983  * otherwise when restoring rv3d->localvd the 'viewquat' won't
3984  * match the 'view', set on entering localview See: T26315,
3985  *
3986  * We could avoid manipulating rv3d->localvd here if exiting
3987  * localview with a 4-split would assign these view locks */
3988  RegionView3D *rv3d = region->regiondata;
3989  const char viewlock = (rv3d->viewlock_quad & RV3D_VIEWLOCK_INIT) ?
3990  (rv3d->viewlock_quad & ~RV3D_VIEWLOCK_INIT) :
3992 
3994  area, region, viewlock, ED_view3d_lock_view_from_index(index_qsplit++), RV3D_ORTHO);
3996  (region = region->next),
3997  viewlock,
3998  ED_view3d_lock_view_from_index(index_qsplit++),
3999  RV3D_ORTHO);
4001  (region = region->next),
4002  viewlock,
4003  ED_view3d_lock_view_from_index(index_qsplit++),
4004  RV3D_ORTHO);
4005  /* forcing camera is distracting */
4006 #if 0
4007  if (v3d->camera) {
4009  }
4010  else {
4011  region_quadview_init_rv3d(area, (region = region->next), 0, RV3D_VIEW_USER, RV3D_PERSP);
4012  }
4013 #else
4014  (void)v3d;
4015 #endif
4016  }
4019  }
4020 
4021  return OPERATOR_FINISHED;
4022 }
4023 
4025 {
4026  /* identifiers */
4027  ot->name = "Toggle Quad View";
4028  ot->description = "Split selected area into camera, front, right, and top views";
4029  ot->idname = "SCREEN_OT_region_quadview";
4030 
4031  /* api callbacks */
4034  ot->flag = 0;
4035 }
4036 
4039 /* -------------------------------------------------------------------- */
4044 {
4045  PropertyRNA *prop = RNA_struct_find_property(op->ptr, "region_type");
4046 
4047  ARegion *region;
4048  if (RNA_property_is_set(op->ptr, prop)) {
4050  }
4051  else {
4052  region = CTX_wm_region(C);
4053  }
4054 
4055  if (region && (region->alignment != RGN_ALIGN_NONE)) {
4056  ED_region_toggle_hidden(C, region);
4057  }
4058  ED_region_tag_redraw(region);
4059 
4060  return OPERATOR_FINISHED;
4061 }
4062 
4064 {
4065  ScrArea *area = CTX_wm_area(C);
4066 
4067  /* Don't flip anything around in top-bar. */
4068  if (area && area->spacetype == SPACE_TOPBAR) {
4069  CTX_wm_operator_poll_msg_set(C, "Toggling regions in the Top-bar is not allowed");
4070  return false;
4071  }
4072 
4073  return ED_operator_areaactive(C);
4074 }
4075 
4077 {
4078  /* identifiers */
4079  ot->name = "Toggle Region";
4080  ot->idname = "SCREEN_OT_region_toggle";
4081  ot->description = "Hide or unhide the region";
4082 
4083  /* api callbacks */
4086  ot->flag = 0;
4087 
4088  RNA_def_enum(ot->srna,
4089  "region_type",
4091  0,
4092  "Region Type",
4093  "Type of the region to toggle");
4094 }
4095 
4098 /* -------------------------------------------------------------------- */
4102 /* flip a region alignment */
4104 {
4105  ARegion *region = CTX_wm_region(C);
4106 
4107  if (!region) {
4108  return OPERATOR_CANCELLED;
4109  }
4110 
4111  if (region->alignment == RGN_ALIGN_TOP) {
4112  region->alignment = RGN_ALIGN_BOTTOM;
4113  }
4114  else if (region->alignment == RGN_ALIGN_BOTTOM) {
4115  region->alignment = RGN_ALIGN_TOP;
4116  }
4117  else if (region->alignment == RGN_ALIGN_LEFT) {
4118  region->alignment = RGN_ALIGN_RIGHT;
4119  }
4120  else if (region->alignment == RGN_ALIGN_RIGHT) {
4121  region->alignment = RGN_ALIGN_LEFT;
4122  }
4123 
4127 
4128  return OPERATOR_FINISHED;
4129 }
4130 
4132 {
4133  ScrArea *area = CTX_wm_area(C);
4134 
4135  /* Don't flip anything around in top-bar. */
4136  if (area && area->spacetype == SPACE_TOPBAR) {
4137  CTX_wm_operator_poll_msg_set(C, "Flipping regions in the Top-bar is not allowed");
4138  return 0;
4139  }
4140 
4141  return ED_operator_areaactive(C);
4142 }
4143 
4145 {
4146  /* identifiers */
4147  ot->name = "Flip Region";
4148  ot->idname = "SCREEN_OT_region_flip";
4149  ot->description = "Toggle the region's alignment (left/right or top/bottom)";
4150 
4151  /* api callbacks */
4154  ot->flag = 0;
4155 }
4156 
4159 /* -------------------------------------------------------------------- */
4163 /* show/hide header text menus */
4165 {
4166  ScrArea *area = CTX_wm_area(C);
4167 
4168  area->flag = area->flag ^ HEADER_NO_PULLDOWN;
4169 
4172 
4173  return OPERATOR_FINISHED;
4174 }
4175 
4177 {
4178  /* identifiers */
4179  ot->name = "Expand/Collapse Header Menus";
4180  ot->idname = "SCREEN_OT_header_toggle_menus";
4181  ot->description = "Expand or collapse the header pulldown menus";
4182 
4183  /* api callbacks */
4186  ot->flag = 0;
4187 }
4188 
4191 /* -------------------------------------------------------------------- */
4196 {
4197  if (ED_area_is_global(area)) {
4198  return;
4199  }
4200 
4201  PointerRNA ptr;
4202 
4203  /* Mouse position as if in middle of area. */
4204  const int loc[2] = {BLI_rcti_cent_x(&area->totrct), BLI_rcti_cent_y(&area->totrct)};
4205 
4206  /* Vertical Split */
4207  uiItemFullO(layout,
4208  "SCREEN_OT_area_split",
4209  IFACE_("Vertical Split"),
4210  ICON_NONE,
4211  NULL,
4213  0,
4214  &ptr);
4215 
4216  RNA_int_set_array(&ptr, "cursor", loc);
4217  RNA_enum_set(&ptr, "direction", SCREEN_AXIS_V);
4218 
4219  /* Horizontal Split */
4220  uiItemFullO(layout,
4221  "SCREEN_OT_area_split",
4222  IFACE_("Horizontal Split"),
4223  ICON_NONE,
4224  NULL,
4226  0,
4227  &ptr);
4228 
4229  RNA_int_set_array(&ptr, "cursor", &loc[0]);
4230  RNA_enum_set(&ptr, "direction", SCREEN_AXIS_H);
4231 
4232  uiItemS(layout);
4233 
4234  if (area->spacetype != SPACE_FILE) {
4235  uiItemO(layout,
4236  area->full ? IFACE_("Restore Areas") : IFACE_("Maximize Area"),
4237  ICON_NONE,
4238  "SCREEN_OT_screen_full_area");
4239 
4240  if (!area->full) {
4241  uiItemFullO(layout,
4242  "SCREEN_OT_screen_full_area",
4243  IFACE_("Full Screen Area"),
4244  ICON_NONE,
4245  NULL,
4247  0,
4248  &ptr);
4249  RNA_boolean_set(&ptr, "use_hide_panels", true);
4250  }
4251  }
4252 
4253  uiItemO(layout, NULL, ICON_NONE, "SCREEN_OT_area_dupli");
4254  uiItemS(layout);
4255  uiItemO(layout, NULL, ICON_NONE, "SCREEN_OT_area_close");
4256 }
4257 
4259 {
4260  ScrArea *area = CTX_wm_area(C);
4261  ARegion *region = CTX_wm_region(C);
4262  const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ?
4263  IFACE_("Flip to Bottom") :
4264  IFACE_("Flip to Top");
4265  {
4266  PointerRNA ptr;
4267  RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, area->spacedata.first, &ptr);
4268  if (!ELEM(area->spacetype, SPACE_TOPBAR)) {
4269  uiItemR(layout, &ptr, "show_region_header", 0, IFACE_("Show Header"), ICON_NONE);
4270  }
4271 
4273  uiLayout *col = uiLayoutColumn(layout, 0);
4274  uiLayoutSetActive(col, (region_header->flag & RGN_FLAG_HIDDEN) == 0);
4275 
4277  uiItemR(col, &ptr, "show_region_tool_header", 0, IFACE_("Show Tool Settings"), ICON_NONE);
4278  }
4279 
4280  uiItemO(col,
4281  IFACE_("Show Menus"),
4282  (area->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT,
4283  "SCREEN_OT_header_toggle_menus");
4284  }
4285 
4286  /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */
4288 
4289  if (!ELEM(area->spacetype, SPACE_TOPBAR)) {
4290  uiItemS(layout);
4291  uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip");
4292  uiItemS(layout);
4293  screen_area_menu_items(area, layout);
4294  }
4295 }
4296 
4298 {
4299  ScrArea *area = CTX_wm_area(C);
4300  ARegion *region = CTX_wm_region(C);
4301  const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_TOP) ?
4302  IFACE_("Flip to Bottom") :
4303  IFACE_("Flip to Top");
4304  {
4305  PointerRNA ptr;
4306  RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, area->spacedata.first, &ptr);
4307  uiItemR(layout, &ptr, "show_region_footer", 0, IFACE_("Show Footer"), ICON_NONE);
4308  }
4309 
4310  /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */
4312 
4313  uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip");
4314 
4315  uiItemS(layout);
4316  screen_area_menu_items(area, layout);
4317 }
4318 
4320 {
4321  const ARegion *region = CTX_wm_region(C);
4322  const char *but_flip_str = (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_LEFT) ?
4323  IFACE_("Flip to Right") :
4324  IFACE_("Flip to Left");
4325 
4326  /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */
4328 
4329  uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip");
4330 }
4331 
4332 static void ed_screens_statusbar_menu_create(uiLayout *layout, void *UNUSED(arg))
4333 {
4334  PointerRNA ptr;
4335 
4336  RNA_pointer_create(NULL, &RNA_PreferencesView, &U, &ptr);
4337  uiItemR(layout, &ptr, "show_statusbar_stats", 0, IFACE_("Scene Statistics"), ICON_NONE);
4338  uiItemR(layout, &ptr, "show_statusbar_memory", 0, IFACE_("System Memory"), ICON_NONE);
4339  if (GPU_mem_stats_supported()) {
4340  uiItemR(layout, &ptr, "show_statusbar_vram", 0, IFACE_("Video Memory"), ICON_NONE);
4341  }
4342  uiItemR(layout, &ptr, "show_statusbar_version", 0, IFACE_("Blender Version"), ICON_NONE);
4343 }
4344 
4346  wmOperator *UNUSED(op),
4347  const wmEvent *UNUSED(event))
4348 {
4349  const ScrArea *area = CTX_wm_area(C);
4350  const ARegion *region = CTX_wm_region(C);
4351 
4352  if (area && area->spacetype == SPACE_STATUSBAR) {
4353  uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Status Bar"), ICON_NONE);
4354  uiLayout *layout = UI_popup_menu_layout(pup);
4356  UI_popup_menu_end(C, pup);
4357  }
4358  else if (ELEM(region->regiontype, RGN_TYPE_HEADER, RGN_TYPE_TOOL_HEADER)) {
4359  uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Header"), ICON_NONE);
4360  uiLayout *layout = UI_popup_menu_layout(pup);
4362  UI_popup_menu_end(C, pup);
4363  }
4364  else if (region->regiontype == RGN_TYPE_FOOTER) {
4365  uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Footer"), ICON_NONE);
4366  uiLayout *layout = UI_popup_menu_layout(pup);
4368  UI_popup_menu_end(C, pup);
4369  }
4370  else if (region->regiontype == RGN_TYPE_NAV_BAR) {
4371  uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("Navigation Bar"), ICON_NONE);
4372  uiLayout *layout = UI_popup_menu_layout(pup);
4374  UI_popup_menu_end(C, pup);
4375  }
4376 
4377  return OPERATOR_INTERFACE;
4378 }
4379 
4381 {
4382  /* identifiers */
4383  ot->name = "Region Context Menu";
4384  ot->description = "Display region context menu";
4385  ot->idname = "SCREEN_OT_region_context_menu";
4386 
4387  /* api callbacks */
4389 }
4390 
4393 /* -------------------------------------------------------------------- */
4400  eRegion_Type regiontype)
4401 {
4402  return (regiontype == RGN_TYPE_WINDOW &&
4403  ELEM(spacetype, SPACE_SEQ, SPACE_GRAPH, SPACE_ACTION, SPACE_NLA)) ||
4404  (spacetype == SPACE_CLIP && regiontype == RGN_TYPE_PREVIEW);
4405 }
4406 
4408  eRegion_Type regiontype,
4409  eScreen_Redraws_Flag redraws,
4410  bool from_anim_edit)
4411 {
4412  const eSpace_Type spacetype = area->spacetype;
4413  if (regiontype == RGN_TYPE_WINDOW) {
4414 
4415  switch (spacetype) {
4416  case SPACE_VIEW3D:
4417  if ((redraws & TIME_ALL_3D_WIN) || from_anim_edit) {
4418  return true;
4419  }
4420  break;
4421  case SPACE_GRAPH:
4422  case SPACE_NLA:
4423  if ((redraws & TIME_ALL_ANIM_WIN) || from_anim_edit) {
4424  return true;
4425  }
4426  break;
4427  case SPACE_ACTION:
4428  /* if only 1 window or 3d windows, we do timeline too
4429  * NOTE: Now we do action editor in all these cases, since timeline is here. */
4430  if ((redraws & (TIME_ALL_ANIM_WIN | TIME_REGION | TIME_ALL_3D_WIN)) || from_anim_edit) {
4431  return true;
4432  }
4433  break;
4434  case SPACE_PROPERTIES:
4435  if (redraws & TIME_ALL_BUTS_WIN) {
4436  return true;
4437  }
4438  break;
4439  case SPACE_SEQ:
4440  if ((redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) || from_anim_edit) {
4441  return true;
4442  }
4443  break;
4444  case SPACE_NODE:
4445  if (redraws & TIME_NODES) {
4446  return true;
4447  }
4448  break;
4449  case SPACE_IMAGE:
4450  if ((redraws & TIME_ALL_IMAGE_WIN) || from_anim_edit) {
4451  return true;
4452  }
4453  break;
4454  case SPACE_CLIP:
4455  if ((redraws & TIME_CLIPS) || from_anim_edit) {
4456  return true;
4457  }
4458  break;
4459  default:
4460  break;
4461  }
4462  }
4463  else if (regiontype == RGN_TYPE_UI) {
4464  if (spacetype == SPACE_CLIP) {
4465  /* Track Preview button is on Properties Editor in SpaceClip,
4466  * and it's very common case when users want it be refreshing
4467  * during playback, so asking people to enable special option
4468  * for this is a bit tricky, so add exception here for refreshing
4469  * Properties Editor for SpaceClip always */
4470  return true;
4471  }
4472 
4473  if (redraws & TIME_ALL_BUTS_WIN) {
4474  return true;
4475  }
4476  }
4477  else if (regiontype == RGN_TYPE_HEADER) {
4478  if (spacetype == SPACE_ACTION) {
4479  /* The timeline shows the current frame in the header. Other headers
4480  * don't need to be updated. */
4481  SpaceAction *saction = (SpaceAction *)area->spacedata.first;
4482  return saction->mode == SACTCONT_TIMELINE;
4483  }
4484  }
4485  else if (regiontype == RGN_TYPE_PREVIEW) {
4486  switch (spacetype) {
4487  case SPACE_SEQ:
4488  if (redraws & (TIME_SEQ | TIME_ALL_ANIM_WIN)) {
4489  return true;
4490  }
4491  break;
4492  case SPACE_CLIP:
4493  return true;
4494  default:
4495  break;
4496  }
4497  }
4498  return false;
4499 }
4500 
4502  bContext *C, ScrArea *area, ARegion *region, const Scene *scene, eScreen_Redraws_Flag redraws)
4503 {
4504  /* Do follow time here if editor type supports it */
4505  if ((redraws & TIME_FOLLOW) &&
4507  float w = BLI_rctf_size_x(&region->v2d.cur);
4508  if (scene->r.cfra < region->v2d.cur.xmin) {
4509  region->v2d.cur.xmax = scene->r.cfra;
4510  region->v2d.cur.xmin = region->v2d.cur.xmax - w;
4511  ED_region_tag_redraw(region);
4512  return;
4513  }
4514  if (scene->r.cfra > region->v2d.cur.xmax) {
4515  region->v2d.cur.xmin = scene->r.cfra;
4516  region->v2d.cur.xmax = region->v2d.cur.xmin + w;
4517  ED_region_tag_redraw(region);
4518  return;
4519  }
4520  }
4521 
4522  /* No need to do a full redraw as the current frame indicator is only updated.
4523  * We do need to redraw when this area is in full screen as no other areas
4524  * will be tagged for redrawing. */
4525  if (region->regiontype == RGN_TYPE_WINDOW && !area->full) {
4526  if (ELEM(area->spacetype, SPACE_NLA, SPACE_ACTION)) {
4527  return;
4528  }
4529 
4530  /* Drivers Editor needs a full redraw on playback for graph_draw_driver_debug().
4531  * This will make it slower than regular graph editor during playback, but drawing this in
4532  * graph_main_region_draw_overlay() is not feasible because it requires animation filtering
4533  * which has significant overhead which needs to be avoided in the overlay which is redrawn on
4534  * every UI interaction. */
4535  if (area->spacetype == SPACE_GRAPH) {
4536  const SpaceGraph *sipo = area->spacedata.first;
4537  if (sipo->mode != SIPO_MODE_DRIVERS) {
4538  return;
4539  }
4540  bAnimContext ac;
4541  if (ANIM_animdata_get_context(C, &ac) == false) {
4542  return;
4543  }
4544  if (ac.datatype != ANIMCONT_DRIVERS) {
4545  return;
4546  }
4547  }
4548 
4549  if (area->spacetype == SPACE_SEQ) {
4550  const SpaceSeq *sseq = area->spacedata.first;
4552  return;
4553  }
4554  }
4555  }
4556  ED_region_tag_redraw(region);
4557 }
4558 
4559 //#define PROFILE_AUDIO_SYNCH
4560 
4562 {
4563  bScreen *screen = CTX_wm_screen(C);
4564  wmTimer *wt = screen->animtimer;
4565 
4566  if (!(wt && wt == event->customdata)) {
4567  return OPERATOR_PASS_THROUGH;
4568  }
4569 
4570  wmWindow *win = CTX_wm_window(C);
4571 
4572 #ifdef PROFILE_AUDIO_SYNCH
4573  static int old_frame = 0;
4574  int newfra_int;
4575 #endif
4576 
4577  Main *bmain = CTX_data_main(C);
4579  ViewLayer *view_layer = WM_window_get_active_view_layer(win);
4581  Scene *scene_eval = (depsgraph != NULL) ? DEG_get_evaluated_scene(depsgraph) : NULL;
4582  ScreenAnimData *sad = wt->customdata;
4584  int sync;
4585  double time;
4586 
4587  /* sync, don't sync, or follow scene setting */
4588  if (sad->flag & ANIMPLAY_FLAG_SYNC) {
4589  sync = 1;
4590  }
4591  else if (sad->flag & ANIMPLAY_FLAG_NO_SYNC) {
4592  sync = 0;
4593  }
4594  else {
4595  sync = (scene->flag & SCE_FRAME_DROP);
4596  }
4597 
4598  if (scene_eval == NULL) {
4599  /* Happens when undo/redo system is used during playback, nothing meaningful we can do here. */
4600  }
4601  else if (scene_eval->id.recalc & ID_RECALC_FRAME_CHANGE) {
4602  /* Ignore seek here, the audio will be updated to the scene frame after jump during next
4603  * dependency graph update. */
4604  }
4605  else if ((scene->audio.flag & AUDIO_SYNC) && (sad->flag & ANIMPLAY_FLAG_REVERSE) == false &&
4606  isfinite(time = BKE_sound_sync_scene(scene_eval))) {
4607  double newfra = time * FPS;
4608 
4609  /* give some space here to avoid jumps */
4610  if (newfra + 0.5 > scene->r.cfra && newfra - 0.5 < scene->r.cfra) {
4611  scene->r.cfra++;
4612  }
4613  else {
4614  scene->r.cfra = max_ii(scene->r.cfra, round(newfra));
4615  }
4616 
4617 #ifdef PROFILE_AUDIO_SYNCH
4618  newfra_int = scene->r.cfra;
4619  if (newfra_int < old_frame) {
4620  printf("back jump detected, frame %d!\n", newfra_int);
4621  }
4622  else if (newfra_int > old_frame + 1) {
4623  printf("forward jump detected, frame %d!\n", newfra_int);
4624  }
4625  fflush(stdout);
4626  old_frame = newfra_int;
4627 #endif
4628  }
4629  else {
4630  if (sync) {
4631  /* Try to keep the playback in realtime by dropping frames. */
4632 
4633  /* How much time (in frames) has passed since the last frame was drawn? */
4634  double delta_frames = wt->delta * FPS;
4635 
4636  /* Add the remaining fraction from the last time step. */
4637  delta_frames += sad->lagging_frame_count;
4638 
4639  if (delta_frames < 1.0) {
4640  /* We can render faster than the scene frame rate. However skipping or delaying frames
4641  * here seems to in practice lead to jittery playback so just step forward a minimum of
4642  * one frame. (Even though this can lead to too fast playback, the jitteryness is more
4643  * annoying)
4644  */
4645  delta_frames = 1.0f;
4646  sad->lagging_frame_count = 0;
4647  }
4648  else {
4649  /* Extract the delta frame fractions that will be skipped when converting to int. */
4650  sad->lagging_frame_count = delta_frames - (int)delta_frames;
4651  }
4652 
4653  const int step = delta_frames;
4654 
4655  /* skip frames */
4656  if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
4657  scene->r.cfra -= step;
4658  }
4659  else {
4660  scene->r.cfra += step;
4661  }
4662  }
4663  else {
4664  /* one frame +/- */
4665  if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
4666  scene->r.cfra--;
4667  }
4668  else {
4669  scene->r.cfra++;
4670  }
4671  }
4672  }
4673 
4674  /* reset 'jumped' flag before checking if we need to jump... */
4675  sad->flag &= ~ANIMPLAY_FLAG_JUMPED;
4676 
4677  if (sad->flag & ANIMPLAY_FLAG_REVERSE) {
4678  /* jump back to end? */
4679  if (PRVRANGEON) {
4680  if (scene->r.cfra < scene->r.psfra) {
4681  scene->r.cfra = scene->r.pefra;
4682  sad->flag |= ANIMPLAY_FLAG_JUMPED;
4683  }
4684  }
4685  else {
4686  if (scene->r.cfra < scene->r.sfra) {
4687  scene->r.cfra = scene->r.efra;
4688  sad->flag |= ANIMPLAY_FLAG_JUMPED;
4689  }
4690  }
4691  }
4692  else {
4693  /* jump back to start? */
4694  if (PRVRANGEON) {
4695  if (scene->r.cfra > scene->r.pefra) {
4696  scene->r.cfra = scene->r.psfra;
4697  sad->flag |= ANIMPLAY_FLAG_JUMPED;
4698  }
4699  }
4700  else {
4701  if (scene->r.cfra > scene->r.efra) {
4702  scene->r.cfra = scene->r.sfra;
4703  sad->flag |= ANIMPLAY_FLAG_JUMPED;
4704  }
4705  }
4706  }
4707 
4708  /* next frame overridden by user action (pressed jump to first/last frame) */
4709  if (sad->flag & ANIMPLAY_FLAG_USE_NEXT_FRAME) {
4710  scene->r.cfra = sad->nextfra;
4712  sad->flag |= ANIMPLAY_FLAG_JUMPED;
4713  }
4714 
4715  if (sad->flag & ANIMPLAY_FLAG_JUMPED) {
4717 #ifdef PROFILE_AUDIO_SYNCH
4718  old_frame = scene->r.cfra;
4719 #endif
4720  }
4721 
4722  /* Since we follow draw-flags, we can't send notifier but tag regions ourselves. */
4723  if (depsgraph != NULL) {
4725  }
4726 
4727  LISTBASE_FOREACH (wmWindow *, window, &wm->windows) {
4728  const bScreen *win_screen = WM_window_get_active_screen(window);
4729 
4730  LISTBASE_FOREACH (ScrArea *, area, &win_screen->areabase) {
4731  LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
4732  bool redraw = false;
4733  if (region == sad->region) {
4734  redraw = true;
4735  }
4736  else if (match_region_with_redraws(
4737  area, region->regiontype, sad->redraws, sad->from_anim_edit)) {
4738  redraw = true;
4739  }
4740 
4741  if (redraw) {
4743  }
4744  }
4745  }
4746  }
4747 
4748  /* update frame rate info too
4749  * NOTE: this may not be accurate enough, since we might need this after modifiers/etc.
4750  * have been calculated instead of just before updates have been done?
4751  */
4753 
4754  /* Recalculate the time-step for the timer now that we've finished calculating this,
4755  * since the frames-per-second value may have been changed.
4756  */
4757  /* TODO: this may make evaluation a bit slower if the value doesn't change...
4758  * any way to avoid this? */
4759  wt->timestep = (1.0 / FPS);
4760 
4761  return OPERATOR_FINISHED;
4762 }
4763 
4765 {
4766  /* identifiers */
4767  ot->name = "Animation Step";
4768  ot->description = "Step through animation by position";
4769  ot->idname = "SCREEN_OT_animation_step";
4770 
4771  /* api callbacks */
4773 
4775 }
4776 
4779 /* -------------------------------------------------------------------- */
4786 {
4787  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
4788  bScreen *screen = WM_window_get_active_screen(win);
4789 
4790  if (screen->animtimer || screen->scrubbing) {
4791  return screen;
4792  }
4793  }
4794 
4795  return NULL;
4796 }
4797 
4799 {
4800  LISTBASE_FOREACH (wmWindow *, win, &wm->windows) {
4801  bScreen *screen = WM_window_get_active_screen(win);
4802 
4803  if (screen->animtimer) {
4804  return screen;
4805  }
4806  }
4807 
4808  return NULL;
4809 }
4810 
4811 int ED_screen_animation_play(bContext *C, int sync, int mode)
4812 {
4813  bScreen *screen = CTX_wm_screen(C);
4816 
4818  /* stop playback now */
4819  ED_screen_animation_timer(C, 0, 0, 0);
4820  BKE_sound_stop_scene(scene_eval);
4821 
4823  }
4824  else {
4825  /* these settings are currently only available from a menu in the TimeLine */
4826  if (mode == 1) { /* XXX only play audio forwards!? */
4827  BKE_sound_play_scene(scene_eval);
4828  }
4829 
4830  ED_screen_animation_timer(C, screen->redraws_flag, sync, mode);
4831 
4832  if (screen->animtimer) {
4833  wmTimer *wt = screen->animtimer;
4834  ScreenAnimData *sad = wt->customdata;
4835 
4836  sad->region = CTX_wm_region(C);
4837  }
4838  }
4839 
4840  return OPERATOR_FINISHED;
4841 }
4842 
4844 {
4845  int mode = (RNA_boolean_get(op->ptr, "reverse")) ? -1 : 1;
4846  int sync = -1;
4847 
4848  if (RNA_struct_property_is_set(op->ptr, "sync")) {
4849  sync = (RNA_boolean_get(op->ptr, "sync"));
4850  }
4851 
4852  return ED_screen_animation_play(C, sync, mode);
4853 }
4854 
4856 {
4857  PropertyRNA *prop;
4858 
4859  /* identifiers */
4860  ot->name = "Play Animation";
4861  ot->description = "Play animation";
4862  ot->idname = "SCREEN_OT_animation_play";
4863 
4864  /* api callbacks */
4866 
4868 
4869  prop = RNA_def_boolean(
4870  ot->srna, "reverse", 0, "Play in Reverse", "Animation is played backwards");
4872  prop = RNA_def_boolean(ot->srna, "sync", 0, "Sync", "Drop frames to maintain framerate");
4874 }
4875 
4878 /* -------------------------------------------------------------------- */
4883 {
4885 
4886  if (screen) {
4887  if (RNA_boolean_get(op->ptr, "restore_frame") && screen->animtimer) {
4888  ScreenAnimData *sad = screen->animtimer->customdata;
4890 
4891  /* reset current frame before stopping, and just send a notifier to deal with the rest
4892  * (since playback still needs to be stopped)
4893  */
4894  scene->r.cfra = sad->sfra;
4895 
4897  }
4898 
4899  /* call the other "toggling" operator to clean up now */
4900  ED_screen_animation_play(C, 0, 0);
4901  }
4902 
4903  return OPERATOR_PASS_THROUGH;
4904 }
4905 
4907 {
4908  /* identifiers */
4909  ot->name = "Cancel Animation";
4910  ot->description = "Cancel animation, returning to the original frame";
4911  ot->idname = "SCREEN_OT_animation_cancel";
4912 
4913  /* api callbacks */
4915 
4917 
4919  "restore_frame",
4920  true,
4921  "Restore Frame",
4922  "Restore the frame when animation was initialized");
4923 }
4924 
4927 /* -------------------------------------------------------------------- */
4931 /* operator state vars used: (added by default WM callbacks)
4932  * xmin, ymin
4933  * xmax, ymax
4934  *
4935  * customdata: the wmGesture pointer
4936  *
4937  * callbacks:
4938  *
4939  * exec() has to be filled in by user
4940  *
4941  * invoke() default WM function
4942  * adds modal handler
4943  *
4944  * modal() default WM function
4945  * accept modal events while doing it, calls exec(), handles ESC and border drawing
4946  *
4947  * poll() has to be filled in by user for context
4948  */
4949 #if 0
4950 static int box_select_exec(bContext *C, wmOperator *op)
4951 {
4952  int event_type = RNA_int_get(op->ptr, "event_type");
4953 
4954  if (event_type == LEFTMOUSE) {
4955  printf("box select do select\n");
4956  }
4957  else if (event_type == RIGHTMOUSE) {
4958  printf("box select deselect\n");
4959  }
4960  else {
4961  printf("box select do something\n");
4962  }
4963 
4964  return 1;
4965 }
4966 
4967 static void SCREEN_OT_box_select(wmOperatorType *ot)
4968 {
4969  /* identifiers */
4970  ot->name = "Box Select";
4971  ot->idname = "SCREEN_OT_box_select";
4972 
4973  /* api callbacks */
4974  ot->exec = box_select_exec;
4978 
4980 
4981  /* rna */
4982  RNA_def_int(ot->srna, "event_type", 0, INT_MIN, INT_MAX, "Event Type", "", INT_MIN, INT_MAX);
4984 }
4985 #endif
4986 
4989 /* -------------------------------------------------------------------- */
4996 {
4997  bScreen *screen = CTX_wm_screen(C);
4998  ScrArea *area = NULL;
4999 
5000  /* search current screen for 'fullscreen' areas */
5001  LISTBASE_FOREACH (ScrArea *, area_iter, &screen->areabase) {
5002  if (area_iter->full) {
5003  area = area_iter;
5004  break;
5005  }
5006  }
5007  if (!area) {
5008  BKE_report(op->reports, RPT_ERROR, "No fullscreen areas were found");
5009  return OPERATOR_CANCELLED;
5010  }
5011 
5013 
5014  return OPERATOR_FINISHED;
5015 }
5016 
5018 {
5019  /* identifiers */
5020  ot->name = "Back to Previous Screen";
5021  ot->description = "Revert back to the original screen layout, before fullscreen area overlay";
5022  ot->idname = "SCREEN_OT_back_to_previous";
5023 
5024  /* api callbacks */
5027 }
5028 
5031 /* -------------------------------------------------------------------- */
5036 {
5037  wmWindow *win_cur = CTX_wm_window(C);
5038  /* Use eventstate, not event from _invoke, so this can be called through exec(). */
5039  const wmEvent *event = win_cur->eventstate;
5040  int sizex = (500 + UI_NAVIGATION_REGION_WIDTH) * UI_DPI_FAC;
5041  int sizey = 520 * UI_DPI_FAC;
5042 
5043  PropertyRNA *prop = RNA_struct_find_property(op->ptr, "section");
5044  if (prop && RNA_property_is_set(op->ptr, prop)) {
5045  /* Set active section via RNA, so it can fail properly. */
5046 
5047  PointerRNA pref_ptr;
5048  RNA_pointer_create(NULL, &RNA_Preferences, &U, &pref_ptr);
5049  PropertyRNA *active_section_prop = RNA_struct_find_property(&pref_ptr, "active_section");
5050 
5051  RNA_property_enum_set(&pref_ptr, active_section_prop, RNA_property_enum_get(op->ptr, prop));
5052  RNA_property_update(C, &pref_ptr, active_section_prop);
5053  }
5054 
5055  /* changes context! */
5056  if (WM_window_open(C,
5057  IFACE_("Blender Preferences"),
5058  event->xy[0],
5059  event->xy[1],
5060  sizex,
5061  sizey,
5063  false,
5064  false,
5065  true,
5067  /* The header only contains the editor switcher and looks empty.
5068  * So hiding in the temp window makes sense. */
5069  ScrArea *area = CTX_wm_area(C);
5071 
5072  region->flag |= RGN_FLAG_HIDDEN;
5074 
5075  /* And also show the region with "Load & Save" buttons. */
5077  region->flag &= ~RGN_FLAG_HIDDEN;
5079 
5080  return OPERATOR_FINISHED;
5081  }
5082  BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
5083  return OPERATOR_CANCELLED;
5084 }
5085 
5087 {
5088  PropertyRNA *prop;
5089 
5090  /* identifiers */
5091  ot->name = "Open Preferences...";
5092  ot->description = "Edit user preferences and system settings";
5093  ot->idname = "SCREEN_OT_userpref_show";
5094 
5095  /* api callbacks */
5097  ot->poll = ED_operator_screenactive_nobackground; /* Not in background as this opens a window. */
5098 
5099  prop = RNA_def_enum(ot->srna,
5100  "section",
5102  0,
5103  "",
5104  "Section to activate in the Preferences");
5106 }
5107 
5110 /* -------------------------------------------------------------------- */
5115 {
5116  wmWindow *win_cur = CTX_wm_window(C);
5117  /* Use eventstate, not event from _invoke, so this can be called through exec(). */
5118  const wmEvent *event = win_cur->eventstate;
5119 
5120  int sizex = 900 * UI_DPI_FAC;
5121  int sizey = 580 * UI_DPI_FAC;
5122 
5123  /* Get active property to show driver for
5124  * - Need to grab it first, or else this info disappears
5125  * after we've created the window
5126  */
5127  int index;
5128  PointerRNA ptr;
5129  PropertyRNA *prop;
5130  uiBut *but = UI_context_active_but_prop_get(C, &ptr, &prop, &index);
5131 
5132  /* changes context! */
5133  if (WM_window_open(C,
5134  IFACE_("Blender Drivers Editor"),
5135  event->xy[0],
5136  event->xy[1],
5137  sizex,
5138  sizey,
5139  SPACE_GRAPH,
5140  false,
5141  false,
5142  true,
5145 
5146  /* activate driver F-Curve for the property under the cursor */
5147  if (but) {
5148  bool driven, special;
5150  C, &ptr, prop, index, NULL, NULL, &driven, &special);
5151 
5152  if (fcu) {
5153  /* Isolate this F-Curve... */
5154  bAnimContext ac;
5155  if (ANIM_animdata_get_context(C, &ac)) {
5159  }
5160  else {
5161  /* Just blindly isolate...
5162  * This isn't the best, and shouldn't happen, but may be enough. */
5163  fcu->flag |= (FCURVE_ACTIVE | FCURVE_SELECTED);
5164  }
5165  }
5166  }
5167 
5168  return OPERATOR_FINISHED;
5169  }
5170  BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
5171  return OPERATOR_CANCELLED;
5172 }
5173 
5175 {
5176  /* identifiers */
5177  ot->name = "Show Drivers Editor";
5178  ot->description = "Show drivers editor in a separate window";
5179  ot->idname = "SCREEN_OT_drivers_editor_show";
5180 
5181  /* api callbacks */
5183  ot->poll = ED_operator_screenactive_nobackground; /* Not in background as this opens a window. */
5184 }
5185 
5188 /* -------------------------------------------------------------------- */
5193 {
5194  wmWindow *win_cur = CTX_wm_window(C);
5195  /* Use eventstate, not event from _invoke, so this can be called through exec(). */
5196  const wmEvent *event = win_cur->eventstate;
5197  int sizex = 900 * UI_DPI_FAC;
5198  int sizey = 580 * UI_DPI_FAC;
5199  int shift_y = 480;
5200 
5201  /* changes context! */
5202  if (WM_window_open(C,
5203  IFACE_("Blender Info Log"),
5204  event->xy[0],
5205  event->xy[1] + shift_y,
5206  sizex,
5207  sizey,
5208  SPACE_INFO,
5209  false,
5210  false,
5211  true,
5213  return OPERATOR_FINISHED;
5214  }
5215  BKE_report(op->reports, RPT_ERROR, "Failed to open window!");
5216  return OPERATOR_CANCELLED;
5217 }
5218 
5220 {
5221  /* identifiers */
5222  ot->name = "Show Info Log";
5223  ot->description = "Show info log in a separate window";
5224  ot->idname = "SCREEN_OT_info_log_show";
5225 
5226  /* api callbacks */
5229 }
5230 
5233 /* -------------------------------------------------------------------- */
5238 {
5239  Main *bmain = CTX_data_main(C);
5240  wmWindow *win = CTX_wm_window(C);
5243 
5244  WorkSpaceLayout *layout_new = ED_workspace_layout_duplicate(bmain, workspace, layout_old, win);
5245 
5247 
5248  return OPERATOR_FINISHED;
5249 }
5250 
5252 {
5253  /* identifiers */
5254  ot->name = "New Screen";
5255  ot->description = "Add a new screen";
5256  ot->idname = "SCREEN_OT_new";
5257 
5258  /* api callbacks */
5259  ot->exec = screen_new_exec;
5261 }
5262 
5265 /* -------------------------------------------------------------------- */
5270 {
5271  bScreen *screen = CTX_wm_screen(C);
5272  WorkSpace *workspace = CTX_wm_workspace(C);
5273  WorkSpaceLayout *layout = BKE_workspace_layout_find(workspace, screen);
5274 
5276 
5277  return OPERATOR_FINISHED;
5278 }
5279 
5281 {
5282  /* identifiers */
5283  ot->name = "Delete Screen";
5284  ot->description = "Delete active screen";
5285  ot->idname = "SCREEN_OT_delete";
5286 
5287  /* api callbacks */
5289 }
5290 
5293 /* -------------------------------------------------------------------- */
5302 typedef struct RegionAlphaInfo {
5304  ARegion *region, *child_region; /* other region */
5305  int hidden;
5307 
5308 #define TIMEOUT 0.1f
5309 #define TIMESTEP (1.0f / 60.0f)
5310 
5312 {
5313  /* check parent too */
5314  if (region->regiontimer == NULL && (region->alignment & RGN_SPLIT_PREV) && region->prev) {
5315  region = region->prev;
5316  }
5317 
5318  if (region->regiontimer) {
5319  RegionAlphaInfo *rgi = region->regiontimer->customdata;
5320  float alpha;
5321 
5322  alpha = (float)region->regiontimer->duration / TIMEOUT;
5323  /* makes sure the blend out works 100% - without area redraws */
5324  if (rgi->hidden) {
5325  alpha = 0.9f - TIMESTEP - alpha;
5326  }
5327 
5328  CLAMP(alpha, 0.0f, 1.0f);
5329  return alpha;
5330  }
5331  return 1.0f;
5332 }
5333 
5334 /* assumes region has running region-blend timer */
5335 static void region_blend_end(bContext *C, ARegion *region, const bool is_running)
5336 {
5337  RegionAlphaInfo *rgi = region->regiontimer->customdata;
5338 
5339  /* always send redraw */
5340  ED_region_tag_redraw(region);
5341  if (rgi->child_region) {
5343  }
5344 
5345  /* if running timer was hiding, the flag toggle went wrong */
5346  if (is_running) {
5347  if (rgi->hidden) {
5348  rgi->region->flag &= ~RGN_FLAG_HIDDEN;
5349  }
5350  }
5351  else {
5352  if (rgi->hidden) {
5353  rgi->region->flag |= rgi->hidden;
5355  }
5356  /* area decoration needs redraw in end */
5357  ED_area_tag_redraw(rgi->area);
5358  }
5359  WM_event_remove_timer(CTX_wm_manager(C), NULL, region->regiontimer); /* frees rgi */
5360  region->regiontimer = NULL;
5361 }
5363 {
5365  wmWindow *win = CTX_wm_window(C);
5366 
5367  /* end running timer */
5368  if (region->regiontimer) {
5369 
5370  region_blend_end(C, region, true);
5371  }
5372  RegionAlphaInfo *rgi = MEM_callocN(sizeof(RegionAlphaInfo), "RegionAlphaInfo");
5373 
5374  rgi->hidden = region->flag & RGN_FLAG_HIDDEN;
5375  rgi->area = area;
5376  rgi->region = region;
5377  region->flag &= ~RGN_FLAG_HIDDEN;
5378 
5379  /* blend in, reinitialize regions because it got unhidden */
5380  if (rgi->hidden == 0) {
5381  ED_area_init(wm, win, area);
5382  }
5383  else {
5384  WM_event_remove_handlers(C, &region->handlers);
5385  }
5386 
5387  if (region->next) {
5388  if (region->next->alignment & RGN_SPLIT_PREV) {
5389  rgi->child_region = region->next;
5390  }
5391  }
5392 
5393  /* new timer */
5394  region->regiontimer = WM_event_add_timer(wm, win, TIMERREGION, TIMESTEP);
5395  region->regiontimer->customdata = rgi;
5396 }
5397 
5398 /* timer runs in win->handlers, so it cannot use context to find area/region */
5399 static int region_blend_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
5400 {
5401  wmTimer *timer = event->customdata;
5402 
5403  /* event type is TIMERREGION, but we better check */
5404  if (event->type != TIMERREGION || timer == NULL) {
5405  return OPERATOR_PASS_THROUGH;
5406  }
5407 
5408  RegionAlphaInfo *rgi = timer->customdata;
5409 
5410  /* always send redraws */
5412  if (rgi->child_region) {
5414  }
5415 
5416  /* end timer? */
5417  if (rgi->region->regiontimer->duration > (double)TIMEOUT) {
5418  region_blend_end(C, rgi->region, false);
5420  }
5421 
5423 }
5424 
5426 {
5427  /* identifiers */
5428  ot->name = "Region Alpha";
5429  ot->idname = "SCREEN_OT_region_blend";
5430  ot->description = "Blend in and out overlapping region";
5431 
5432  /* api callbacks */
5434 
5435  /* flags */
5436  ot->flag = OPTYPE_INTERNAL;
5437 
5438  /* properties */
5439 }
5440 
5443 /* -------------------------------------------------------------------- */
5448 {
5449  ScrArea *area = CTX_wm_area(C);
5450  return (area && !ELEM(area->spacetype, SPACE_TOPBAR, SPACE_STATUSBAR));
5451 }
5452 
5454 {
5455  const int space_type = RNA_enum_get(op->ptr, "space_type");
5456 
5457  PointerRNA ptr;
5458  ScrArea *area = CTX_wm_area(C);
5459  RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Area, area, &ptr);
5460  PropertyRNA *prop_type = RNA_struct_find_property(&ptr, "type");
5461  PropertyRNA *prop_ui_type = RNA_struct_find_property(&ptr, "ui_type");
5462 
5463  if (area->spacetype != space_type) {
5464  /* Set the type. */
5465  RNA_property_enum_set(&ptr, prop_type, space_type);
5466  RNA_property_update(C, &ptr, prop_type);
5467  }
5468  else {
5469  /* Types match, cycle the subtype. */
5470  const int space_type_ui = RNA_property_enum_get(&ptr, prop_ui_type);
5471  const EnumPropertyItem *item;
5472  int item_len;
5473  bool free;
5474  RNA_property_enum_items(C, &ptr, prop_ui_type, &item, &item_len, &free);
5475  int index = RNA_enum_from_value(item, space_type_ui);
5476  for (int i = 1; i < item_len; i++) {
5477  const EnumPropertyItem *item_test = &item[(index + i) % item_len];
5478  if ((item_test->value >> 16) == space_type) {
5479  RNA_property_enum_set(&ptr, prop_ui_type, item_test->value);
5480  RNA_property_update(C, &ptr, prop_ui_type);
5481  break;
5482  }
5483  }
5484  if (free) {
5485  MEM_freeN((void *)item);
5486  }
5487  }
5488 
5489  return OPERATOR_FINISHED;
5490 }
5491 
5493 {
5494  /* identifiers */
5495  ot->name = "Cycle Space Type Set";
5496  ot->description = "Set the space type or cycle subtype";
5497  ot->idname = "SCREEN_OT_space_type_set_or_cycle";
5498 
5499  /* api callbacks */
5502 
5503  ot->flag = 0;
5504 
5505  RNA_def_enum(ot->srna, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Type", "");
5506 }
5507 
5510 /* -------------------------------------------------------------------- */
5515  {SPACE_CONTEXT_CYCLE_PREV, "PREV", 0, "Previous", ""},
5516  {SPACE_CONTEXT_CYCLE_NEXT, "NEXT", 0, "Next", ""},
5517  {0, NULL, 0, NULL, NULL},
5518 };
5519 
5521 {
5522  ScrArea *area = CTX_wm_area(C);
5523  /* area might be NULL if called out of window bounds */
5524  return (area && ELEM(area->spacetype, SPACE_PROPERTIES, SPACE_USERPREF));
5525 }
5526 
5531 static void context_cycle_prop_get(bScreen *screen,
5532  const ScrArea *area,
5533  PointerRNA *r_ptr,
5534  PropertyRNA **r_prop)
5535 {
5536  const char *propname;
5537 
5538  switch (area->spacetype) {
5539  case SPACE_PROPERTIES:
5540  RNA_pointer_create(&screen->id, &RNA_SpaceProperties, area->spacedata.first, r_ptr);
5541  propname = "context";
5542  break;
5543  case SPACE_USERPREF:
5544  RNA_pointer_create(NULL, &RNA_Preferences, &U, r_ptr);
5545  propname = "active_section";
5546  break;
5547  default:
5548  BLI_assert(0);
5549  propname = "";
5550  }
5551 
5552  *r_prop = RNA_struct_find_property(r_ptr, propname);
5553 }
5554 
5556 {
5557  const eScreenCycle direction = RNA_enum_get(op->ptr, "direction");
5558 
5559  PointerRNA ptr;
5560  PropertyRNA *prop;
5562  const int old_context = RNA_property_enum_get(&ptr, prop);
5563  const int new_context = RNA_property_enum_step(
5564  C, &ptr, prop, old_context, direction == SPACE_CONTEXT_CYCLE_PREV ? -1 : 1);
5565  RNA_property_enum_set(&ptr, prop, new_context);
5566  RNA_property_update(C, &ptr, prop);
5567 
5568  return OPERATOR_FINISHED;
5569 }
5570 
5572 {
5573  /* identifiers */
5574  ot->name = "Cycle Space Context";
5575  ot->description = "Cycle through the editor context by activating the next/previous one";
5576  ot->idname = "SCREEN_OT_space_context_cycle";
5577 
5578  /* api callbacks */
5581 
5582  ot->flag = 0;
5583 
5584  RNA_def_enum(ot->srna,
5585  "direction",
5588  "Direction",
5589  "Direction to cycle through");
5590 }
5591 
5594 /* -------------------------------------------------------------------- */
5599 {
5600  wmWindow *win = CTX_wm_window(C);
5601  if (WM_window_is_temp_screen(win)) {
5602  return OPERATOR_CANCELLED;
5603  }
5604 
5605  Main *bmain = CTX_data_main(C);
5606  const eScreenCycle direction = RNA_enum_get(op->ptr, "direction");
5607  WorkSpace *workspace_src = WM_window_get_active_workspace(win);
5608  WorkSpace *workspace_dst = NULL;
5609 
5610  ListBase ordered;
5611  BKE_id_ordered_list(&ordered, &bmain->workspaces);
5612 
5613  LISTBASE_FOREACH (LinkData *, link, &ordered) {
5614  if (link->data == workspace_src) {
5615  if (direction == SPACE_CONTEXT_CYCLE_PREV) {
5616  workspace_dst = (link->prev) ? link->prev->data : NULL;
5617  }
5618  else {
5619  workspace_dst = (link->next) ? link->next->data : NULL;
5620  }
5621  }
5622  }
5623 
5624  if (workspace_dst == NULL) {
5625  LinkData *link = (direction == SPACE_CONTEXT_CYCLE_PREV) ? ordered.last : ordered.first;
5626  workspace_dst = link->data;
5627  }
5628 
5629  BLI_freelistN(&ordered);
5630 
5631  if (workspace_src == workspace_dst) {
5632  return OPERATOR_CANCELLED;
5633  }
5634 
5635  win->workspace_hook->temp_workspace_store = workspace_dst;
5638 
5639  return OPERATOR_FINISHED;
5640 }
5641 
5643 {
5644  /* identifiers */
5645  ot->name = "Cycle Workspace";
5646  ot->description = "Cycle through workspaces";
5647  ot->idname = "SCREEN_OT_workspace_cycle";
5648 
5649  /* api callbacks */
5652 
5653  ot->flag = 0;
5654 
5655  RNA_def_enum(ot->srna,
5656  "direction",
5659  "Direction",
5660  "Direction to cycle through");
5661 }
5662 
5665 /* -------------------------------------------------------------------- */
5670 {
5671  /* Generic UI stuff. */
5676 
5677  /* Screen tools. */
5704 
5705  /* Frame changes. */
5710 
5714 
5715  /* New/delete. */
5718 }
5719 
5722 /* -------------------------------------------------------------------- */
5726 static void keymap_modal_set(wmKeyConfig *keyconf)
5727 {
5728  static const EnumPropertyItem modal_items[] = {
5729  {KM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
5730  {KM_MODAL_APPLY, "APPLY", 0, "Apply", ""},
5731  {KM_MODAL_SNAP_ON, "SNAP", 0, "Snap On", ""},
5732  {KM_MODAL_SNAP_OFF, "SNAP_OFF", 0, "Snap Off", ""},
5733  {0, NULL, 0, NULL, NULL},
5734  };
5735 
5736  /* Standard Modal keymap ------------------------------------------------ */
5737  wmKeyMap *keymap = WM_modalkeymap_ensure(keyconf, "Standard Modal Map", modal_items);
5738 
5739  WM_modalkeymap_assign(keymap, "SCREEN_OT_area_move");
5740 }
5741 
5742 static bool blend_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
5743 {
5744  if (drag->type == WM_DRAG_PATH) {
5745  if (ELEM(drag->icon, ICON_FILE_BLEND, ICON_BLENDER)) {
5746  return true;
5747  }
5748  }
5749  return false;
5750 }
5751 
5753 {
5754  /* copy drag path to properties */
5755  RNA_string_set(drop->ptr, "filepath", drag->path);
5756 }
5757 
5759 {
5760  /* Screen Editing ------------------------------------------------ */
5761  WM_keymap_ensure(keyconf, "Screen Editing", 0, 0);
5762 
5763  /* Screen General ------------------------------------------------ */
5764  WM_keymap_ensure(keyconf, "Screen", 0, 0);
5765 
5766  /* Anim Playback ------------------------------------------------ */
5767  WM_keymap_ensure(keyconf, "Frames", 0, 0);
5768 
5769  /* dropbox for entire window */
5770  ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
5772  lb, "WM_OT_drop_blend_file", blend_file_drop_poll, blend_file_drop_copy, NULL, NULL);
5773  WM_dropbox_add(lb, "UI_OT_drop_color", UI_drop_color_poll, UI_drop_color_copy, NULL, NULL);
5774 
5775  keymap_modal_set(keyconf);
5776 }
5777 
typedef float(TangentPoint)[2]
struct WorkSpace * CTX_wm_workspace(const bContext *C)
Definition: context.c:728
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 SpaceNode * CTX_wm_space_node(const bContext *C)
Definition: context.c:878
struct Object * CTX_data_edit_object(const bContext *C)
Definition: context.c:1370
struct wmWindowManager * CTX_wm_manager(const bContext *C)
Definition: context.c:713
struct Mask * CTX_data_edit_mask(const bContext *C)
Definition: context.c:1390
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
Definition: context.c:473
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Definition: context.c:1528
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
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 ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
void CTX_wm_area_set(bContext *C, struct ScrArea *area)
Definition: context.c:997
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg)
Definition: context.c:1042
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:824
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
Definition: context.c:793
struct SpaceFile * CTX_wm_space_file(const bContext *C)
Definition: context.c:842
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
Definition: editmesh.c:58
struct FCurve * BKE_fcurve_find_by_rna_context_ui(struct bContext *C, const struct PointerRNA *ptr, struct PropertyRNA *prop, int rnaindex, struct AnimData **r_animdata, struct bAction **r_action, bool *r_driven, bool *r_special)
@ G_TRANSFORM_WM
Definition: BKE_global.h:251
void BKE_icon_changed(int icon_id)
Definition: icons.cc:637
bool BKE_id_is_editable(const struct Main *bmain, const struct ID *id)
void BKE_id_ordered_list(struct ListBase *ordered_lb, const struct ListBase *lb)
struct MaskLayer * BKE_mask_layer_active(struct Mask *mask)
Definition: mask.c:361
General operations, lookup, etc. for blender objects.
struct Object * BKE_object_pose_armature_get(struct Object *ob)
Definition: object.cc:2511
bool BKE_object_pose_context_check(const struct Object *ob)
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
struct Depsgraph * BKE_scene_get_depsgraph(const struct Scene *scene, const struct ViewLayer *view_layer)
struct ARegion * BKE_area_find_region_type(const struct ScrArea *area, int type)
struct ScrEdge * BKE_screen_find_edge(const struct bScreen *screen, struct ScrVert *v1, struct ScrVert *v2)
void BKE_screen_remove_double_scredges(struct bScreen *screen)
Definition: screen.c:777
void BKE_spacedata_freelist(ListBase *lb)
Definition: screen.c:411
struct ScrArea struct ScrArea * BKE_screen_find_area_xy(struct bScreen *screen, int spacetype, const int xy[2]) ATTR_NONNULL(1
void BKE_screen_remove_unused_scrverts(struct bScreen *screen)
Definition: screen.c:838
void BKE_screen_remove_unused_scredges(struct bScreen *screen)
Definition: screen.c:793
struct ARegion * BKE_area_region_copy(const struct SpaceType *st, const struct ARegion *region)
void BKE_screen_remove_double_scrverts(struct bScreen *screen)
Definition: screen.c:725
double BKE_sound_sync_scene(struct Scene *scene)
void BKE_sound_stop_scene(struct Scene *scene)
void BKE_sound_play_scene(struct Scene *scene)
struct WorkSpace * BKE_workspace_active_get(struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
Definition: workspace.c:516
struct WorkSpaceLayout * BKE_workspace_active_layout_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS
struct WorkSpaceLayout * BKE_workspace_layout_find(const struct WorkSpace *workspace, const struct bScreen *screen) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
#define BLI_assert(a)
Definition: BLI_assert.h:46
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:102
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
Definition: BLI_listbase.h:269
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
Definition: BLI_listbase.h:354
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
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int round_fl_to_int(float a)
MINLINE int min_ii(int a, int b)
MINLINE int square_i(int a)
MINLINE int max_ii(int a, int b)
void copy_qt_qt(float q[4], const float a[4])
Definition: math_rotation.c:33
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE int len_manhattan_v2v2_int(const int a[2], const int b[2]) ATTR_WARN_UNUSED_RESULT
bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2])
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition: BLI_rect.h:190
int BLI_rcti_length_x(const rcti *rect, int x)
Definition: rct.c:148
int BLI_rcti_length_y(const rcti *rect, int y)
Definition: rct.c:159
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition: rct.c:417
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition: BLI_rect.h:186
BLI_INLINE int BLI_rcti_cent_y(const struct rcti *rct)
Definition: BLI_rect.h:173
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
Definition: BLI_rect.h:194
BLI_INLINE int BLI_rcti_cent_x(const struct rcti *rct)
Definition: BLI_rect.h:169
#define ARRAY_SIZE(arr)
#define SWAP(type, a, b)
#define UNUSED(x)
#define ELEM(...)
#define IS_EQF(a, b)
#define IN_RANGE_INCL(a, b, c)
#define IFACE_(msgid)
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
void DEG_id_tag_update(struct ID *id, int flag)
struct Scene * DEG_get_evaluated_scene(const struct Depsgraph *graph)
@ ID_RECALC_FRAME_CHANGE
Definition: DNA_ID.h:841
#define ID_IS_LINKED(_id)
Definition: DNA_ID.h:566
#define ID_IS_OVERRIDE_LIBRARY(_id)
Definition: DNA_ID.h:588
@ ADS_FILTER_ONLYSEL
@ SACTCONT_TIMELINE
@ FCURVE_ACTIVE
@ FCURVE_SELECTED
@ CU_3D
@ ME_AUTOSMOOTH
#define OB_MODE_ALL_WEIGHT_PAINT
@ OB_MODE_EDIT
@ OB_MODE_OBJECT
Object is a sort of wrapper for general info.
@ OB_HIDE_VIEWPORT
@ OB_LATTICE
@ OB_MBALL
@ OB_SURF
@ OB_FONT
@ OB_ARMATURE
@ OB_MESH
@ OB_CURVES_LEGACY
@ OB_GPENCIL
#define PSFRA
#define SCE_KEYS_NO_SELONLY
#define AUDIO_SYNC
#define FPS
#define SCE_FRAME_DROP
#define PRVRANGEON
#define PEFRA
@ AREA_FLAG_ACTIONZONES_UPDATE
@ HEADER_NO_PULLDOWN
#define RGN_ALIGN_ENUM_FROM_MASK(align)
@ RGN_FLAG_DYNAMIC_SIZE
@ RGN_FLAG_HIDDEN
@ RGN_FLAG_TOO_SMALL
@ RGN_FLAG_HIDDEN_BY_USER
@ SCREENFULL
@ SCREENMAXIMIZED
@ SCREENNORMAL
#define AREAMAP_FROM_SCREEN(screen)
#define AREAMINX
eRegion_Type
@ RGN_TYPE_TOOL_HEADER
@ RGN_TYPE_EXECUTE
@ RGN_TYPE_UI
@ RGN_TYPE_WINDOW
@ RGN_TYPE_PREVIEW
@ RGN_TYPE_NAV_BAR
@ RGN_TYPE_FOOTER
@ RGN_TYPE_HEADER
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ RGN_SPLIT_PREV
@ RGN_ALIGN_NONE
@ RGN_ALIGN_QSPLIT
eScreen_Redraws_Flag
@ TIME_SEQ
@ TIME_ALL_IMAGE_WIN
@ TIME_ALL_BUTS_WIN
@ TIME_FOLLOW
@ TIME_REGION
@ TIME_ALL_3D_WIN
@ TIME_CLIPS
@ TIME_NODES
@ TIME_ALL_ANIM_WIN
#define AREAGRID
eSpace_Type
@ SPACE_CLIP
@ SPACE_ACTION
@ SPACE_CONSOLE
@ SPACE_OUTLINER
@ SPACE_STATUSBAR
@ SPACE_TOPBAR
@ SPACE_NODE
@ SPACE_SPREADSHEET
@ SPACE_USERPREF
@ SPACE_FILE
@ SPACE_PROPERTIES
@ SPACE_NLA
@ SPACE_SEQ
@ SPACE_EMPTY
@ SPACE_IMAGE
@ SPACE_GRAPH
@ SPACE_VIEW3D
@ SPACE_INFO
@ SIPO_MODE_DRIVERS
#define SPACE_TYPE_ANY
#define FRAMENUMBER_MIN_CLAMP(cfra)
@ V2D_KEEPTOT_STRICT
@ V2D_SCROLL_HORIZONTAL
@ V2D_SCROLL_VERTICAL
#define RV3D_GPULIGHT_UPDATE
#define RV3D_VIEW_CAMERA
@ RV3D_VIEW_AXIS_ROLL_0
#define RV3D_CAMOB
@ RV3D_LOCK_ROTATION
@ RV3D_BOXCLIP
#define RV3D_VIEWLOCK_INIT
#define RV3D_PERSP
#define RV3D_VIEW_USER
#define RV3D_ORTHO
@ OPERATOR_CANCELLED
@ OPERATOR_INTERFACE
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
@ ACHANNEL_SETFLAG_CLEAR
Definition: ED_anim_api.h:550
void ED_drivers_editor_init(struct bContext *C, struct ScrArea *area)
Definition: graph_utils.c:38
@ ANIMTYPE_FCURVE
Definition: ED_anim_api.h:199
@ ANIMCONT_DRIVERS
Definition: ED_anim_api.h:109
@ ANIMFILTER_DATA_VISIBLE
Definition: ED_anim_api.h:292
@ ANIMFILTER_NODUPLIS
Definition: ED_anim_api.h:325
bool ED_fileselect_is_asset_browser(const struct SpaceFile *sfile)
bool ED_fileselect_is_file_browser(const struct SpaceFile *sfile)
bool ED_space_image_show_uvedit(const struct SpaceImage *sima, struct Object *obedit)
struct Mesh * ED_mesh_context(struct bContext *C)
Definition: mesh_data.cc:1406
struct Object * ED_object_active_context(const struct bContext *C)
void ED_area_tag_redraw(ScrArea *area)
Definition: area.c:729
void ED_screen_global_areas_sync(struct wmWindow *win)
Definition: screen_edit.c:1053
void ED_region_visibility_change_update(struct bContext *C, struct ScrArea *area, struct ARegion *region)
Definition: area.c:2086
void ED_screen_full_prevspace(struct bContext *C, ScrArea *area)
Definition: screen_edit.c:1275
int ED_area_global_min_size_y(const ScrArea *area)
Definition: area.c:3438
#define ED_screen_verts_iter(win, screen, vert_name)
Definition: ED_screen.h:270
#define ED_screen_areas_iter(win, screen, area_name)
Definition: ED_screen.h:267
void ED_region_remove(struct bContext *C, struct ScrArea *area, struct ARegion *region)
Definition: screen_edit.c:677
void ED_area_tag_redraw_no_rebuild(ScrArea *area)
Definition: area.c:738
int ED_area_global_max_size_y(const ScrArea *area)
Definition: area.c:3443
void ED_region_toggle_hidden(struct bContext *C, struct ARegion *region)
Definition: area.c:2117
void ED_screen_animation_timer(struct bContext *C, int redraws, int sync, int enable)
Definition: screen_edit.c:1595
int ED_area_headersize(void)
Definition: area.c:3422
ScrArea * ED_area_find_under_cursor(const struct bContext *C, int spacetype, const int xy[2])
bool ED_area_is_global(const ScrArea *area)
Definition: area.c:3449
void ED_region_tag_redraw_no_rebuild(struct ARegion *region)
Definition: area.c:674
void ED_refresh_viewport_fps(struct bContext *C)
Definition: screen_edit.c:1570
struct WorkSpaceLayout * ED_workspace_layout_duplicate(struct Main *bmain, struct WorkSpace *workspace, const struct WorkSpaceLayout *layout_old, struct wmWindow *win) ATTR_NONNULL()
void ED_update_for_newframe(struct Main *bmain, struct Depsgraph *depsgraph)
Definition: screen_edit.c:1694
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:655
struct ScrArea * ED_screen_state_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *area, short state)
Definition: screen_edit.c:1415
void ED_area_init(struct wmWindowManager *wm, struct wmWindow *win, struct ScrArea *area)
Definition: area.c:1902
void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2)
Definition: area.c:2401
bool ED_workspace_layout_cycle(struct WorkSpace *workspace, short direction, struct bContext *C) ATTR_NONNULL()
eScreenCycle
Definition: ED_screen.h:704
@ SPACE_CONTEXT_CYCLE_NEXT
Definition: ED_screen.h:706
@ SPACE_CONTEXT_CYCLE_PREV
Definition: ED_screen.h:705
@ AZONE_REGION
@ AZONE_FULLSCREEN
@ AZONE_REGION_SCROLL
@ AZONE_AREA
@ AZ_SCROLL_HOR
@ AZ_SCROLL_VERT
@ ANIMPLAY_FLAG_JUMPED
@ ANIMPLAY_FLAG_NO_SYNC
@ ANIMPLAY_FLAG_REVERSE
@ ANIMPLAY_FLAG_SYNC
@ ANIMPLAY_FLAG_USE_NEXT_FRAME
AZEdge
@ AE_LEFT_TO_TOPRIGHT
@ AE_RIGHT_TO_TOPLEFT
@ AE_BOTTOM_TO_TOPLEFT
@ AE_TOP_TO_BOTTOMRIGHT
bool ED_space_sequencer_has_playback_animation(const struct SpaceSeq *sseq, const struct Scene *scene)
char ED_view3d_lock_view_from_index(int index)
void ED_view3d_lastview_store(struct RegionView3D *rv3d)
Definition: view3d_utils.c:440
bool ED_view3d_lock(struct RegionView3D *rv3d)
bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_region)
Definition: space_view3d.c:98
void ED_view3d_quadview_update(struct ScrArea *area, struct ARegion *region, bool do_clip)
Definition: view3d_utils.c:938
static AppView * view
bool GPU_mem_stats_supported(void)
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_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 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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble x2
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
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
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
@ PROP_HIDDEN
Definition: RNA_types.h:216
#define C
Definition: RandGen.cpp:25
#define UI_REGION_OVERLAP_MARGIN
Definition: UI_interface.h:101
#define UI_UNIT_Y
void uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void UI_drop_color_copy(struct bContext *C, struct wmDrag *drag, struct wmDropBox *drop)
void uiItemIntO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value)
#define UI_NAVIGATION_REGION_WIDTH
Definition: UI_interface.h:243
struct uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemS(uiLayout *layout)
#define UI_DPI_FAC
Definition: UI_interface.h:305
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
void uiItemFullO(uiLayout *layout, const char *opname, const char *name, int icon, struct IDProperty *properties, wmOperatorCallContext context, int flag, struct PointerRNA *r_opptr)
uiBut * UI_context_active_but_prop_get(const struct bContext *C, struct PointerRNA *r_ptr, struct PropertyRNA **r_prop, int *r_index)
void UI_popup_menu_end(struct bContext *C, struct uiPopupMenu *pup)
#define UI_UNIT_X
bool UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event)
void uiLayoutSetOperatorContext(uiLayout *layout, wmOperatorCallContext opcontext)
uiPopupMenu * UI_popup_menu_begin(struct bContext *C, const char *title, int icon) ATTR_NONNULL()
float UI_view2d_view_to_region_x(const struct View2D *v2d, float x)
float UI_view2d_view_to_region_y(const struct View2D *v2d, float y)
char UI_view2d_mouse_in_scrollers_ex(const struct ARegion *region, const struct View2D *v2d, const int xy[2], int *r_scroll) ATTR_NONNULL(1
void UI_view2d_curRect_validate(struct View2D *v2d)
Definition: view2d.cc:828
@ WIN_ALIGN_LOCATION_CENTER
Definition: WM_api.h:218
@ WIN_ALIGN_ABSOLUTE
Definition: WM_api.h:217
@ KM_NOTHING
Definition: WM_types.h:266
@ 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_GROUPED
Definition: WM_types.h:173
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define NC_WINDOW
Definition: WM_types.h:325
#define WM_DRAG_PATH
Definition: WM_types.h:1050
#define NC_SCREEN
Definition: WM_types.h:327
#define NC_SCENE
Definition: WM_types.h:328
#define NA_EDITED
Definition: WM_types.h:523
#define WM_EVENT_CURSOR_MOTION_THRESHOLD
Definition: WM_types.h:757
#define ND_FRAME
Definition: WM_types.h:382
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:201
@ WM_OP_EXEC_DEFAULT
Definition: WM_types.h:208
#define ND_WORKSPACE_SET
Definition: WM_types.h:376
#define ND_LAYOUTBROWSE
Definition: WM_types.h:370
#define ND_LAYOUTDELETE
Definition: WM_types.h:371
void ANIM_anim_channels_select_set(bAnimContext *ac, eAnimChannels_SetFlag sel)
void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datatype, eAnimFilter_Flags filter, void *channel_data, eAnim_ChannelType channel_type)
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
Definition: anim_filter.c:379
void region_toggle_hidden(bContext *C, ARegion *region, const bool do_fade)
Definition: area.c:2102
void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free)
Definition: area.c:2122
return(oflags[bm->toolflag_index].f &oflag) !=0
ATTR_WARN_UNUSED_RESULT const BMVert * v2
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
unsigned int U
Definition: btGjkEpa3.h:78
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
bool closest(btVector3 &v)
static float is_left(const float p0[2], const float p1[2], const float p2[2])
Definition: convexhull_2d.c:37
double time
Scene scene
const Depsgraph * depsgraph
SyclQueue void void size_t num_bytes void
uint col
DO_INLINE void filter(lfVector *V, fmatrix3x3 *S)
int count
const int state
AnimKeylist * ED_keylist_create()
void scene_to_keylist(bDopeSheet *ads, Scene *sce, AnimKeylist *keylist, const int saction_flag)
void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskLayer *masklay, AnimKeylist *keylist)
void gpencil_to_keylist(bDopeSheet *ads, bGPdata *gpd, AnimKeylist *keylist, const bool active)
void ob_to_keylist(bDopeSheet *ads, Object *ob, AnimKeylist *keylist, const int saction_flag)
void ED_keylist_prepare_for_direct_access(AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_next(const AnimKeylist *keylist, const float cfra)
void ED_keylist_free(AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_prev(const AnimKeylist *keylist, const float cfra)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
static int box_select_exec(bContext *C, wmOperator *op)
Definition: mask_select.c:426
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
static ulong * next
#define G(x, y, z)
bool isfinite(uchar)
Definition: scene/image.cpp:31
static void area(int d1, int d2, int e1, int e2, float weights[2])
bool active
all scheduled work for the GPU.
T abs(const T &a)
Object * ED_pose_object_from_context(bContext *C)
Definition: pose_edit.c:61
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
Definition: rna_access.c:4945
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
Definition: rna_access.c:4933
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
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:4874
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:5271
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:4921
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
Definition: rna_access.c:3421
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:717
int RNA_property_enum_step(const bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int step)
Definition: rna_access.c:3460
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:2138
int RNA_int_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4910
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4957
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:4968
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
Definition: rna_access.c:3402
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
Definition: rna_access.c:2790
void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
Definition: rna_access.c:2512
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
Definition: rna_access.c:1736
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
Definition: rna_access.c:1495
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
Definition: rna_access.c:5015
int RNA_enum_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:5004
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_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3623
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
const EnumPropertyItem rna_enum_region_type_items[]
Definition: rna_screen.c:21
const EnumPropertyItem rna_enum_space_type_items[]
Definition: rna_space.c:86
const EnumPropertyItem rna_enum_preference_section_items[]
Definition: rna_userdef.c:41
void screen_draw_split_preview(ScrArea *area, const eScreenAxis dir_axis, const float fac)
Definition: screen_draw.c:302
void screen_draw_join_highlight(ScrArea *sa1, ScrArea *sa2)
Definition: screen_draw.c:217
bool screen_area_close(struct bContext *C, bScreen *screen, ScrArea *area)
Definition: screen_edit.c:514
eScreenDir area_getorientation(ScrArea *sa_a, ScrArea *sa_b)
Definition: screen_edit.c:265
int screen_area_join(bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2)
Definition: screen_edit.c:509
ScrArea * area_split(const wmWindow *win, bScreen *screen, ScrArea *area, const eScreenAxis dir_axis, const float fac, const bool merge)
Definition: screen_edit.c:92
ScrEdge * screen_geom_area_map_find_active_scredge(const ScrAreaMap *area_map, const rcti *bounds_rect, const int mx, const int my)
void screen_geom_select_connected_edge(const wmWindow *win, ScrEdge *edge)
bool screen_geom_edge_is_horizontal(ScrEdge *se)
ScrEdge * screen_geom_find_active_scredge(const wmWindow *win, const bScreen *screen, const int mx, const int my)
int screen_geom_area_width(const ScrArea *area)
int screen_geom_area_height(const ScrArea *area)
void SCREEN_OT_screenshot_area(struct wmOperatorType *ot)
Definition: screendump.c:258
#define AZONESPOTW
Definition: screen_intern.h:39
eScreenAxis
Definition: screen_intern.h:32
@ SCREEN_AXIS_V
Definition: screen_intern.h:36
@ SCREEN_AXIS_H
Definition: screen_intern.h:34
#define AZONEFADEIN
Definition: screen_intern.h:41
#define SCREEN_DIR_IS_VERTICAL(dir)
Definition: screen_intern.h:29
eScreenDir
Definition: screen_intern.h:16
@ SCREEN_DIR_W
Definition: screen_intern.h:20
@ SCREEN_DIR_N
Definition: screen_intern.h:22
@ SCREEN_DIR_E
Definition: screen_intern.h:24
@ SCREEN_DIR_S
Definition: screen_intern.h:26
@ SCREEN_DIR_NONE
Definition: screen_intern.h:18
#define AZONEFADEOUT
Definition: screen_intern.h:42
void SCREEN_OT_screenshot(struct wmOperatorType *ot)
Definition: screendump.c:247
static int region_flip_exec(bContext *C, wmOperator *UNUSED(op))
Definition: screen_ops.c:4103
static void screen_animation_region_tag_redraw(bContext *C, ScrArea *area, ARegion *region, const Scene *scene, eScreen_Redraws_Flag redraws)
Definition: screen_ops.c:4501
bool ED_operator_spreadsheet_active(bContext *C)
Definition: screen_ops.c:292
static void SCREEN_OT_back_to_previous(struct wmOperatorType *ot)
Definition: screen_ops.c:5017
static void SCREEN_OT_area_options(wmOperatorType *ot)
Definition: screen_ops.c:3669
static int screen_delete_exec(bContext *C, wmOperator *UNUSED(op))
Definition: screen_ops.c:5269
bool ED_operator_editarmature(bContext *C)
Definition: screen_ops.c:466
static int frame_jump_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:2991
static void screen_area_menu_items(ScrArea *area, uiLayout *layout)
Definition: screen_ops.c:4195
static int area_split_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:2388
static bool ed_operator_posemode_exclusive_ex(bContext *C, Object *obact)
Definition: screen_ops.c:482
static void area_swap_cancel(bContext *C, wmOperator *op)
Definition: screen_ops.c:1286
static void actionzone_exit(wmOperator *op)
Definition: screen_ops.c:979
static void SCREEN_OT_region_context_menu(wmOperatorType *ot)
Definition: screen_ops.c:4380
static int area_move_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1936
static bool area_split_allowed(const ScrArea *area, const eScreenAxis dir_axis)
Definition: screen_ops.c:2058
static void keymap_modal_set(wmKeyConfig *keyconf)
Definition: screen_ops.c:5726
static void SCREEN_OT_region_scale(wmOperatorType *ot)
Definition: screen_ops.c:2884
#define KM_MODAL_APPLY
Definition: screen_ops.c:83
static void SCREEN_OT_userpref_show(struct wmOperatorType *ot)
Definition: screen_ops.c:5086
static int screen_maximize_area_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3262
bool ED_operator_uvmap(bContext *C)
Definition: screen_ops.c:571
static int area_swap_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1291
void ED_operatortypes_screen(void)
Definition: screen_ops.c:5669
bool ED_operator_graphedit_active(bContext *C)
Definition: screen_ops.c:329
bool ED_operator_action_active(bContext *C)
Definition: screen_ops.c:297
bool ED_operator_sequencer_active_editable(bContext *C)
Definition: screen_ops.c:339
bool ED_operator_animview_active(bContext *C)
Definition: screen_ops.c:240
static int area_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1911
bool ED_operator_node_editable(bContext *C)
Definition: screen_ops.c:318
bool ED_operator_screen_mainwinactive(bContext *C)
Definition: screen_ops.c:153
static int screen_animation_cancel_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:4882
static bool area_split_menu_init(bContext *C, wmOperator *op)
Definition: screen_ops.c:2088
static void ed_screens_statusbar_menu_create(uiLayout *layout, void *UNUSED(arg))
Definition: screen_ops.c:4332
static void area_move_set_limits(wmWindow *win, bScreen *screen, const eScreenAxis dir_axis, int *bigger, int *smaller, bool *use_bigger_smaller_snap)
Definition: screen_ops.c:1566
static void region_scale_validate_size(RegionMoveData *rmd)
Definition: screen_ops.c:2723
static int area_swap_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1304
static bool space_context_cycle_poll(bContext *C)
Definition: screen_ops.c:5520
static bool area_split_apply(bContext *C, wmOperator *op)
Definition: screen_ops.c:2159
bool ED_operator_console_active(bContext *C)
Definition: screen_ops.c:359
static void context_cycle_prop_get(bScreen *screen, const ScrArea *area, PointerRNA *r_ptr, PropertyRNA **r_prop)
Definition: screen_ops.c:5531
float ED_region_blend_alpha(ARegion *region)
Definition: screen_ops.c:5311
static void SCREEN_OT_animation_play(wmOperatorType *ot)
Definition: screen_ops.c:4855
static bool area_join_init(bContext *C, wmOperator *op, ScrArea *sa1, ScrArea *sa2)
Definition: screen_ops.c:3380
static void SCREEN_OT_workspace_cycle(wmOperatorType *ot)
Definition: screen_ops.c:5642
#define KM_MODAL_CANCEL
Definition: screen_ops.c:82
static void area_move_exit(bContext *C, wmOperator *op)
Definition: screen_ops.c:1887
bool ED_operator_info_active(bContext *C)
Definition: screen_ops.c:354
static void area_move_apply_do(const bContext *C, int delta, const int origval, const eScreenAxis dir_axis, const int bigger, const int smaller, const enum AreaMoveSnapType snap_type)
Definition: screen_ops.c:1802
static int screen_new_exec(bContext *C, wmOperator *UNUSED(op))
Definition: screen_ops.c:5237
void ED_keymap_screen(wmKeyConfig *keyconf)
Definition: screen_ops.c:5758
static int screen_animation_play_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:4843
static int area_snap_calc_location(const bScreen *screen, const enum AreaMoveSnapType snap_type, const int delta, const int origval, const eScreenAxis dir_axis, const int bigger, const int smaller)
Definition: screen_ops.c:1708
static AZone * area_actionzone_refresh_xy(ScrArea *area, const int xy[2], const bool test_only)
Definition: screen_ops.c:794
bool ED_operator_editable_mesh(bContext *C)
Definition: screen_ops.c:427
static int region_scale_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:2767
static int region_blend_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: screen_ops.c:5399
bool ED_operator_editmesh_auto_smooth(bContext *C)
Definition: screen_ops.c:457
static int area_join_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:3457
#define TIMEOUT
Definition: screen_ops.c:5308
static void SCREEN_OT_actionzone(wmOperatorType *ot)
Definition: screen_ops.c:1171
static int space_context_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: screen_ops.c:5555
static int area_join_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:3494
static void actionzone_apply(bContext *C, wmOperator *op, int type)
Definition: screen_ops.c:987
static void region_scale_cancel(bContext *UNUSED(C), wmOperator *op)
Definition: screen_ops.c:2879
bool ED_operator_scene(bContext *C)
Definition: screen_ops.c:168
AZone * ED_area_azones_update(ScrArea *area, const int xy[2])
Definition: screen_ops.c:974
bool ED_operator_object_active_local_editable(bContext *C)
Definition: screen_ops.c:407
static int region_toggle_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:4043
bool ED_operator_screenactive(bContext *C)
Definition: screen_ops.c:119
#define KM_MODAL_SNAP_ON
Definition: screen_ops.c:84
bool ED_operator_regionactive(bContext *C)
Definition: screen_ops.c:91
static bool actionzone_area_poll(bContext *C)
Definition: screen_ops.c:723
bool ED_operator_editsurfcurve_region_view3d(bContext *C)
Definition: screen_ops.c:596
int ED_screen_animation_play(bContext *C, int sync, int mode)
Definition: screen_ops.c:4811
void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
Definition: screen_ops.c:4258
static int marker_jump_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3166
static void area_split_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
Definition: screen_ops.c:2074
static void region_scale_toggle_hidden(bContext *C, RegionMoveData *rmd)
Definition: screen_ops.c:2743
static bool match_region_with_redraws(const ScrArea *area, eRegion_Type regiontype, eScreen_Redraws_Flag redraws, bool from_anim_edit)
Definition: screen_ops.c:4407
static void SCREEN_OT_keyframe_jump(wmOperatorType *ot)
Definition: screen_ops.c:3143
static bool space_type_set_or_cycle_poll(bContext *C)
Definition: screen_ops.c:5447
static int drivers_editor_show_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:5114
struct RegionAlphaInfo RegionAlphaInfo
static ScrEdge * area_findsharededge(bScreen *screen, ScrArea *area, ScrArea *sb)
Definition: screen_ops.c:2131
static bool ed_spacetype_test(bContext *C, int type)
Definition: screen_ops.c:216
bool ED_operator_object_active(bContext *C)
Definition: screen_ops.c:370
bool ED_operator_editsurfcurve(bContext *C)
Definition: screen_ops.c:587
static void SCREEN_OT_frame_jump(wmOperatorType *ot)
Definition: screen_ops.c:3030
static void SCREEN_OT_area_close(wmOperatorType *ot)
Definition: screen_ops.c:1504
static void SCREEN_OT_redo_last(wmOperatorType *ot)
Definition: screen_ops.c:3858
static int space_type_set_or_cycle_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:5453
static bool area_swap_init(wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1264
static void area_move_apply(bContext *C, wmOperator *op)
Definition: screen_ops.c:1879
#define TIMESTEP
Definition: screen_ops.c:5309
bool ED_operator_editcurve_3d(bContext *C)
Definition: screen_ops.c:615
bool ED_operator_objectmode(bContext *C)
Definition: screen_ops.c:186
static int redo_last_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
Definition: screen_ops.c:3847
static int header_toggle_menus_exec(bContext *C, wmOperator *UNUSED(op))
Definition: screen_ops.c:4164
static bool area_split_init(bContext *C, wmOperator *op)
Definition: screen_ops.c:2100
static void SCREEN_OT_drivers_editor_show(struct wmOperatorType *ot)
Definition: screen_ops.c:5174
bool ED_operator_sequencer_active(bContext *C)
Definition: screen_ops.c:334
static bool blend_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event))
Definition: screen_ops.c:5742
static void SCREEN_OT_animation_step(wmOperatorType *ot)
Definition: screen_ops.c:4764
static void SCREEN_OT_header_toggle_menus(wmOperatorType *ot)
Definition: screen_ops.c:4176
static int area_join_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3444
bool ED_operator_scene_editable(bContext *C)
Definition: screen_ops.c:177
bool ED_operator_asset_browsing_active(bContext *C)
Definition: screen_ops.c:284
static int actionzone_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1013
static void SCREEN_OT_delete(wmOperatorType *ot)
Definition: screen_ops.c:5280
bool ED_operator_image_active(bContext *C)
Definition: screen_ops.c:344
static void SCREEN_OT_space_type_set_or_cycle(wmOperatorType *ot)
Definition: screen_ops.c:5492
bool ED_operator_view3d_active(bContext *C)
Definition: screen_ops.c:225
static ScrArea * screen_actionzone_area(bScreen *screen, const AZone *az)
Definition: screen_ops.c:957
static const EnumPropertyItem prop_direction_items[]
Definition: screen_ops.c:2544
static int info_log_show_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:5192
static ScrEdge * screen_area_edge_from_cursor(const bContext *C, const int cursor[2], ScrArea **r_sa1, ScrArea **r_sa2)
Definition: screen_ops.c:1195
static AZone * screen_actionzone_find_xy(bScreen *screen, const int xy[2])
Definition: screen_ops.c:945
static int spacedata_cleanup_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3691
bool ED_operator_node_active(bContext *C)
Definition: screen_ops.c:307
struct sAreaSplitData sAreaSplitData
void ED_screens_footer_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
Definition: screen_ops.c:4297
static void SCREEN_OT_screen_full_area(wmOperatorType *ot)
Definition: screen_ops.c:3311
static bool azone_clipped_rect_calc(const AZone *az, rcti *r_rect_clip)
Definition: screen_ops.c:750
static bool repeat_history_poll(bContext *C)
Definition: screen_ops.c:3731
bool ED_operator_posemode_local(bContext *C)
Definition: screen_ops.c:546
static void SCREEN_OT_frame_offset(wmOperatorType *ot)
Definition: screen_ops.c:2968
static void view3d_localview_update_rv3d(struct RegionView3D *rv3d)
Definition: screen_ops.c:3876
static int repeat_history_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3810
static int area_max_regionsize(ScrArea *area, ARegion *scalear, AZEdge edge)
Definition: screen_ops.c:2590
bool ED_operator_nla_active(bContext *C)
Definition: screen_ops.c:349
bool ED_operator_object_active_local_editable_ex(bContext *C, const Object *ob)
Definition: screen_ops.c:402
bool ED_operator_screenactive_nobackground(bContext *C)
Definition: screen_ops.c:130
bool ED_operator_uvedit_space_image(bContext *C)
Definition: screen_ops.c:564
static void region_scale_exit(wmOperator *op)
Definition: screen_ops.c:2655
static void SCREEN_OT_space_context_cycle(wmOperatorType *ot)
Definition: screen_ops.c:5571
bool ED_operator_region_view3d_active(bContext *C)
Definition: screen_ops.c:230
bool ED_operator_object_active_editable(bContext *C)
Definition: screen_ops.c:396
bool ED_operator_posemode_exclusive(bContext *C)
Definition: screen_ops.c:494
struct sAreaMoveData sAreaMoveData
static bool region_toggle_poll(bContext *C)
Definition: screen_ops.c:4063
static int screen_context_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
Definition: screen_ops.c:4345
static int region_quadview_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3908
bool ED_operator_editcurve(bContext *C)
Definition: screen_ops.c:606
static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: screen_ops.c:3780
struct sActionzoneData sActionzoneData
static void area_split_exit(bContext *C, wmOperator *op)
Definition: screen_ops.c:2206
static bool area_close_poll(bContext *C)
Definition: screen_ops.c:1480
static void SCREEN_OT_area_swap(wmOperatorType *ot)
Definition: screen_ops.c:1354
static int frame_offset_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:2949
static void area_swap_exit(bContext *C, wmOperator *op)
Definition: screen_ops.c:1280
bScreen * ED_screen_animation_playing(const wmWindowManager *wm)
Definition: screen_ops.c:4785
bool ED_operator_areaactive(bContext *C)
Definition: screen_ops.c:105
bool ED_operator_editmesh_region_view3d(bContext *C)
Definition: screen_ops.c:447
bool ED_operator_file_browsing_active(bContext *C)
Definition: screen_ops.c:276
static void SCREEN_OT_area_split(wmOperatorType *ot)
Definition: screen_ops.c:2550
void ED_region_visibility_change_update_animated(bContext *C, ScrArea *area, ARegion *region)
Definition: screen_ops.c:5362
bool ED_operator_object_active_editable_mesh(bContext *C)
Definition: screen_ops.c:413
static void blend_file_drop_copy(bContext *UNUSED(C), wmDrag *drag, wmDropBox *drop)
Definition: screen_ops.c:5752
static void SCREEN_OT_spacedata_cleanup(wmOperatorType *ot)
Definition: screen_ops.c:3713
static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1382
bool ED_operator_posemode_context(bContext *C)
Definition: screen_ops.c:517
static void SCREEN_OT_repeat_history(wmOperatorType *ot)
Definition: screen_ops.c:3826
bool ED_operator_posemode(bContext *C)
Definition: screen_ops.c:530
static int repeat_last_exec(bContext *C, wmOperator *UNUSED(op))
Definition: screen_ops.c:3740
bool ED_operator_editmball(bContext *C)
Definition: screen_ops.c:653
static int area_move_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:1898
static void SCREEN_OT_new(wmOperatorType *ot)
Definition: screen_ops.c:5251
static void SCREEN_OT_animation_cancel(wmOperatorType *ot)
Definition: screen_ops.c:4906
static int userpref_show_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:5035
static void fullscreen_click_rcti_init(rcti *rect, const short UNUSED(x1), const short UNUSED(y1), const short x2, const short y2)
Definition: screen_ops.c:744
bool ED_operator_camera_poll(bContext *C)
Definition: screen_ops.c:662
static void SCREEN_OT_area_dupli(wmOperatorType *ot)
Definition: screen_ops.c:1427
#define KM_MODAL_SNAP_OFF
Definition: screen_ops.c:85
bool ED_operator_file_active(bContext *C)
Definition: screen_ops.c:271
static void area_split_preview_update_cursor(bContext *C, wmOperator *op)
Definition: screen_ops.c:2235
static bool screen_animation_region_supports_time_follow(eSpace_Type spacetype, eRegion_Type regiontype)
Definition: screen_ops.c:4399
struct sAreaSwapData sAreaSwapData
static void SCREEN_OT_region_quadview(wmOperatorType *ot)
Definition: screen_ops.c:4024
static void SCREEN_OT_screen_set(wmOperatorType *ot)
Definition: screen_ops.c:3242
static void actionzone_cancel(bContext *UNUSED(C), wmOperator *op)
Definition: screen_ops.c:1166
bool ED_operator_editmesh_view3d(bContext *C)
Definition: screen_ops.c:442
static void area_split_cancel(bContext *C, wmOperator *op)
Definition: screen_ops.c:2400
static bool screen_active_editable(bContext *C)
Definition: screen_ops.c:674
bool ED_operator_object_active_local_editable_posemode_exclusive(bContext *C)
Definition: screen_ops.c:501
static bool ED_operator_screenactive_norender(bContext *C)
Definition: screen_ops.c:139
static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:2249
static int region_scale_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:2663
bool ED_operator_editsurf(bContext *C)
Definition: screen_ops.c:626
static void SCREEN_OT_repeat_last(wmOperatorType *ot)
Definition: screen_ops.c:3761
static bool area_join_apply(bContext *C, wmOperator *op)
Definition: screen_ops.c:3406
struct sAreaJoinData sAreaJoinData
static int actionzone_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:1047
bScreen * ED_screen_animation_no_scrub(const wmWindowManager *wm)
Definition: screen_ops.c:4798
static void region_blend_end(bContext *C, ARegion *region, const bool is_running)
Definition: screen_ops.c:5335
static int space_workspace_cycle_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
Definition: screen_ops.c:5598
void ED_screens_navigation_bar_tools_menu_create(bContext *C, uiLayout *layout, void *UNUSED(arg))
Definition: screen_ops.c:4319
static void areas_do_frame_follow(bContext *C, bool middle)
Definition: screen_ops.c:2907
struct RegionMoveData RegionMoveData
bool ED_operator_object_active_editable_ex(bContext *C, const Object *ob)
Definition: screen_ops.c:376
static void SCREEN_OT_area_move(wmOperatorType *ot)
Definition: screen_ops.c:1981
static void SCREEN_OT_marker_jump(wmOperatorType *ot)
Definition: screen_ops.c:3207
bool ED_operator_editlattice(bContext *C)
Definition: screen_ops.c:644
static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:3597
static int fullscreen_back_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:4995
bool ED_operator_outliner_active_no_editobject(bContext *C)
Definition: screen_ops.c:258
static bool region_flip_poll(bContext *C)
Definition: screen_ops.c:4131
bool ED_operator_editmesh(bContext *C)
Definition: screen_ops.c:433
static bool ed_object_hidden(const Object *ob)
Definition: screen_ops.c:364
static const EnumPropertyItem space_context_cycle_direction[]
Definition: screen_ops.c:5514
bool ED_operator_uvedit(bContext *C)
Definition: screen_ops.c:557
static void area_join_cancel(bContext *C, wmOperator *op)
Definition: screen_ops.c:3486
bool ED_operator_outliner_active(bContext *C)
Definition: screen_ops.c:253
bool ED_operator_object_active_editable_font(bContext *C)
Definition: screen_ops.c:420
static void region_quadview_init_rv3d(ScrArea *area, ARegion *region, const char viewlock, const char view, const char persp)
Definition: screen_ops.c:3885
static void SCREEN_OT_region_flip(wmOperatorType *ot)
Definition: screen_ops.c:4144
static void area_join_exit(bContext *C, wmOperator *op)
Definition: screen_ops.c:3425
static int screen_animation_step_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: screen_ops.c:4561
static void area_join_draw_cb(const struct wmWindow *UNUSED(win), void *userdata)
Definition: screen_ops.c:3368
static bool area_move_init(bContext *C, wmOperator *op)
Definition: screen_ops.c:1666
static void area_move_cancel(bContext *C, wmOperator *op)
Definition: screen_ops.c:1927
bool ED_operator_objectmode_poll_msg(bContext *C)
Definition: screen_ops.c:206
static int area_close_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:1452
static bool screen_maximize_area_poll(bContext *C)
Definition: screen_ops.c:3299
static void SCREEN_OT_region_blend(wmOperatorType *ot)
Definition: screen_ops.c:5425
static int area_swap_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:1341
AZone * ED_area_actionzone_find_xy(ScrArea *area, const int xy[2])
Definition: screen_ops.c:969
bool ED_operator_buttons_active(bContext *C)
Definition: screen_ops.c:302
static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: screen_ops.c:2419
static void SCREEN_OT_info_log_show(struct wmOperatorType *ot)
Definition: screen_ops.c:5219
static int keyframe_jump_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3053
static int screen_set_exec(bContext *C, wmOperator *op)
Definition: screen_ops.c:3230
static void SCREEN_OT_region_toggle(wmOperatorType *ot)
Definition: screen_ops.c:4076
static void SCREEN_OT_area_join(wmOperatorType *ot)
Definition: screen_ops.c:3569
bool ED_operator_editfont(bContext *C)
Definition: screen_ops.c:635
static bool is_split_edge(const int alignment, const AZEdge edge)
Definition: screen_ops.c:2647
int(* snap_size)(const struct ARegion *region, int size, int axis)
Definition: BKE_screen.h:163
struct wmTimer * regiontimer
void * regiondata
struct ARegion * prev
struct ARegion * next
ListBase handlers
short alignment
short regiontype
struct ARegionType * type
rcti rect
short y2
float alpha
struct AZone * next
AZEdge edge
ARegion * region
short x1
short x2
AZScrollDirection direction
short y1
struct ActKeyColumn * next
struct ActKeyColumn * prev
struct BMesh * bm
Definition: BKE_editmesh.h:40
int totface
Definition: bmesh_class.h:297
EditNurb * editnurb
short flag
Definition: DNA_ID.h:368
int recalc
Definition: DNA_ID.h:390
int icon_id
Definition: DNA_ID.h:389
void * data
Definition: DNA_listBase.h:26
void * last
Definition: DNA_listBase.h:31
void * first
Definition: DNA_listBase.h:31
Definition: BKE_main.h:121
ListBase screens
Definition: BKE_main.h:183
ListBase workspaces
Definition: BKE_main.h:203
short visibility_flag
void * data
void * data
Definition: RNA_types.h:38
ARegion * child_region
Definition: screen_ops.c:5304
ARegion * region
Definition: screen_ops.c:5304
ScrArea * area
Definition: screen_ops.c:5303
ScrArea * area
Definition: screen_ops.c:2582
ARegion * region
Definition: screen_ops.c:2581
float viewquat[4]
struct RegionView3D * localvd
short flag
struct RenderData r
ListBase markers
struct AudioData audio
ListBase areabase
ScrVert * v2
ScrVert * v3
ScrVert * v1
ScrVert * v4
ScrVert * v1
ScrVert * v2
short editflag
ARegion * region
double lagging_frame_count
struct bNodeTree * edittree
char alpha_vert
short keeptot
char alpha_hor
struct Object * camera
Wrapper for bScreen.
short datatype
Definition: ED_anim_api.h:62
void * data
Definition: ED_anim_api.h:60
char do_refresh
short redraws_flag
ListBase vertbase
struct wmTimer * animtimer
char scrubbing
ListBase areabase
struct ARegion * active_region
float xmax
Definition: DNA_vec_types.h:69
float xmin
Definition: DNA_vec_types.h:69
float ymax
Definition: DNA_vec_types.h:70
float ymin
Definition: DNA_vec_types.h:70
int ymin
Definition: DNA_vec_types.h:64
int ymax
Definition: DNA_vec_types.h:64
int xmin
Definition: DNA_vec_types.h:63
int xmax
Definition: DNA_vec_types.h:63
ScrArea * sa1
Definition: screen_ops.c:715
ScrArea * sa2
Definition: screen_ops.c:715
eScreenDir gesture_dir
Definition: screen_ops.c:718
ScrArea * sa1
Definition: screen_ops.c:3361
eScreenDir dir
Definition: screen_ops.c:3363
void * draw_callback
Definition: screen_ops.c:3364
ScrArea * sa2
Definition: screen_ops.c:3362
eScreenAxis dir_axis
Definition: screen_ops.c:1549
enum sAreaMoveData::AreaMoveSnapType snap_type
@ SNAP_FRACTION_AND_ADJACENT
Definition: screen_ops.c:1556
@ SNAP_BIGGER_SMALLER_ONLY
Definition: screen_ops.c:1560
ScrEdge * nedge
Definition: screen_ops.c:2052
ScrArea * narea
Definition: screen_ops.c:2054
void * draw_callback
Definition: screen_ops.c:2049
ScrArea * sarea
Definition: screen_ops.c:2053
ScrArea * sa1
Definition: screen_ops.c:1261
ScrArea * sa2
Definition: screen_ops.c:1261
short y
Definition: DNA_vec_types.h:18
short x
Definition: DNA_vec_types.h:18
char path[1024]
Definition: WM_types.h:1150
int icon
Definition: WM_types.h:1146
int type
Definition: WM_types.h:1148
struct PointerRNA * ptr
Definition: WM_types.h:1237
short val
Definition: WM_types.h:680
int xy[2]
Definition: WM_types.h:682
short type
Definition: WM_types.h:678
void * customdata
Definition: WM_types.h:715
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
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 * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
const char * undo_group
Definition: WM_types.h:895
struct ReportList * reports
struct wmOperator * prev
struct wmOperatorType * type
struct PointerRNA * ptr
double timestep
Definition: WM_types.h:863
void * customdata
Definition: WM_types.h:869
double delta
Definition: WM_types.h:874
double duration
Definition: WM_types.h:872
struct wmEvent * eventstate
ScrAreaMap global_areas
struct WorkSpaceInstanceHook * workspace_hook
void WM_operator_free_all_after(wmWindowManager *wm, struct wmOperator *op)
Definition: wm.c:325
void WM_cursor_modal_set(wmWindow *win, int val)
Definition: wm_cursors.c:191
void WM_cursor_set(wmWindow *win, int curs)
Definition: wm_cursors.c:126
void WM_cursor_modal_restore(wmWindow *win)
Definition: wm_cursors.c:200
@ WM_CURSOR_CROSS
Definition: wm_cursors.h:26
@ WM_CURSOR_H_SPLIT
Definition: wm_cursors.h:40
@ WM_CURSOR_S_ARROW
Definition: wm_cursors.h:47
@ WM_CURSOR_E_ARROW
Definition: wm_cursors.h:48
@ WM_CURSOR_EDIT
Definition: wm_cursors.h:22
@ WM_CURSOR_N_ARROW
Definition: wm_cursors.h:46
@ WM_CURSOR_STOP
Definition: wm_cursors.h:21
@ WM_CURSOR_V_SPLIT
Definition: wm_cursors.h:41
@ WM_CURSOR_SWAP_AREA
Definition: wm_cursors.h:37
@ WM_CURSOR_W_ARROW
Definition: wm_cursors.h:49
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
Definition: wm_dragdrop.cc:76
wmDropBox * WM_dropbox_add(ListBase *lb, const char *idname, bool(*poll)(bContext *, wmDrag *, const wmEvent *), void(*copy)(bContext *, wmDrag *, wmDropBox *), void(*cancel)(Main *, wmDrag *, wmDropBox *), WMDropboxTooltipFunc tooltip)
Definition: wm_dragdrop.cc:95
int xy[2]
Definition: wm_draw.c:135
void WM_draw_cb_exit(wmWindow *win, void *handle)
Definition: wm_draw.c:574
void * WM_draw_cb_activate(wmWindow *win, void(*draw)(const struct wmWindow *, void *), void *customdata)
Definition: wm_draw.c:561
int WM_operator_repeat_last(bContext *C, wmOperator *op)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
wmEvent * wm_event_add(wmWindow *win, const wmEvent *event_to_add)
int WM_operator_repeat(bContext *C, wmOperator *op)
bool WM_operator_repeat_check(const bContext *UNUSED(C), wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void wm_event_init_from_window(wmWindow *win, wmEvent *event)
void WM_event_remove_handlers(bContext *C, ListBase *handlers)
void WM_event_add_mousemove(wmWindow *win)
@ RIGHTMOUSE
@ EVT_MODAL_MAP
@ EVT_RIGHTCTRLKEY
@ EVT_ACTIONZONE_FULLSCREEN
@ EVT_ACTIONZONE_REGION
@ EVT_TABKEY
@ EVT_LEFTCTRLKEY
@ EVT_ACTIONZONE_AREA
@ MOUSEMOVE
@ LEFTMOUSE
@ MIDDLEMOUSE
@ EVT_ESCKEY
@ TIMERREGION
PointerRNA * ptr
Definition: wm_files.c:3480
wmOperatorType * ot
Definition: wm_files.c:3479
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
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_operator_properties_border(wmOperatorType *ot)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
const char * WM_operatortype_name(struct wmOperatorType *ot, struct PointerRNA *properties)
int WM_operator_redo_popup(bContext *C, wmOperator *op)
bool WM_operator_winactive(bContext *C)
wmOperator * WM_operator_last_redo(const bContext *C)
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
Definition: wm_window.c:1682
bScreen * WM_window_get_active_screen(const wmWindow *win)
Definition: wm_window.c:2300
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Definition: wm_window.c:2217
WorkSpace * WM_window_get_active_workspace(const wmWindow *win)
Definition: wm_window.c:2266
bool WM_window_is_temp_screen(const wmWindow *win)
Definition: wm_window.c:2311
void WM_window_rect_calc(const wmWindow *win, rcti *r_rect)
Definition: wm_window.c:2089
void WM_window_screen_rect_calc(const wmWindow *win, rcti *r_rect)
Definition: wm_window.c:2093
wmWindow * WM_window_open(bContext *C, const char *title, int x, int y, int sizex, int sizey, int space_type, bool toplevel, bool dialog, bool temp, eWindowAlignment alignment)
Definition: wm_window.c:721
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)
Definition: wm_window.c:1630