48#define DNA_DEPRECATED_ALLOW
133 if (image->
runtime->partial_update_user !=
nullptr) {
135 image->
runtime->partial_update_user =
nullptr;
154 if (image !=
nullptr) {
160 std::optional<Library *> ,
166 const Image *image_src = (
const Image *)id_src;
178 image_dst->
cache =
nullptr;
179 image_dst->
rr =
nullptr;
183 slot->render =
nullptr;
190 for (
int eye = 0; eye < 2; eye++) {
203 image_dst->
runtime = MEM_new<blender::bke::ImageRuntime>(__func__);
218 slot->render =
nullptr;
243 function_callback(
id, &key, (
void **)&image->
cache, 0, user_data);
246 function_callback(
id, &key, &image->
anims.
first, 0, user_data);
248 function_callback(
id, &key, &image->
anims.
last, 0, user_data);
250 auto gputexture_offset = [image](
int target,
int eye) {
253 const size_t array_offset =
sizeof(*first) * (&image->
gputexture[target][eye] - first);
254 return base_offset + array_offset;
257 for (
int eye = 0; eye < 2; eye++) {
264 function_callback(
id, &key, (
void **)&image->
gputexture[a][eye], 0, user_data);
269 function_callback(
id, &key, (
void **)&image->
rr, 0, user_data);
273 function_callback(
id, &key, (
void **)&slot->render, 0, user_data);
341 ima->
cache =
nullptr;
344 for (
int i = 0;
i < 3;
i++) {
345 for (
int j = 0; j < 2; j++) {
385 ima->packedfile =
nullptr;
407 if (!imapf->packedfile) {
412 ima->packedfile =
nullptr;
424 ima->
runtime = MEM_new<blender::bke::ImageRuntime>(__func__);
435 if (ima->
cache ==
nullptr) {
477 Image *ima,
ImageUser *iuser,
int entry,
int cfra,
bool is_sequence);
483#define IMA_NO_INDEX 0x7FEFEFEF
486#define IMA_MAKE_INDEX(entry, index) (((entry) << 10) + (index))
487#define IMA_INDEX_ENTRY(index) ((index) >> 10)
489# define IMA_INDEX_PASS(index) (index & ~1023)
513 return (a->
index !=
b->index);
529 if (image->
cache ==
nullptr) {
545 if (image->
cache ==
nullptr) {
575 image->
cache =
nullptr;
617 ima->
runtime->cache_mutex.lock();
631 ima->
runtime->cache_mutex.unlock();
648 tile->tile_number = tile_number;
673 for (
int i = 0;
i < 8;
i++) {
678 ima->
runtime = MEM_new<blender::bke::ImageRuntime>(__func__);
685 std::optional<Library *> owner_library,
710 bool *r_is_cached_empty)
742 imapf_src = imapf_src->
next)
761 if (dest && source && dest != source) {
763 std::scoped_lock lock_src(source->
runtime->cache_mutex);
764 std::scoped_lock lock_dst(dest->
runtime->cache_mutex);
766 if (source->
cache !=
nullptr) {
767 MovieCacheIter *iter;
799 return (ibuf !=
nullptr);
804 for (
int eye = 0; eye < 2; eye++) {
818 return (iuser && iuser->
tile) ? iuser->
tile :
tile->tile_number;
823 if (ima ==
nullptr) {
829 if (
ELEM(tile_number, 0, 1001)) {
839 if (
tile->tile_number == tile_number) {
855 if (r_ofs ==
nullptr) {
868 int tile_number = 1001 + 10 * iy + ix;
924 const float best_uv[2],
928 if (best_dist_sq == dist_sq) {
929 if (best_uv[0] == uv[0]) {
930 return (uv[1] > best_uv[1]);
932 return (uv[0] > best_uv[0]);
934 return (dist_sq < best_dist_sq);
939 float r_uv_offset[2])
944 int tile_number_best = -1;
947 return tile_number_best;
961 if (
floorf(co[0]) == uv_offset[0] &&
floorf(co[1]) == uv_offset[1]) {
964 return tile_number_best;
970 dist_best_sq = dist_sq;
972 tile_number_best =
tile->tile_number;
975 return tile_number_best;
980 float uv_offset_dummy[2];
1029 const char *filepath,
1030 char *r_filepath_abs)
1033 if (owner_library) {
1047 std::optional<Library *> owner_library,
1048 const char *filepath)
1089 std::optional<Library *> owner_library,
1090 const char *filepath,
1116 if (ima->
id.
lib != owner_lib) {
1148 const short gen_type = usersata->
gen_type;
1171 uchar *rect =
nullptr;
1172 float *rect_float =
nullptr;
1173 float fill_color[4];
1186 if (ibuf !=
nullptr) {
1210 if (ibuf !=
nullptr) {
1234 data.rect_float = rect_float;
1249 const float color[4],
1250 const bool stereo3d,
1262 if (ima ==
nullptr) {
1275 tile->gen_x = width;
1276 tile->gen_y = height;
1277 tile->gen_type = gen_type;
1279 tile->gen_depth = depth;
1287 for (view_id = 0; view_id < 2; view_id++) {
1291 int entry = tiled ? 1001 : 0;
1308 const char *colorspace_name =
nullptr;
1328 if (colorspace_name) {
1335 if (
name ==
nullptr) {
1374 image->gen_x = ibuf->
x;
1375 image->gen_y = ibuf->
y;
1385 Image *ima,
ImBuf *ibuf,
int view,
int tile_number,
const char *filepath)
1431 int entry = is_tiled ?
tile->tile_number : 0;
1438 const char *filepath = ibuf->
filepath;
1442 filepath = tiled_filepath;
1444 else if (is_multiview) {
1513 const size_t data_len)
1517 if (tot_viewfiles != 1) {
1518 BKE_report(reports,
RPT_ERROR,
"Cannot pack multiview images from raw data currently...");
1551 std::scoped_lock
lock(image->
runtime->cache_mutex);
1553 if (image->
cache !=
nullptr) {
1559 if (ibuf ==
nullptr) {
1574 uintptr_t
size, totsize = 0;
1582 printf(
"\ntotal image memory len: %.3f MB\n",
double(totsize) /
double(1024 * 1024));
1590 printf(
"%s len: %.3f MB\n", ima->
id.
name + 2,
double(
size) /
double(1024 * 1024));
1597 if (ibuf ==
nullptr) {
1605#undef CHECK_FREED_SIZE
1609#ifdef CHECK_FREED_SIZE
1610 uintptr_t tot_freed_size = 0;
1631#ifdef CHECK_FREED_SIZE
1637#ifdef CHECK_FREED_SIZE
1642#ifdef CHECK_FREED_SIZE
1643 printf(
"%s: freed total %lu MB\n", __func__, tot_freed_size / (1024 * 1024));
1649 if (ibuf ==
nullptr) {
1652 int except_frame = *(
int *)userdata;
1660 if (ima->
cache !=
nullptr) {
1684#define STAMP_NAME_SIZE ((MAX_ID_NAME - 2) + 16)
1718#undef STAMP_NAME_SIZE
1734 do_prefix ?
"File %s" :
"%s",
1735 (blendfile_path[0] !=
'\0') ? blendfile_path :
"<untitled>");
1738 stamp_data->
file[0] =
'\0';
1746 stamp_data->
note[0] =
'\0';
1753 "%04d/%02d/%02d %02d:%02d:%02d",
1763 stamp_data->
date[0] =
'\0';
1779 stamp_data->
marker[0] =
'\0';
1788 scene->frames_per_second(),
1793 stamp_data->
time[0] =
'\0';
1800 if (scene->
r.
efra > 9) {
1804 SNPRINTF_UTF8(fmtstr, do_prefix ?
"Frame %%0%di" :
"%%0%di", digits);
1808 stamp_data->
frame[0] =
'\0';
1813 do_prefix ?
"Frame Range %d:%d" :
"%d:%d",
1823 do_prefix ?
"Camera %s" :
"%s",
1824 camera ? camera->
id.
name + 2 :
"<none>");
1827 stamp_data->
camera[0] =
'\0';
1848 stamp_data->
scene[0] =
'\0';
1864 stamp_data->
strip[0] =
'\0';
1884 stamp_data->
memory[0] =
'\0';
1889 do_prefix ?
"Frame Range %d:%d" :
"%d:%d",
1916 stamp_data->
file[0] =
'\0';
1922 stamp_data->
note[0] =
'\0';
1928 stamp_data->
date[0] =
'\0';
1934 stamp_data->
marker[0] =
'\0';
1940 stamp_data->
time[0] =
'\0';
1946 stamp_data->
frame[0] =
'\0';
1950 do_prefix ?
"Frame Range %s" :
"%s",
1960 stamp_data->
camera[0] =
'\0';
1973 stamp_data->
scene[0] =
'\0';
1979 stamp_data->
strip[0] =
'\0';
1983 do_prefix ?
"RenderTime %s" :
"%s",
1991 stamp_data->
memory, do_prefix ?
"Peak Memory %s" :
"%s", stamp_data_template->
memory);
1994 stamp_data->
memory[0] =
'\0';
1998 stamp_data->
hostname, do_prefix ?
"Hostname %s" :
"%s", stamp_data_template->
hostname);
2025#define TEXT_SIZE_CHECK(str, w, h) \
2026 ((str[0]) && ((void)(h = h_fixed), (w = int(BLF_width(mono, str, sizeof(str))))))
2029#define TEXT_SIZE_CHECK_WORD_WRAP(str, w, h) \
2030 ((str[0]) && (BLF_boundbox(mono, str, sizeof(str), &wrap.rect, &wrap.info), \
2031 (void)(h = h_fixed * wrap.info.lines), \
2032 (w = BLI_rcti_size_x(&wrap.rect))))
2034#define BUFF_MARGIN_X 2
2035#define BUFF_MARGIN_Y 1
2042 if (stamp_data_template ==
nullptr) {
2043 stampdata(scene, camera, &stamp_data, do_prefix,
true);
2279 x = ibuf->
x -
w - 2;
2313 BLF_buffer(mono,
nullptr,
nullptr, 0, 0,
nullptr);
2316#undef TEXT_SIZE_CHECK
2317#undef TEXT_SIZE_CHECK_WORD_WRAP
2340 if (!allocate_only) {
2341 stampdata(scene, camera, stamp_data, 0,
true);
2360 stampdata(scene,
nullptr, stamp_data, 0,
false);
2400 if ((callback ==
nullptr) || (stamp_data ==
nullptr)) {
2404#define CALL(member, value_str) \
2405 if (noskip || stamp_data->member[0]) { \
2406 callback(data, value_str, stamp_data->member, sizeof(stamp_data->member)); \
2415 CALL(marker,
"Marker");
2417 CALL(frame,
"Frame");
2418 CALL(frame_range,
"FrameRange");
2419 CALL(camera,
"Camera");
2420 CALL(cameralens,
"Lens");
2421 CALL(scene,
"Scene");
2422 CALL(strip,
"Strip");
2423 CALL(rendertime,
"RenderTime");
2424 CALL(memory,
"Memory");
2425 CALL(hostname,
"Hostname");
2428 if (noskip || custom_field->value[0]) {
2429 callback(
data, custom_field->key, custom_field->value, strlen(custom_field->value) + 1);
2441 std::scoped_lock
lock(image.
runtime->cache_mutex);
2465 if (stamp_data ==
nullptr) {
2473 custom_fieldn->value =
static_cast<char *
>(
MEM_dupallocN(custom_fieldn->value));
2481 if (stamp_data ==
nullptr) {
2493 const char *propname,
2503 const char *propname,
2505 int propvalue_maxncpy)
2545 if (buf[3] < 1.0f) {
2553 if (buf[3] != 255) {
2565 CLOG_ERROR(&
LOG,
"Couldn't create directory for file %s: %s", filepath, std::strerror(errno));
2572 if (!ok && errno != 0) {
2580 const char *filepath,
2582 const bool save_copy)
2584 ImBuf ibuf_back = *ibuf;
2605 const char *filepath,
2617 const int streamindex,
2618 const bool keep_original_colorspace,
2623 anim =
MOV_open_file(filepath, flags, streamindex, keep_original_colorspace, colorspace);
2628 const int ibuf_flags,
2629 const int streamindex,
2630 const bool keep_original_colorspace,
2636 anim =
MOV_open_file(filepath, ibuf_flags, streamindex, keep_original_colorspace, colorspace);
2637 if (anim ==
nullptr) {
2642 if (ibuf ==
nullptr) {
2645 reason =
"file doesn't exist";
2648 reason =
"not an anim";
2650 CLOG_INFO(&
LOG,
"unable to load anim, %s: %s", reason, filepath);
2691 if (ima->
type == type) {
2697 if (ima ==
nullptr) {
2702 if (ima->
id.
us == 0) {
2742 return image_view->
name[0] ==
'\0';
2753 if (!scene_render_view) {
2792 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
2794 switch (ntree->
type) {
2796 for (
bNode *node : ntree->all_nodes()) {
2801 callback(ima,
id, &tex->
iuser, customdata);
2806 callback(ima,
id, &tex->
iuser, customdata);
2812 for (
bNode *node : ntree->all_nodes()) {
2816 callback(ima,
id, iuser, customdata);
2821 for (
bNode *node : ntree->all_nodes()) {
2825 callback(ima,
id, iuser, customdata);
2832 callback(image,
id, image_user, customdata);
2844 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
2850 if (gpu_material_texture->iuser_available) {
2851 callback(gpu_material_texture->ima,
id, &gpu_material_texture->iuser, customdata);
2859 bool skip_nested_nodes,
2861 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
2873 if (ma->
nodetree && !skip_nested_nodes) {
2888 if (world->
nodetree && !skip_nested_nodes) {
2897 callback(tex->
ima, &tex->
id, &tex->
iuser, customdata);
2912 callback(bgpic->ima,
nullptr, &bgpic->iuser, customdata);
2924 callback(sima->
image,
nullptr, &sima->
iuser, customdata);
2938 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
2941 scene =
static_cast<Scene *
>(scene->id.next))
2947 ob =
static_cast<Object *
>(ob->id.next))
2959 ma =
static_cast<Material *
>(ma->id.next))
2965 light =
static_cast<Light *
>(light->id.next))
2971 world =
static_cast<World *
>(world->id.next))
2977 tex =
static_cast<Tex *
>(tex->id.next))
2983 cam =
static_cast<Camera *
>(cam->id.next))
2997 Image *changed_image =
static_cast<Image *
>(customdata);
3011 Image *changed_image =
static_cast<Image *
>(customdata);
3013 if (ima == changed_image) {
3053 for (
int eye = 0; eye < 2; eye++) {
3064 for (
int i = 0;
i < totviews;
i++) {
3097 if (ima ==
nullptr) {
3101 ima->
runtime->cache_mutex.lock();
3122 if (base_tile->
gen_x == 0 || base_tile->
gen_y == 0) {
3125 base_tile->
gen_x = ibuf->
x;
3126 base_tile->
gen_y = ibuf->
y;
3206 imapf->packedfile =
pf;
3209 printf(
"ERROR: Image \"%s\" not available. Keeping packed image\n", imapf->filepath);
3223 ListBase new_tiles = {
nullptr,
nullptr};
3224 int new_start, new_range;
3238 int remaining_tile_number = base_tile->
tile_number;
3239 bool needs_final_cleanup =
true;
3248 if (new_tile_number == remaining_tile_number) {
3249 needs_final_cleanup =
false;
3254 if (needs_final_cleanup) {
3260 else if (ima->
filepath[0] !=
'\0') {
3287 ima->
runtime->cache_mutex.unlock();
3306 const char *rp_name =
"";
3310 if (rp_index == pass) {
3317 rp_name = rpass->
name;
3327 if (rpass_ret ==
nullptr) {
3333 *r_passindex = (rpass == rpass_ret ? rp_index : pass);
3342 const int label_maxncpy)
3345 if (ima ==
nullptr ||
tile ==
nullptr) {
3349 if (
tile->label[0]) {
3367 bool all_valid_udim =
true;
3374 for (
int i = 0;
i < dirs_num;
i++) {
3375 if (!(dirs[
i].type & S_IFREG)) {
3385 all_valid_udim =
false;
3390 min_udim =
min_ii(min_udim,
id);
3391 max_udim =
max_ii(max_udim,
id);
3399 *r_tile_start = min_udim;
3400 *r_tile_range = max_udim - min_udim + 1;
3412 if (tile_number < 1001 || tile_number >
IMA_UDIM_MAX) {
3420 next_tile = next_tile->
next)
3444 for (
int eye = 0; eye < 2; eye++) {
3475 if (new_tile_number < 1001 || new_tile_number >
IMA_UDIM_MAX) {
3479 const int old_tile_number =
tile->tile_number;
3480 tile->tile_number = new_tile_number;
3484 for (
int i = 0;
i < totviews;
i++) {
3498 for (
int eye = 0; eye < 2; eye++) {
3538 if (tile_ibuf !=
nullptr) {
3549 return strstr(filename,
"<UDIM>") !=
nullptr || strstr(filename,
"<UVTILE>") !=
nullptr;
3555 "Only the file-name component should be used!");
3561 std::string path(filename);
3567 std::regex pattern(R
"((.*[._-])([12]\d{3})([._-].*))");
3568 if (std::regex_search(path, match, pattern)) {
3569 BLI_strncpy(filename, match.format(
"$1<UDIM>$3").c_str(), filename_maxncpy);
3574 pattern = std::regex(R
"((.*)(u\d{1,2}_v\d{1,3})(\D.*))");
3575 if (std::regex_search(path, match, pattern)) {
3576 BLI_strncpy(filename, match.format(
"$1<UVTILE>$3").c_str(), filename_maxncpy);
3600 for (
int i = 0;
i < dirs_num;
i++) {
3601 if (!(dirs[
i].type & S_IFREG)) {
3625 if (filepath ==
nullptr || r_tile_format ==
nullptr) {
3629 if (strstr(filepath,
"<UDIM>") !=
nullptr) {
3633 if (strstr(filepath,
"<UVTILE>") !=
nullptr) {
3643 const char *pattern,
3647 if (filepath ==
nullptr || pattern ==
nullptr || r_tile_number ==
nullptr) {
3655 if (sscanf(filepath, pattern, &u) == 1) {
3661 if (sscanf(filepath, pattern, &u, &
v) == 2) {
3662 *r_tile_number = 1001 + (u - 1) + ((
v - 1) * 10);
3671 const char *pattern,
3675 if (filepath ==
nullptr || pattern ==
nullptr) {
3683 int u = ((tile_number - 1001) % 10);
3684 int v = ((tile_number - 1001) / 10);
3697 if (rr ==
nullptr) {
3702 short index = 0, rv_index, rl_index = 0;
3711 if (iuser->
layer == rl_index) {
3733 if ((iuser->
view < 0) ||
3785 bool modified =
false;
3786 for (; rv; rv = rv->
next, iv = iv->
next) {
3836 if (render_result) {
3854#ifdef WITH_IMAGE_OPENEXR
3885 last_slot->
render =
nullptr;
3889 if (free_current_slot) {
3926 if (left_iv ==
nullptr) {
3940#ifdef WITH_IMAGE_OPENEXR
3941static void image_create_multilayer(
Image *ima,
ImBuf *ibuf,
int framenr)
3954 if (ima->
rr !=
nullptr) {
4006 if (!is_multiview) {
4019 ImBuf *ibuf =
nullptr;
4024 if (ima->
rr ==
nullptr || frame != ima->
rr->
framenr) {
4039 printf(
"error, multi is normal image\n");
4045 if (rpass && rpass->
ibuf) {
4063 ImBuf *ibuf =
nullptr;
4068 if (ia->
anim ==
nullptr) {
4081 iuser_t.
view = view_id;
4089 if (ia->
anim && iuser && iuser->
frames == 0) {
4096 int fra = frame - 1;
4098 fra = std::max(fra, 0);
4099 fra = std::min(fra, dur - 1);
4112 ImBuf *ibuf =
nullptr;
4119 for (
int i = 0;
i < tot_viewfiles;
i++) {
4126 if (!is_multiview) {
4134 for (
int i = 0;
i < tot_viewfiles;
i++) {
4142 for (
int i = 0;
i < totviews;
i++) {
4147 ibuf = ibuf_arr[(iuser ? iuser->
multi_index : 0)];
4150 for (
int i = 0;
i < totviews;
i++) {
4151 if (ibuf_arr[
i] != ibuf) {
4164 const bool has_packed,
4165 const bool is_sequence,
4169 ImBuf *ibuf =
nullptr;
4172 *r_cache_ibuf =
true;
4176 if (has_packed && !is_sequence) {
4178 if (imapf->view == view_id && imapf->tile_number == tile_number) {
4179 if (imapf->packedfile) {
4181 imapf->packedfile->size,
4198 if (!(is_sequence || is_tiled)) {
4210 iuser_t.
view = view_id;
4219#ifdef WITH_IMAGE_OPENEXR
4224 image_create_multilayer(ima, ibuf, cfra);
4230 *r_cache_ibuf =
false;
4239 if (!is_sequence && (has_packed ==
false) && (
G.fileflags &
G_FILE_AUTOPACK)) {
4244 imapf->
view = view_id;
4259 Image *ima,
ImageUser *iuser,
int entry,
int cfra,
bool is_sequence)
4261 ImBuf *ibuf =
nullptr;
4267 if (!(is_sequence || is_tiled)) {
4273 if (!is_sequence && has_packed) {
4281 if (!is_multiview) {
4283 ibuf =
load_image_single(ima, iuser, cfra, 0, has_packed, is_sequence, &put_in_cache);
4285 const int index = (is_sequence || is_tiled) ? 0 :
IMA_NO_INDEX;
4296 for (
int i = 0;
i < tot_viewfiles;
i++) {
4298 ima, iuser, cfra,
i, has_packed, is_sequence, &cache_ibuf_arr[
i]);
4303 tot_viewfiles == 1 && totviews >= 2)
4310 ibuf = ibuf_arr[ibuf_index];
4312 for (
int i = 0;
i < totviews;
i++) {
4313 if (cache_ibuf_arr[
i]) {
4319 for (
int i = 0;
i < totviews;
i++) {
4320 if (ibuf_arr[
i] != ibuf) {
4331 ImBuf *ibuf =
nullptr;
4333 if (ima->
rr ==
nullptr) {
4343 if (rpass && rpass->
ibuf) {
4365 ImBuf *pass_ibuf =
nullptr;
4369 if (!(iuser && iuser->
scene)) {
4380 const int layer = iuser->
layer;
4381 const int pass = iuser->
pass;
4382 int actview = iuser->
view;
4413 if (rv ==
nullptr) {
4419 if (rv ==
nullptr) {
4420 pass_ibuf = rres.
ibuf;
4423 pass_ibuf = rv->
ibuf;
4441 pass_ibuf = rpass->
ibuf;
4461 if (ima->
cache ==
nullptr) {
4476 pass_ibuf->
dither = dither;
4486 pass_ibuf->
x = rres.
rectx;
4487 pass_ibuf->
y = rres.
recty;
4500 if (is_multilayer) {
4547 Image *ima,
ImageUser *iuser,
int *r_entry,
int *r_index,
bool *r_is_cached_empty)
4549 ImBuf *ibuf =
nullptr;
4605 if (ima ==
nullptr) {
4610 if (
tile ==
nullptr) {
4624 ImBuf *ibuf =
nullptr;
4625 int entry = 0, index = 0;
4636 bool is_cached_empty =
false;
4638 if (is_cached_empty) {
4642 if (ibuf ==
nullptr) {
4682 ima, iuser, 0, entry,
false);
4694 if (base_tile->
gen_x == 0) {
4695 base_tile->
gen_x = 1024;
4697 if (base_tile->
gen_y == 0) {
4698 base_tile->
gen_y = 1024;
4749 if (ima ==
nullptr) {
4759 const char *view_name)
4765 const int view_image = image_user.
view;
4766 const bool is_allview = (view_image == 0);
4778 return view_image - 1;
4784 const char *pass_name,
4785 const char *view_name)
4787 std::scoped_lock
lock(image.
runtime->cache_mutex);
4824 if (
lock !=
nullptr) {
4860 return ibuf !=
nullptr;
4867 if (image_ibuf ==
nullptr) {
4872 float scale =
float(max_size) /
float(std::max(image_ibuf->
x, image_ibuf->
y));
4874 *r_width = image_ibuf->
x;
4877 *r_height = image_ibuf->
y;
4910 ImagePool *pool = MEM_new<ImagePool>(__func__);
4924 if (item->ibuf !=
nullptr) {
4925 std::scoped_lock
lock(item->image->runtime->cache_mutex);
4936 ImagePool *pool,
Image *image,
int entry,
int index,
bool *r_found)
4939 if (item->image == image && item->entry == entry && item->index == index) {
4959 if (pool ==
nullptr) {
4991 item->
entry = entry;
4992 item->
index = index;
5006 if (pool ==
nullptr) {
5015 if (r_is_in_range) {
5016 *r_is_in_range =
false;
5024 cfra = cfra - iuser->
sfra + 1;
5028 cfra = ((cfra) %
len);
5036 if (r_is_in_range) {
5037 *r_is_in_range =
true;
5044 else if (cfra >
len) {
5048 if (r_is_in_range) {
5049 *r_is_in_range =
true;
5055 framenr = std::min(framenr, iuser->
frames);
5058 framenr = ((framenr) %
len);
5059 while (framenr < 0) {
5068 framenr += iuser->
offset;
5118 int cfra = *(
int *)customdata;
5139 *(
bool *)customdata =
true;
5147 bool has_animation =
false;
5148 bool skip_nested_nodes =
true;
5150 return has_animation;
5159 Depsgraph *
depsgraph = (Depsgraph *)customdata;
5178 bool skip_nested_nodes =
true;
5191 const bool resolve_udim,
5192 const bool resolve_multiview)
5217 else if (resolve_udim) {
5234 const int planes = (ibuf ? ibuf->
planes : 0);
5237 if (
ELEM(planes, 32, 16)) {
5246 ImBuf *ibuf =
nullptr;
5249 if (image !=
nullptr) {
5253 if (ibuf && ibuf->
x > 0 && ibuf->
y > 0) {
5255 *r_height = ibuf->
y;
5258 iuser->
scene !=
nullptr)
5267 if (image !=
nullptr) {
5277 r_size[0] =
float(width);
5278 r_size[1] =
float(height);
5287 *r_aspy = image->
aspy / image->
aspx;
5300 uchar *pixels =
nullptr;
5330 float *pixels =
nullptr;
5388 bool is_dirty =
false;
5389 bool is_writable =
false;
5391 std::scoped_lock
lock(image->
runtime->cache_mutex);
5392 if (image->
cache !=
nullptr) {
5407 if (r_is_writable) {
5408 *r_is_writable = is_writable;
5434 std::scoped_lock
lock(image->
runtime->cache_mutex);
5435 if (image->
cache !=
nullptr) {
5440 if (ibuf !=
nullptr) {
5452 bool has_loaded_ibuf =
false;
5454 std::scoped_lock
lock(image->
runtime->cache_mutex);
5455 if (image->
cache !=
nullptr) {
5460 if (ibuf !=
nullptr) {
5461 has_loaded_ibuf =
true;
5469 return has_loaded_ibuf;
5475 ImBuf *ibuf =
nullptr;
5477 std::scoped_lock
lock(image->
runtime->cache_mutex);
5478 if (image->
cache !=
nullptr) {
5483 if (current_ibuf !=
nullptr &&
STREQ(current_ibuf->
filepath, filepath)) {
5484 ibuf = current_ibuf;
5498 ImBuf *ibuf =
nullptr;
5500 std::scoped_lock
lock(image->
runtime->cache_mutex);
5501 if (image->
cache !=
nullptr) {
5506 if (ibuf !=
nullptr) {
5527 if (!is_multiview) {
5533 for (
int i = 0;
i < 2;
i++) {
5542 const char *ext =
nullptr;
5546 if (prefix[0] ==
'\0') {
5555 SNPRINTF(filepath_view,
"%s%s%s", prefix, srv->suffix, ext);
5614 if (
G.is_rendering) {
5620 if (slot >= num_slots || num_slots == 1) {
5631 if (current_slot == remove_slot) {
5636 next_slot = current_slot;
5641 if (remove_slot == current_last_slot) {
5645 if (current_slot == remove_slot) {
5646 next_last_slot = next_slot;
5649 next_last_slot = current_slot;
5652 if (iuser ==
nullptr || iuser->
scene ==
nullptr) {
5656 if (re !=
nullptr) {
5660 current_last_slot = next_last_slot;
5663 current_slot = next_slot;
5670 if (remove_slot->
render) {
5684 if (
G.is_rendering) {
5699 if (render_slot->
render) {
5701 render_slot->
render =
nullptr;
bool BKE_bpath_foreach_path_fixed_process(BPathForeachPathData *bpath_data, char *path, size_t path_maxncpy)
@ BKE_BPATH_FOREACH_PATH_SKIP_PACKED
@ BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN
@ BKE_BPATH_FOREACH_PATH_RELOAD_EDITED
void BKE_icon_id_delete(struct ID *id)
void BKE_icon_changed(int icon_id)
int BKE_icon_id_ensure(struct ID *id)
void(*)(ID *id, const IDCacheKey *cache_key, void **cache_p, uint flags, void *user_data) IDTypeForeachCacheFunctionCallback
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
@ IDTYPE_FLAGS_NO_ANIMDATA
@ UDIM_TILE_FORMAT_UVTILE
void StampCallback(void *data, const char *propname, char *propvalue, int propvalue_maxncpy)
void BKE_image_partial_update_free(PartialUpdateUser *user)
free a partial update user.
void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int width, int height)
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height)
#define IMA_SIGNAL_COLORMANAGE
void BKE_image_free_gputextures(Image *ima)
#define IMA_SIGNAL_SRC_CHANGE
#define IMA_SIGNAL_USER_NEW_IMAGE
#define IMA_SIGNAL_RELOAD
void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4])
void BKE_image_partial_update_mark_full_update(Image *image)
Mark the whole image to be updated.
void BKE_image_partial_update_register_free(Image *image)
void BKE_id_free(Main *bmain, void *idv)
void id_us_ensure_real(ID *id)
void * BKE_libblock_alloc_in_lib(Main *bmain, std::optional< Library * > owner_library, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
void BKE_id_blend_write(BlendWriter *writer, ID *id)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
const char * BKE_main_blendfile_path_from_global()
#define SH_NODE_TEX_IMAGE
#define CMP_NODE_CRYPTOMATTE
#define SH_NODE_TEX_ENVIRONMENT
void BKE_ntree_update(Main &bmain, std::optional< blender::Span< bNodeTree * > > modified_trees=std::nullopt, const NodeTreeUpdateExtraParams ¶ms={})
void BKE_ntree_update_tag_id_changed(Main *bmain, ID *id)
PackedFile * BKE_packedfile_duplicate(const PackedFile *pf_src)
void BKE_packedfile_free(PackedFile *pf)
PackedFile * BKE_packedfile_new_from_memory(const void *mem, int memlen, const blender::ImplicitSharingInfo *sharing_info=nullptr)
void BKE_packedfile_blend_write(BlendWriter *writer, const PackedFile *pf)
void BKE_packedfile_blend_read(BlendDataReader *reader, PackedFile **pf_p, blender::StringRefNull filepath)
PackedFile * BKE_packedfile_new(ReportList *reports, const char *filepath_rel, const char *basepath)
void BKE_previewimg_blend_write(BlendWriter *writer, const PreviewImage *prv)
void BKE_previewimg_free(PreviewImage **prv)
void BKE_previewimg_blend_read(BlendDataReader *reader, PreviewImage *prv)
void BKE_previewimg_id_copy(ID *new_id, const ID *old_id)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
int BKE_scene_multiview_num_views_get(const RenderData *rd)
bool BKE_scene_multiview_is_render_view_active(const RenderData *rd, const SceneRenderView *srv)
void BKE_scene_multiview_view_prefix_get(Scene *scene, const char *filepath, char *r_prefix, const char **r_ext)
bool BKE_scene_multiview_is_stereo3d(const RenderData *rd)
const char * BKE_scene_find_last_marker_name(const Scene *scene, int frame)
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
void BLF_size(int fontid, float size)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_enable(int fontid, FontFlags flag)
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, const ColorSpace *colorspace)
int BLF_width_max(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_draw_buffer(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
void BLF_wordwrap(int fontid, int wrap_width, BLFWrapMode mode=BLFWrapMode::Minimal)
void BLF_buffer_col(int fontid, const float srgb_color[4]) ATTR_NONNULL(2)
void BLF_disable(int fontid, FontFlags flag)
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
void BLF_position(int fontid, float x, float y, float z)
#define BLI_assert_msg(a, msg)
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries)
int BLI_open(const char *filepath, int oflag, int pmode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_file_ensure_parent_dir_exists(const char *filepath) ATTR_NONNULL(1)
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
LinkData * BLI_genericNodeN(void *data)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
int BLI_listbase_count_at_most(const ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findstringindex(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_listbase_sort(ListBase *listbase, int(*cmp)(const void *, const void *)) ATTR_NONNULL(1
BLI_INLINE bool BLI_listbase_count_is_equal_to(const ListBase *listbase, const int count_cmp)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void void BLI_INLINE bool BLI_listbase_is_single(const ListBase *lb)
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
MINLINE int integer_digits_i(int i)
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v2_v2_db(double r[2], const double a[2])
MINLINE void sub_v2_v2(float r[2], const float a[2])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void zero_v2(float r[2])
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
bool bool BLI_path_suffix(char *path, size_t path_maxncpy, const char *suffix, const char *sep) ATTR_NONNULL(1
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_check_array(const char *path, const char **ext_array) ATTR_NONNULL(1
#define BLI_path_join(...)
void void void BLI_path_split_file_part(const char *filepath, char *file, size_t file_maxncpy) ATTR_NONNULL(1
void BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_check(const char *path, const char *ext) ATTR_NONNULL(1
const char * BLI_path_slash_find(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
int BLI_path_sequence_decode(const char *path, char *head, size_t head_maxncpy, char *tail, size_t tail_maxncpy, unsigned short *r_digits_len)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
bool BLI_path_extension_check_n(const char *path,...) ATTR_NONNULL(1) ATTR_SENTINEL(0)
void BLI_path_sequence_encode(char *path, size_t path_maxncpy, const char *head, const char *tail, unsigned short numlen, int pic)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define SNPRINTF(dst, format,...)
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
char * BLI_string_replaceN(const char *__restrict str, const char *__restrict substr_old, const char *__restrict substr_new) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BLI_hostname_get(char *buffer, size_t buffer_maxncpy)
void BLI_task_isolate(void(*func)(void *userdata), void *userdata)
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
int BLI_thread_is_main(void)
Platform independent time functions.
long int BLI_time_now_seconds_i(void)
size_t BLI_timecode_string_from_time_simple(char *str, size_t maxncpy, double time_seconds) ATTR_NONNULL()
size_t BLI_timecode_string_from_time(char *str, size_t maxncpy, int brevity_level, float time_seconds, double fps, short timecode_style) ATTR_NONNULL()
#define POINTER_FROM_INT(i)
#define UNUSED_VARS_NDEBUG(...)
#define POINTER_AS_INT(i)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
const char * dirname(char *path)
bool BLO_read_data_is_undo(BlendDataReader *reader)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_write_struct_list(writer, struct_name, list_ptr)
#define BLO_read_struct(reader, struct_name, ptr_p)
bool BLO_write_is_undo(BlendWriter *writer)
#define BLT_I18NCONTEXT_ID_IMAGE
#define CLOG_ERROR(clg_ref,...)
#define CLOG_STR_ERROR(clg_ref, str)
#define CLOG_INFO(clg_ref,...)
void DEG_id_tag_update(ID *id, unsigned int flags)
float DEG_get_ctime(const Depsgraph *graph)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
#define ID_BLEND_PATH(_bmain, _id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
#define DNA_struct_default_get(struct_name)
#define IMAGE_GPU_PASS_NONE
#define IMAGE_GPU_LAYER_NONE
@ IMA_USER_FRAME_IN_RANGE
@ IMA_ALPHA_CHANNEL_PACKED
#define IMAGE_GPU_FRAME_NONE
#define IMAGE_GPU_VIEW_NONE
@ CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE
Object is a sort of wrapper for general info.
#define STEREO_LEFT_SUFFIX
#define STEREO_RIGHT_NAME
#define STEREO_RIGHT_SUFFIX
#define IMG_SIZE_FALLBACK
@ USER_TIMECODE_SMPTE_FULL
ListBase GPU_material_textures(GPUMaterial *material)
void GPU_texture_free(blender::gpu::Texture *texture)
void IMB_colormanagement_assign_byte_colorspace(ImBuf *ibuf, const char *name)
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
void IMB_colormanagement_check_is_data(ImBuf *ibuf, const char *name)
@ COLOR_ROLE_DEFAULT_FLOAT
@ COLOR_ROLE_DEFAULT_BYTE
bool IMB_colormanagement_space_name_is_data(const char *name)
const char * IMB_colormanagement_colorspace_get_name(const ColorSpace *colorspace)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
ImBuf * IMB_load_image_from_filepath(const char *filepath, const int flags, char r_colorspace[IM_MAX_SPACE]=nullptr)
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
ImBuf * IMB_load_image_from_memory(const unsigned char *mem, const size_t size, const int flags, const char *descr, const char *filepath=nullptr, char r_colorspace[IM_MAX_SPACE]=nullptr)
ImBuf * IMB_makeSingleUser(ImBuf *ibuf)
void IMB_ImBufFromStereo3d(const Stereo3dFormat *s3d, ImBuf *ibuf_stereo3d, ImBuf **r_ibuf_left, ImBuf **r_ibuf_right)
void IMB_byte_from_float(ImBuf *ibuf)
void IMB_freeImBuf(ImBuf *ibuf)
size_t IMB_get_pixel_count(const ImBuf *ibuf)
Get the length of the data of the given image buffer in pixels.
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, unsigned char planes, unsigned int flags)
void IMB_refImBuf(ImBuf *ibuf)
uint8_t * IMB_steal_encoded_buffer(ImBuf *ibuf)
void IMB_rectfill_area(ImBuf *ibuf, const float scene_linear_color[4], int x1, int y1, int x2, int y2)
bool IMB_save_image(ImBuf *ibuf, const char *filepath, const int flags)
bool IMB_scale(ImBuf *ibuf, unsigned int newx, unsigned int newy, IMBScaleFilter filter, bool threaded=true)
size_t IMB_get_size_in_memory(const ImBuf *ibuf)
const char * imb_ext_movie[]
@ IB_alphamode_channel_packed
MovieCacheIter * IMB_moviecacheIter_new(MovieCache *cache)
void * IMB_moviecacheIter_getUserKey(MovieCacheIter *iter)
void IMB_moviecache_free(MovieCache *cache)
void IMB_moviecache_cleanup(MovieCache *cache, bool(cleanup_check_cb)(ImBuf *ibuf, void *userkey, void *userdata), void *userdata)
ImBuf * IMB_moviecache_get(MovieCache *cache, void *userkey, bool *r_is_cached_empty)
void IMB_moviecacheIter_free(MovieCacheIter *iter)
bool IMB_moviecacheIter_done(MovieCacheIter *iter)
void IMB_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf)
void IMB_moviecache_set_getdata_callback(MovieCache *cache, MovieCacheGetKeyDataFP getdatafp)
void IMB_moviecacheIter_step(MovieCacheIter *iter)
ImBuf * IMB_moviecacheIter_getImBuf(MovieCacheIter *iter)
MovieCache * IMB_moviecache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp)
void IMB_moviecache_remove(MovieCache *cache, void *userkey)
void IMB_exr_close(ExrHandle *handle)
bool IMB_exr_has_multilayer(ExrHandle *handle)
Read Guarded memory(de)allocation.
int pad[32 - sizeof(int)]
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
CCL_NAMESPACE_BEGIN struct Options options
#define pf(_x, _i)
Prefetch 64.
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
const ccl_global KernelWorkTile * tile
void * MEM_mallocN(size_t len, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
void MOV_close(MovieReader *anim)
int MOV_get_duration_frames(MovieReader *anim, IMB_Timecode_Type tc)
MovieReader * MOV_open_file(const char *filepath, const int ib_flags, const int streamindex, const bool keep_original_colorspace, char colorspace[IM_MAX_SPACE])
ImBuf * MOV_decode_frame(MovieReader *anim, int position, IMB_Timecode_Type tc, IMB_Proxy_Size preview_size)
const Strip * strip_topmost_get(const Scene *scene, int frame)
float wrap(float value, float max, float min)
bool RE_HasCombinedLayer(const RenderResult *result)
bool RE_RenderResult_is_stereo(const RenderResult *result)
void BKE_imbuf_stamp_info(const RenderResult *rr, ImBuf *ibuf)
Image * BKE_image_load_exists_in_lib(Main *bmain, std::optional< Library * > owner_library, const char *filepath, bool *r_exists)
static bool nearest_udim_tile_tie_break(const float best_dist_sq, const float best_uv[2], const float dist_sq, const float uv[2])
int BKE_image_get_tile_from_pos(Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
RenderSlot * BKE_image_get_renderslot(Image *ima, int index)
static void image_init_color_management(Image *ima)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
static void image_free_tile(Image *ima, ImageTile *tile)
static void image_abs_path(Main *bmain, Library *owner_library, const char *filepath, char *r_filepath_abs)
bool BKE_image_is_multilayer(const Image *ima)
bool BKE_image_has_alpha(Image *image)
static void image_init_after_load(Image *ima, ImageUser *iuser, ImBuf *)
void BKE_image_ensure_viewer_views(const RenderData *rd, Image *ima, ImageUser *iuser)
static void image_walk_ntree_all_users(bNodeTree *ntree, ID *id, void *customdata, void callback(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata))
static void image_gpu_runtime_reset(Image *ima)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
char * BKE_image_get_tile_strformat(const char *filepath, eUDIM_TILE_FORMAT *r_tile_format)
Image * BKE_image_load(Main *bmain, const char *filepath)
static int image_num_viewfiles(Image *ima)
BLI_INLINE bool image_quick_test(Image *ima, const ImageUser *iuser)
void BKE_stamp_info_from_imbuf(RenderResult *rr, ImBuf *ibuf)
void BKE_image_alpha_mode_from_extension(Image *image)
Image * BKE_image_load_exists(Main *bmain, const char *filepath, bool *r_exists)
bool BKE_image_scale(Image *image, int width, int height, ImageUser *iuser)
static void image_viewer_create_views(const RenderData *rd, Image *ima)
BLI_INLINE ImBuf * image_pool_find_item(ImagePool *pool, Image *image, int entry, int index, bool *r_found)
static ImBuf * image_get_cached_ibuf_for_index_entry(Image *ima, int index, int entry, bool *r_is_cached_empty)
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float r_size[2])
void BKE_image_free_buffers_ex(Image *ima, bool do_lock)
static void stampdata(const Scene *scene, Object *camera, StampData *stamp_data, int do_prefix, bool use_dynamic)
bool BKE_image_user_id_has_animation(ID *id)
bool BKE_image_has_filepath(const Image *ima)
void BKE_image_mark_dirty(Image *, ImBuf *ibuf)
void BKE_image_set_filepath_from_tile_number(char *filepath, const char *pattern, eUDIM_TILE_FORMAT tile_format, int tile_number)
void BKE_image_multilayer_stamp_info_callback(void *data, const Image &image, StampCallback callback, bool noskip)
void BKE_image_get_aspect(Image *image, float *r_aspx, float *r_aspy)
StampData * BKE_stamp_data_copy(const StampData *stamp_data)
static ImBuf * add_ibuf_for_tile(Image *ima, ImageTile *tile)
ImBuf * BKE_image_acquire_multilayer_view_ibuf(const RenderData &render_data, Image &image, const ImageUser &image_user, const char *pass_name, const char *view_name)
static void imagecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
static void metadata_copy_custom_fields(const char *field, const char *value, void *rr_v)
bool BKE_image_is_openexr(Image *ima)
bool BKE_image_has_multiple_ibufs(Image *image)
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
static int tile_sort_cb(const void *a, const void *b)
static void image_remove_ibuf(Image *ima, int index, int entry)
RenderPass * BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
static void image_get_entry_and_index(Image *ima, ImageUser *iuser, int *r_entry, int *r_index)
static void image_init_data(ID *id)
bool BKE_image_fill_tile(Image *ima, ImageTile *tile)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void BKE_image_free_data(Image *ima)
Image * BKE_image_add_generated(Main *bmain, uint width, uint height, const char *name, int depth, int floatbuf, short gen_type, const float color[4], const bool stereo3d, const bool is_data, const bool tiled)
RenderSlot * BKE_image_add_renderslot(Image *ima, const char *name)
StampData * BKE_stamp_info_from_scene_static(const Scene *scene)
static uintptr_t image_mem_size(Image *image)
static void image_tag_reload(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata)
static float distance_squared_to_udim(const float co[2], const float udim[2])
void BKE_image_user_file_path(const ImageUser *iuser, const Image *ima, char *filepath)
void BKE_image_tag_time(Image *ima)
static void image_init_multilayer_multiview(Image *ima, RenderResult *rr)
void BKE_image_merge(Main *bmain, Image *dest, Image *source)
MovieReader * openanim(const char *filepath, const int ibuf_flags, const int streamindex, const bool keep_original_colorspace, char colorspace[IMA_MAX_SPACE])
bool BKE_image_memorypack(Image *ima)
void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
static int get_multilayer_view_index(const Image &image, const ImageUser &image_user, const char *view_name)
#define IMA_MAKE_INDEX(entry, index)
void BKE_image_packfiles_from_mem(ReportList *reports, Image *ima, char *data, const size_t data_len)
static ImBuf * image_load_image_file(Image *ima, ImageUser *iuser, int entry, int cfra, bool is_sequence)
static ImBuf * image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
bool BKE_image_is_dirty(Image *image)
static const char * stamp_metadata_fields[]
void BKE_stamp_data_free(StampData *stamp_data)
void BKE_image_free_anim_ibufs(Image *ima, int except_frame)
static ImBuf * imagecache_get(Image *image, int index, bool *r_is_cached_empty)
void BKE_image_release_renderresult(Scene *scene, Image *ima, RenderResult *render_result)
void BKE_image_pool_free(ImagePool *pool)
MovieReader * openanim_noload(const char *filepath, const int flags, const int streamindex, const bool keep_original_colorspace, char colorspace[IMA_MAX_SPACE])
int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_range)
static void image_tag_frame_recalc(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata)
static void image_foreach_path(ID *id, BPathForeachPathData *bpath_data)
static void stampdata_from_template(StampData *stamp_data, const Scene *scene, const StampData *stamp_data_template, bool do_prefix)
#define CALL(member, value_str)
void BKE_image_free_packedfiles(Image *ima)
static void image_runtime_free_data(Image *image)
ImBuf * BKE_image_pool_acquire_ibuf(Image *ima, ImageUser *iuser, ImagePool *pool)
Image * BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
static void image_walk_id_all_users(ID *id, bool skip_nested_nodes, void *customdata, void callback(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata))
static void image_user_id_has_animation(Image *ima, ID *, ImageUser *, void *customdata)
static bool image_views_match_render_views(const Image *image, const RenderData *render_data)
static void image_foreach_cache(ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data)
void BKE_image_sort_tiles(Image *ima)
uchar * BKE_image_get_pixels_for_frame(Image *image, int frame, int tile)
static ImBuf * load_movie_single(Image *ima, ImageUser *iuser, int frame, const int view_id)
void BKE_image_backup_render(Scene *scene, Image *ima, bool free_current_slot)
static uint imagecache_hashhash(const void *key_v)
static ImBuf * load_image_single(Image *ima, ImageUser *iuser, int cfra, const int view_id, const bool has_packed, const bool is_sequence, bool *r_cache_ibuf)
static Image * image_alloc(Main *bmain, std::optional< Library * > owner_library, const char *name, short source, short type)
void BKE_image_user_file_path_ex(const Main *bmain, const ImageUser *iuser, const Image *ima, char *filepath, const bool resolve_udim, const bool resolve_multiview)
bool BKE_image_get_tile_number_from_filepath(const char *filepath, const char *pattern, eUDIM_TILE_FORMAT tile_format, int *r_tile_number)
bool BKE_image_has_opengl_texture(Image *ima)
static void image_free_anims(Image *ima)
void BKE_image_ensure_tile_token_filename_only(char *filename, size_t filename_maxncpy)
static void image_remove_all_tiles(Image *ima)
void BKE_image_get_tile_uv(const Image *ima, const int tile_number, float r_uv[2])
static ImBuf * image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_entry, int *r_index, bool *r_is_cached_empty)
static ImBuf * image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
ImagePool * BKE_image_pool_new()
bool BKE_imbuf_alpha_test(ImBuf *ibuf)
static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int entry)
static void image_walk_gpu_materials(ID *id, ListBase *gpu_materials, void *customdata, void callback(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata))
static int image_get_tile_number_from_iuser(const Image *ima, const ImageUser *iuser)
void BKE_imageuser_default(ImageUser *iuser)
bool BKE_image_has_anim(Image *ima)
#define TEXT_SIZE_CHECK(str, w, h)
Image * BKE_image_load_in_lib(Main *bmain, std::optional< Library * > owner_library, const char *filepath)
int BKE_image_get_tile_label(const Image *ima, const ImageTile *tile, char *label, const int label_maxncpy)
void BKE_render_result_stamp_info(Scene *scene, Object *camera, RenderResult *rr, bool allocate_only)
static void image_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int flag)
static ImBuf * image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BKE_image_free_all_textures(Main *bmain)
static ImBuf * image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int entry, int frame)
void BKE_stamp_info_callback(void *data, StampData *stamp_data, StampCallback callback, bool noskip)
static int imbuf_alpha_flags_for_image(Image *ima)
static bool image_remove_tile(Image *ima, ImageTile *tile)
int BKE_image_sequence_guess_offset(Image *image)
static void metadata_get_field(void *data, const char *propname, char *propvalue, int propvalue_maxncpy)
bool BKE_image_is_stereo(const Image *ima)
bool BKE_image_is_multiview(const Image *ima)
bool BKE_imbuf_write(ImBuf *ibuf, const char *filepath, const ImageFormatData *imf)
void BKE_image_get_size(Image *image, ImageUser *iuser, int *r_width, int *r_height)
static void imagecache_put(Image *image, int index, ImBuf *ibuf)
void BKE_image_ensure_tile_token(char *filepath, size_t filepath_maxncpy)
static void image_free_data(ID *id)
ImBuf * BKE_image_get_ibuf_with_name(Image *image, const char *filepath)
static bool imagecache_check_dirty(ImBuf *ibuf, void *, void *)
static bool image_memorypack_imbuf(Image *ima, ImBuf *ibuf, int view, int tile_number, const char *filepath)
static void image_update_views_format(Image *ima, ImageUser *iuser)
bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *r_tile_start, int *r_tile_range)
static float distance_to_unit_interval(float x)
static void image_free_packedfiles(Image *ima)
char BKE_image_alpha_mode_from_extension_ex(const char *filepath)
void BKE_image_free_views(Image *image)
static void image_editors_update_frame(Image *ima, ID *, ImageUser *iuser, void *customdata)
void BKE_image_all_free_anim_ibufs(Main *bmain, int cfra)
void BKE_image_walk_all_users(const Main *mainp, void *customdata, void callback(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata))
bool BKE_image_remove_renderslot(Image *ima, ImageUser *iuser, int slot)
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
void BKE_image_reassign_tile(Image *ima, ImageTile *tile, int new_tile_number)
static void image_colorspace_from_imbuf(Image *image, const ImBuf *ibuf)
void BKE_render_result_stamp_data(RenderResult *rr, const char *key, const char *value)
static void image_blend_read_data(BlendDataReader *reader, ID *id)
bool BKE_image_is_animated(Image *image)
bool BKE_stamp_is_known_field(const char *field_name)
bool BKE_image_clear_renderslot(Image *ima, ImageUser *iuser, int slot)
bool BKE_image_is_filename_tokenized(char *filepath)
int BKE_image_find_nearest_tile_with_offset(const Image *image, const float co[2], float r_uv_offset[2])
static bool imagecache_hashcmp(const void *a_v, const void *b_v)
static void imagecache_remove(Image *image, int index)
void BKE_image_user_id_eval_animation(Depsgraph *depsgraph, ID *id)
int BKE_image_find_nearest_tile(const Image *image, const float co[2])
bool BKE_imbuf_write_stamp(const Scene *scene, const RenderResult *rr, ImBuf *ibuf, const char *filepath, const ImageFormatData *imf)
void BKE_image_editors_update_frame(const Main *bmain, int cfra)
void BKE_image_replace_imbuf(Image *image, ImBuf *ibuf)
void BKE_image_init_imageuser(Image *ima, ImageUser *iuser)
void BKE_image_stamp_buf(Scene *scene, Object *camera, const StampData *stamp_data_template, ImBuf *ibuf)
void BKE_image_pool_release_ibuf(Image *ima, ImBuf *ibuf, ImagePool *pool)
#define IMA_INDEX_ENTRY(index)
#define TEXT_SIZE_CHECK_WORD_WRAP(str, w, h)
static void image_buf_fill_isolated(void *usersata_v)
ImBuf * BKE_image_preview(Image *ima, const short max_size, short *r_width, short *r_height)
constexpr IDTypeInfo get_type_info()
RenderResult * BKE_image_acquire_renderresult(Scene *scene, Image *ima)
ImageTile * BKE_image_add_tile(Image *ima, int tile_number, const char *label)
static ImageTile * imagetile_alloc(int tile_number)
static RenderPass * image_render_pass_get(RenderLayer *rl, const int pass, const int view, int *r_passindex)
ImBuf * BKE_image_get_first_ibuf(Image *image)
static void image_blend_write(BlendWriter *writer, ID *id, const void *id_address)
static void image_free_cached_frames(Image *image)
static void metadata_set_field(void *data, const char *propname, char *propvalue, int)
static void copy_image_packedfiles(ListBase *lb_dst, const ListBase *lb_src)
void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *options)
static bool imagecache_check_free_anim(ImBuf *ibuf, void *, void *userdata)
static ImBuf * image_get_render_result(Image *ima, ImageUser *iuser, void **r_lock)
bool BKE_image_remove_tile(Image *ima, ImageTile *tile)
static int image_get_multiview_index(Image *ima, ImageUser *iuser)
static void image_add_view(Image *ima, const char *viewname, const char *filepath)
static void image_user_id_eval_animation(Image *ima, ID *, ImageUser *iuser, void *customdata)
bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
float * BKE_image_get_float_pixels_for_frame(Image *image, int frame, int tile)
bool BKE_image_has_packedfile(const Image *ima)
bool BKE_imbuf_write_as(ImBuf *ibuf, const char *filepath, const ImageFormatData *imf, const bool save_copy)
void BKE_image_multiview_index(const Image *ima, ImageUser *iuser)
bool BKE_image_has_loaded_ibuf(Image *image)
bool BKE_image_tile_filepath_exists(const char *filepath)
void BKE_image_print_memlist(Main *bmain)
bool BKE_image_is_dirty_writable(Image *image, bool *r_is_writable)
static void image_init(Image *ima, short source, short type)
static void image_blend_read_after_liblink(BlendLibReader *, ID *id)
bool BKE_image_buffer_format_writable(ImBuf *ibuf)
void RE_ReleaseResultImage(Render *re)
RenderResult * RE_MultilayerConvert(ExrHandle *exrhandle, const char *colorspace, bool predivide, int rectx, int recty)
void RE_AcquireResultImage(Render *re, RenderResult *rr, const int view_id)
void RE_ClearResult(Render *re)
void RE_SwapResult(Render *re, RenderResult **rr)
void RE_FreeRenderResult(RenderResult *rr)
void RE_ReferenceRenderResult(RenderResult *rr)
RenderResult * RE_AcquireResultRead(Render *re)
void RE_ReleaseResult(Render *re)
Render * RE_GetSceneRender(const Scene *scene)
RenderStats * RE_GetStats(Render *re)
struct ListBase bg_images
unsigned int id_session_uid
IDTypeBlendReadUndoPreserve blend_read_undo_preserve
uint64_t dependencies_id_types
IDTypeForeachIDFunction foreach_id
IDTypeCopyDataFunction copy_data
IDTypeInitDataFunction init_data
IDTypeForeachCacheFunction foreach_cache
IDTypeBlendWriteFunction blend_write
IDTypeBlendReadDataFunction blend_read_data
IDTypeFreeDataFunction free_data
IDTypeMakeLocalFunction make_local
AssetTypeInfo * asset_type_info
IDTypeLibOverrideApplyPost lib_override_apply_post
IDTypeForeachPathFunction foreach_path
const char * translation_context
IDTypeBlendReadAfterLiblinkFunction blend_read_after_liblink
IDTypeEmbeddedOwnerPointerGetFunction owner_pointer_get
const ColorSpace * colorspace
const ColorSpace * colorspace
char filepath[IMB_FILEPATH_SIZE]
ImBufFloatBuffer float_buffer
ImbFormatOptions foptions
ImBufByteBuffer byte_buffer
ImBufByteBuffer encoded_buffer
unsigned int encoded_size
struct MovieReader * anim
struct PackedFile * packedfile
struct ImagePackedFile * next
BLI_mempool * memory_pool
struct MovieCache * cache
GPUTexture * gputexture[3][2]
struct ListBase packedfiles
struct PreviewImage * preview
ColorManagedColorspaceSettings colorspace_settings
struct Stereo3dFormat * stereo3d_format
ImageRuntimeHandle * runtime
LibraryRuntimeHandle * runtime
struct bNodeTree * nodetree
struct bNodeTree * nodetree
struct RenderLayer * next
struct StampData * stamp_data
struct RenderResult * render
StampDataCustomField * prev
StampDataCustomField * next
char memory[STAMP_NAME_SIZE]
char strip[STAMP_NAME_SIZE]
char rendertime[STAMP_NAME_SIZE]
char camera[STAMP_NAME_SIZE]
char cameralens[STAMP_NAME_SIZE]
char scene[STAMP_NAME_SIZE]
struct bNodeTree * nodetree
struct bNodeTree * nodetree
void * BKE_image_free_buffers
void * BKE_image_get_tile_from_iuser
void * BKE_image_get_tile