Blender V5.3
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 <limits>
10
12#include "DNA_image_types.h"
13#include "DNA_mask_types.h"
14#include "DNA_object_types.h"
15#include "DNA_scene_types.h"
16
17#include "MEM_guardedalloc.h"
18
19#include "BLI_listbase.hh"
20#include "BLI_string_utf8.hh"
21#include "BLI_threads.hh"
22
23#include "BKE_colortools.hh"
24#include "BKE_context.hh"
25#include "BKE_image.hh"
26#include "BKE_layer.hh"
27#include "BKE_lib_query.hh"
28#include "BKE_lib_remap.hh"
29#include "BKE_scene.hh"
30#include "BKE_screen.hh"
31
32#include "RNA_access.hh"
33#include "RNA_define.hh"
34#include "RNA_enum_types.hh"
35
36#include "IMB_imbuf.hh"
37#include "IMB_imbuf_types.hh"
38
39#include "ED_asset_shelf.hh"
40#include "ED_image.hh"
41#include "ED_mask.hh"
42#include "ED_node.hh"
43#include "ED_paint.hh"
44#include "ED_render.hh"
45#include "ED_screen.hh"
46#include "ED_space_api.hh"
47#include "ED_transform.hh"
48#include "ED_util.hh"
49#include "ED_uvedit.hh"
50
52
53#include "WM_api.hh"
54#include "WM_types.hh"
55
56#include "UI_interface.hh"
57#include "UI_view2d.hh"
58
59#include "BLO_read_write.hh"
60
61#include "DRW_engine.hh"
62
63#include "image_intern.hh"
64
65namespace blender {
66
67/**************************** common state *****************************/
68
70{
71 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
72
73 /* only while histogram is visible */
74 for (ARegion &region : area->regionbase) {
75 if (region.regiontype == RGN_TYPE_TOOL_PROPS && region.flag & RGN_FLAG_HIDDEN) {
76 return;
77 }
78 }
79
80 sima->scopes.ok = 0;
81}
82
84{
85 /* Update scene image user for acquiring render results. */
86 Scene *sequencer_scene = CTX_data_sequencer_scene(C);
87 sima->iuser.scene = (sima->iuser.flag & IMA_SHOW_SEQUENCER_SCENE) && sequencer_scene ?
88 sequencer_scene :
90
91 if (sima->image && sima->image->type == IMA_TYPE_R_RESULT) {
92 /* While rendering, prefer scene that is being rendered. */
94 if (render_scene) {
95 sima->iuser.scene = render_scene;
98 }
99 }
100
101 /* Auto switch image to show in UV editor when selection changes. */
103}
104
105/* ******************** default callbacks for image space ***************** */
106
107static SpaceLink *image_create(const ScrArea * /*area*/, const Scene * /*scene*/)
108{
109 ARegion *region;
110 SpaceImage *simage;
111
112 simage = MEM_new<SpaceImage>("initimage");
113 simage->spacetype = SPACE_IMAGE;
114 simage->zoom = 1.0f;
115 simage->lock = true;
117 simage->uv_opacity = 1.0f;
118 simage->uv_face_opacity = 1.0f;
119 simage->uv_edge_opacity = 1.0f;
120 simage->stretch_opacity = 1.0f;
122 simage->overlay.passepartout_alpha = 0.5f;
123
126
127 BKE_scopes_new(&simage->scopes);
128 simage->sample_line_hist.height = 100;
129
130 simage->tile_grid_shape[0] = 1;
131 simage->tile_grid_shape[1] = 1;
132
133 simage->custom_grid_subdiv[0] = 10;
134 simage->custom_grid_subdiv[1] = 10;
135
136 simage->mask_info = MaskSpaceInfo();
137
138 /* header */
139 region = BKE_area_region_new();
140
141 BLI_addtail(&simage->regionbase, region);
142 region->regiontype = RGN_TYPE_HEADER;
144
145 /* asset shelf */
146 region = BKE_area_region_new();
147 BLI_addtail(&simage->regionbase, region);
149 region->alignment = RGN_ALIGN_BOTTOM;
150 region->flag |= RGN_FLAG_HIDDEN;
151
152 /* asset shelf header */
153 region = BKE_area_region_new();
154 BLI_addtail(&simage->regionbase, region);
157
158 /* tool header */
159 region = BKE_area_region_new();
160
161 BLI_addtail(&simage->regionbase, region);
165
166 /* buttons/list view */
167 region = BKE_area_region_new();
168
169 BLI_addtail(&simage->regionbase, region);
170 region->regiontype = RGN_TYPE_UI;
171 region->alignment = RGN_ALIGN_RIGHT;
172 region->flag = RGN_FLAG_HIDDEN;
173
174 /* scopes/uv sculpt/paint */
175 region = BKE_area_region_new();
176
177 BLI_addtail(&simage->regionbase, region);
178 region->regiontype = RGN_TYPE_TOOLS;
179 region->alignment = RGN_ALIGN_LEFT;
180 region->flag = RGN_FLAG_HIDDEN;
181
182 /* main area */
183 region = BKE_area_region_new();
184
185 BLI_addtail(&simage->regionbase, region);
186 region->regiontype = RGN_TYPE_WINDOW;
187
188 return reinterpret_cast<SpaceLink *>(simage);
189}
190
191/* Doesn't free the space-link itself. */
192static void image_free(SpaceLink *sl)
193{
194 SpaceImage *simage = reinterpret_cast<SpaceImage *>(sl);
195
196 BKE_scopes_free(&simage->scopes);
197}
198
199/* spacetype; init callback, add handlers */
200static void image_init(wmWindowManager * /*wm*/, ScrArea *area)
201{
202 ListBaseT<wmDropBox> *lb = WM_dropboxmap_find("Image", SPACE_IMAGE, RGN_TYPE_WINDOW);
203
204 /* add drop boxes */
206}
207
209{
210 SpaceImage *simagen = MEM_dupalloc(reinterpret_cast<SpaceImage *>(sl));
211
212 /* clear or remove stuff from old */
213
214 BKE_scopes_new(&simagen->scopes);
215
216 return reinterpret_cast<SpaceLink *>(simagen);
217}
218
220{
231#ifdef WITH_INPUT_NDOF
232 WM_operatortype_append(IMAGE_OT_view_ndof);
233#endif
234
249
254
259
263
265
269
273}
274
275static void image_keymap(wmKeyConfig *keyconf)
276{
277 WM_keymap_ensure(keyconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
278 WM_keymap_ensure(keyconf, "Image", SPACE_IMAGE, RGN_TYPE_WINDOW);
279}
280
281/* area+region dropbox definition */
282static void image_dropboxes() {}
283
284static void image_refresh(const bContext *C, ScrArea *area)
285{
286 Scene *scene = CTX_data_scene(C);
287 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
288 Image *ima;
289
290 ima = ED_space_image(sima);
291 BKE_image_user_frame_calc(ima, &sima->iuser, scene->r.cfra);
292}
293
295{
296 wmWindow *win = params->window;
297 ScrArea *area = params->area;
298 const wmNotifier *wmn = params->notifier;
299 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
300
301 /* context changes */
302 switch (wmn->category) {
303 case NC_WINDOW:
304 /* notifier comes from editing color space */
306 ED_area_tag_redraw(area);
307 break;
308 case NC_SCENE:
309 switch (wmn->data) {
310 case ND_FRAME:
313 ED_area_tag_redraw(area);
314 break;
315 case ND_OB_ACTIVE:
316 case ND_OB_SELECT:
317 ED_area_tag_redraw(area);
318 break;
319 case ND_MODE:
322
323 if (wmn->subtype == NS_EDITMODE_MESH) {
325 }
326 ED_area_tag_redraw(area);
327 break;
328 case ND_RENDER_RESULT:
330 case ND_COMPO_RESULT:
331 if (ED_space_image_show_render(sima)) {
333 }
334 ED_area_tag_redraw(area);
337 break;
338 }
339 break;
340 case NC_IMAGE:
341 if (wmn->reference == sima->image || !wmn->reference) {
342 if (wmn->action != NA_PAINTING) {
345 ED_area_tag_redraw(area);
346 }
347 }
348 break;
349 case NC_SPACE:
350 if (wmn->data == ND_SPACE_IMAGE) {
352 ED_area_tag_redraw(area);
353 }
354 break;
355 case NC_MASK: {
356 Scene *scene = WM_window_get_active_scene(win);
358 BKE_view_layer_synced_ensure(*params->bmain, scene, view_layer);
359 Object *obedit = BKE_view_layer_edit_object_get(view_layer);
360 if (ED_space_image_check_show_maskedit(sima, obedit)) {
361 switch (wmn->data) {
362 case ND_SELECT:
363 ED_area_tag_redraw(area);
364 break;
365 case ND_DATA:
366 case ND_DRAW:
367 /* causes node-recalc */
368 ED_area_tag_redraw(area);
370 break;
371 }
372 switch (wmn->action) {
373 case NA_SELECTED:
374 ED_area_tag_redraw(area);
375 break;
376 case NA_EDITED:
377 /* causes node-recalc */
378 ED_area_tag_redraw(area);
380 break;
381 }
382 }
383 break;
384 }
385 case NC_GEOM: {
386 switch (wmn->data) {
387 case ND_DATA:
388 case ND_SELECT:
391 ED_area_tag_redraw(area);
392 break;
393 }
394 break;
395 }
396 case NC_OBJECT: {
397 switch (wmn->data) {
398 case ND_TRANSFORM:
399 case ND_MODIFIER: {
400 const Scene *scene = WM_window_get_active_scene(win);
402 BKE_view_layer_synced_ensure(*params->bmain, scene, view_layer);
404 /* \note With a geometry nodes modifier, the UVs on `ob` can change in response to
405 * any change on `wmn->reference`. If we could track the upstream dependencies,
406 * unnecessary redraws could be reduced. Until then, just redraw. See #98594. */
407 if (ob && (ob->mode & OB_MODE_EDIT) && sima->mode == SI_MODE_UV) {
408 if (sima->lock && ((sima->flag & SI_DRAWSHADOW) || (sima->flag & SI_DRAW_STRETCH))) {
410 ED_area_tag_redraw(area);
411 }
412 }
413 else if (ob) {
414 if (sima->lock && !(sima->flag & SI_NO_DRAW_UV_GUIDE) &&
416 {
418 ED_area_tag_redraw(area);
419 }
420 }
421 break;
422 }
423 }
424
425 break;
426 }
427 case NC_ID: {
428 if (wmn->action == NA_RENAME) {
429 ED_area_tag_redraw(area);
430 }
431 break;
432 }
433 case NC_WM:
434 if (wmn->data == ND_UNDO) {
435 ED_area_tag_redraw(area);
437 }
438 break;
439 }
440}
441
442const char *image_context_dir[] = {"edit_image", "edit_mask", nullptr};
443
444static int /*eContextResult*/ image_context(const bContext *C,
445 const char *member,
447{
449
450 if (CTX_data_dir(member)) {
452 // return CTX_RESULT_OK; /* TODO(@sybren). */
453 }
454 else if (CTX_data_equals(member, "edit_image")) {
455 CTX_data_id_pointer_set(result, id_cast<ID *>(ED_space_image(sima)));
456 return CTX_RESULT_OK;
457 }
458 else if (CTX_data_equals(member, "edit_mask")) {
460 if (mask) {
462 }
463 return CTX_RESULT_OK;
464 }
466}
467
481
495
497{
498 gzgt->name = "UV Transform Gizmo Resize";
499 gzgt->idname = "IMAGE_GGT_gizmo2d_resize";
500
503
506
508}
509
511{
512 gzgt->name = "UV Transform Gizmo Resize";
513 gzgt->idname = "IMAGE_GGT_gizmo2d_rotate";
514
517
520
522}
523
525{
526 ui::VIEW2D_GGT_navigate_impl(gzgt, "IMAGE_GGT_navigate");
527}
528
542
556
570
584
598
612
626
640
654
677
678/************************** main region ***************************/
679
680/* sets up the fields of the View2D from zoom and offset */
682{
683 Image *ima = ED_space_image(sima);
684
685 int width, height;
686 ED_space_image_get_size(sima, &width, &height);
687
688 float w = width;
689 float h = height;
690
691 if (ima) {
692 h *= ima->aspy / ima->aspx;
693 }
694
695 int winx = BLI_rcti_size_x(&region->winrct) + 1;
696 int winy = BLI_rcti_size_y(&region->winrct) + 1;
697
698 region->v2d.tot.xmin = 0;
699 region->v2d.tot.ymin = 0;
700 region->v2d.tot.xmax = w;
701 region->v2d.tot.ymax = h;
702
703 region->v2d.mask.xmin = region->v2d.mask.ymin = 0;
704 region->v2d.mask.xmax = winx;
705 region->v2d.mask.ymax = winy;
706
707 /* which part of the image space do we see? */
708 float x1 = region->winrct.xmin + (winx - sima->zoom * w) / 2.0f;
709 float y1 = region->winrct.ymin + (winy - sima->zoom * h) / 2.0f;
710
711 /* Add half pixel offsets and corrective translation to match image drawing logic exactly, see
712 * compute_screen_space_to_sampler_space_transformation for reference. */
713 const float2 corrective_translation = float2(std::numeric_limits<float>::epsilon() * 10e3f);
714 x1 -= sima->zoom * (sima->xof + 0.5f - corrective_translation.x);
715 y1 -= sima->zoom * (sima->yof + 0.5f - corrective_translation.y);
716
717 /* relative display right */
718 region->v2d.cur.xmin = ((region->winrct.xmin - x1) / sima->zoom);
719 region->v2d.cur.xmax = region->v2d.cur.xmin + (float(winx) / sima->zoom);
720
721 /* relative display left */
722 region->v2d.cur.ymin = ((region->winrct.ymin - y1) / sima->zoom);
723 region->v2d.cur.ymax = region->v2d.cur.ymin + (float(winy) / sima->zoom);
724
725 /* normalize 0.0..1.0 */
726 region->v2d.cur.xmin /= w;
727 region->v2d.cur.xmax /= w;
728 region->v2d.cur.ymin /= h;
729 region->v2d.cur.ymax /= h;
730}
731
732/* add handlers, stuff you only do once or on area/region changes */
734{
735 wmKeyMap *keymap;
736
737 /* NOTE: don't use `view2d_region_reinit(&region->v2d, ...)`
738 * since the space clip manages own v2d in #image_main_region_set_view2d */
739
740 /* mask polls mode */
741 keymap = WM_keymap_ensure(
742 wm->runtime->defaultconf, "Mask Editing", SPACE_EMPTY, RGN_TYPE_WINDOW);
744
745 /* image paint polls for mode */
746 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "Paint Curve", SPACE_EMPTY, RGN_TYPE_WINDOW);
748
749 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "Image Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
751
752 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "UV Editor", SPACE_EMPTY, RGN_TYPE_WINDOW);
754
755 /* own keymaps */
756 keymap = WM_keymap_ensure(
757 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
759 keymap = WM_keymap_ensure(wm->runtime->defaultconf, "Image", SPACE_IMAGE, RGN_TYPE_WINDOW);
761}
762
763static void image_main_region_draw(const bContext *C, ARegion *region)
764{
765 /* draw entirely, view changes should be handled here */
767 Object *obedit = CTX_data_edit_object(C);
768 Depsgraph *depsgraph = CTX_data_expect_evaluated_depsgraph(C);
769 Mask *mask = nullptr;
770 Scene *scene = CTX_data_scene(C);
771 View2D *v2d = &region->v2d;
772 Image *image = ED_space_image(sima);
773 /* Typically a render result or viewer image from the compositor. */
774 const bool show_viewer = (image && image->source == IMA_SRC_VIEWER);
775 const bool show_compositor_viewer = show_viewer && image->type == IMA_TYPE_COMPOSITE;
776
777 /* Text info and render region are only relevant for the compositor. */
778 const bool show_text_info = show_compositor_viewer &&
782 const bool show_render_region = show_compositor_viewer &&
786
787 /* XXX not supported yet, disabling for now */
788 scene->r.scemode &= ~R_COMP_CROP;
789
791
792 /* we set view2d from own zoom and offset each time */
793 image_main_region_set_view2d(sima, region);
794
795 /* check for mask (delay draw) */
796 if (!ED_space_image_show_uvedit(sima, obedit) && sima->mode == SI_MODE_MASK) {
798 }
799
800 if (show_viewer) {
802 }
804 if (show_viewer) {
806 }
807
808 if (show_render_region) {
809 int render_size_x, render_size_y;
810
811 BKE_render_resolution(&scene->r, true, &render_size_x, &render_size_y);
812
813 float zoomx, zoomy;
814 ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
815 int width, height;
816 ED_space_image_get_size(sima, &width, &height);
817 int center_x = width / 2;
818 int center_y = height / 2;
819
820 int x, y;
821 rcti render_region;
823 &render_region, center_x, render_size_x + center_x, center_y, render_size_y + center_y);
824 ui::view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
825
827 x, y, &render_region, zoomx, zoomy, sima->overlay.passepartout_alpha);
828 }
829
830 draw_image_main_helpers(C, region);
831
832 /* Draw Meta data of the image isn't added to the DrawManager as it is
833 * used in other areas as well. */
835 void *lock;
836 /* #ED_space_image_get_zoom temporarily locks the image, so this needs to be done before
837 * the image is locked when calling #ED_space_image_acquire_buffer. */
838 float zoomx, zoomy;
839 ED_space_image_get_zoom(sima, region, &zoomx, &zoomy);
840 ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0, false);
841 if (ibuf) {
842 int x, y;
843 rctf frame;
844 BLI_rctf_init(&frame, 0.0f, ibuf->x, 0.0f, ibuf->y);
845 ui::view2d_view_to_region(&region->v2d, 0.0f, 0.0f, &x, &y);
846 ED_region_image_metadata_draw(x, y, ibuf, &frame, zoomx, zoomy);
847 }
849 }
850
851 if (show_text_info) {
852
853 int render_size_x, render_size_y;
854 BKE_render_resolution(&scene->r, true, &render_size_x, &render_size_y);
855
856 /* Use same positioning convention as in 3D View. */
857 const rcti *rect = ED_region_visible_rect(region);
858 int xoffset = rect->xmin + (0.5f * U.widget_unit);
859 int yoffset = rect->ymax - (0.1f * U.widget_unit);
860
861 int viewer_size_x, viewer_size_y;
862 ED_space_image_get_size(sima, &viewer_size_x, &viewer_size_y);
863
865 render_size_x, render_size_y, viewer_size_x, viewer_size_y, xoffset, yoffset);
866 }
867
868 /* sample line */
872
873 if (mask) {
874 int width, height;
875 float aspx, aspy;
876
877 if (show_viewer) {
878 /* ED_space_image_get* will acquire image buffer which requires
879 * lock here by the same reason why lock is needed in draw_image_main
880 */
882 }
883
884 ED_space_image_get_size(sima, &width, &height);
885 ED_space_image_get_aspect(sima, &aspx, &aspy);
886
887 if (show_viewer) {
889 }
890
891 ED_mask_draw_region(depsgraph,
892 mask,
893 region, /* Mask overlay is drawn by image/overlay engine. */
899 width,
900 height,
901 aspx,
902 aspy,
903 true,
904 false,
905 nullptr,
906 C);
907 }
908 if ((sima->gizmo_flag & SI_GIZMO_HIDE) == 0) {
910 }
911 draw_image_cache(C, region);
912}
913
915{
916 ScrArea *area = params->area;
917 ARegion *region = params->region;
918 const wmNotifier *wmn = params->notifier;
919
920 /* context changes */
921 switch (wmn->category) {
922 case NC_GEOM:
923 if (ELEM(wmn->data, ND_DATA, ND_SELECT)) {
925 }
926 break;
927 case NC_GPENCIL:
928 if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
929 ED_region_tag_redraw(region);
930 }
931 else if (wmn->data & ND_GPENCIL_EDITMODE) {
932 ED_region_tag_redraw(region);
933 }
934 break;
935 case NC_IMAGE:
936 if (wmn->action == NA_PAINTING) {
937 ED_region_tag_redraw(region);
938 }
940 break;
941 case NC_MASK:
942 if (wmn->action == NA_EDITED) {
944 }
945 else if (ELEM(wmn->data, ND_DATA, ND_SELECT)) {
947 }
948 break;
949 case NC_MATERIAL:
950 if (wmn->data == ND_SHADING_LINKS) {
951 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
952
953 if (sima->iuser.scene &&
955 {
956 ED_region_tag_redraw(region);
957 }
958 }
959 break;
960 case NC_NODE:
961 if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
963 ED_region_tag_redraw(region);
964 }
965 break;
966 case NC_SCREEN:
967 if (ELEM(wmn->data, ND_LAYER)) {
968 ED_region_tag_redraw(region);
969 }
970 if (wmn->action == NA_EDITED) {
971 ED_region_tag_redraw(region);
972 }
973 break;
974 }
975}
976
977/* *********************** buttons region ************************ */
978
979/* add handlers, stuff you only do once or on area/region changes */
981{
982 wmKeyMap *keymap;
983
985 ED_region_panels_init(wm, region);
986
987 keymap = WM_keymap_ensure(
988 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
990}
991
992std::array<const char *, 4> ED_image_buttons_contexts(const bContext *C)
993{
994 const enum eContextObjectMode mode = CTX_data_mode_enum(C);
995 std::array<const char *, 4> contexts_base = {nullptr};
996
997 const char **contexts = contexts_base.data();
998
1000 switch (sima->mode) {
1001 case SI_MODE_VIEW:
1002 break;
1003 case SI_MODE_PAINT:
1004 ARRAY_SET_ITEMS(contexts, ".paint_common_2d", ".imagepaint_2d");
1005 break;
1006 case SI_MODE_MASK:
1007 break;
1008 case SI_MODE_UV:
1009 if (mode == CTX_MODE_EDIT_MESH) {
1010 ARRAY_SET_ITEMS(contexts, ".uv_sculpt");
1011 }
1012 break;
1013 }
1014 return contexts_base;
1015}
1016
1017static void image_buttons_region_layout(const bContext *C, ARegion *region)
1018{
1019 std::array<const char *, 4> contexts = ED_image_buttons_contexts(C);
1020
1022 region,
1023 &region->runtime->type->paneltypes,
1025 contexts.data(),
1026 nullptr);
1027}
1028
1029static void image_buttons_region_draw(const bContext *C, ARegion *region)
1030{
1032 Scene *scene = CTX_data_scene(C);
1033 /* XXX performance regression if name of scopes category changes! */
1034 PanelCategoryStack *category = ui::panel_category_active_find(region, "Scopes");
1035
1036 /* only update scopes if scope category is active */
1037 if (category) {
1038 /* TODO(lukas): Support tiles in scopes? */
1039 void *lock;
1040 ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock, 0, true);
1041 if (ibuf) {
1042 if (!sima->scopes.ok) {
1044 &sima->sample_line_hist, ibuf, &scene->view_settings, &scene->display_settings);
1045 }
1046 if (sima->image->flag & IMA_VIEW_AS_RENDER) {
1047 ED_space_image_scopes_update(C, sima, ibuf, true);
1048 }
1049 else {
1050 ED_space_image_scopes_update(C, sima, ibuf, false);
1051 }
1052 }
1054 }
1055
1056 /* Layout handles details. */
1057 ED_region_panels_draw(C, region);
1058}
1059
1061{
1062 ARegion *region = params->region;
1063 const wmNotifier *wmn = params->notifier;
1064
1065 /* context changes */
1066 switch (wmn->category) {
1067 case NC_TEXTURE:
1068 case NC_MATERIAL:
1069 /* sending by texture render job and needed to properly update displaying
1070 * brush texture icon */
1071 ED_region_tag_redraw(region);
1072 break;
1073 case NC_SCENE:
1074 switch (wmn->data) {
1075 case ND_MODE:
1076 case ND_RENDER_RESULT:
1077 case ND_COMPO_RESULT:
1078 ED_region_tag_redraw(region);
1079 break;
1080 }
1081 break;
1082 case NC_IMAGE:
1083 if (wmn->action != NA_PAINTING) {
1084 ED_region_tag_redraw(region);
1085 }
1086 break;
1087 case NC_NODE:
1088 ED_region_tag_redraw(region);
1089 break;
1090 case NC_GPENCIL:
1091 if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
1092 ED_region_tag_redraw(region);
1093 }
1094 break;
1095 case NC_BRUSH:
1096 if (wmn->action == NA_EDITED) {
1097 ED_region_tag_redraw(region);
1098 }
1099 break;
1100 }
1101}
1102
1103/* *********************** scopes region ************************ */
1104
1105/* add handlers, stuff you only do once or on area/region changes */
1107{
1108 wmKeyMap *keymap;
1109
1111 ED_region_panels_init(wm, region);
1112
1113 keymap = WM_keymap_ensure(
1114 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
1115 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
1116}
1117
1118static void image_tools_region_draw(const bContext *C, ARegion *region)
1119{
1120 ED_region_panels(C, region);
1121}
1122
1124{
1125 ARegion *region = params->region;
1126 const wmNotifier *wmn = params->notifier;
1127
1128 /* context changes */
1129 switch (wmn->category) {
1130 case NC_GPENCIL:
1131 if (wmn->data == ND_DATA || ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
1132 ED_region_tag_redraw(region);
1133 }
1134 break;
1135 case NC_BRUSH:
1136 /* NA_SELECTED is used on brush changes */
1137 if (ELEM(wmn->action, NA_EDITED, NA_SELECTED)) {
1138 ED_region_tag_redraw(region);
1139 }
1140 break;
1141 case NC_SCENE:
1142 switch (wmn->data) {
1143 case ND_MODE:
1144 case ND_RENDER_RESULT:
1145 case ND_COMPO_RESULT:
1146 ED_region_tag_redraw(region);
1147 break;
1148 }
1149 break;
1150 case NC_IMAGE:
1151 if (wmn->action != NA_PAINTING) {
1152 ED_region_tag_redraw(region);
1153 }
1154 break;
1155 case NC_NODE:
1156 ED_region_tag_redraw(region);
1157 break;
1158 }
1159}
1160
1161/************************* Tool header region **************************/
1162
1164{
1165 ScrArea *area = CTX_wm_area(C);
1166 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
1167
1169
1171 C,
1172 region,
1176}
1177
1178/************************* header region **************************/
1179
1180/* add handlers, stuff you only do once or on area/region changes */
1182{
1183 ED_region_header_init(region);
1184}
1185
1186static void image_header_region_draw(const bContext *C, ARegion *region)
1187{
1188 ScrArea *area = CTX_wm_area(C);
1189 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
1190
1192
1193 ED_region_header(C, region);
1194}
1195
1197{
1198 ARegion *region = params->region;
1199 const wmNotifier *wmn = params->notifier;
1200
1201 /* context changes */
1202 switch (wmn->category) {
1203 case NC_SCENE:
1204 switch (wmn->data) {
1205 case ND_MODE:
1206 case ND_TOOLSETTINGS:
1207 ED_region_tag_redraw(region);
1208 break;
1209 }
1210 break;
1211 case NC_GEOM:
1212 switch (wmn->data) {
1213 case ND_DATA:
1214 case ND_SELECT:
1215 ED_region_tag_redraw(region);
1216 break;
1217 }
1218 break;
1219 case NC_BRUSH:
1220 if (wmn->action == NA_EDITED) {
1221 ED_region_tag_redraw(region);
1222 }
1223 break;
1224 case NC_GPENCIL:
1225 if (wmn->data & ND_GPENCIL_EDITMODE) {
1226 ED_region_tag_redraw(region);
1227 }
1228 else if (wmn->action == NA_EDITED) {
1229 ED_region_tag_redraw(region);
1230 }
1231 break;
1232 }
1233}
1234
1235/* add handlers, stuff you only do once or on area/region changes */
1237{
1238 using namespace blender::ed;
1239 wmKeyMap *keymap = WM_keymap_ensure(
1240 wm->runtime->defaultconf, "Image Generic", SPACE_IMAGE, RGN_TYPE_WINDOW);
1241 WM_event_add_keymap_handler(&region->runtime->handlers, keymap);
1242
1244}
1245
1246static void image_id_remap(ScrArea * /*area*/,
1247 SpaceLink *slink,
1248 const bke::id::IDRemapper &mappings)
1249{
1250 SpaceImage *simg = reinterpret_cast<SpaceImage *>(slink);
1251
1253 return;
1254 }
1255
1256 mappings.apply(reinterpret_cast<ID **>(&simg->image), ID_REMAP_APPLY_ENSURE_REAL);
1257 mappings.apply(reinterpret_cast<ID **>(&simg->gpd), ID_REMAP_APPLY_UPDATE_REFCOUNT);
1258 mappings.apply(reinterpret_cast<ID **>(&simg->mask_info.mask), ID_REMAP_APPLY_ENSURE_REAL);
1259}
1260
1262{
1263 SpaceImage *simg = reinterpret_cast<SpaceImage *>(space_link);
1264 const int data_flags = BKE_lib_query_foreachid_process_flags_get(data);
1265 const bool is_readonly = (data_flags & IDWALK_READONLY) != 0;
1266
1273 if (!is_readonly) {
1274 simg->scopes.ok = 0;
1275 }
1276}
1277
1284{
1285 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
1286 return sima->mode == SI_MODE_UV ? SI_MODE_UV : SI_MODE_VIEW;
1287}
1288
1289static void image_space_subtype_set(ScrArea *area, int value)
1290{
1291 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
1292 if (value == SI_MODE_UV) {
1293 if (sima->mode != SI_MODE_UV) {
1294 sima->mode_prev = sima->mode;
1295 }
1296 sima->mode = eSpaceImage_Mode(value);
1297 }
1298 else {
1299 sima->mode = sima->mode_prev;
1300 }
1301}
1302
1304 EnumPropertyItem **item,
1305 int *totitem)
1306{
1308}
1309
1311{
1312 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
1314 if (index < 0) {
1316 }
1318 return item.name;
1319}
1320
1321static int image_space_icon_get(const ScrArea *area)
1322{
1323 SpaceImage *sima = area->spacedata.first_as<SpaceImage>();
1325 if (index < 0) {
1327 }
1329 return item.icon;
1330}
1331
1333{
1334 SpaceImage *sima = reinterpret_cast<SpaceImage *>(sl);
1335
1336 sima->iuser.scene = nullptr;
1337 sima->scopes.waveform_1 = nullptr;
1338 sima->scopes.waveform_2 = nullptr;
1339 sima->scopes.waveform_3 = nullptr;
1340 sima->scopes.vecscope = nullptr;
1341 sima->scopes.vecscope_rgb = nullptr;
1342 sima->scopes.ok = 0;
1343
1344/* WARNING: gpencil data is no longer stored directly in sima after 2.5
1345 * so sacrifice a few old files for now to avoid crashes with new files!
1346 * committed: r28002 */
1347#if 0
1348 sima->gpd = newdataadr(fd, sima->gpd);
1349 if (sima->gpd) {
1351 }
1352#endif
1353}
1354
1356{
1357 writer->write_struct_cast<SpaceImage>(sl);
1358}
1359
1360/**************************** spacetype *****************************/
1361
1363{
1364 using namespace blender::ed;
1365 std::unique_ptr<SpaceType> st = std::make_unique<SpaceType>();
1366 ARegionType *art;
1367
1368 st->spaceid = SPACE_IMAGE;
1369 STRNCPY_UTF8(st->name, "Image");
1370 st->struct_size = sizeof(SpaceImage);
1371
1372 st->create = image_create;
1373 st->free = image_free;
1374 st->init = image_init;
1375 st->duplicate = image_duplicate;
1376 st->operatortypes = image_operatortypes;
1377 st->keymap = image_keymap;
1378 st->dropboxes = image_dropboxes;
1379 st->refresh = image_refresh;
1380 st->listener = image_listener;
1381 st->context = image_context;
1382 st->gizmos = image_widgets;
1383 st->id_remap = image_id_remap;
1384 st->foreach_id = image_foreach_id;
1385 st->space_subtype_item_extend = image_space_subtype_item_extend;
1386 st->space_subtype_get = image_space_subtype_get;
1387 st->space_subtype_set = image_space_subtype_set;
1388 st->space_name_get = image_space_name_get;
1389 st->space_icon_get = image_space_icon_get;
1390 st->blend_read_data = image_space_blend_read_data;
1391 st->blend_read_after_liblink = nullptr;
1392 st->blend_write = image_space_blend_write;
1393
1394 /* regions: main window */
1395 art = MEM_new_zeroed<ARegionType>("spacetype image region");
1402 BLI_addhead(&st->regiontypes, art);
1403
1404 /* regions: list-view/buttons/scopes */
1405 art = MEM_new_zeroed<ARegionType>("spacetype image region");
1406 art->regionid = RGN_TYPE_UI;
1416 BLI_addhead(&st->regiontypes, art);
1417
1420
1421 /* regions: tool(bar) */
1422 art = MEM_new_zeroed<ARegionType>("spacetype image region");
1423 art->regionid = RGN_TYPE_TOOLS;
1424 art->prefsizex = int(UI_TOOLBAR_WIDTH);
1425 art->prefsizey = 50; /* XXX */
1432 BLI_addhead(&st->regiontypes, art);
1433
1434 /* regions: tool header */
1435 art = MEM_new_zeroed<ARegionType>("spacetype image tool header region");
1437 art->prefsizey = HEADERY;
1443 BLI_addhead(&st->regiontypes, art);
1444
1445 /* regions: header */
1446 art = MEM_new_zeroed<ARegionType>("spacetype image region");
1448 art->prefsizey = HEADERY;
1453
1454 BLI_addhead(&st->regiontypes, art);
1455
1456 /* regions: asset shelf */
1457 art = MEM_new_zeroed<ARegionType>("spacetype image asset shelf region");
1472 BLI_addhead(&st->regiontypes, art);
1473
1474 /* regions: asset shelf header */
1475 art = MEM_new_zeroed<ARegionType>("spacetype image asset shelf header region");
1483 BLI_addhead(&st->regiontypes, art);
1485
1486 /* regions: hud */
1487 art = ui::ED_area_type_hud(st->spaceid);
1488 BLI_addhead(&st->regiontypes, art);
1489
1490 BKE_spacetype_register(std::move(st));
1491}
1492
1493} // namespace blender
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
#define STRNCPY_UTF8(dst, src)
#define FILTER_ID_GD_LEGACY
Definition DNA_ID.h:1204
#define FILTER_ID_MSK
Definition DNA_ID.h:1214
#define FILTER_ID_IM
Definition DNA_ID.h:1206
Object is a sort of wrapper for general info.
#define HEADERY
#define RGN_ALIGN_ENUM_FROM_MASK(align)
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define UI_SIDEBAR_PANEL_WIDTH
#define UI_TOOLBAR_WIDTH
#define NS_EDITMODE_MESH
Definition WM_types.hh:612
#define NC_WINDOW
Definition WM_types.hh:388
#define NC_ID
Definition WM_types.hh:408
#define NC_NODE
Definition WM_types.hh:407
#define NC_GEOM
Definition WM_types.hh:406
#define ND_DRAW
Definition WM_types.hh:502
#define NC_BRUSH
Definition WM_types.hh:398
#define ND_OB_ACTIVE
Definition WM_types.hh:459
#define ND_RENDER_RESULT
Definition WM_types.hh:465
#define NC_WM
Definition WM_types.hh:387
#define ND_DATA
Definition WM_types.hh:552
#define ND_GPENCIL_EDITMODE
Definition WM_types.hh:547
#define ND_RENDER_OPTIONS
Definition WM_types.hh:454
#define ND_COMPO_RESULT
Definition WM_types.hh:466
#define NC_SCREEN
Definition WM_types.hh:390
#define ND_MODE
Definition WM_types.hh:464
#define ND_OB_SELECT
Definition WM_types.hh:461
#define NC_SCENE
Definition WM_types.hh:391
#define ND_TOOLSETTINGS
Definition WM_types.hh:468
#define ND_MODIFIER
Definition WM_types.hh:503
#define ND_SPACE_IMAGE
Definition WM_types.hh:565
#define NA_EDITED
Definition WM_types.hh:634
#define NC_MATERIAL
Definition WM_types.hh:393
#define NC_IMAGE
Definition WM_types.hh:397
#define ND_UNDO
Definition WM_types.hh:433
#define ND_FRAME
Definition WM_types.hh:453
#define ND_SELECT
Definition WM_types.hh:551
#define NC_GPENCIL
Definition WM_types.hh:412
#define NC_TEXTURE
Definition WM_types.hh:394
#define ND_TRANSFORM
Definition WM_types.hh:475
#define ND_LAYER
Definition WM_types.hh:469
#define NC_MASK
Definition WM_types.hh:411
#define NA_RENAME
Definition WM_types.hh:638
#define NA_PAINTING
Definition WM_types.hh:641
#define NC_OBJECT
Definition WM_types.hh:392
#define ND_SHADING_LINKS
Definition WM_types.hh:522
#define NC_SPACE
Definition WM_types.hh:405
#define NA_SELECTED
Definition WM_types.hh:639
volatile int lock
#define ARRAY_SET_ITEMS(...)
#define SET_FLAG_FROM_TEST(value, test, flag)
#define ELEM(...)
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
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)
bool split_poll_space_image(const bContext *C, wmGizmoGroupType *)
void split_setup(const bContext *, wmGizmoGroup *gzgroup)
void split_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void box_mask_refresh(const bContext *C, wmGizmoGroup *gzgroup)
bool crop_poll_space_image(const bContext *C, wmGizmoGroupType *)
void translate_setup(const bContext *, wmGizmoGroup *gzgroup)
void glare_draw_prepare_space_image(const bContext *C, wmGizmoGroup *gzgroup)
void corner_pin_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void glare_setup(const bContext *, wmGizmoGroup *gzgroup)
bool box_mask_poll_space_image(const bContext *C, wmGizmoGroupType *)
void box_mask_setup(const bContext *, wmGizmoGroup *gzgroup)
bool glare_poll_space_image(const bContext *C, wmGizmoGroupType *)
void transform_setup(const bContext *, wmGizmoGroup *gzgroup)
void transform_refresh(const bContext *C, wmGizmoGroup *gzgroup)
bool translate_poll_space_image(const bContext *C, wmGizmoGroupType *)
void bbox_draw_prepare_space_image(const bContext *C, wmGizmoGroup *gzgroup)
bool transform_poll_space_image(const bContext *C, wmGizmoGroupType *)
void corner_pin_setup(const bContext *, wmGizmoGroup *gzgroup)
void ellipse_mask_setup(const bContext *, wmGizmoGroup *gzgroup)
void translate_refresh(const bContext *C, wmGizmoGroup *gzgroup)
bool ellipse_mask_poll_space_image(const bContext *C, wmGizmoGroupType *)
void corner_pin_draw_prepare_space_image(const bContext *C, wmGizmoGroup *gzgroup)
void crop_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void scale_refresh(const bContext *C, wmGizmoGroup *gzgroup)
void glare_refresh(const bContext *C, wmGizmoGroup *gzgroup)
bool scale_poll_space_image(const bContext *C, wmGizmoGroupType *)
void crop_setup(const bContext *, wmGizmoGroup *gzgroup)
bool corner_pin_poll_space_image(const bContext *C, wmGizmoGroupType *)
void scale_setup(const bContext *, wmGizmoGroup *gzgroup)
void view2d_view_ortho(const View2D *v2d)
Definition view2d.cc:1080
void view2d_view_restore(const bContext *C)
Definition view2d.cc:1147
ARegionType * ED_area_type_hud(int space_type)
void view2d_view_to_region(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
Definition view2d.cc:1705
PanelCategoryStack * panel_category_active_find(ARegion *region, const char *idname)
void VIEW2D_GGT_navigate_impl(wmGizmoGroupType *gzgt, const char *idname)
BMesh Iterators.
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
UserDef U
Definition blender.cc:58
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
static void image_widgets()
void IMAGE_OT_rotate_orthogonal(wmOperatorType *ot)
static void image_header_region_draw(const bContext *C, ARegion *region)
ScrArea * CTX_wm_area(const bContext *C)
void DRW_draw_view(const bContext *C)
static int image_context(const bContext *C, const char *member, bContextDataResult *result)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void IMAGE_OT_tile_remove(wmOperatorType *ot)
void IMAGE_OT_view_pan(wmOperatorType *ot)
Definition image_ops.cc:519
void draw_image_cache(const bContext *C, ARegion *region)
Scene * CTX_data_sequencer_scene(const bContext *C)
static SpaceLink * image_create(const ScrArea *, const Scene *)
static void IMAGE_GGT_navigate(wmGizmoGroupType *gzgt)
void ED_region_generic_tools_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
Definition area_utils.cc:30
void ED_space_image_auto_set(const bContext *C, SpaceImage *sima)
void CTX_data_dir_set(bContextDataResult *result, const char **dir)
void IMAGE_OT_view_zoom_border(wmOperatorType *ot)
static int image_space_subtype_get(ScrArea *area)
void ED_space_image_get_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy)
void IMAGE_OT_replace(wmOperatorType *ot)
void IMAGE_OT_read_viewlayers(wmOperatorType *ot)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:98
@ REGION_DRAW_LOCK_BAKING
bool ED_space_image_check_show_maskedit(SpaceImage *sima, Object *obedit)
@ RGN_TYPE_ASSET_SHELF_HEADER
static void image_free(SpaceLink *sl)
void IMAGE_OT_clipboard_copy(wmOperatorType *ot)
static void image_tools_header_region_draw(const bContext *C, ARegion *region)
void ED_uvedit_buttons_register(ARegionType *art)
void IMAGE_OT_sample(wmOperatorType *ot)
const char * image_context_dir[]
void ED_spacetype_image()
static void image_buttons_region_init(wmWindowManager *wm, ARegion *region)
static void image_space_blend_read_data(BlendDataReader *, SpaceLink *sl)
ImBuf * ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock, int tile, const bool ensure_host_buffer)
void IMAGE_OT_view_all(wmOperatorType *ot)
Definition image_ops.cc:936
void IMAGE_OT_clear_render_border(wmOperatorType *ot)
void ED_region_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:953
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height)
void draw_image_main_helpers(const bContext *C, ARegion *region)
void IMAGE_OT_invert(wmOperatorType *ot)
static void image_keymap(wmKeyConfig *keyconf)
void IMAGE_OT_view_center_cursor(wmOperatorType *ot)
static void IMAGE_GGT_compositor_ellipse_mask(wmGizmoGroupType *gzgt)
static void IMAGE_GGT_gizmo2d_rotate(wmGizmoGroupType *gzgt)
@ LOCK_DRAW_IMAGE
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
static void IMAGE_GGT_compositor_corner_pin(wmGizmoGroupType *gzgt)
static void IMAGE_GGT_gizmo2d_translate(wmGizmoGroupType *gzgt)
@ SI_OVERLAY_SHOW_OVERLAYS
@ SI_OVERLAY_SHOW_GRID_BACKGROUND
@ SI_OVERLAY_DRAW_TEXT_INFO
@ SI_OVERLAY_DRAW_RENDER_REGION
static void * newdataadr(FileData *fd, const void *adr, int64_t *r_alloc_len=nullptr)
Definition readfile.cc:1503
const rcti * ED_region_visible_rect(ARegion *region)
Definition area.cc:4791
void IMAGE_OT_view_selected(wmOperatorType *ot)
bool CTX_data_equals(const char *member, const char *str)
void WM_gizmomap_tag_refresh(wmGizmoMap *gzmap)
void image_buttons_register(ARegionType *art)
static void image_init(Image *ima, eImageSource source, eImageType type)
ViewLayer * WM_window_get_active_view_layer(const wmWindow *win)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:681
void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock)
void IMAGE_OT_view_cursor_center(wmOperatorType *ot)
Definition image_ops.cc:982
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
Definition lib_query.cc:133
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
@ CTX_MODE_EDIT_MESH
static void IMAGE_GGT_gizmo2d(wmGizmoGroupType *gzgt)
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
Definition scene.cc:3168
static void image_space_subtype_item_extend(bContext *, EnumPropertyItem **item, int *totitem)
void ED_paint_cursor_start(Paint *paint, bool(*poll)(bContext *C))
@ RGN_ALIGN_HIDE_WITH_PREV
static void image_listener(const wmSpaceTypeListenerParams *params)
static void image_foreach_id(SpaceLink *space_link, LibraryForeachIDData *data)
void CTX_data_id_pointer_set(bContextDataResult *result, ID *id)
static void image_operatortypes()
void IMAGE_OT_clipboard_paste(wmOperatorType *ot)
static StringRefNull image_space_name_get(const ScrArea *area)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
Definition BLI_rect.hh:207
void IMAGE_OT_sample_line(wmOperatorType *ot)
void IMAGE_OT_flip(wmOperatorType *ot)
void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
wmEventHandler_Dropbox * WM_event_add_dropbox_handler(ListBaseT< wmEventHandler > *handlers, ListBaseT< wmDropBox > *dropboxes)
Scene * WM_window_get_active_scene(const wmWindow *win)
VecBase< float, 2 > float2
void IMAGE_OT_open(wmOperatorType *ot)
bool ED_space_image_show_render(const SpaceImage *sima)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
int ED_region_generic_panel_region_snap_size(const ARegion *region, int size, int axis)
Definition area_utils.cc:73
wmGizmoGroupTypeRef * WM_gizmogrouptype_append_and_link(wmGizmoMapType *gzmap_type, void(*wtfunc)(wmGizmoGroupType *))
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
static void image_buttons_region_layout(const bContext *C, ARegion *region)
Object * BKE_view_layer_edit_object_get(const ViewLayer *view_layer)
BMesh const char void * data
wmEventHandler_Keymap * WM_event_add_keymap_handler_v2d_mask(ListBaseT< wmEventHandler > *handlers, wmKeyMap *keymap)
void IMAGE_OT_add_render_slot(wmOperatorType *ot)
void ED_region_header_with_button_sections(const bContext *C, ARegion *region, ui::ButtonSectionsAlign align)
Definition area.cc:4398
static void image_scopes_tag_refresh(ScrArea *area)
static void image_space_blend_write(BlendWriter *writer, SpaceLink *sl)
Object * CTX_data_edit_object(const bContext *C)
static void image_space_subtype_set(ScrArea *area, int value)
const EnumPropertyItem rna_enum_space_image_mode_items[]
Definition rna_space.cc:329
static void image_header_region_listener(const wmRegionListenerParams *params)
void ED_region_panels(const bContext *C, ARegion *region)
Definition area.cc:3999
static void IMAGE_GGT_compositor_scale(wmGizmoGroupType *gzgt)
static void image_dropboxes()
static void IMAGE_GGT_compositor_split(wmGizmoGroupType *gzgt)
void IMAGE_OT_file_browse(wmOperatorType *ot)
void BKE_annotations_blend_read_data(struct BlendDataReader *reader, struct bGPdata *gpd)
static void image_user_refresh_scene(const bContext *C, SpaceImage *sima)
static void image_main_region_set_view2d(SpaceImage *sima, ARegion *region)
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
void IMAGE_OT_save_as(wmOperatorType *ot)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:935
void BKE_scopes_free(Scopes *scopes)
void ED_region_image_metadata_draw(int x, int y, const ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy)
Definition ed_draw.cc:1039
void draw_image_sample_line(SpaceImage *sima)
void ED_area_do_mgs_subscribe_for_tool_ui(const wmRegionMessageSubscribeParams *params)
Definition area.cc:442
wmEventHandler_Keymap * WM_event_add_keymap_handler(ListBaseT< wmEventHandler > *handlers, wmKeyMap *keymap)
void IMAGE_OT_tile_add(wmOperatorType *ot)
ARegion * BKE_area_region_new()
Definition screen.cc:522
int ED_region_generic_tools_region_snap_size(const ARegion *region, int size, int axis)
Definition area_utils.cc:42
@ MASK_DRAWFLAG_OVERLAY
void ED_region_panels_layout_ex(const bContext *C, ARegion *region, ListBaseT< PanelType > *paneltypes, wm::OpCallContext op_context, const char *contexts[], const char *category_override)
Definition area.cc:3524
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.hh:203
static SpaceLink * image_duplicate(SpaceLink *sl)
bool CTX_data_dir(const char *member)
static void image_header_region_init(wmWindowManager *, ARegion *region)
static void IMAGE_GGT_gizmo2d_resize(wmGizmoGroupType *gzgt)
@ ED_KEYMAP_UI
Definition ED_screen.hh:852
@ ED_KEYMAP_FOOTER
Definition ED_screen.hh:859
@ ED_KEYMAP_HEADER
Definition ED_screen.hh:858
@ ED_KEYMAP_GPENCIL
Definition ED_screen.hh:860
@ ED_KEYMAP_TOOL
Definition ED_screen.hh:854
@ ED_KEYMAP_ASSET_SHELF
Definition ED_screen.hh:862
@ ED_KEYMAP_VIEW2D
Definition ED_screen.hh:855
@ ED_KEYMAP_FRAMES
Definition ED_screen.hh:857
@ ED_KEYMAP_GIZMO
Definition ED_screen.hh:853
void ED_space_image_scopes_update(const bContext *C, SpaceImage *sima, ImBuf *ibuf, bool use_view_settings)
static void image_id_remap(ScrArea *, SpaceLink *slink, const bke::id::IDRemapper &mappings)
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition rct.cc:428
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL
@ WM_GIZMOGROUPTYPE_PERSISTENT
@ WM_GIZMOGROUPTYPE_DELAY_REFRESH_FOR_TWEAK
@ WM_GIZMOGROUPTYPE_TOOL_FALLBACK_KEYMAP
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE
void IMAGE_OT_tile_fill(wmOperatorType *ot)
void IMAGE_OT_remove_render_slot(wmOperatorType *ot)
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
Definition screen.cc:1024
SpaceImage * CTX_wm_space_image(const bContext *C)
@ V2D_SCROLL_VERTICAL_HIDE
void IMAGE_OT_save_all_modified(wmOperatorType *ot)
void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
void IMAGE_OT_unpack(wmOperatorType *ot)
void IMAGE_OT_view_zoom(wmOperatorType *ot)
Definition image_ops.cc:818
void IMAGE_OT_curves_point_set(wmOperatorType *ot)
static void image_main_region_listener(const wmRegionListenerParams *params)
Depsgraph * CTX_data_expect_evaluated_depsgraph(const bContext *C)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
@ IMA_SHOW_SEQUENCER_SCENE
void BKE_scopes_new(Scopes *scopes)
static void image_tools_region_init(wmWindowManager *wm, ARegion *region)
static void image_tools_region_listener(const wmRegionListenerParams *params)
void BKE_spacetype_register(std::unique_ptr< SpaceType > st)
Definition screen.cc:379
void WM_gizmomap_draw(wmGizmoMap *gzmap, const bContext *C, const eWM_GizmoFlagMapDrawStep drawstep)
void IMAGE_OT_render_border(wmOperatorType *ot)
void IMAGE_OT_change_frame(wmOperatorType *ot)
void ED_region_header_init(ARegion *region)
Definition area.cc:4406
static int image_space_icon_get(const ScrArea *area)
bool ED_image_tools_paint_poll(bContext *C)
wmGizmoMapType * WM_gizmomaptype_ensure(const wmGizmoMapType_Params *gzmap_params)
void IMAGE_OT_clear_render_slot(wmOperatorType *ot)
void IMAGE_OT_reload(wmOperatorType *ot)
void ED_space_image_get_zoom(SpaceImage *sima, const ARegion *region, float *r_zoomx, float *r_zoomy)
static void image_tools_region_draw(const bContext *C, ARegion *region)
Scene * CTX_data_scene(const bContext *C)
static void IMAGE_GGT_compositor_transform(wmGizmoGroupType *gzgt)
wmKeyMap * WM_gizmogroup_setup_keymap_generic_maybe_drag(const wmGizmoGroupType *, wmKeyConfig *kc)
void ED_area_do_mgs_subscribe_for_tool_header(const wmRegionMessageSubscribeParams *params)
Definition area.cc:427
@ RGN_FLAG_HIDDEN_BY_USER
void ED_area_tag_refresh(ScrArea *area)
Definition area.cc:813
@ CTX_RESULT_MEMBER_NOT_FOUND
static void image_asset_shelf_region_init(wmWindowManager *wm, ARegion *region)
void IMAGE_OT_match_movie_length(wmOperatorType *ot)
static void image_buttons_region_draw(const bContext *C, ARegion *region)
@ ID_REMAP_APPLY_ENSURE_REAL
@ ID_REMAP_APPLY_UPDATE_REFCOUNT
@ IDWALK_CB_DIRECT_WEAK_LINK
ListBaseT< wmDropBox > * WM_dropboxmap_find(const char *idname, int spaceid, int regionid)
void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
void IMAGE_OT_resize(wmOperatorType *ot)
void BLI_thread_unlock(int type)
Definition threads.cc:336
void BKE_imageuser_default(ImageUser *iuser)
static void image_main_region_init(wmWindowManager *wm, ARegion *region)
void ED_region_header(const bContext *C, ARegion *region)
Definition area.cc:4391
static void image_refresh(const bContext *C, ScrArea *area)
@ UV_FLAG_SHOW_SAME_IMAGE
void ED_region_panels_draw(const bContext *C, ARegion *region)
Definition area.cc:3916
void ED_region_panels_init(wmWindowManager *wm, ARegion *region)
Definition area.cc:4006
void ED_mask_draw_region(Depsgraph *depsgraph, Mask *mask, ARegion *region, bool show_overlays, MaskDrawFlag draw_flag, MaskDrawType draw_type, MaskOverlayMode 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:642
Image * ED_space_image(const SpaceImage *sima)
Definition image_edit.cc:43
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit)
static void IMAGE_GGT_compositor_glare(wmGizmoGroupType *gzgt)
void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
static void IMAGE_GGT_compositor_translate(wmGizmoGroupType *gzgt)
static void IMAGE_GGT_compositor_box_mask(wmGizmoGroupType *gzgt)
void ED_region_render_region_draw(int x, int y, const rcti *frame, float zoomx, float zoomy, float passepartout_alpha)
Definition ed_draw.cc:991
void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
static void IMAGE_GGT_compositor_crop(wmGizmoGroupType *gzgt)
void IMAGE_OT_new(wmOperatorType *ot)
void BLI_thread_lock(int type)
Definition threads.cc:331
static void image_main_region_draw(const bContext *C, ARegion *region)
wmGizmoGroupType * WM_gizmogrouptype_append(void(*wtfunc)(wmGizmoGroupType *))
Mask * ED_space_image_get_mask(const SpaceImage *sima)
@ WM_GIZMOMAP_DRAWSTEP_2D
static void image_buttons_region_listener(const wmRegionListenerParams *params)
void IMAGE_OT_pack(wmOperatorType *ot)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
Definition rct.cc:418
void ED_area_tag_redraw(ScrArea *area)
Definition area.cc:784
Scene * ED_render_job_get_current_scene(const bContext *C)
std::array< const char *, 4 > ED_image_buttons_contexts(const bContext *C)
void IMAGE_OT_save(wmOperatorType *ot)
void IMAGE_OT_save_sequence(wmOperatorType *ot)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
void(*) on_user_resize(const ARegion *region)
ARegionTypeFlag flag
int(*) snap_size(const ARegion *region, int size, int axis)
void *(*) duplicate(void *poin)
void(*) on_poll_success(const bContext *C, ARegion *region)
void(*) message_subscribe(const wmRegionMessageSubscribeParams *params)
bContextDataCallback context
void(*) free(ARegion *)
void(*) draw(const bContext *C, ARegion *region)
void(*) listener(const wmRegionListenerParams *params)
void(*) layout(const bContext *C, ARegion *region)
bool(*) poll(const RegionPollParams *params)
ListBaseT< PanelType > paneltypes
void(*) init(wmWindowManager *wm, ARegion *region)
bke::ARegionRuntime * runtime
eRegion_Alignment alignment
eRegion_Type regiontype
void write_struct_cast(const void *data, BlendStructWriterTypedFn< T > fn=nullptr)
eImageUser_Flag flag
struct Scene * scene
MaskOverlayMode overlay_mode
ColorManagedViewSettings view_settings
ColorManagedDisplaySettings display_settings
struct RenderData r
struct ToolSettings * toolsettings
ListBaseT< struct wmEventHandler > handlers
ListBaseT< ARegion > regionbase
ListBaseT< SpaceLink > spacedata
eSpaceImageOverlay_Flag flag
eSpaceImage_Gizmo_Flag gizmo_flag
MaskSpaceInfo mask_info
struct ImageUser iuser
SpaceImageOverlay overlay
struct Histogram sample_line_hist
ListBaseT< ARegion > regionbase
eSpaceImage_Mode mode_prev
struct bGPdata * gpd
eSpaceImage_Mode mode
eSpaceImage_Flag flag
struct ImagePaintSettings imapaint
eView2D_Scroll scroll
ListBaseT< wmEventHandler > handlers
struct ARegionType * type
wmGizmoGroupFnRefresh refresh
wmGizmoGroupFnSetupKeymap setup_keymap
wmGizmoMapType_Params gzmap_params
wmGizmoGroupFnDrawPrepare draw_prepare
eWM_GizmoFlagGroupTypeFlag flag
unsigned int action
Definition WM_types.hh:371
unsigned int subtype
Definition WM_types.hh:371
unsigned int category
Definition WM_types.hh:371
unsigned int data
Definition WM_types.hh:371