70#include "RNA_prototypes.hh"
101 SpaceImage *sima,
ARegion *region,
float zoom,
const float location[2],
const bool zoom_to_pos)
103 float oldzoom = sima->
zoom;
115 const float sima_minzoom_image_over_screen = 1.0f / 100.0f;
116 const float sima_maxzoom_pixel_over_screen = 10.0f / 1.0f;
119 float comp_image = std::max(width, height);
122 if (comp_image * sima->
zoom < comp_screen * sima_minzoom_image_over_screen &&
123 sima->
zoom < oldzoom)
125 sima->
zoom = oldzoom;
128 else if (comp_screen * sima_maxzoom_pixel_over_screen <= sima->zoom && sima->
zoom > oldzoom) {
129 sima->
zoom = oldzoom;
132 if (zoom_to_pos && location) {
133 float aspx, aspy,
w, h;
141 sima->
xof += ((location[0] - 0.5f) *
w - sima->
xof) * (sima->
zoom - oldzoom) / sima->
zoom;
142 sima->
yof += ((location[1] - 0.5f) * h - sima->
yof) * (sima->
zoom - oldzoom) / sima->
zoom;
147 ima->runtime->view_zoom = sima->
zoom;
148 ima->runtime->view_offset[0] = sima->
xof;
149 ima->runtime->view_offset[1] = sima->
yof;
156 const float location[2],
157 const bool zoom_to_pos)
173 image_size[0] = image_size[0] * aspx;
174 image_size[1] = image_size[1] * aspy;
180 float size_xy[2], size;
184 size =
min_ff(size_xy[0], size_xy[1]);
202 return (sima) ? sima->
image :
nullptr;
218 return (sima) ? &sima->
iuser :
nullptr;
227 iuser = *iuser_context;
237 iuser.
tile = active ? active->
tile_number : (ima->tiles.first())->tile_number;
248 if (ima ==
nullptr) {
280 return (ima && ima->packedfiles.is_empty());
285 float aspx, aspy, zoomx, zoomy,
w, h;
295 float xof = 0.0f, yof = 0.0f;
298 int x_tiles, y_tiles;
299 if (sima->
image ==
nullptr) {
304 x_tiles = y_tiles = 1;
306 int tile_x = (
tile.tile_number - 1001) % 10;
307 int tile_y = (
tile.tile_number - 1001) / 10;
308 x_tiles =
max_ii(x_tiles, tile_x + 1);
309 y_tiles =
max_ii(y_tiles, tile_y + 1);
312 xof = 0.5f * (x_tiles - 1.0f) *
w;
313 yof = 0.5f * (y_tiles - 1.0f) * h;
323 const int margin = 5;
325 zoomx =
float(width) / (
w + 2 * margin);
326 zoomy =
float(height) / (h + 2 * margin);
331 if ((
w >= width || h >= height) && (width > 0 && height > 0)) {
333 zoomy =
float(height) / h;
348 ima->runtime->view_zoom = sima->
zoom;
349 ima->runtime->view_offset[0] = sima->
xof;
350 ima->runtime->view_offset[1] = sima->
yof;
357 if (sima ==
nullptr) {
366 if (sima ==
nullptr) {
380 if (sima ==
nullptr) {
420 if (vpd->own_cursor) {
424 vpd->x =
event->xy[0];
425 vpd->y =
event->xy[1];
426 vpd->xof = sima->
xof;
427 vpd->yof = sima->
yof;
436 ViewPanData *vpd =
static_cast<ViewPanData *
>(op->
customdata);
439 sima->
xof = vpd->xof;
440 sima->
yof = vpd->yof;
444 if (vpd->own_cursor) {
456 sima->
xof += offset[0];
457 sima->
yof += offset[1];
463 ima->runtime->view_offset[0] = sima->
xof;
464 ima->runtime->view_offset[1] = sima->
yof;
476 offset[0] = (
event->prev_xy[0] -
event->xy[0]) / sima->
zoom;
477 offset[1] = (
event->prev_xy[1] -
event->xy[1]) / sima->
zoom;
491 ViewPanData *vpd =
static_cast<ViewPanData *
>(op->
customdata);
494 switch (event->
type) {
496 sima->
xof = vpd->xof;
497 sima->
yof = vpd->yof;
498 offset[0] = (vpd->x -
event->xy[0]) / sima->
zoom;
499 offset[1] = (vpd->y -
event->xy[1]) / sima->
zoom;
522 ot->
name =
"Pan View";
523 ot->
idname =
"IMAGE_OT_view_pan";
544 "Offset in floating-point units, 1.0 is the width and height of the image",
566 double timer_lastdraw;
588 if (vpd->own_cursor) {
592 vpd->origx =
event->xy[0];
593 vpd->origy =
event->xy[1];
594 vpd->zoom = sima->
zoom;
599 ®ion->
v2d, event->
mval[0], event->
mval[1], &vpd->location[0], &vpd->location[1]);
609 vpd->region = region;
617 ViewZoomData *vpd =
static_cast<ViewZoomData *
>(op->
customdata);
620 sima->
zoom = vpd->zoom;
631 if (vpd->own_cursor) {
660 float delta, factor, location[2];
663 ®ion->
v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
665 delta =
event->prev_xy[0] -
event->xy[0] +
event->prev_xy[1] -
event->xy[1];
671 factor = 1.0f + delta / 300.0f;
692 const short viewzoom,
693 const short zoom_invert,
694 const bool zoom_to_pos,
696 const bool precision)
703 delta =
float(
x - vpd->origx);
706 delta =
float(
y - vpd->origy);
710 delta =
x - vpd->origx +
y - vpd->origy;
713 delta /=
U.pixelsize;
725 float time_step =
float(time - vpd->timer_lastdraw);
727 zfac = 1.0f + ((delta / 20.0f) * time_step);
728 vpd->timer_lastdraw = time;
730 factor = (vpd->sima->zoom * zfac) / vpd->zoom;
733 factor = 1.0f + delta / 300.0f;
736 float zoom = vpd->zoom * factor;
738 zoom =
round(zoom * 10.0f) / 10.0f;
742 SNPRINTF(
str,
"%4.2f%%", vpd->sima->zoom * 100.0f);
751 sima_zoom_set(vpd->sima, vpd->region, zoom, vpd->location, zoom_to_pos);
757 ViewZoomData *vpd =
static_cast<ViewZoomData *
>(op->
customdata);
771 else if (event->
type == vpd->launch_event) {
779 vpd->snap = (
event->val ==
KM_PRESS);
782 switch (event_code) {
823 ot->
name =
"Zoom View";
824 ot->
idname =
"IMAGE_OT_view_zoom";
844 "Zoom factor, values higher than 1.0 zoom in, lower values zoom out",
854#ifdef WITH_INPUT_NDOF
868 const wmEvent *event)
877 const wmNDOFMotionData &ndof = *
static_cast<const wmNDOFMotionData *
>(
event->customdata);
880 float3 pan_vec = ndof.time_delta * WM_event_ndof_translation_get_for_navigation(ndof);
882 mul_v2_fl(pan_vec, pan_speed / sima->zoom);
885 sima->xof += pan_vec[0];
886 sima->yof += pan_vec[1];
896 ot->name =
"NDOF Pan/Zoom";
897 ot->idname =
"IMAGE_OT_view_ndof";
898 ot->description =
"Use a 3D mouse device to pan/zoom the view";
901 ot->invoke = image_view_ndof_invoke;
941 ot->
name =
"Frame All";
942 ot->
idname =
"IMAGE_OT_view_all";
953 prop =
RNA_def_boolean(ot->
srna,
"fit_view",
false,
"Fit View",
"Fit frame to the viewport");
987 ot->
name =
"Cursor To Center View";
988 ot->
description =
"Set 2D cursor to center view location";
989 ot->
idname =
"IMAGE_OT_view_cursor_center";
996 prop =
RNA_def_boolean(ot->
srna,
"fit_view",
false,
"Fit View",
"Fit frame to the viewport");
1021 ot->
name =
"Center View to Cursor";
1022 ot->
description =
"Center the view so that the cursor is in the middle of the view";
1023 ot->
idname =
"IMAGE_OT_view_center_cursor";
1057 *bmain, scene, view_layer,
nullptr);
1094 ot->
name =
"View Center";
1095 ot->
idname =
"IMAGE_OT_view_selected";
1133 ®ion->
v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
1144 ot->
name =
"Zoom In";
1145 ot->
idname =
"IMAGE_OT_view_zoom_in";
1146 ot->
description =
"Zoom in the image (centered around 2D cursor)";
1164 "Cursor location in screen coordinates",
1194 ®ion->
v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
1205 ot->
name =
"Zoom Out";
1206 ot->
idname =
"IMAGE_OT_view_zoom_out";
1207 ot->
description =
"Zoom out the image (centered around 2D cursor)";
1225 "Cursor location in screen coordinates",
1245 sima->
xof = int(sima->
xof);
1246 sima->
yof = int(sima->
yof);
1256 ot->
name =
"View Zoom Ratio";
1257 ot->
idname =
"IMAGE_OT_view_zoom_ratio";
1274 "Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out",
1301 sima_view_prev.xof = sima->
xof;
1302 sima_view_prev.yof = sima->
yof;
1303 sima_view_prev.zoom = sima->
zoom;
1309 sima->
xof = sima_view_prev.xof + (sima->
xof - sima_view_prev.xof);
1310 sima->
yof = sima_view_prev.yof + (sima->
yof - sima_view_prev.yof);
1311 sima->
zoom = sima_view_prev.zoom * (sima_view_prev.zoom / sima->
zoom);
1322 ot->
name =
"Zoom to Border";
1323 ot->
description =
"Zoom in the view to the nearest item contained in the border";
1324 ot->
idname =
"IMAGE_OT_view_zoom_border";
1360 op->
customdata = iod = MEM_new<ImageOpenData>(__func__);
1377 const bool use_multiview)
1379 bool exists =
false;
1380 Image *ima =
nullptr;
1388 "Cannot read '%s': %s",
1390 errno ? strerror(errno) :
RPT_(
"unsupported image format"));
1402 if (use_multiview) {
1418 ImageTile *first_tile = ima->tiles.first();
1424 else if (range->
length > 1) {
1438 Image *ima =
nullptr;
1439 int frame_seq_len = 0;
1451 Library *owner_library = owner_id ? owner_id->
lib :
nullptr;
1456 blendfile_path, root_path, op, use_udim);
1461 if ((ima ==
nullptr) && ima_range) {
1463 frame_seq_len = range.length;
1464 frame_ofs = range.offset;
1467 range.udim_tiles.free_no_destruct();
1468 range.frames.free_no_destruct();
1470 ranges.free_no_destruct();
1472 if (ima ==
nullptr) {
1499 iuser = &sima->
iuser;
1504 iuser = &tex->
iuser;
1507 if (iuser ==
nullptr) {
1511 if (bgpic.
ima == ima) {
1512 iuser = &bgpic.
iuser;
1530 iuser->
offset = frame_ofs - 1;
1532 iuser->
scene = scene;
1551 const char *path =
U.textudir;
1552 Image *ima =
nullptr;
1559 if (ima ==
nullptr) {
1566 if (ima ==
nullptr) {
1578 oldima = id_cast<Image *>(oldptr.
owner_id);
1580 if (oldima &&
GS(oldima->id.name) ==
ID_IM) {
1587 path = ima->filepath;
1612 return !
STR_ELEM(prop_id,
"filepath",
"directory",
"filename");
1622 uiDefAutoButsRNA(&layout,
1642 ot->
srna,
"allow_path_tokens",
true,
"",
"Allow the path to contain substitution tokens");
1649 ot->
name =
"Open Image";
1651 ot->
idname =
"IMAGE_OT_open";
1675 "use_sequence_detection",
1678 "Automatically detect animated sequences in selected images (based on file names)");
1680 "use_udim_detecting",
1683 "Detect selected UDIM files and load all matching tiles");
1695 if (ima ==
nullptr) {
1736 STRNCPY(filepath, ima->filepath);
1782 ot->
name =
"Browse Image";
1784 "Open an image file browser, hold Shift to open the file, Alt to browse containing "
1786 ot->
idname =
"IMAGE_OT_file_browse";
1818 if (!ima || !iuser) {
1823 iuser = &tex->
iuser;
1844 ot->
name =
"Match Movie Length";
1845 ot->
description =
"Set the image's frame range to match the video's duration";
1846 ot->
idname =
"IMAGE_OT_match_movie_length";
1926 ot->
name =
"Replace Image";
1927 ot->
idname =
"IMAGE_OT_replace";
1928 ot->
description =
"Replace current image by another one from disk";
2057 if (isd ==
nullptr) {
2096 if (isd ==
nullptr) {
2115 return !(
STREQ(prop_id,
"filepath") ||
STREQ(prop_id,
"directory") ||
2116 STREQ(prop_id,
"filename") ||
2133 uiDefAutoButsRNA(&layout,
2148 if (!save_as_render) {
2157 "UI_MT_color_space_select");
2172 if (
G.is_rendering) {
2188 ot->
name =
"Save As Image";
2189 ot->
idname =
"IMAGE_OT_save_as";
2190 ot->
description =
"Save the image with another name and/or settings";
2210 "Save image with render color management.\n"
2211 "For display image formats like PNG, apply view and display transform.\n"
2212 "For intermediate image formats like OpenEXR, use the default render output color space");
2218 "Create a new image file without modifying the current image in Blender");
2261 if (
G.is_rendering) {
2340 ot->
name =
"Save Image";
2341 ot->
idname =
"IMAGE_OT_save";
2342 ot->
description =
"Save the image with current name and settings";
2362 ImBuf *ibuf, *first_ibuf =
nullptr;
2365 ImBufCacheIter *iter;
2367 if (
image ==
nullptr) {
2383 if (
image->runtime->cache !=
nullptr) {
2388 if (first_ibuf ==
nullptr) {
2431 ot->
name =
"Save Sequence";
2432 ot->
idname =
"IMAGE_OT_save_sequence";
2466 return strchr(ima->filepath,
'\\') || strchr(ima->filepath,
'/');
2483 bool should_save = modified_images_count || !reports.
list.is_empty();
2494 int num_saveable_images = 0;
2496 for (
Image *ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
2497 bool is_format_writable;
2502 num_saveable_images++;
2507 "Packed library image cannot be saved: \"%s\" from \"%s\"",
2509 ima->id.lib->filepath);
2512 else if (!is_format_writable) {
2515 "Image cannot be saved, use a different file format: \"%s\"",
2520 num_saveable_images++;
2524 "Multiple images cannot be saved to an identical path: \"%s\"",
2528 unique_paths.
add(ima->filepath);
2534 "Image cannot be saved, no valid file path: \"%s\"",
2541 return num_saveable_images;
2552 for (
Image *ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
2553 bool is_format_writable;
2559 else if (is_format_writable) {
2564 bool saved_successfully =
BKE_image_save(reports, bmain, ima,
nullptr, &opts);
2565 ok = ok && saved_successfully;
2577 for (
Image *ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
2578 bool is_format_writable;
2593 return num_files > 0;
2605 ot->
name =
"Save All Modified";
2606 ot->
idname =
"IMAGE_OT_save_all_modified";
2650 ot->
name =
"Reload Image";
2651 ot->
idname =
"IMAGE_OT_reload";
2652 ot->
description =
"Reload current image from disk";
2667#define IMA_DEF_NAME N_("Untitled")
2707 int width, height, floatbuf, gen_type, alpha;
2718 name =
DATA_(name_buffer);
2756 if (
data->pprop.prop) {
2761 if (
data->pprop.ptr.owner_id) {
2797 C, op, 300,
IFACE_(
"Create a New Image"),
IFACE_(
"New Image"));
2837 static const float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
2840 ot->
name =
"New Image";
2842 ot->
idname =
"IMAGE_OT_new";
2861 ot->
srna,
"color", 4,
nullptr, 0.0f,
FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
2864 RNA_def_boolean(ot->
srna,
"alpha",
true,
"Alpha",
"Create an image with an alpha channel");
2870 "Fill the image with a grid for UV map testing");
2875 "Create image with 32-bit floating-point bit depth");
2878 ot->
srna,
"use_stereo_3d",
false,
"Stereo 3D",
"Create an image with left and right views");
2900 if (ibuf ==
nullptr) {
2908 if (!use_flip_x && !use_flip_y) {
2919 const int size_x = ibuf->
x;
2920 const int size_y = ibuf->
y;
2925 float *orig_float_pixels = MEM_dupalloc(float_pixels);
2926 for (
int x = 0;
x < size_x;
x++) {
2927 const int source_pixel_x = use_flip_x ? size_x -
x - 1 :
x;
2928 for (
int y = 0;
y < size_y;
y++) {
2929 const int source_pixel_y = use_flip_y ? size_y -
y - 1 :
y;
2931 const float *source_pixel =
2932 &orig_float_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
2933 float *target_pixel = &float_pixels[4 * (
x +
y * size_x)];
2938 MEM_delete(orig_float_pixels);
2945 uchar *orig_char_pixels = MEM_dupalloc(char_pixels);
2946 for (
int x = 0;
x < size_x;
x++) {
2947 const int source_pixel_x = use_flip_x ? size_x -
x - 1 :
x;
2948 for (
int y = 0;
y < size_y;
y++) {
2949 const int source_pixel_y = use_flip_y ? size_y -
y - 1 :
y;
2951 const uchar *source_pixel =
2952 &orig_char_pixels[4 * (source_pixel_x + source_pixel_y * size_x)];
2953 uchar *target_pixel = &char_pixels[4 * (
x +
y * size_x)];
2958 MEM_delete(orig_char_pixels);
2981 ot->
name =
"Flip Image";
2982 ot->
idname =
"IMAGE_OT_flip";
2992 ot->
srna,
"use_flip_x",
false,
"Horizontal",
"Flip the image horizontally");
2994 prop =
RNA_def_boolean(ot->
srna,
"use_flip_y",
false,
"Vertical",
"Flip the image vertically");
3015 if (ibuf ==
nullptr) {
3049 {90,
"90", 0,
"90 Degrees",
"Rotate 90 degrees clockwise"},
3050 {180,
"180", 0,
"180 Degrees",
"Rotate 180 degrees clockwise"},
3051 {270,
"270", 0,
"270 Degrees",
"Rotate 270 degrees clockwise"},
3052 {0,
nullptr, 0,
nullptr,
nullptr},
3056 ot->
name =
"Rotate Image Orthogonal";
3057 ot->
idname =
"IMAGE_OT_rotate_orthogonal";
3068 orthogonal_rotation_items,
3071 "Amount of rotation in degrees (90, 180, 270)");
3088 if (ima ==
nullptr) {
3101 bool changed =
false;
3112 ibuf, save_as_render,
true, &image_format);
3118 if (colormanaged_ibuf != ibuf) {
3142 ot->
name =
"Copy Image";
3143 ot->
idname =
"IMAGE_OT_clipboard_copy";
3144 ot->
description =
"Copy the image to the clipboard";
3162 bool changed =
false;
3203 ot->
name =
"Paste Image";
3204 ot->
idname =
"IMAGE_OT_clipboard_paste";
3205 ot->
description =
"Paste new image from the clipboard";
3237 if (ibuf ==
nullptr) {
3251 float *fp = float_data;
3252 for (i =
size_t(ibuf->
x) * ibuf->
y; i > 0; i--, fp += 4) {
3254 fp[0] = 1.0f - fp[0];
3257 fp[1] = 1.0f - fp[1];
3260 fp[2] = 1.0f - fp[2];
3263 fp[3] = 1.0f - fp[3];
3272 for (i =
size_t(ibuf->
x) * ibuf->
y; i > 0; i--, cp += 4) {
3274 cp[0] = 255 - cp[0];
3277 cp[1] = 255 - cp[1];
3280 cp[2] = 255 - cp[2];
3283 cp[3] = 255 - cp[3];
3311 ot->
name =
"Invert Channels";
3312 ot->
idname =
"IMAGE_OT_invert";
3346 const int size[2] = {ibuf->
x, ibuf->
y};
3351 C, op, 200,
IFACE_(
"Scale Image to New Size"),
IFACE_(
"Resize"));
3367 if (!is_scaling_all) {
3370 if (ibuf ==
nullptr) {
3395 for (
ImageTile ¤t_tile : ima->tiles) {
3400 if (ibuf ==
nullptr) {
3409 for (
ImageTile ¤t_tile : ima->tiles) {
3442 ot->
name =
"Resize Image";
3443 ot->
idname =
"IMAGE_OT_resize";
3454 ot->
srna,
"all_udims",
false,
"All UDIM Tiles",
"Scale all the image's UDIM tiles");
3473 *r_error_message =
N_(
"Image is not editable");
3478 *r_error_message =
N_(
"Unedited generated images do not support packing");
3483 *r_error_message =
N_(
"Movies or image sequences do not support packing");
3488 *r_error_message =
N_(
"Render Result and Viewer Nodes cannot be packed");
3498 const char *error_message =
nullptr;
3504 if (error_message) {
3515 const char *error_message =
nullptr;
3517 if (error_message) {
3538 ot->
name =
"Pack Image";
3539 ot->
description =
"Pack an image as embedded data into the .blend file";
3540 ot->
idname =
"IMAGE_OT_pack";
3589 "AutoPack is enabled, so image will be packed again on file save");
3627 "AutoPack is enabled, so image will be packed again on file save");
3643 ot->
name =
"Unpack Image";
3644 ot->
description =
"Save an image packed in the .blend file to disk";
3645 ot->
idname =
"IMAGE_OT_unpack";
3660 ot->
srna,
"id",
nullptr,
MAX_ID_NAME - 2,
"Image Name",
"Image data-block name to unpack");
3677 if (ibuf ==
nullptr) {
3689 SpaceImage *sima,
ARegion *region,
const int mval[2],
float r_col[3],
bool *r_is_data)
3694 if (sima->
image ==
nullptr) {
3703 if (is_repeat_display) {
3715 if (ibuf ==
nullptr) {
3720 if (uv[0] >= 0.0f && uv[1] >= 0.0f && uv[0] < 1.0f && uv[1] < 1.0f) {
3723 int x = int(uv[0] * ibuf->
x),
y = int(uv[1] * ibuf->
y);
3752 ot->
name =
"Sample Color";
3753 ot->
idname =
"IMAGE_OT_sample";
3754 ot->
description =
"Use mouse to sample a color in current image";
3766 prop =
RNA_def_int(ot->
srna,
"size", 1, 1, 128,
"Sample Size",
"", 1, 64);
3789 float uv1[2], uv2[2], ofs[2];
3793 if (ima ==
nullptr) {
3804 if (ibuf ==
nullptr) {
3849 ot->
name =
"Sample Line";
3850 ot->
idname =
"IMAGE_OT_sample_line";
3851 ot->
description =
"Sample a line and show it in Scope panels";
3875 {0,
"BLACK_POINT", 0,
"Black Point",
""},
3876 {1,
"WHITE_POINT", 0,
"White Point",
""},
3877 {0,
nullptr, 0,
nullptr,
nullptr},
3881 ot->
name =
"Set Curves Point";
3882 ot->
idname =
"IMAGE_OT_curves_point_set";
3883 ot->
description =
"Set black point or white point for curves";
3896 ot->
srna,
"point", point_items, 0,
"Point",
"Set black point or white point for curves");
3899 prop =
RNA_def_int(ot->
srna,
"size", 1, 1, 128,
"Sample Size",
"", 1, 64);
3930 if ((slot && slot->
render) || ima->render_slot == ima->last_render_slot) {
3940 ot->
name =
"Cycle Render Slot";
3941 ot->
idname =
"IMAGE_OT_cycle_render_slot";
3942 ot->
description =
"Cycle through all non-void render slots";
3977 ot->
name =
"Clear Render Slot";
3978 ot->
idname =
"IMAGE_OT_clear_render_slot";
3979 ot->
description =
"Clear the currently selected render slot";
4010 ot->
name =
"Add Render Slot";
4011 ot->
idname =
"IMAGE_OT_add_render_slot";
4045 ot->
name =
"Remove Render Slot";
4046 ot->
idname =
"IMAGE_OT_remove_render_slot";
4047 ot->
description =
"Remove the current render slot";
4066 if (
G.is_rendering) {
4101 float sfra = scene->
r.
sfra, efra = scene->
r.
efra, framelen = region->
winx / (efra - sfra + 1);
4103 framenr = sfra +
event->mval[0] / framelen;
4139 switch (event->
type) {
4165 ot->
name =
"Change Frame";
4166 ot->
idname =
"IMAGE_OT_change_frame";
4167 ot->
description =
"Interactively change the current frame number";
4192 if (sima->
image ==
nullptr) {
4204 ot->
name =
"Open Cached Render";
4205 ot->
idname =
"IMAGE_OT_read_viewlayers";
4206 ot->
description =
"Read all the current scene's view layers from cache, as needed";
4228 if (re ==
nullptr) {
4259 if ((border.
xmin <= 0.0f && border.
xmax >= 1.0f && border.
ymin <= 0.0f && border.
ymax >= 1.0f) ||
4285 ot->
name =
"Render Region";
4286 ot->
description =
"Set the boundaries of the render region and enable render region";
4287 ot->
idname =
"IMAGE_OT_render_border";
4324 ot->
name =
"Clear Render Region";
4325 ot->
description =
"Clear the boundaries of the render region and disable render region";
4326 ot->
idname =
"IMAGE_OT_clear_render_border";
4374 if (
tile !=
nullptr) {
4382 if (ibuf ==
nullptr && (
tile !=
nullptr) && (
tile != ima->tiles.first_)) {
4386 if (ibuf !=
nullptr) {
4400 static const float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
4402 srna,
"color", 4,
nullptr, 0.0f,
FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
4410 "Fill the image with a grid for UV map testing");
4411 prop =
RNA_def_int(srna,
"width", 1024, 1,
INT_MAX,
"Width",
"Image width", 1, 16384);
4413 prop =
RNA_def_int(srna,
"height", 1024, 1,
INT_MAX,
"Height",
"Image height", 1, 16384);
4418 srna,
"float",
false,
"32-bit Float",
"Create image with 32-bit floating-point bit depth");
4419 RNA_def_boolean(srna,
"alpha",
true,
"Alpha",
"Create an image with an alpha channel");
4448 for (
int tile_number = start_tile; tile_number <= end_tile; tile_number++) {
4451 if (
tile !=
nullptr) {
4456 last_tile_created =
tile;
4460 if (!last_tile_created) {
4465 ima->active_tile_index =
BLI_findindex(&ima->tiles, last_tile_created);
4477 int next_number = 0;
4479 next_number =
tile.tile_number + 1;
4480 if (
tile.next ==
nullptr ||
tile.next->tile_number > next_number) {
4495 IFACE_(
"Add Tile to Image"),
4522 ot->
name =
"Add Tile";
4524 ot->
idname =
"IMAGE_OT_tile_add";
4541 "UDIM number of the tile",
4546 prop =
RNA_def_boolean(ot->
srna,
"fill",
true,
"Fill",
"Fill new tile with a generated image");
4561 return (ima !=
nullptr && ima->source ==
IMA_SRC_TILED && !ima->tiles.is_single());
4574 ima->active_tile_index =
min_ii(ima->active_tile_index, ima->tiles.count() - 1);
4584 ot->
name =
"Remove Tile";
4585 ot->
description =
"Removes a tile from the image";
4586 ot->
idname =
"IMAGE_OT_tile_remove";
4634 IFACE_(
"Fill Tile With Generated Image"),
4646 ot->
name =
"Fill Tile";
4647 ot->
description =
"Fill the current tile with a generated image";
4648 ot->
idname =
"IMAGE_OT_tile_fill";
#define IMA_SIGNAL_SRC_CHANGE
#define IMA_SIGNAL_USER_NEW_IMAGE
#define IMA_SIGNAL_RELOAD
File and directory operations.
#define SNPRINTF(dst, format,...)
Platform independent time functions.
#define BLT_I18NCONTEXT_ID_IMAGE
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define ID_BLEND_PATH(_bmain, _id)
#define ID_IS_EDITABLE(_id)
Object is a sort of wrapper for general info.
#define FRAMENUMBER_MIN_CLAMP(cfra)
#define NDOF_PIXELS_PER_SECOND
Read Blender memory allocation and freeing.
#define ND_RENDER_OPTIONS
#define POINTER_AS_INT(i)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
bool contains_as(const ForwardKey &key) const
void item_bool(std::string text, bool inverted, int icon1, int icon2=0)
constexpr T degrees(T) RET
const ccl_global KernelWorkTile * tile
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void context_active_but_prop_get_templateID(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop)
void view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
bool BKE_image_is_multiview(const Image *ima)
int BKE_image_get_tile_from_pos(Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
MINLINE float min_ff(float a, float b)
static ImageNewData * image_new_init(bContext *C, wmOperator *op)
void WM_main_add_notifier(uint type, void *reference)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
static Image * image_from_context(const bContext *C)
bool IMB_rotate_orthogonal(ImBuf *ibuf, int degrees)
static bool image_from_context_editable_has_data_poll_active_tile(bContext *C)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
void IMB_cacheIter_step(ImBufCacheIter *iter)
static wmOperatorStatus image_view_zoom_ratio_exec(bContext *C, wmOperator *op)
void IMAGE_OT_rotate_orthogonal(wmOperatorType *ot)
static bool image_should_be_saved_when_modified(Image *ima)
static void sima_zoom_set_factor(SpaceImage *sima, ARegion *region, float zoomfac, const float location[2], const bool zoom_to_pos)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
bool ED_operator_uvedit(bContext *C)
static void draw_fill_tile(PointerRNA *ptr, ui::Layout &layout)
ScrArea * CTX_wm_area(const bContext *C)
ImBuf * WM_clipboard_image_get()
static bool image_save_as_check(bContext *C, wmOperator *op)
char * STRNCPY(char(&dst)[N], const char *src)
int RNA_enum_get(PointerRNA *ptr, const char *name)
static wmOperatorStatus image_sample_line_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus image_view_pan_modal(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus image_view_all_exec(bContext *C, wmOperator *op)
void BKE_image_sort_tiles(Image *ima)
static bool tile_remove_poll(bContext *C)
bool ED_image_slot_cycle(Image *image, int direction)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void IMAGE_OT_tile_remove(wmOperatorType *ot)
void IMAGE_OT_view_pan(wmOperatorType *ot)
void uiTemplateImageFormatViews(ui::Layout *layout, PointerRNA *imfptr, PointerRNA *ptr)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool BKE_image_is_dirty(Image *image)
static wmOperatorStatus render_border_exec(bContext *C, wmOperator *op)
void BKE_image_format_set(ImageFormatData *imf, ID *owner_id, const char imtype)
bool BKE_image_clear_renderslot(Image *ima, ImageUser *iuser, int slot)
static bool image_pack_test(Image *ima, const char **r_error_message)
bool ED_space_image_show_cache_and_mval_over(const SpaceImage *sima, ARegion *region, const int mval[2])
static wmOperatorStatus tile_add_exec(bContext *C, wmOperator *op)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void IMAGE_OT_view_zoom_border(wmOperatorType *ot)
static wmOperatorStatus image_view_zoom_out_exec(bContext *C, wmOperator *op)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
MINLINE void copy_v3_v3(float r[3], const float a[3])
static wmOperatorStatus image_view_zoom_modal(bContext *C, wmOperator *op, const wmEvent *event)
void ED_space_image_get_aspect(SpaceImage *sima, float *r_aspx, float *r_aspy)
void IMAGE_OT_replace(wmOperatorType *ot)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void IMAGE_OT_read_viewlayers(wmOperatorType *ot)
static void sima_zoom_set_from_bounds(SpaceImage *sima, ARegion *region, const rctf *bounds)
void unpack_menu(bContext *C, const char *opname, const char *id_name, const char *abs_name, const char *folder, PackedFile *pf)
static void image_filesel(bContext *C, wmOperator *op, const char *path)
void BKE_reports_free(ReportList *reports)
void ED_imapaint_clear_partial_redraw()
bool ED_space_image_check_show_maskedit(SpaceImage *sima, Object *obedit)
static void tile_add_draw(bContext *, wmOperator *op)
static void image_view_zoom_init(bContext *C, wmOperator *op, const wmEvent *event)
MINLINE int round_fl_to_int(float a)
static wmOperatorStatus view_center_cursor_exec(bContext *C, wmOperator *)
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
int BKE_icon_id_ensure(ID *id)
void IMAGE_OT_clipboard_copy(wmOperatorType *ot)
static void image_open_draw(bContext *, wmOperator *op)
PointerRNA RNA_id_pointer_create(ID *id)
wmOperatorStatus WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus tile_fill_exec(bContext *C, wmOperator *op)
MINLINE void mul_v2_fl(float r[2], float f)
PropertyRNA * RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void ED_image_undo_push_end()
void WM_operator_properties_free(PointerRNA *ptr)
void IMAGE_OT_sample(wmOperatorType *ot)
bool WM_clipboard_image_available()
const char * RNA_property_identifier(const PropertyRNA *prop)
MINLINE void copy_v2_v2(float r[2], const float a[2])
static void image_view_all(SpaceImage *sima, ARegion *region, wmOperator *op)
static wmOperatorStatus image_view_pan_exec(bContext *C, wmOperator *op)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
static void image_view_pan_exit(bContext *C, wmOperator *op, bool cancel)
void BKE_reports_init(ReportList *reports, int flag)
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static wmOperatorStatus image_remove_render_slot_exec(bContext *C, wmOperator *)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
static wmOperatorStatus image_match_len_exec(bContext *C, wmOperator *)
bool BKE_image_has_filepath(const Image *ima)
static wmOperatorStatus image_view_pan_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void IMB_mark_dirty(ImBuf *ibuf)
wmOperatorStatus WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *event)
void WM_cursor_modal_set(wmWindow *win, int val)
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)
void IMAGE_OT_clear_render_border(wmOperatorType *ot)
void ED_space_image_get_size(SpaceImage *sima, int *r_width, int *r_height)
static wmOperatorStatus image_new_invoke(bContext *C, wmOperator *op, const wmEvent *)
Image * CTX_data_edit_image(const bContext *C)
bool BKE_image_fill_tile(Image *ima, ImageTile *tile)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void IMAGE_OT_invert(wmOperatorType *ot)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
PointerRNA WM_operator_properties_create_ptr(wmOperatorType *ot)
static Image * image_open_single(Main *bmain, Library *owner_library, wmOperator *op, const ImageFrameRange *range, const bool use_multiview)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void IMAGE_OT_view_center_cursor(wmOperatorType *ot)
void WM_operator_properties_border(wmOperatorType *ot)
ImBuf * IMB_cacheIter_getImBuf(ImBufCacheIter *iter)
static wmOperatorStatus image_view_zoom_out_invoke(bContext *C, wmOperator *op, const wmEvent *event)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
static bool image_save_all_modified_poll(bContext *C)
static wmOperatorStatus image_replace_invoke(bContext *C, wmOperator *op, const wmEvent *)
int RNA_int_get(PointerRNA *ptr, const char *name)
wmWindow * CTX_wm_window(const bContext *C)
void BKE_image_user_file_path(const ImageUser *iuser, const Image *ima, char *filepath)
bool ED_uvedit_minmax_multi(const Scene *scene, Span< Object * > objects_edit, float r_min[2], float r_max[2])
static wmOperatorStatus image_view_zoom_in_exec(bContext *C, wmOperator *op)
bool ED_space_image_region_cursor_poll(bContext *C)
static wmOperatorStatus image_invert_exec(bContext *C, wmOperator *op)
MINLINE int max_ii(int a, int b)
static wmOperatorStatus image_scale_invoke(bContext *C, wmOperator *op, const wmEvent *)
void IMAGE_OT_view_selected(wmOperatorType *ot)
static ImageUser image_user_from_context_and_active_tile(const bContext *C, Image *ima)
bool BKE_image_save_options_init(ImageSaveOptions *opts, Main *bmain, Scene *scene, Image *ima, ImageUser *iuser, bool guess_path, bool save_as_render)
void ED_undo_push_op(bContext *C, wmOperator *op)
ImageTile * BKE_image_add_tile(Image *ima, int tile_number, const char *label)
void BLI_rctf_scale(rctf *rect, float scale)
bool ED_space_image_get_position(SpaceImage *sima, ARegion *region, const int mval[2], float r_fpos[2])
static bool image_file_format_writable(Image *ima, ImageUser *iuser)
void ED_region_tag_redraw(ARegion *region)
void ED_space_image_release_buffer(SpaceImage *sima, ImBuf *ibuf, void *lock)
void IMAGE_OT_view_cursor_center(wmOperatorType *ot)
static bool image_save_as_draw_check_prop(PointerRNA *ptr, PropertyRNA *prop, void *user_data)
static wmOperatorStatus image_open_exec(bContext *C, wmOperator *op)
void ED_space_image_set(Main *bmain, SpaceImage *sima, Image *ima, bool automatic)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
static void tile_fill_init(PointerRNA *ptr, Image *ima, ImageTile *tile)
static wmOperatorStatus clear_render_border_exec(bContext *C, wmOperator *)
ViewLayer * CTX_data_view_layer(const bContext *C)
static wmOperatorStatus image_save_as_exec(bContext *C, wmOperator *op)
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
static bool image_from_context_has_data_poll(bContext *C)
bool ED_image_save_all_modified(const bContext *C, ReportList *reports)
static wmOperatorStatus image_save_sequence_exec(bContext *C, wmOperator *op)
void WM_operator_properties_use_cursor_init(wmOperatorType *ot)
static wmOperatorStatus image_clipboard_paste_exec(bContext *C, wmOperator *op)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
static wmOperatorStatus image_new_exec(bContext *C, wmOperator *op)
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
static ImageUser * image_user_from_context(const bContext *C)
static wmOperatorStatus image_open_invoke(bContext *C, wmOperator *op, const wmEvent *)
bool BKE_image_is_dirty_writable(Image *image, bool *r_is_writable)
bool IMB_save_image(ImBuf *ibuf, const char *filepath, ImBufFlags flags)
void WM_operator_properties_border_to_rctf(wmOperator *op, rctf *r_rect)
void ED_preview_kill_jobs(wmWindowManager *wm, Main *bmain)
RenderSlot * BKE_image_add_renderslot(Image *ima, const char *name)
void IMAGE_OT_clipboard_paste(wmOperatorType *ot)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
RenderData * RE_engine_get_render_data(Render *re)
const char * imb_ext_movie[]
static wmOperatorStatus image_file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void image_new_draw(bContext *, wmOperator *op)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Render * RE_GetSceneRender(const Scene *scene)
void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], const ColorSpace *colorspace)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
ImBuf * BKE_image_acquire_ibuf_gpu(Image *ima, ImageUser *iuser, void **r_lock, bool *r_load_failed=nullptr, bool cached_only=false)
static wmOperatorStatus image_save_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
static wmOperatorStatus image_save_exec(bContext *C, wmOperator *op)
void IMAGE_OT_sample_line(wmOperatorType *ot)
static wmOperatorStatus tile_add_invoke(bContext *C, wmOperator *op, const wmEvent *)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
void IMAGE_OT_flip(wmOperatorType *ot)
void IMAGE_OT_cycle_render_slot(wmOperatorType *ot)
bool BKE_image_remove_tile(Image *ima, ImageTile *tile)
void IMB_freeImBuf(ImBuf *ibuf)
void BKE_icon_changed(int icon_id)
static ImageSaveData * image_save_as_init(bContext *C, wmOperator *op)
void IMAGE_OT_open(wmOperatorType *ot)
bool space_image_poll(bContext *C)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
ListBaseT< ImageFrameRange > ED_image_filesel_detect_sequences(StringRefNull blendfile_path, StringRefNull root_path, wmOperator *op, bool detect_udim)
ImBufCacheIter * IMB_cacheIter_new(ImBufCache *cache)
static wmOperatorStatus image_unpack_invoke(bContext *C, wmOperator *op, const wmEvent *)
static bool image_has_valid_path(Image *ima)
static wmOperatorStatus image_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *)
void ED_imbuf_sample_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus image_flip_exec(bContext *C, wmOperator *op)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
void BKE_report(ReportList *reports, eReportType type, const char *message)
int BKE_packedfile_unpack_image(Main *bmain, ReportList *reports, Image *ima, enum ePF_FileStatus how)
BMesh const char void * data
bool ED_maskedit_poll(bContext *C)
static void image_save_as_free(wmOperator *op)
void BKE_image_free_packedfiles(Image *image)
void IMAGE_OT_add_render_slot(wmOperatorType *ot)
static void image_view_pan_init(bContext *C, wmOperator *op, const wmEvent *event)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
wmWindowManager * CTX_wm_manager(const bContext *C)
static float frame_from_event(bContext *C, const wmEvent *event)
Object * CTX_data_edit_object(const bContext *C)
void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
static bool do_fill_tile(PointerRNA *ptr, Image *ima, ImageTile *tile)
void ED_image_internal_autosave_flush(const Main *bmain)
static bool image_open_draw_check_prop(PointerRNA *, PropertyRNA *prop, void *)
static wmOperatorStatus change_frame_exec(bContext *C, wmOperator *op)
RenderSlot * BKE_image_get_renderslot(Image *ima, int index)
void IMAGE_OT_file_browse(wmOperatorType *ot)
bool WM_clipboard_image_set_byte_buffer(ImBuf *ibuf)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void WM_cursor_modal_restore(wmWindow *win)
static void image_zoom_apply(ViewZoomData *vpd, wmOperator *op, const int x, const int y, const short viewzoom, const short zoom_invert, const bool zoom_to_pos, const bool snap, const bool precision)
MINLINE float power_of_2(float f)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
bool BKE_image_has_anim(Image *image)
void ED_image_undo_push_begin_with_image_all_udims(const char *name, Image *image, ImageUser *iuser)
void WM_operator_properties_gesture_box_zoom(wmOperatorType *ot)
void IMAGE_OT_save_as(wmOperatorType *ot)
static wmOperatorStatus change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool ED_space_image_has_buffer(SpaceImage *sima)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
static bool image_pack_poll(bContext *C)
void IMB_partial_update_mark_full(ImBuf *ibuf)
const EnumPropertyItem rna_enum_unpack_method_items[]
bool BLI_file_is_writable(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static void image_view_zoom_exit(bContext *C, wmOperator *op, bool cancel)
Image * BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
void ED_area_status_text(ScrArea *area, const char *str)
wmOperatorStatus WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message, const bool show_icon)
static bool image_view_selected_poll(bContext *C)
void BKE_image_free_views(Image *image)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
static wmOperatorStatus image_file_browse_exec(bContext *C, wmOperator *op)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void uiTemplateImageSettings(ui::Layout *layout, bContext *C, PointerRNA *imfptr, bool color_management, const char *panel_idname=nullptr)
void IMAGE_OT_tile_add(wmOperatorType *ot)
@ GEN_CONTEXT_PAINT_CANVAS
@ GEN_CONTEXT_PAINT_STENCIL
static bool image_save_as_poll(bContext *C)
bool IMB_cacheIter_done(ImBufCacheIter *iter)
static bool tile_fill_poll(bContext *C)
MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4])
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
static wmOperatorStatus change_frame_modal(bContext *C, wmOperator *op, const wmEvent *event)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void BKE_image_ensure_tile_token(char *filepath, size_t filepath_maxncpy)
wmOperatorStatus ED_imbuf_sample_modal(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus image_unpack_exec(bContext *C, wmOperator *op)
Image * BKE_image_load_exists_in_lib(Main *bmain, std::optional< Library * > owner_library, const char *filepath, bool check_open=true, bool *r_exists=nullptr)
void BKE_image_format_free(ImageFormatData *imf)
void BKE_image_format_init_for_write(ImageFormatData *imf, const Scene *scene_src, const ImageFormatData *imf_src, const bool allow_video=false)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
ImBuf * IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, bool save_as_render, bool allocate_result, const ImageFormatData *image_format)
static wmOperatorStatus image_view_zoom_in_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void BKE_image_init_imageuser(Image *ima, ImageUser *iuser)
static void sima_zoom_set(SpaceImage *sima, ARegion *region, float zoom, const float location[2], const bool zoom_to_pos)
static void image_new_cancel(bContext *, wmOperator *op)
bool BKE_image_autosave_memorypack(Image *ima)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
static void image_operator_prop_allow_tokens(wmOperatorType *ot)
static wmOperatorStatus image_view_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool image_should_be_saved(Image *ima, bool *r_is_format_writable)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void IMAGE_OT_tile_fill(wmOperatorType *ot)
static wmOperatorStatus tile_fill_invoke(bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus image_add_render_slot_exec(bContext *C, wmOperator *)
void IMAGE_OT_remove_render_slot(wmOperatorType *ot)
SpaceImage * CTX_wm_space_image(const bContext *C)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void IMAGE_OT_save_all_modified(wmOperatorType *ot)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus image_cycle_render_slot_exec(bContext *C, wmOperator *op)
void IMAGE_OT_view_zoom_ratio(wmOperatorType *ot)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
static wmOperatorStatus tile_remove_exec(bContext *C, wmOperator *)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void IMAGE_OT_unpack(wmOperatorType *ot)
void IMAGE_OT_view_zoom(wmOperatorType *ot)
static bool image_clipboard_copy_poll(bContext *C)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
static wmOperatorStatus image_view_selected_exec(bContext *C, wmOperator *)
void IMAGE_OT_curves_point_set(wmOperatorType *ot)
static wmOperatorStatus image_replace_exec(bContext *C, wmOperator *op)
Main * CTX_data_main(const bContext *C)
static void image_save_as_cancel(bContext *, wmOperator *op)
void IMB_byte_from_float(ImBuf *ibuf)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
static wmOperatorStatus view_cursor_center_exec(bContext *C, wmOperator *op)
bool BLI_path_extension_check_array(const char *path, const char **ext_array) ATTR_NONNULL(1
static bool image_save_poll(bContext *C)
static wmOperatorStatus image_save_all_modified_exec(bContext *C, wmOperator *op)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
static void image_view_zoom_cancel(bContext *C, wmOperator *op)
MINLINE float max_ff(float a, float b)
static wmOperatorStatus image_view_zoom_exec(bContext *C, wmOperator *op)
static wmOperatorStatus image_pack_exec(bContext *C, wmOperator *op)
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
void BKE_image_save_options_free(ImageSaveOptions *opts)
static bool save_image_op(Main *bmain, Image *ima, ImageUser *iuser, wmOperator *op, const ImageSaveOptions *opts)
static wmOperatorStatus image_clear_render_slot_exec(bContext *C, wmOperator *)
static bool image_cycle_render_slot_poll(bContext *C)
static wmOperatorStatus image_view_zoom_border_exec(bContext *C, wmOperator *op)
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
ID_Type GS(const char *name)
void IMAGE_OT_render_border(wmOperatorType *ot)
bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
void IMAGE_OT_change_frame(wmOperatorType *ot)
static wmOperatorStatus image_scale_exec(bContext *C, wmOperator *op)
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_clear_render_slot(wmOperatorType *ot)
void IMAGE_OT_reload(wmOperatorType *ot)
void BKE_id_move_to_same_lib(Main &bmain, ID &id, const ID &owner_id)
bool ED_imbuf_sample_poll(bContext *C)
MINLINE void rgb_uchar_to_float(float r_col[3], const unsigned char col_ub[3])
static wmOperatorStatus image_read_viewlayers_exec(bContext *C, wmOperator *)
double BLI_time_now_seconds()
static bool space_image_main_area_not_uv_brush_poll(bContext *C)
static void image_open_init(bContext *C, wmOperator *op)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
Scene * CTX_data_scene(const bContext *C)
static wmOperatorStatus image_reload_exec(bContext *C, wmOperator *)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
void BKE_mask_coord_to_image(Image *image, ImageUser *iuser, float r_co[2], const float co[2])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void sub_v2_v2(float r[2], const float a[2])
void BKE_image_save_options_update(ImageSaveOptions *opts, const Image *image)
bool ED_mask_selected_minmax(const bContext *C, float min[2], float max[2], bool handles_as_knot, bool handles_as_knot_selected_only)
void BKE_image_clear_autosave(Image *image)
static bool tile_add_poll(bContext *C)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
void IMAGE_OT_match_movie_length(wmOperatorType *ot)
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
void ED_image_undo_push_begin_with_image(const char *name, Image *image, ImBuf *ibuf, ImageUser *iuser)
bool ED_space_image_cursor_poll(bContext *C)
VecBase< float, 3 > float3
bool BKE_image_has_packedfile(const Image *image)
bool WM_cursor_modal_is_set_ok(const wmWindow *win)
Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data_with_uvs(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
static wmOperatorStatus image_sample_line_exec(bContext *C, wmOperator *op)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void IMAGE_OT_view_zoom_out(wmOperatorType *ot)
bool IMB_scale(ImBuf *ibuf, int2 new_size, IMBScaleFilter filter, bool threaded=true)
void IMAGE_OT_resize(wmOperatorType *ot)
static void image_new_free(wmOperator *op)
int MOV_get_duration_frames(const MovieReader *anim)
const EnumPropertyItem rna_enum_image_generated_type_items[]
int WM_userdef_event_type_from_keymap_type(int kmitype)
static wmOperatorStatus image_rotate_orthogonal_exec(bContext *C, wmOperator *op)
void ED_image_view_center_to_point(SpaceImage *sima, float x, float y)
Image * BKE_image_add_generated(Main *bmain, unsigned int width, unsigned int height, const char *name, int depth, int floatbuf, short gen_type, const float color[4], bool stereo3d, bool is_data, bool tiled)
bool RE_ReadRenderResult(Scene *scene, Scene *scenode)
void BKE_imageuser_default(ImageUser *iuser)
static wmOperatorStatus image_clipboard_copy_exec(bContext *C, wmOperator *op)
static bool image_not_packed_poll(bContext *C)
void WM_cursor_wait(bool val)
static void image_open_cancel(bContext *, wmOperator *op)
MINLINE int min_ii(int a, int b)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports)
static bool image_should_pack_during_save_all(const Image *ima)
bool BKE_image_remove_renderslot(Image *ima, ImageUser *iuser, int slot)
ARegion * CTX_wm_region(const bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
static bool image_clipboard_paste_poll(bContext *C)
static void image_save_options_from_op(Main *bmain, ImageSaveOptions *opts, wmOperator *op)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
Image * ED_space_image(const SpaceImage *sima)
static bool change_frame_poll(bContext *C)
bool ED_space_image_show_uvedit(const SpaceImage *sima, Object *obedit)
void IMB_cacheIter_free(ImBufCacheIter *iter)
bool space_image_main_region_poll(bContext *C)
float RNA_float_get(PointerRNA *ptr, const char *name)
PointerRNA CTX_data_pointer_get_type(const bContext *C, const char *member, StructRNA *type)
void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
bool ED_image_should_save_modified(const Main *bmain)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const ImageFormatData *im_format)
wmOperatorStatus ED_imbuf_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void image_save_as_draw(bContext *C, wmOperator *op)
const char * BLI_path_slash_rfind(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
static void change_frame_apply(bContext *C, wmOperator *op, const bool always_update)
static void tile_fill_draw(bContext *, wmOperator *op)
bool BKE_image_memorypack(Image *ima)
static bool image_file_browse_poll(bContext *C)
void IMAGE_OT_view_zoom_in(wmOperatorType *ot)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
bool BKE_image_save(ReportList *reports, Main *bmain, Image *ima, ImageUser *iuser, const ImageSaveOptions *opts)
void IMAGE_OT_new(wmOperatorType *ot)
static void def_fill_tile(StructOrFunctionRNA *srna)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
bool ED_space_image_color_sample(SpaceImage *sima, ARegion *region, const int mval[2], float r_col[3], bool *r_is_data)
void IMAGE_OT_pack(wmOperatorType *ot)
static void image_view_pan_cancel(bContext *C, wmOperator *op)
void BLI_rctf_init(struct rctf *rect, float xmin, float xmax, float ymin, float ymax)
void ED_area_tag_redraw(ScrArea *area)
bool BKE_image_buffer_format_writable(ImBuf *ibuf)
void WM_gesture_straightline_cancel(bContext *C, wmOperator *op)
void IMAGE_OT_save(wmOperatorType *ot)
void IMAGE_OT_save_sequence(wmOperatorType *ot)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
vector snap(vector a, vector b)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const ColorSpace * colorspace
std::atomic< gpu::Texture * > texture
ImBufByteBuffer byte_buffer
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
bool colorspace_is_data() const
const float * float_data() const
float * float_data_for_write()
bool can_contain_alpha() const
ListBaseT< LinkData > udim_tiles
ImageFormatData im_format
ImageFormatData im_format
bke::library::LibraryRuntime * runtime
ListBaseT< Image > images
struct RenderResult * render
ColorManagedViewSettings view_settings
ColorManagedDisplaySettings display_settings
ListBaseT< SpaceLink > spacedata
struct Histogram sample_line_hist
void use_property_decorate_set(bool is_decorate)
void use_property_split_set(bool is_sep)
void prop_with_menu(PointerRNA *ptr, blender::StringRefNull propname, eUI_Item_Flag flag, std::optional< blender::StringRefNull > name, int icon, const char *menu_type)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
Layout & column(bool align)
void separator(float factor=1.0f, LayoutSeparatorType type=LayoutSeparatorType::Auto)
wmEventModifierFlag modifier
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) check(bContext *C, wmOperator *op)
void(*) cancel(bContext *C, wmOperator *op)
void(*) ui(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type