Blender V5.0
space_image.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2008 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "DNA_defaults.h"
11#include "DNA_image_types.h"
12#include "DNA_mask_types.h"
13#include "DNA_object_types.h"
14#include "DNA_scene_types.h"
15
16#include "MEM_guardedalloc.h"
17
18#include "BLI_listbase.h"
19#include "BLI_string_utf8.h"
20#include "BLI_threads.h"
21
22#include "BKE_colortools.hh"
23#include "BKE_context.hh"
24#include "BKE_image.hh"
25#include "BKE_layer.hh"
26#include "BKE_lib_query.hh"
27#include "BKE_lib_remap.hh"
28#include "BKE_scene.hh"
29#include "BKE_screen.hh"
30
31#include "RNA_access.hh"
32#include "RNA_define.hh"
33#include "RNA_enum_types.hh"
34
35#include "IMB_imbuf_types.hh"
36
37#include "ED_asset_shelf.hh"
38#include "ED_image.hh"
39#include "ED_mask.hh"
40#include "ED_node.hh"
41#include "ED_render.hh"
42#include "ED_screen.hh"
43#include "ED_space_api.hh"
44#include "ED_transform.hh"
45#include "ED_util.hh"
46#include "ED_uvedit.hh"
47
48#include "WM_api.hh"
49#include "WM_types.hh"
50
51#include "UI_interface.hh"
52#include "UI_view2d.hh"
53
54#include "BLO_read_write.hh"
55
56#include "DRW_engine.hh"
57
58#include "image_intern.hh"
59
60/**************************** common state *****************************/
61
63{
64 SpaceImage *sima = (SpaceImage *)area->spacedata.first;
65
66 /* only while histogram is visible */
67 LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
68 if (region->regiontype == RGN_TYPE_TOOL_PROPS && region->flag & RGN_FLAG_HIDDEN) {
69 return;
70 }
71 }
72
73 sima->scopes.ok = 0;
74}
75
77{
78 /* Update scene image user for acquiring render results. */
79 Scene *sequencer_scene = CTX_data_sequencer_scene(C);
80 sima->iuser.scene = (sima->iuser.flag & IMA_SHOW_SEQUENCER_SCENE) && sequencer_scene ?
81 sequencer_scene :
83
84 if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
85 /* While rendering, prefer scene that is being rendered. */
87 if (render_scene) {
88 sima->iuser.scene = render_scene;
91 }
92 }
93
94 /* Auto switch image to show in UV editor when selection changes. */
96}
97
98/* ******************** default callbacks for image space ***************** */
99
100static SpaceLink *image_create(const ScrArea * /*area*/, const Scene * /*scene*/)
101{
102 ARegion *region;
103 SpaceImage *simage;
104
105 simage = MEM_callocN<SpaceImage>("initimage");
106 simage->spacetype = SPACE_IMAGE;
107 simage->zoom = 1.0f;
108 simage->lock = true;
110 simage->uv_opacity = 1.0f;
111 simage->uv_face_opacity = 1.0f;
112 simage->stretch_opacity = 1.0f;
114 simage->overlay.passepartout_alpha = 0.5f;
115
118
119 BKE_scopes_new(&simage->scopes);
120 simage->sample_line_hist.height = 100;
121
122 simage->tile_grid_shape[0] = 1;
123 simage->tile_grid_shape[1] = 1;
124
125 simage->custom_grid_subdiv[0] = 10;
126 simage->custom_grid_subdiv[1] = 10;
127
129
130 /* header */
131 region = BKE_area_region_new();
132
133 BLI_addtail(&simage->regionbase, region);
134 region->regiontype = RGN_TYPE_HEADER;
136
137 /* asset shelf */
138 region = BKE_area_region_new();
139 BLI_addtail(&simage->regionbase, region);
141 region->alignment = RGN_ALIGN_BOTTOM;
142 region->flag |= RGN_FLAG_HIDDEN;
143
144 /* asset shelf header */
145 region = BKE_area_region_new();
146 BLI_addtail(&simage->regionbase, region);
149
150 /* tool header */
151 region = BKE_area_region_new();
152
153 BLI_addtail(&simage->regionbase, region);
157
158 /* buttons/list view */
159 region = BKE_area_region_new();
160
161 BLI_addtail(&simage->regionbase, region);
162 region->regiontype = RGN_TYPE_UI;
163 region->alignment = RGN_ALIGN_RIGHT;
164 region->flag = RGN_FLAG_HIDDEN;
165
166 /* scopes/uv sculpt/paint */
167 region = BKE_area_region_new();
168
169 BLI_addtail(&simage->regionbase, region);
170 region->regiontype = RGN_TYPE_TOOLS;
171 region->alignment = RGN_ALIGN_LEFT;
172 region->flag = RGN_FLAG_HIDDEN;
173
174 /* main area */
175 region = BKE_area_region_new();
176
177 BLI_addtail(&simage->regionbase, region);
178 region->regiontype = RGN_TYPE_WINDOW;
179
180 return (SpaceLink *)simage;
181}
182
183/* Doesn't free the space-link itself. */
184static void image_free(SpaceLink *sl)
185{
186 SpaceImage *simage = (SpaceImage *)sl;
187
188 BKE_scopes_free(&simage->scopes);
189}
190
191/* spacetype; init callback, add handlers */
192static void image_init(wmWindowManager * /*wm*/, ScrArea *area)
193{
195
196 /* add drop boxes */
198}
199
201{
202 SpaceImage *simagen = static_cast<SpaceImage *>(MEM_dupallocN(sl));
203
204 /* clear or remove stuff from old */
205
206 BKE_scopes_new(&simagen->scopes);
207
208 return (SpaceLink *)simagen;
209}
210
212{
223#ifdef WITH_INPUT_NDOF
224 WM_operatortype_append(IMAGE_OT_view_ndof);
225#endif
226
241
246
251
255
257
261
265}
266
267static void image_keymap(wmKeyConfig *keyconf)
268{
269 WM_keymap_ensure(keyconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
270 WM_keymap_ensure(keyconf, "Image", SPACE_IMAGE, RGN_TYPE_WINDOW);
271}
272
273/* area+region dropbox definition */
274static void image_dropboxes() {}
275
280static void image_refresh(const bContext *C, ScrArea *area)
281{
282 Scene *scene = CTX_data_scene(C);
283 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
284 Image *ima;
285
286 ima = ED_space_image(sima);
287 BKE_image_user_frame_calc(ima, &sima->iuser, scene->r.cfra);
288
289 /* Check if we have to set the image from the edit-mesh. */
290 if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) {
291 if (scene->compositing_node_group) {
293 if (mask) {
295 }
296 }
297 }
298}
299
301{
302 wmWindow *win = params->window;
303 ScrArea *area = params->area;
304 const wmNotifier *wmn = params->notifier;
305 SpaceImage *sima = (SpaceImage *)area->spacedata.first;
306
307 /* context changes */
308 switch (wmn->category) {
309 case NC_WINDOW:
310 /* notifier comes from editing color space */
312 ED_area_tag_redraw(area);
313 break;
314 case NC_SCENE:
315 switch (wmn->data) {
316 case ND_FRAME:
319 ED_area_tag_redraw(area);
320 break;
321 case ND_OB_ACTIVE:
322 case ND_OB_SELECT:
323 ED_area_tag_redraw(area);
324 break;
325 case ND_MODE:
326 ED_paint_cursor_start(&params->scene->toolsettings->imapaint.paint,
328
329 if (wmn->subtype == NS_EDITMODE_MESH) {
331 }
332 ED_area_tag_redraw(area);
333 break;
334 case ND_RENDER_RESULT:
336 case ND_COMPO_RESULT:
337 if (ED_space_image_show_render(sima)) {
340 }
341 ED_area_tag_redraw(area);
342 break;
343 }
344 break;
345 case NC_IMAGE:
346 if (wmn->reference == sima->image || !wmn->reference) {
347 if (wmn->action != NA_PAINTING) {
350 ED_area_tag_redraw(area);
351 }
352 }
353 break;
354 case NC_SPACE:
355 if (wmn->data == ND_SPACE_IMAGE) {
357 ED_area_tag_redraw(area);
358 }
359 break;
360 case NC_MASK: {
361 Scene *scene = WM_window_get_active_scene(win);
363 BKE_view_layer_synced_ensure(scene, view_layer);
364 Object *obedit = BKE_view_layer_edit_object_get(view_layer);
365 if (ED_space_image_check_show_maskedit(sima, obedit)) {
366 switch (wmn->data) {
367 case ND_SELECT:
368 ED_area_tag_redraw(area);
369 break;
370 case ND_DATA:
371 case ND_DRAW:
372 /* causes node-recalc */
373 ED_area_tag_redraw(area);
375 break;
376 }
377 switch (wmn->action) {
378 case NA_SELECTED:
379 ED_area_tag_redraw(area);
380 break;
381 case NA_EDITED:
382 /* causes node-recalc */
383 ED_area_tag_redraw(area);
385 break;
386 }
387 }
388 break;
389 }
390 case NC_GEOM: {
391 switch (wmn->data) {
392 case ND_DATA:
393 case ND_SELECT:
396 ED_area_tag_redraw(area);
397 break;
398 }
399 break;
400 }
401 case NC_OBJECT: {
402 switch (wmn->data) {
403 case ND_TRANSFORM:
404 case ND_MODIFIER: {
405 const Scene *scene = WM_window_get_active_scene(win);
407 BKE_view_layer_synced_ensure(scene, view_layer);
409 /* \note With a geometry nodes modifier, the UVs on `ob` can change in response to
410 * any change on `wmn->reference`. If we could track the upstream dependencies,
411 * unnecessary redraws could be reduced. Until then, just redraw. See #98594. */
412 if (ob && (ob->mode & OB_MODE_EDIT) && sima->mode == SI_MODE_UV) {
413 if (sima->lock && (sima->flag & SI_DRAWSHADOW)) {
415 ED_area_tag_redraw(area);
416 }
417 }
418 else if (ob) {
419 if (sima->lock && !(sima->flag & SI_NO_DRAW_UV_GUIDE) &&
421 {
423 ED_area_tag_redraw(area);
424 }
425 }
426 break;
427 }
428 }
429
430 break;
431 }
432 case NC_ID: {
433 if (wmn->action == NA_RENAME) {
434 ED_area_tag_redraw(area);
435 }
436 break;
437 }
438 case NC_WM:
439 if (wmn->data == ND_UNDO) {
440 ED_area_tag_redraw(area);
442 }
443 break;
444 }
445}
446
447const char *image_context_dir[] = {"edit_image", "edit_mask", nullptr};
448
449static int /*eContextResult*/ image_context(const bContext *C,
450 const char *member,
452{
454
455 if (CTX_data_dir(member)) {
457 // return CTX_RESULT_OK; /* TODO(@sybren). */
458 }
459 else if (CTX_data_equals(member, "edit_image")) {
461 return CTX_RESULT_OK;
462 }
463 else if (CTX_data_equals(member, "edit_mask")) {
465 if (mask) {
467 }
468 return CTX_RESULT_OK;
469 }
471}
472
486
500
514
528
530{
531 VIEW2D_GGT_navigate_impl(gzgt, "IMAGE_GGT_navigate");
532}
533
546
547/************************** main region ***************************/
548
549/* sets up the fields of the View2D from zoom and offset */
551{
552 Image *ima = ED_space_image(sima);
553
554 int width, height;
555 ED_space_image_get_size(sima, &width, &height);
556
557 float w = width;
558 float h = height;
559
560 if (ima) {
561 h *= ima->aspy / ima->aspx;
562 }
563
564 int winx = BLI_rcti_size_x(&region->winrct) + 1;
565 int winy = BLI_rcti_size_y(&region->winrct) + 1;
566
567 /* For region overlap, move center so image doesn't overlap header. */
568 const rcti *visible_rect = ED_region_visible_rect(region);
569 const int visible_winy = BLI_rcti_size_y(visible_rect) + 1;
570 int visible_centerx = 0;
571 int visible_centery = visible_rect->ymin + (visible_winy - winy) / 2;
572
573 region->v2d.tot.xmin = 0;
574 region->v2d.tot.ymin = 0;
575 region->v2d.tot.xmax = w;
576 region->v2d.tot.ymax = h;
577
578 region->v2d.mask.xmin = region->v2d.mask.ymin = 0;
579 region->v2d.mask.xmax = winx;
580 region->v2d.mask.ymax = winy;
581
582 /* which part of the image space do we see? */
583 float x1 = region->winrct.xmin + visible_centerx + (winx - sima->zoom * w) / 2.0f;
584 float y1 = region->winrct.ymin + visible_centery + (winy - sima->zoom * h) / 2.0f;
585
586 x1 -= sima->zoom * sima->xof;
587 y1 -= sima->zoom * sima->yof;
588
589 /* relative display right */
590 region->v2d.cur.xmin = ((region->winrct.xmin - x1) / sima->zoom);
591 region->v2d.cur.xmax = region->v2d.cur.xmin + (float(winx) / sima->zoom);
592
593 /* relative display left */
594 region->v2d.cur.ymin = ((region->winrct.ymin - y1) / sima->zoom);
595 region->v2d.cur.ymax = region->v2d.cur.ymin + (float(winy) / sima->zoom);
596
597 /* normalize 0.0..1.0 */
598 region->v2d.cur.xmin /= w;
599 region->v2d.cur.xmax /= w;
600 region->v2d.cur.ymin /= h;
601 region->v2d.cur.ymax /= h;
602}
603
604/* add handlers, stuff you only do once or on area/region changes */
606{
607 wmKeyMap *keymap;
608
609 /* NOTE: don't use `UI_view2d_region_reinit(&region->v2d, ...)`
610 * since the space clip manages own v2d in #image_main_region_set_view2d */
611
612 /* mask polls mode */
613 keymap = WM_keymap_ensure(
614 wm->runtime->defaultconf, "Mask Editing", SPACE_EMPTY, RGN_TYPE_WINDOW);
615 WM_event_add_keymap_handler_v2d_mask(&region->runtime->handlers, keymap);
616
617 /* image paint polls for mode */
618 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "Curve", SPACE_EMPTY, RGN_TYPE_WINDOW);
619 WM_event_add_keymap_handler_v2d_mask(&region->runtime->handlers, keymap);
620
621 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "Paint Curve", SPACE_EMPTY, RGN_TYPE_WINDOW);
622 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
623
624 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "Image Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
625 WM_event_add_keymap_handler_v2d_mask(&region->runtime->handlers, keymap);
626
627 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "UV Editor", SPACE_EMPTY, RGN_TYPE_WINDOW);
628 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
629
630 /* own keymaps */
631 keymap = WM_keymap_ensure(
632 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
633 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
634 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "Image", SPACE_IMAGE, RGN_TYPE_WINDOW);
635 WM_event_add_keymap_handler_v2d_mask(&region->runtime->handlers, keymap);
636}
637
638static void image_main_region_draw(const bContext *C, ARegion *region)
639{
640 /* draw entirely, view changes should be handled here */
642 Object *obedit = CTX_data_edit_object(C);
644 Mask *mask = nullptr;
645 Scene *scene = CTX_data_scene(C);
646 View2D *v2d = &region->v2d;
647 Image *image = ED_space_image(sima);
648 /* Typically a render result or viewer image from the compositor. */
649 const bool show_viewer = (image && image->source == IMA_SRC_VIEWER);
650 const bool show_compositor_viewer = show_viewer && image->type == IMA_TYPE_COMPOSITE;
651
652 /* Text info and render region are only relevant for the compositor. */
653 const bool show_text_info = show_compositor_viewer &&
657 const bool show_render_region = show_compositor_viewer &&
661
662 /* XXX not supported yet, disabling for now */
663 scene->r.scemode &= ~R_COMP_CROP;
664
666
667 /* we set view2d from own zoom and offset each time */
668 image_main_region_set_view2d(sima, region);
669
670 /* check for mask (delay draw) */
671 if (!ED_space_image_show_uvedit(sima, obedit) && sima->mode == SI_MODE_MASK) {
673 }
674
675 if (show_viewer) {
677 }
679 if (show_viewer) {
681 }
682
683 if (show_render_region) {
684 int render_size_x, render_size_y;
685
686 BKE_render_resolution(&scene->r, true, &render_size_x, &render_size_y);
687
688 float zoomx, zoomy;
689 ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
690 int width, height;
691 ED_space_image_get_size(sima, &width, &height);
692 int center_x = width / 2;
693 int center_y = height / 2;
694
695 int x, y;
696 rcti render_region;
698 &render_region, center_x, render_size_x + center_x, center_y, render_size_y + center_y);
699 UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
700
702 x, y, &render_region, zoomx, zoomy, sima->overlay.passepartout_alpha);
703 }
704
705 draw_image_main_helpers(C, region);
706
707 /* Draw Meta data of the image isn't added to the DrawManager as it is
708 * used in other areas as well. */
710 void *lock;
711 /* #ED_space_image_get_zoom temporarily locks the image, so this needs to be done before
712 * the image is locked when calling #ED_space_image_acquire_buffer. */
713 float zoomx, zoomy;
714 ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
715 ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
716 if (ibuf) {
717 int x, y;
718 rctf frame;
719 BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
720 UI_view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
721 ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
722 }
724 }
725
726 if (show_text_info) {
727
728 int render_size_x, render_size_y;
729 BKE_render_resolution(&scene->r, true, &render_size_x, &render_size_y);
730
731 /* Use same positioning convention as in 3D View. */
732 const rcti *rect = ED_region_visible_rect(region);
733 int xoffset = rect->xmin + (0.5f * U.widget_unit);
734 int yoffset = rect->ymax - (0.1f * U.widget_unit);
735
736 int viewer_size_x, viewer_size_y;
737 ED_space_image_get_size(sima, &viewer_size_x, &viewer_size_y);
738
740 render_size_x, render_size_y, viewer_size_x, viewer_size_y, xoffset, yoffset);
741 }
742
743 /* sample line */
747
748 if (mask) {
749 int width, height;
750 float aspx, aspy;
751
752 if (show_viewer) {
753 /* ED_space_image_get* will acquire image buffer which requires
754 * lock here by the same reason why lock is needed in draw_image_main
755 */
757 }
758
759 ED_space_image_get_size(sima, &width, &height);
760 ED_space_image_get_aspect(sima, &aspx, &aspy);
761
762 if (show_viewer) {
764 }
765
767 mask,
768 region, /* Mask overlay is drawn by image/overlay engine. */
771 sima->mask_info.draw_type,
774 width,
775 height,
776 aspx,
777 aspy,
778 true,
779 false,
780 nullptr,
781 C);
782 }
783 if ((sima->gizmo_flag & SI_GIZMO_HIDE) == 0) {
785 }
786 draw_image_cache(C, region);
787}
788
790{
791 ScrArea *area = params->area;
792 ARegion *region = params->region;
793 const wmNotifier *wmn = params->notifier;
794
795 /* context changes */
796 switch (wmn->category) {
797 case NC_GEOM:
798 if (ELEM(wmn->data, ND_DATA, ND_SELECT)) {
799 WM_gizmomap_tag_refresh(region->runtime->gizmo_map);
800 }
801 break;
802 case NC_GPENCIL:
803 if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
804 ED_region_tag_redraw(region);
805 }
806 else if (wmn->data & ND_GPENCIL_EDITMODE) {
807 ED_region_tag_redraw(region);
808 }
809 break;
810 case NC_IMAGE:
811 if (wmn->action == NA_PAINTING) {
812 ED_region_tag_redraw(region);
813 }
814 WM_gizmomap_tag_refresh(region->runtime->gizmo_map);
815 break;
816 case NC_MASK:
817 if (wmn->action == NA_EDITED) {
818 WM_gizmomap_tag_refresh(region->runtime->gizmo_map);
819 }
820 else if (ELEM(wmn->data, ND_DATA, ND_SELECT)) {
821 WM_gizmomap_tag_refresh(region->runtime->gizmo_map);
822 }
823 break;
824 case NC_MATERIAL:
825 if (wmn->data == ND_SHADING_LINKS) {
826 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
827
828 if (sima->iuser.scene &&
830 {
831 ED_region_tag_redraw(region);
832 }
833 }
834 break;
835 case NC_SCREEN:
836 if (ELEM(wmn->data, ND_LAYER)) {
837 ED_region_tag_redraw(region);
838 }
839 break;
840 }
841}
842
843/* *********************** buttons region ************************ */
844
845/* add handlers, stuff you only do once or on area/region changes */
847{
848 wmKeyMap *keymap;
849
851 ED_region_panels_init(wm, region);
852
853 keymap = WM_keymap_ensure(
854 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
855 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
856}
857
858static void image_buttons_region_layout(const bContext *C, ARegion *region)
859{
860 const enum eContextObjectMode mode = CTX_data_mode_enum(C);
861 const char *contexts_base[3] = {nullptr};
862
863 const char **contexts = contexts_base;
864
866 switch (sima->mode) {
867 case SI_MODE_VIEW:
868 break;
869 case SI_MODE_PAINT:
870 ARRAY_SET_ITEMS(contexts, ".paint_common_2d", ".imagepaint_2d");
871 break;
872 case SI_MODE_MASK:
873 break;
874 case SI_MODE_UV:
875 if (mode == CTX_MODE_EDIT_MESH) {
876 ARRAY_SET_ITEMS(contexts, ".uv_sculpt");
877 }
878 break;
879 }
880
882 region,
883 &region->runtime->type->paneltypes,
885 contexts_base,
886 nullptr);
887}
888
889static void image_buttons_region_draw(const bContext *C, ARegion *region)
890{
892 Scene *scene = CTX_data_scene(C);
893 void *lock;
894 /* TODO(lukas): Support tiles in scopes? */
895 ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0);
896 /* XXX performance regression if name of scopes category changes! */
897 PanelCategoryStack *category = UI_panel_category_active_find(region, "Scopes");
898
899 /* only update scopes if scope category is active */
900 if (category) {
901 if (ibuf) {
902 if (!sima->scopes.ok) {
904 &sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
905 }
906 if (sima->image->flag & IMA_VIEW_AS_RENDER) {
907 ED_space_image_scopes_update(C, sima, ibuf, true);
908 }
909 else {
910 ED_space_image_scopes_update(C, sima, ibuf, false);
911 }
912 }
913 }
915
916 /* Layout handles details. */
917 ED_region_panels_draw(C, region);
918}
919
921{
922 ARegion *region = params->region;
923 const wmNotifier *wmn = params->notifier;
924
925 /* context changes */
926 switch (wmn->category) {
927 case NC_TEXTURE:
928 case NC_MATERIAL:
929 /* sending by texture render job and needed to properly update displaying
930 * brush texture icon */
931 ED_region_tag_redraw(region);
932 break;
933 case NC_SCENE:
934 switch (wmn->data) {
935 case ND_MODE:
936 case ND_RENDER_RESULT:
937 case ND_COMPO_RESULT:
938 ED_region_tag_redraw(region);
939 break;
940 }
941 break;
942 case NC_IMAGE:
943 if (wmn->action != NA_PAINTING) {
944 ED_region_tag_redraw(region);
945 }
946 break;
947 case NC_NODE:
948 ED_region_tag_redraw(region);
949 break;
950 case NC_GPENCIL:
951 if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
952 ED_region_tag_redraw(region);
953 }
954 break;
955 case NC_BRUSH:
956 if (wmn->action == NA_EDITED) {
957 ED_region_tag_redraw(region);
958 }
959 break;
960 }
961}
962
963/* *********************** scopes region ************************ */
964
965/* add handlers, stuff you only do once or on area/region changes */
967{
968 wmKeyMap *keymap;
969
971 ED_region_panels_init(wm, region);
972
973 keymap = WM_keymap_ensure(
974 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
975 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
976}
977
978static void image_tools_region_draw(const bContext *C, ARegion *region)
979{
980 ED_region_panels(C, region);
981}
982
984{
985 ARegion *region = params->region;
986 const wmNotifier *wmn = params->notifier;
987
988 /* context changes */
989 switch (wmn->category) {
990 case NC_GPENCIL:
991 if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
992 ED_region_tag_redraw(region);
993 }
994 break;
995 case NC_BRUSH:
996 /* NA_SELECTED is used on brush changes */
997 if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
998 ED_region_tag_redraw(region);
999 }
1000 break;
1001 case NC_SCENE:
1002 switch (wmn->data) {
1003 case ND_MODE:
1004 case ND_RENDER_RESULT:
1005 case ND_COMPO_RESULT:
1006 ED_region_tag_redraw(region);
1007 break;
1008 }
1009 break;
1010 case NC_IMAGE:
1011 if (wmn->action != NA_PAINTING) {
1012 ED_region_tag_redraw(region);
1013 }
1014 break;
1015 case NC_NODE:
1016 ED_region_tag_redraw(region);
1017 break;
1018 }
1019}
1020
1021/************************* Tool header region **************************/
1022
1024{
1025 ScrArea *area = CTX_wm_area(C);
1026 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
1027
1029
1031 C,
1032 region,
1036}
1037
1038/************************* header region **************************/
1039
1040/* add handlers, stuff you only do once or on area/region changes */
1042{
1043 ED_region_header_init(region);
1044}
1045
1046static void image_header_region_draw(const bContext *C, ARegion *region)
1047{
1048 ScrArea *area = CTX_wm_area(C);
1049 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
1050
1052
1053 ED_region_header(C, region);
1054}
1055
1057{
1058 ARegion *region = params->region;
1059 const wmNotifier *wmn = params->notifier;
1060
1061 /* context changes */
1062 switch (wmn->category) {
1063 case NC_SCENE:
1064 switch (wmn->data) {
1065 case ND_MODE:
1066 case ND_TOOLSETTINGS:
1067 ED_region_tag_redraw(region);
1068 break;
1069 }
1070 break;
1071 case NC_GEOM:
1072 switch (wmn->data) {
1073 case ND_DATA:
1074 case ND_SELECT:
1075 ED_region_tag_redraw(region);
1076 break;
1077 }
1078 break;
1079 case NC_BRUSH:
1080 if (wmn->action == NA_EDITED) {
1081 ED_region_tag_redraw(region);
1082 }
1083 break;
1084 case NC_GPENCIL:
1085 if (wmn->data & ND_GPENCIL_EDITMODE) {
1086 ED_region_tag_redraw(region);
1087 }
1088 else if (wmn->action == NA_EDITED) {
1089 ED_region_tag_redraw(region);
1090 }
1091 break;
1092 }
1093}
1094
1095/* add handlers, stuff you only do once or on area/region changes */
1097{
1098 using namespace blender::ed;
1099 wmKeyMap *keymap = WM_keymap_ensure(
1100 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
1101 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
1102
1104}
1105
1106static void image_id_remap(ScrArea * /*area*/,
1107 SpaceLink *slink,
1108 const blender::bke::id::IDRemapper &mappings)
1109{
1110 SpaceImage *simg = (SpaceImage *)slink;
1111
1113 return;
1114 }
1115
1116 mappings.apply(reinterpret_cast<ID **>(&simg->image), ID_REMAP_APPLY_ENSURE_REAL);
1117 mappings.apply(reinterpret_cast<ID **>(&simg->gpd), ID_REMAP_APPLY_UPDATE_REFCOUNT);
1118 mappings.apply(reinterpret_cast<ID **>(&simg->mask_info.mask), ID_REMAP_APPLY_ENSURE_REAL);
1119}
1120
1122{
1123 SpaceImage *simg = reinterpret_cast<SpaceImage *>(space_link);
1124 const int data_flags = BKE_lib_query_foreachid_process_flags_get(data);
1125 const bool is_readonly = (data_flags & IDWALK_READONLY) != 0;
1126
1133 if (!is_readonly) {
1134 simg->scopes.ok = 0;
1135 }
1136}
1137
1144{
1145 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
1146 return sima->mode == SI_MODE_UV ? SI_MODE_UV : SI_MODE_VIEW;
1147}
1148
1149static void image_space_subtype_set(ScrArea *area, int value)
1150{
1151 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
1152 if (value == SI_MODE_UV) {
1153 if (sima->mode != SI_MODE_UV) {
1154 sima->mode_prev = sima->mode;
1155 }
1156 sima->mode = value;
1157 }
1158 else {
1159 sima->mode = sima->mode_prev;
1160 }
1161}
1162
1164 EnumPropertyItem **item,
1165 int *totitem)
1166{
1168}
1169
1171{
1172 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
1174 if (index < 0) {
1175 index = SI_MODE_VIEW;
1176 }
1178 return item.name;
1179}
1180
1181static int image_space_icon_get(const ScrArea *area)
1182{
1183 SpaceImage *sima = static_cast<SpaceImage *>(area->spacedata.first);
1185 if (index < 0) {
1186 index = SI_MODE_VIEW;
1187 }
1189 return item.icon;
1190}
1191
1193{
1194 SpaceImage *sima = (SpaceImage *)sl;
1195
1196 sima->iuser.scene = nullptr;
1197 sima->scopes.waveform_1 = nullptr;
1198 sima->scopes.waveform_2 = nullptr;
1199 sima->scopes.waveform_3 = nullptr;
1200 sima->scopes.vecscope = nullptr;
1201 sima->scopes.vecscope_rgb = nullptr;
1202 sima->scopes.ok = 0;
1203
1204/* WARNING: gpencil data is no longer stored directly in sima after 2.5
1205 * so sacrifice a few old files for now to avoid crashes with new files!
1206 * committed: r28002 */
1207#if 0
1208 sima->gpd = newdataadr(fd, sima->gpd);
1209 if (sima->gpd) {
1211 }
1212#endif
1213}
1214
1216{
1217 BLO_write_struct(writer, SpaceImage, sl);
1218}
1219
1220/**************************** spacetype *****************************/
1221
1223{
1224 using namespace blender::ed;
1225 std::unique_ptr<SpaceType> st = std::make_unique<SpaceType>();
1226 ARegionType *art;
1227
1228 st->spaceid = SPACE_IMAGE;
1229 STRNCPY_UTF8(st->name, "Image");
1230
1231 st->create = image_create;
1232 st->free = image_free;
1233 st->init = image_init;
1234 st->duplicate = image_duplicate;
1235 st->operatortypes = image_operatortypes;
1236 st->keymap = image_keymap;
1237 st->dropboxes = image_dropboxes;
1238 st->refresh = image_refresh;
1239 st->listener = image_listener;
1240 st->context = image_context;
1241 st->gizmos = image_widgets;
1242 st->id_remap = image_id_remap;
1243 st->foreach_id = image_foreach_id;
1244 st->space_subtype_item_extend = image_space_subtype_item_extend;
1245 st->space_subtype_get = image_space_subtype_get;
1246 st->space_subtype_set = image_space_subtype_set;
1247 st->space_name_get = image_space_name_get;
1248 st->space_icon_get = image_space_icon_get;
1249 st->blend_read_data = image_space_blend_read_data;
1250 st->blend_read_after_liblink = nullptr;
1251 st->blend_write = image_space_blend_write;
1252
1253 /* regions: main window */
1254 art = MEM_callocN<ARegionType>("spacetype image region");
1261 BLI_addhead(&st->regiontypes, art);
1262
1263 /* regions: list-view/buttons/scopes */
1264 art = MEM_callocN<ARegionType>("spacetype image region");
1265 art->regionid = RGN_TYPE_UI;
1274 BLI_addhead(&st->regiontypes, art);
1275
1278
1279 /* regions: tool(bar) */
1280 art = MEM_callocN<ARegionType>("spacetype image region");
1281 art->regionid = RGN_TYPE_TOOLS;
1282 art->prefsizex = int(UI_TOOLBAR_WIDTH);
1283 art->prefsizey = 50; /* XXX */
1290 BLI_addhead(&st->regiontypes, art);
1291
1292 /* regions: tool header */
1293 art = MEM_callocN<ARegionType>("spacetype image tool header region");
1295 art->prefsizey = HEADERY;
1301 BLI_addhead(&st->regiontypes, art);
1302
1303 /* regions: header */
1304 art = MEM_callocN<ARegionType>("spacetype image region");
1306 art->prefsizey = HEADERY;
1311
1312 BLI_addhead(&st->regiontypes, art);
1313
1314 /* regions: asset shelf */
1315 art = MEM_callocN<ARegionType>("spacetype image asset shelf region");
1330 BLI_addhead(&st->regiontypes, art);
1331
1332 /* regions: asset shelf header */
1333 art = MEM_callocN<ARegionType>("spacetype image asset shelf header region");
1341 BLI_addhead(&st->regiontypes, art);
1343
1344 /* regions: hud */
1345 art = ED_area_type_hud(st->spaceid);
1346 BLI_addhead(&st->regiontypes, art);
1347
1348 BKE_spacetype_register(std::move(st));
1349}
void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
void BKE_scopes_new(Scopes *scopes)
void BKE_scopes_free(Scopes *scopes)
Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
SpaceImage * CTX_wm_space_image(const bContext *C)
bool CTX_data_equals(const char *member, const char *str)
bool CTX_data_dir(const char *member)
void CTX_data_id_pointer_set(bContextDataResult *result, ID *id)
eContextObjectMode
@ CTX_MODE_EDIT_MESH
ScrArea * CTX_wm_area(const bContext *C)
@ CTX_RESULT_MEMBER_NOT_FOUND
@ CTX_RESULT_OK
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
Scene * CTX_data_sequencer_scene(const bContext *C)
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
void BKE_gpencil_blend_read_data(struct BlendDataReader *reader, struct bGPdata *gpd)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
void BKE_imageuser_default(ImageUser *iuser)
void BKE_image_partial_update_mark_full_update(Image *image)
Mark the whole image to be updated.
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
Object * BKE_view_layer_edit_object_get(const ViewLayer *view_layer)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
@ IDWALK_CB_USER_ONE
@ IDWALK_CB_USER
@ IDWALK_CB_DIRECT_WEAK_LINK
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
Definition lib_query.cc:129
@ IDWALK_READONLY
@ ID_REMAP_APPLY_UPDATE_REFCOUNT
@ ID_REMAP_APPLY_ENSURE_REAL
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
Definition scene.cc:2915
void BKE_spacetype_register(std::unique_ptr< SpaceType > st)
Definition screen.cc:282
ARegion * BKE_area_region_new()
Definition screen.cc:387
@ REGION_DRAW_LOCK_BAKING
#define LISTBASE_FOREACH(type, var, list)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:111
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:91
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.h:198
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition rct.cc:414
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
Definition rct.cc:404
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
#define STRNCPY_UTF8(dst, src)
void BLI_thread_unlock(int type)
Definition threads.cc:333
void BLI_thread_lock(int type)
Definition threads.cc:328
@ LOCK_DRAW_IMAGE
Definition BLI_threads.h:64
#define ARRAY_SET_ITEMS(...)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define FILTER_ID_GD_LEGACY
Definition DNA_ID.h:1202
#define FILTER_ID_MSK
Definition DNA_ID.h:1212
#define FILTER_ID_IM
Definition DNA_ID.h:1204
#define DNA_struct_default_get(struct_name)
@ IMA_SRC_VIEWER
@ IMA_VIEW_AS_RENDER
@ IMA_TYPE_R_RESULT
@ IMA_TYPE_COMPOSITE
@ IMA_SHOW_SEQUENCER_SCENE
@ IMA_ANIM_ALWAYS
@ IMA_SHOW_STEREO
eMaskOverlayMode
@ MASK_DRAWFLAG_OVERLAY
@ OB_MODE_EDIT
Object is a sort of wrapper for general info.
@ UV_FLAG_SHOW_SAME_IMAGE
@ R_COMP_CROP
#define HEADERY
#define RGN_ALIGN_ENUM_FROM_MASK(align)
@ RGN_ALIGN_HIDE_WITH_PREV
@ RGN_ALIGN_BOTTOM
@ RGN_ALIGN_LEFT
@ RGN_ALIGN_TOP
@ RGN_ALIGN_RIGHT
@ RGN_TYPE_TOOL_HEADER
@ RGN_TYPE_UI
@ RGN_TYPE_ASSET_SHELF_HEADER
@ RGN_TYPE_WINDOW
@ RGN_TYPE_ASSET_SHELF
@ RGN_TYPE_HEADER
@ RGN_TYPE_TOOLS
@ RGN_TYPE_TOOL_PROPS
@ RGN_FLAG_HIDDEN
@ RGN_FLAG_HIDDEN_BY_USER
@ SI_NO_DRAW_UV_GUIDE
@ SI_SHOW_GPENCIL
@ SI_DRAW_METADATA
@ SI_USE_ALPHA
@ SI_COORDFLOATS
@ SI_DRAWSHADOW
@ SI_GIZMO_HIDE
@ SI_OVERLAY_SHOW_OVERLAYS
@ SI_OVERLAY_DRAW_TEXT_INFO
@ SI_OVERLAY_SHOW_GRID_BACKGROUND
@ SI_OVERLAY_DRAW_RENDER_REGION
@ SPACE_EMPTY
@ SPACE_IMAGE
@ SI_MODE_PAINT
@ SI_MODE_VIEW
@ SI_MODE_MASK
@ SI_MODE_UV
@ USER_HEADER_BOTTOM
@ V2D_SCROLL_VERTICAL_HIDE
@ V2D_SCROLL_RIGHT
void DRW_draw_view(const bContext *C)
void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock)
void ED_space_image_auto_set(const bContext *C, SpaceImage *sima)
Definition image_edit.cc:95
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height)
bool ED_image_tools_paint_poll(bContext *C)
ImBuf * ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock, int tile)
bool ED_space_image_check_show_maskedit(SpaceImage *sima, Object *obedit)
bool ED_space_image_show_render(const SpaceImage *sima)
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit)
void ED_space_image_get_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy)
void ED_space_image_scopes_update(const bContext *C, SpaceImage *sima, ImBuf *ibuf, bool use_view_settings)
void ED_space_image_get_zoom(SpaceImage *sima, const ARegion *region, float *r_zoomx, float *r_zoomy)
Image * ED_space_image(const SpaceImage *sima)
Definition image_edit.cc:40
void ED_paint_cursor_start(Paint *paint, bool(*poll)(bContext *C))
Mask * ED_space_image_get_mask(const SpaceImage *sima)
void ED_mask_draw_region(Depsgraph *depsgraph, Mask *mask, ARegion *region, bool show_overlays, char draw_flag, char draw_type, eMaskOverlayMode overlay_mode, float blend_factor, int width_i, int height_i, float aspx, float aspy, bool do_scale_applied, bool do_draw_cb, float stabmat[4][4], const bContext *C)
Definition mask_draw.cc:641
void ED_node_composite_job(const bContext *C, bNodeTree *nodetree, Scene *scene_owner)
Definition node_edit.cc:371
Scene * ED_render_job_get_current_scene(const bContext *C)
void ED_area_do_mgs_subscribe_for_tool_header(const wmRegionMessageSubscribeParams *params)
Definition area.cc:394
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:693
ARegionType * ED_area_type_hud(int space_type)
void ED_area_do_mgs_subscribe_for_tool_ui(const wmRegionMessageSubscribeParams *params)
Definition area.cc:409
void ED_region_panels(const bContext *C, ARegion *region)
Definition area.cc:3609
void ED_region_header(const bContext *C, ARegion *region)
Definition area.cc:3935
const rcti * ED_region_visible_rect(ARegion *region)
Definition area.cc:4301
void ED_region_header_init(ARegion *region)
Definition area.cc:3950
void ED_region_header_with_button_sections(const bContext *C, ARegion *region, uiButtonSectionsAlign align)
Definition area.cc:3942
int ED_region_generic_tools_region_snap_size(const ARegion *region, int size, int axis)
Definition area_utils.cc:40
void ED_area_tag_refresh(ScrArea *area)
Definition area.cc:722
void ED_region_generic_tools_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
Definition area_utils.cc:28
int ED_region_generic_panel_region_snap_size(const ARegion *region, int size, int axis)
Definition area_utils.cc:71
void ED_region_panels_init(wmWindowManager *wm, ARegion *region)
Definition area.cc:3616
void ED_region_panels_layout_ex(const bContext *C, ARegion *region, ListBase *paneltypes, blender::wm::OpCallContext op_context, const char *contexts[], const char *category_override)
Definition area.cc:3233
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:618
@ ED_KEYMAP_ASSET_SHELF
Definition ED_screen.hh:768
@ ED_KEYMAP_UI
Definition ED_screen.hh:758
@ ED_KEYMAP_HEADER
Definition ED_screen.hh:764
@ ED_KEYMAP_TOOL
Definition ED_screen.hh:760
@ ED_KEYMAP_GPENCIL
Definition ED_screen.hh:766
@ ED_KEYMAP_GIZMO
Definition ED_screen.hh:759
@ ED_KEYMAP_VIEW2D
Definition ED_screen.hh:761
@ ED_KEYMAP_FRAMES
Definition ED_screen.hh:763
@ ED_KEYMAP_FOOTER
Definition ED_screen.hh:765
void ED_region_panels_draw(const bContext *C, ARegion *region)
Definition area.cc:3529
void ED_region_image_metadata_draw(int x, int y, const ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy)
Definition ed_draw.cc:1030
void ED_region_image_render_region_draw(int x, int y, const rcti *frame, float zoomx, float zoomy, float passepartout_alpha)
Definition ed_draw.cc:982
void ED_region_image_overlay_info_text_draw(const int render_size_x, const int render_size_y, const int viewer_size_x, const int viewer_size_y, const int draw_offset_x, const int draw_offset_y)
Definition ed_draw.cc:942
void ED_uvedit_buttons_register(ARegionType *art)
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
#define UI_SIDEBAR_PANEL_WIDTH
#define UI_TOOLBAR_WIDTH
PanelCategoryStack * UI_panel_category_active_find(ARegion *region, const char *idname)
void UI_view2d_view_restore(const bContext *C)
Definition view2d.cc:1162
void VIEW2D_GGT_navigate_impl(wmGizmoGroupType *gzgt, const char *idname)
void UI_view2d_view_ortho(const View2D *v2d)
Definition view2d.cc:1095
void UI_view2d_view_to_region(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
Definition view2d.cc:1723
@ WM_GIZMOMAP_DRAWSTEP_2D
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE
@ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP
@ WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK
#define NS_EDITMODE_MESH
Definition WM_types.hh:562
#define NC_WINDOW
Definition WM_types.hh:375
#define NC_ID
Definition WM_types.hh:395
#define NC_NODE
Definition WM_types.hh:394
#define NC_GEOM
Definition WM_types.hh:393
#define ND_DRAW
Definition WM_types.hh:461
#define NC_BRUSH
Definition WM_types.hh:385
#define ND_OB_ACTIVE
Definition WM_types.hh:440
#define ND_RENDER_RESULT
Definition WM_types.hh:446
#define NC_WM
Definition WM_types.hh:374
#define ND_DATA
Definition WM_types.hh:509
#define ND_GPENCIL_EDITMODE
Definition WM_types.hh:504
#define ND_RENDER_OPTIONS
Definition WM_types.hh:435
#define ND_COMPO_RESULT
Definition WM_types.hh:447
#define NC_SCREEN
Definition WM_types.hh:377
#define ND_MODE
Definition WM_types.hh:445
#define ND_OB_SELECT
Definition WM_types.hh:442
#define NC_SCENE
Definition WM_types.hh:378
#define ND_TOOLSETTINGS
Definition WM_types.hh:449
#define ND_MODIFIER
Definition WM_types.hh:462
#define ND_SPACE_IMAGE
Definition WM_types.hh:522
#define NA_EDITED
Definition WM_types.hh:584
#define NC_MATERIAL
Definition WM_types.hh:380
#define NC_IMAGE
Definition WM_types.hh:384
#define ND_UNDO
Definition WM_types.hh:417
#define ND_FRAME
Definition WM_types.hh:434
#define ND_SELECT
Definition WM_types.hh:508
#define NC_GPENCIL
Definition WM_types.hh:399
#define NC_TEXTURE
Definition WM_types.hh:381
#define ND_TRANSFORM
Definition WM_types.hh:456
#define ND_LAYER
Definition WM_types.hh:450
#define NC_MASK
Definition WM_types.hh:398
#define NA_RENAME
Definition WM_types.hh:588
#define NA_PAINTING
Definition WM_types.hh:591
#define NC_OBJECT
Definition WM_types.hh:379
#define ND_SHADING_LINKS
Definition WM_types.hh:479
#define NC_SPACE
Definition WM_types.hh:392
#define NA_SELECTED
Definition WM_types.hh:589
volatile int lock
#define U
BMesh const char void * data
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition btQuadWord.h:119
IDRemapperApplyResult apply(ID **r_id_ptr, IDRemapperApplyOptions options, ID *id_self=nullptr) const
bool contains_mappings_for_any(IDTypeFilter filter) const
nullptr float
void image_buttons_register(ARegionType *art)
void draw_image_main_helpers(const bContext *C, ARegion *region)
void draw_image_cache(const bContext *C, ARegion *region)
void draw_image_sample_line(SpaceImage *sima)
void IMAGE_OT_view_cursor_center(wmOperatorType *ot)
Definition image_ops.cc:900
void IMAGE_OT_change_frame(wmOperatorType *ot)
void IMAGE_OT_save_sequence(wmOperatorType *ot)
void IMAGE_OT_view_zoom(wmOperatorType *ot)
Definition image_ops.cc:736
void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
void IMAGE_OT_match_movie_length(wmOperatorType *ot)
void IMAGE_OT_save_all_modified(wmOperatorType *ot)
void IMAGE_OT_save_as(wmOperatorType *ot)
void IMAGE_OT_sample(wmOperatorType *ot)
void IMAGE_OT_tile_fill(wmOperatorType *ot)
void IMAGE_OT_remove_render_slot(wmOperatorType *ot)
void IMAGE_OT_view_zoom_border(wmOperatorType *ot)
void IMAGE_OT_reload(wmOperatorType *ot)
void IMAGE_OT_unpack(wmOperatorType *ot)
void IMAGE_OT_view_selected(wmOperatorType *ot)
void IMAGE_OT_tile_add(wmOperatorType *ot)
void IMAGE_OT_pack(wmOperatorType *ot)
void IMAGE_OT_open(wmOperatorType *ot)
void IMAGE_OT_read_viewlayers(wmOperatorType *ot)
void IMAGE_OT_invert(wmOperatorType *ot)
void IMAGE_OT_resize(wmOperatorType *ot)
void IMAGE_OT_clear_render_slot(wmOperatorType *ot)
void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
void IMAGE_OT_rotate_orthogonal(wmOperatorType *ot)
void IMAGE_OT_view_all(wmOperatorType *ot)
Definition image_ops.cc:854
void IMAGE_OT_render_border(wmOperatorType *ot)
void IMAGE_OT_view_pan(wmOperatorType *ot)
Definition image_ops.cc:475
void IMAGE_OT_clipboard_copy(wmOperatorType *ot)
const char * image_context_dir[]
void IMAGE_OT_save(wmOperatorType *ot)
void IMAGE_OT_file_browse(wmOperatorType *ot)
void IMAGE_OT_clipboard_paste(wmOperatorType *ot)
void IMAGE_OT_add_render_slot(wmOperatorType *ot)
void IMAGE_OT_tile_remove(wmOperatorType *ot)
void IMAGE_OT_flip(wmOperatorType *ot)
void IMAGE_OT_sample_line(wmOperatorType *ot)
void IMAGE_OT_replace(wmOperatorType *ot)
void IMAGE_OT_view_center_cursor(wmOperatorType *ot)
Definition image_ops.cc:936
void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
void IMAGE_OT_new(wmOperatorType *ot)
void IMAGE_OT_clear_render_border(wmOperatorType *ot)
void IMAGE_OT_curves_point_set(wmOperatorType *ot)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void * MEM_dupallocN(const void *vmemh)
Definition mallocn.cc:143
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void header_region(const bContext *C, ARegion *region)
void region_init(wmWindowManager *wm, ARegion *region)
void types_register(ARegionType *region_type, const int space_type)
void region_listen(const wmRegionListenerParams *params)
void region_on_poll_success(const bContext *C, ARegion *region)
void header_region_listen(const wmRegionListenerParams *params)
void region_on_user_resize(const ARegion *region)
int context(const bContext *C, const char *member, bContextDataResult *result)
int region_snap(const ARegion *region, int size, int axis)
void * region_duplicate(void *regiondata)
bool regions_poll(const RegionPollParams *params)
void header_region_init(wmWindowManager *wm, ARegion *region)
void region_draw(const bContext *C, ARegion *region)
void region_message_subscribe(const wmRegionMessageSubscribeParams *params)
void region_layout(const bContext *C, ARegion *region)
void region_free(ARegion *region)
void ED_widgetgroup_gizmo2d_resize_callbacks_set(wmGizmoGroupType *gzgt)
void ED_widgetgroup_gizmo2d_xform_callbacks_set(wmGizmoGroupType *gzgt)
void ED_widgetgroup_gizmo2d_xform_no_cage_callbacks_set(wmGizmoGroupType *gzgt)
void ED_widgetgroup_gizmo2d_rotate_callbacks_set(wmGizmoGroupType *gzgt)
static void * newdataadr(FileData *fd, const void *adr)
Definition readfile.cc:1501
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
const EnumPropertyItem rna_enum_space_image_mode_items[]
Definition rna_space.cc:306
static void image_init(Image *ima, short source, short type)
static void image_buttons_region_init(wmWindowManager *wm, ARegion *region)
static int image_context(const bContext *C, const char *member, bContextDataResult *result)
static void image_space_blend_write(BlendWriter *writer, SpaceLink *sl)
static void image_header_region_listener(const wmRegionListenerParams *params)
static void IMAGE_GGT_gizmo2d(wmGizmoGroupType *gzgt)
static void image_operatortypes()
static void IMAGE_GGT_gizmo2d_translate(wmGizmoGroupType *gzgt)
static void IMAGE_GGT_navigate(wmGizmoGroupType *gzgt)
static void image_widgets()
static void image_main_region_listener(const wmRegionListenerParams *params)
static void image_dropboxes()
static void image_space_blend_read_data(BlendDataReader *, SpaceLink *sl)
static void image_asset_shelf_region_init(wmWindowManager *wm, ARegion *region)
static void image_init(wmWindowManager *, ScrArea *area)
static void image_main_region_set_view2d(SpaceImage *sima, ARegion *region)
static void image_listener(const wmSpaceTypeListenerParams *params)
static void image_tools_region_draw(const bContext *C, ARegion *region)
static void image_space_subtype_set(ScrArea *area, int value)
static void image_foreach_id(SpaceLink *space_link, LibraryForeachIDData *data)
void ED_spacetype_image()
static void IMAGE_GGT_gizmo2d_rotate(wmGizmoGroupType *gzgt)
static void image_tools_header_region_draw(const bContext *C, ARegion *region)
static SpaceLink * image_create(const ScrArea *, const Scene *)
static void image_tools_region_listener(const wmRegionListenerParams *params)
static void image_user_refresh_scene(const bContext *C, SpaceImage *sima)
static void image_keymap(wmKeyConfig *keyconf)
static void image_tools_region_init(wmWindowManager *wm, ARegion *region)
static void image_free(SpaceLink *sl)
static int image_space_subtype_get(ScrArea *area)
static void image_header_region_draw(const bContext *C, ARegion *region)
static SpaceLink * image_duplicate(SpaceLink *sl)
static void image_main_region_init(wmWindowManager *wm, ARegion *region)
static void image_refresh(const bContext *C, ScrArea *area)
static void image_buttons_region_listener(const wmRegionListenerParams *params)
static void image_buttons_region_layout(const bContext *C, ARegion *region)
static void IMAGE_GGT_gizmo2d_resize(wmGizmoGroupType *gzgt)
static blender::StringRefNull image_space_name_get(const ScrArea *area)
static void image_id_remap(ScrArea *, SpaceLink *slink, const blender::bke::id::IDRemapper &mappings)
static void image_scopes_tag_refresh(ScrArea *area)
static void image_main_region_draw(const bContext *C, ARegion *region)
static void image_buttons_region_draw(const bContext *C, ARegion *region)
static void image_header_region_init(wmWindowManager *, ARegion *region)
static int image_space_icon_get(const ScrArea *area)
static void image_space_subtype_item_extend(bContext *, EnumPropertyItem **item, int *totitem)
bool(* poll)(const RegionPollParams *params)
void(* free)(ARegion *)
void(* on_poll_success)(const bContext *C, ARegion *region)
void(* message_subscribe)(const wmRegionMessageSubscribeParams *params)
void(* listener)(const wmRegionListenerParams *params)
void *(* duplicate)(void *poin)
bContextDataCallback context
void(* draw)(const bContext *C, ARegion *region)
void(* layout)(const bContext *C, ARegion *region)
void(* on_user_resize)(const ARegion *region)
int(* snap_size)(const ARegion *region, int size, int axis)
void(* init)(wmWindowManager *wm, ARegion *region)
ARegionRuntimeHandle * runtime
const char * name
Definition RNA_types.hh:661
Definition DNA_ID.h:414
struct Scene * scene
short source
void * first
struct Mask * mask
struct ToolSettings * toolsettings
ColorManagedViewSettings view_settings
struct bNodeTree * compositing_node_group
struct RenderData r
ColorManagedDisplaySettings display_settings
float * waveform_3
float * waveform_2
float * vecscope_rgb
float * waveform_1
float * vecscope
ListBase handlers
ListBase spacedata
ListBase regionbase
struct Scopes scopes
float uv_face_opacity
int tile_grid_shape[2]
SpaceImageOverlay overlay
MaskSpaceInfo mask_info
struct Histogram sample_line_hist
int custom_grid_subdiv[2]
struct ImageUser iuser
struct bGPdata * gpd
struct Image * image
ListBase regionbase
float stretch_opacity
float xmax
float xmin
float ymax
float ymin
int ymin
int ymax
int xmin
int xmax
const char * idname
wmGizmoMapType_Params gzmap_params
eWM_GizmoFlagGroupTypeFlag flag
unsigned int data
Definition WM_types.hh:358
unsigned int action
Definition WM_types.hh:358
unsigned int category
Definition WM_types.hh:358
unsigned int subtype
Definition WM_types.hh:358
void * reference
Definition WM_types.hh:360
WindowManagerRuntimeHandle * runtime
ListBase * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
wmEventHandler_Dropbox * WM_event_add_dropbox_handler(ListBase *handlers, ListBase *dropboxes)
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap)
wmEventHandler_Keymap * WM_event_add_keymap_handler_v2d_mask(ListBase *handlers, wmKeyMap *keymap)
wmGizmoGroupType * WM_gizmogrouptype_append(void(*wtfunc)(wmGizmoGroupType *))
wmGizmoGroupTypeRef * WM_gizmogrouptype_append_and_link(wmGizmoMapType *gzmap_type, void(*wtfunc)(wmGizmoGroupType *))
void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
void WM_gizmomap_draw(wmGizmoMap *gzmap, const bContext *C, const eWM_GizmoFlagMapDrawStep drawstep)
wmGizmoMapType * WM_gizmomaptype_ensure(const wmGizmoMapType_Params *gzmap_params)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:895
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
Scene * WM_window_get_active_scene(const wmWindow *win)