50#define DNA_DEPRECATED_ALLOW
130 const ListBaseT<ImagePackedFile> *lb_src);
140 if (
image !=
nullptr) {
146 std::optional<Library *> ,
151 const Image *image_src = id_cast<const Image *>(id_src);
152 Image *image_dst = id_cast<Image *>(id_dst);
153 image_dst->runtime = MEM_new<bke::ImageRuntime>(__func__);
156 &image_src->colorspace_settings);
162 MEM_dupalloc(image_src->stereo3d_format));
166 image_dst->rr =
nullptr;
169 for (
RenderSlot &slot : image_dst->renderslots) {
173 image_dst->anims.clear_no_delete();
181 image_dst->preview =
nullptr;
201 image->renderslots.free_no_destruct();
204 MEM_SAFE_DELETE(
image->stereo3d_format);
209 image->tiles.free_no_destruct();
211 MEM_delete(
image->runtime);
223 function_callback(
id, &key, &
image->anims.first_, 0, user_data);
225 function_callback(
id, &key, &
image->anims.last_, 0, user_data);
228 function_callback(
id, &key,
reinterpret_cast<void **
>(&
image->rr), 0, user_data);
232 function_callback(
id, &key,
reinterpret_cast<void **
>(&slot.
render), 0, user_data);
236 constexpr size_t runtime_base_id = size_t(1) << 32u;
239 function_callback(
id, &key,
reinterpret_cast<void **
>(&
image->runtime->cache), 0, user_data);
243 const char *source_filepath_abs,
244 const char *cache_dir)
249 source_filepath_abs, cache_dir, [&](
StringRef cache_filepath) {
259 const char *expanded_path,
272 Image *ima = id_cast<Image *>(
id);
287 STRNCPY(abs_filepath, ima->filepath);
303 tile_filepath, udim_pattern, tile_format,
tile.tile_number);
309 MEM_SAFE_DELETE(udim_pattern);
328 STRNCPY(temp_path, ima->filepath);
334 temp_path, udim_pattern, tile_format, (ima->tiles.first())->tile_number);
335 MEM_SAFE_DELETE(udim_pattern);
342 BLI_path_join(ima->filepath,
sizeof(ima->filepath), new_dir, orig_file);
347 bpath_data, ima->filepath,
sizeof(ima->filepath));
371 Image *ima = id_cast<Image *>(
id);
372 const bool is_undo = writer->
is_undo();
376 ima->runtime =
nullptr;
378 ima->anims.clear_no_delete();
386 ima->packedfiles.clear_no_delete();
387 ima->autosave_packedfiles.clear_no_delete();
391 if (ima->packedfiles.first() !=
nullptr) {
392 imapf = ima->packedfiles.first();
420 struct_writer.shallow_data.runtime = {};
424 ima->packedfile =
nullptr;
426 writer->write_struct_list(&ima->renderslots);
431 Image *ima = id_cast<Image *>(
id);
437 ima->last_render_slot = ima->render_slot;
443 if (ima->packedfiles.first()) {
446 if (!imapf.packedfile) {
451 ima->packedfile =
nullptr;
458 if (ima->autosave_packedfiles.first()) {
459 for (
ImagePackedFile &imapf : ima->autosave_packedfiles.items_mutable()) {
461 if (!imapf.packedfile) {
468 ima->anims.clear_no_delete();
473 ima->runtime = MEM_new<bke::ImageRuntime>(__func__);
483 "An image should never be marked as temporary packed after loading");
485 "An image should never have autosave data after loading");
492 if (ima->runtime->cache ==
nullptr) {
498 .id_code = Image::id_type,
500 .dependencies_id_types = 0,
502 .struct_size =
sizeof(
Image),
504 .name_plural =
N_(
"images"),
507 .asset_type_info =
nullptr,
512 .make_local =
nullptr,
513 .foreach_id =
nullptr,
516 .foreach_working_space_color =
nullptr,
517 .foreach_asset_weak_reference =
nullptr,
518 .owner_pointer_get =
nullptr,
524 .blend_read_undo_preserve =
nullptr,
526 .lib_override_apply_post =
nullptr,
530static int image_num_viewfiles(
Image *ima);
531static ImBuf *image_load_image_file(
532 Image *ima, ImageUser *iuser,
int entry,
int cfra,
bool is_sequence);
533static ImBuf *image_acquire_ibuf(
Image *ima,
536 const bool ensure_host_buffer,
537 bool *r_load_failed =
nullptr,
538 const bool cached_only =
false);
539static void image_update_views_format(
Image *ima, ImageUser *iuser);
540static void image_add_view(
Image *ima,
const char *viewname,
const char *filepath);
559 return (a->
index !=
b->index);
573 if (
image->runtime->cache ==
nullptr) {
582 if (ibuf !=
nullptr) {
591 if (
image->runtime->cache ==
nullptr) {
600 if (
image->runtime->cache) {
602 if (ibuf !=
nullptr) {
619 if (
image->runtime->cache) {
621 image->runtime->cache =
nullptr;
627 while (ima->packedfiles.last()) {
644 while (ima->autosave_packedfiles.last()) {
662 image->views.free_no_destruct();
667 while (ima->anims.last()) {
681 ima->runtime->cache_mutex.lock();
693 ima->runtime->cache_mutex.unlock();
728 if (
U.textimeout == 0 || ctime %
U.texcollectrate || ctime == lasttime) {
733 if (
G.is_rendering) {
740 if ((ima.flag &
IMA_NOCOLLECT) || ima.runtime->cache ==
nullptr) {
744 bool any_buffer_left =
false;
746 std::scoped_lock
lock(ima.runtime->cache_mutex);
755 if (ibuf !=
nullptr) {
757 bool freed_gpu =
false;
759 const int owner_refs = multilayer_ibufs.
contains(ibuf) ? 1 : 0;
772 if (!freed_gpu && ibuf->
gpu.
texture ==
nullptr &&
778 any_buffer_left =
true;
791 if (!any_buffer_left && !multilayer_ibufs.
is_empty()) {
812 tile->tile_number = tile_number;
824 ima->source = source;
835 for (
int i = 0; i < 8; i++) {
840 ima->runtime = MEM_new<bke::ImageRuntime>(__func__);
843 ima->stereo3d_format = MEM_new<Stereo3dFormat>(
"Image Stereo Format");
847 std::optional<Library *> owner_library,
872 bool *r_is_cached_empty)
907 const ListBaseT<ImagePackedFile> *lb_src)
911 lb_dst->clear_no_delete();
912 for (imapf_src = lb_src->first(); imapf_src; imapf_src = imapf_src->
next) {
913 ImagePackedFile *imapf_dst = MEM_new<ImagePackedFile>(
"Image Packed Files (copy)");
930 if (dest && source && dest != source) {
932 std::scoped_lock lock_src(source->runtime->cache_mutex);
933 std::scoped_lock lock_dst(dest->runtime->cache_mutex);
935 if (source->runtime->cache !=
nullptr) {
936 ImBufCacheIter *iter;
969 return (ibuf !=
nullptr);
974 BLI_assert(ima !=
nullptr && ima->tiles.first());
976 return (iuser && iuser->
tile) ? iuser->
tile :
tile->tile_number;
981 if (ima ==
nullptr) {
987 if (
ELEM(tile_number, 0, 1001)) {
988 return ima->tiles.first();
997 if (
tile.tile_number == tile_number) {
1013 if (r_ofs ==
nullptr) {
1020 if ((ima->source !=
IMA_SRC_TILED) || uv[0] < 0.0f || uv[1] < 0.0f || uv[0] >= 10.0f) {
1024 int ix = int(uv[0]);
1025 int iy = int(uv[1]);
1026 int tile_number = 1001 + 10 * iy + ix;
1082 const float best_uv[2],
1083 const float dist_sq,
1086 if (best_dist_sq == dist_sq) {
1087 if (best_uv[0] == uv[0]) {
1088 return (uv[1] > best_uv[1]);
1090 return (uv[0] > best_uv[0]);
1092 return (dist_sq < best_dist_sq);
1097 float r_uv_offset[2])
1102 int tile_number_best = -1;
1105 return tile_number_best;
1119 if (
floorf(co[0]) == uv_offset[0] &&
floorf(co[1]) == uv_offset[1]) {
1122 return tile_number_best;
1128 dist_best_sq = dist_sq;
1130 tile_number_best =
tile.tile_number;
1133 return tile_number_best;
1138 float uv_offset_dummy[2];
1187 const char *filepath,
1188 char *r_filepath_abs)
1191 if (owner_library) {
1205 std::optional<Library *> owner_library,
1206 const char *filepath,
1233 STRNCPY(ima->filepath, filepath);
1250 std::optional<Library *> owner_library,
1251 const char *filepath,
1264 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1266 STRNCPY(filepath_test, ima->filepath);
1276 if (ima->id.lib != owner_lib) {
1308 const short gen_type = usersata->
gen_type;
1331 uchar *rect =
nullptr;
1332 float *rect_float =
nullptr;
1333 float fill_color[4];
1340 if (ima->colorspace_settings.name[0] ==
'\0') {
1347 if (ibuf !=
nullptr) {
1365 if (ima->colorspace_settings.name[0] ==
'\0') {
1372 if (ibuf !=
nullptr) {
1386 STRNCPY(filepath, ima->filepath);
1399 data.rect_float = rect_float;
1414 const float color[4],
1415 const bool stereo3d,
1427 if (ima ==
nullptr) {
1440 tile->gen_x = width;
1441 tile->gen_y = height;
1444 tile->gen_depth = depth;
1452 for (view_id = 0; view_id < 2; view_id++) {
1456 int entry = tiled ? 1001 : 0;
1473 const char *colorspace_name =
nullptr;
1479 if (ibuf->
byte_data() && !colorspace_name) {
1483 if (colorspace_name) {
1490 if (name ==
nullptr) {
1530 base_tile->
gen_x = ibuf->
x;
1531 base_tile->
gen_y = ibuf->
y;
1541 Image *ima,
ImBuf *ibuf,
int view,
int tile_number,
const char *filepath)
1554 shared_data->data.data(),
int(shared_data->data.size()), shared_data);
1556 ImagePackedFile *imapf = MEM_new<ImagePackedFile>(
"Image PackedFile");
1582 for (
int view = 0; view < tot_viewfiles; view++) {
1585 int entry = is_tiled ?
tile.tile_number : 0;
1592 const char *filepath = ibuf->
filepath.c_str();
1596 filepath = tiled_filepath;
1598 else if (is_multiview) {
1638 Image *ima,
ImBuf *ibuf,
int view,
int tile_number,
const char *filepath)
1651 shared_data->data.data(),
int(shared_data->data.size()), shared_data);
1653 ImagePackedFile *imapf = MEM_new<ImagePackedFile>(
"Image PackedFile");
1679 for (
int view = 0; view < tot_viewfiles; view++) {
1682 int entry = is_tiled ?
tile.tile_number : 0;
1689 const char *filepath = ibuf->
filepath.c_str();
1693 filepath = tiled_filepath;
1695 else if (is_multiview) {
1727 for (
int view = 0; view < tot_viewfiles; view++) {
1734 ImagePackedFile *imapf = MEM_new<ImagePackedFile>(
"Image packed file");
1755 const size_t data_len)
1759 if (tot_viewfiles != 1) {
1760 BKE_report(reports,
RPT_ERROR,
"Cannot pack multiview images from raw data currently...");
1795 if (is_packed && !is_dirty && !
data) {
1810 char *data_dup =
static_cast<char *
>(
1812 memcpy(data_dup,
data,
size_t(data_len));
1815 else if (is_dirty) {
1832 std::scoped_lock
lock(
image->runtime->cache_mutex);
1834 if (
image->runtime->cache !=
nullptr) {
1859 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1863 printf(
"\ntotal image memory len: %.3f MB\n",
double(totsize) /
double(1024 * 1024));
1865 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1869 printf(
"%s len: %.3f MB\n", ima->id.name + 2,
double(size) /
double(1024 * 1024));
1876 if (ibuf ==
nullptr) {
1884#undef CHECK_FREED_SIZE
1888#ifdef CHECK_FREED_SIZE
1892 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1896 for (tex = bmain->
textures.first(); tex; tex =
static_cast<Tex *
>(tex->
id.
next)) {
1902 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1903 if (ima->runtime->cache && (ima->id.tag &
ID_TAG_DOIT)) {
1904#ifdef CHECK_FREED_SIZE
1910#ifdef CHECK_FREED_SIZE
1915#ifdef CHECK_FREED_SIZE
1916 printf(
"%s: freed total %lu MB\n", __func__, tot_freed_size / (1024 * 1024));
1922 if (ibuf ==
nullptr) {
1926 const int except_frame = *
static_cast<int *
>(userdata);
1938 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
1940 std::scoped_lock
lock(ima->runtime->cache_mutex);
1941 if (ima->runtime->cache !=
nullptr) {
1954#define STAMP_NAME_SIZE ((MAX_ID_NAME - 2) + 16)
1988#undef STAMP_NAME_SIZE
2004 do_prefix ?
"File %s" :
"%s",
2005 (blendfile_path[0] !=
'\0') ? blendfile_path :
"<untitled>");
2008 stamp_data->
file[0] =
'\0';
2016 stamp_data->
note[0] =
'\0';
2023 "%04d/%02d/%02d %02d:%02d:%02d",
2033 stamp_data->
date[0] =
'\0';
2049 stamp_data->
marker[0] =
'\0';
2058 scene->frames_per_second(),
2063 stamp_data->
time[0] =
'\0';
2070 if (scene->
r.
efra > 9) {
2074 SNPRINTF_UTF8(fmtstr, do_prefix ?
"Frame %%0%di" :
"%%0%di", digits);
2078 stamp_data->
frame[0] =
'\0';
2083 do_prefix ?
"Frame Range %d:%d" :
"%d:%d",
2093 do_prefix ?
"Camera %s" :
"%s",
2097 stamp_data->
camera[0] =
'\0';
2118 stamp_data->
scene[0] =
'\0';
2134 stamp_data->
strip[0] =
'\0';
2154 stamp_data->
memory[0] =
'\0';
2159 do_prefix ?
"Frame Range %d:%d" :
"%d:%d",
2186 stamp_data->
file[0] =
'\0';
2192 stamp_data->
note[0] =
'\0';
2198 stamp_data->
date[0] =
'\0';
2204 stamp_data->
marker[0] =
'\0';
2210 stamp_data->
time[0] =
'\0';
2216 stamp_data->
frame[0] =
'\0';
2220 do_prefix ?
"Frame Range %s" :
"%s",
2230 stamp_data->
camera[0] =
'\0';
2243 stamp_data->
scene[0] =
'\0';
2249 stamp_data->
strip[0] =
'\0';
2253 do_prefix ?
"RenderTime %s" :
"%s",
2261 stamp_data->
memory, do_prefix ?
"Peak Memory %s" :
"%s", stamp_data_template->
memory);
2264 stamp_data->
memory[0] =
'\0';
2268 stamp_data->
hostname, do_prefix ?
"Hostname %s" :
"%s", stamp_data_template->
hostname);
2295#define TEXT_SIZE_CHECK(str, w, h) \
2296 ((str[0]) && ((void)(h = h_fixed), (w = int(BLF_width(mono, str, sizeof(str))))))
2299#define TEXT_SIZE_CHECK_WORD_WRAP(str, w, h) \
2300 ((str[0]) && (BLF_boundbox(mono, str, sizeof(str), &wrap.rect, &wrap.info), \
2301 (void)(h = h_fixed * wrap.info.lines), \
2302 (w = BLI_rcti_size_x(&wrap.rect))))
2304#define BUFF_MARGIN_X 2
2305#define BUFF_MARGIN_Y 1
2312 if (stamp_data_template ==
nullptr) {
2550 x = ibuf->
x -
w - 2;
2584 BLF_buffer(mono,
nullptr,
nullptr, 0, 0, 4,
nullptr);
2587#undef TEXT_SIZE_CHECK
2588#undef TEXT_SIZE_CHECK_WORD_WRAP
2611 if (!allocate_only) {
2631 stampdata(scene,
nullptr, stamp_data, 0,
false);
2671 if ((callback ==
nullptr) || (stamp_data ==
nullptr)) {
2675#define CALL(member, value_str) \
2676 if (noskip || stamp_data->member[0]) { \
2677 callback(data, value_str, stamp_data->member, sizeof(stamp_data->member)); \
2686 CALL(marker,
"Marker");
2688 CALL(frame,
"Frame");
2689 CALL(frame_range,
"FrameRange");
2691 CALL(cameralens,
"Lens");
2692 CALL(scene,
"Scene");
2693 CALL(strip,
"Strip");
2694 CALL(rendertime,
"RenderTime");
2695 CALL(memory,
"Memory");
2696 CALL(hostname,
"Hostname");
2699 if (noskip || custom_field.
value[0]) {
2700 callback(
data, custom_field.
key, custom_field.
value, strlen(custom_field.
value) + 1);
2712 std::scoped_lock
lock(
image.runtime->cache_mutex);
2729 "StampData Custom Field");
2737 if (stamp_data ==
nullptr) {
2741 StampData *stamp_datan = MEM_dupalloc(stamp_data);
2745 custom_fieldn.
value = MEM_dupalloc(custom_fieldn.
value);
2753 if (stamp_data ==
nullptr) {
2757 MEM_delete(custom_field.
value);
2760 MEM_delete(stamp_data);
2765 const char *propname,
2775 const char *propname,
2777 int propvalue_maxncpy)
2814 if (buf[3] < 1.0f) {
2821 if (buf[3] != 255) {
2833 CLOG_ERROR(&
LOG,
"Couldn't create directory for file %s: %s", filepath, std::strerror(errno));
2840 if (!ok && errno != 0) {
2848 const char *filepath,
2850 const bool save_copy)
2863 ibuf->
ftype = ftype_back;
2873 const char *filepath,
2885 const int streamindex,
2886 const bool keep_original_colorspace,
2892 filepath, flags, streamindex, keep_original_colorspace, colorspace_settings);
2898 const int streamindex,
2899 const bool keep_original_colorspace,
2906 filepath, ibuf_flags, streamindex, keep_original_colorspace, colorspace_settings);
2907 if (anim ==
nullptr) {
2912 if (ibuf ==
nullptr) {
2915 reason =
"file doesn't exist";
2918 reason =
"not an anim";
2920 CLOG_INFO(&
LOG,
"unable to load anim, %s: %s", reason, filepath);
2957 for (ima = bmain->
images.first(); ima; ima =
static_cast<Image *
>(ima->id.next)) {
2959 if (ima->type == type) {
2965 if (ima ==
nullptr) {
2970 if (ima->id.us == 0) {
3000 if (
image->views.count() != number_of_active_views) {
3010 return image_view->
name[0] ==
'\0';
3021 if (!scene_render_view) {
3044 std::scoped_lock
lock(ima->runtime->cache_mutex);
3060 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
3062 switch (ntree->
type) {
3064 for (
bNode *
node : ntree->all_nodes()) {
3068 Image *ima = id_cast<Image *>(
node->id);
3069 callback(ima,
id, &tex->
iuser, customdata);
3073 Image *ima = id_cast<Image *>(
node->id);
3074 callback(ima,
id, &tex->
iuser, customdata);
3080 for (
bNode *
node : ntree->all_nodes()) {
3082 Image *ima = id_cast<Image *>(
node->id);
3084 callback(ima,
id, iuser, customdata);
3089 for (
bNode *
node : ntree->all_nodes()) {
3091 Image *ima = id_cast<Image *>(
node->id);
3093 callback(ima,
id, iuser, customdata);
3100 callback(
image,
id, image_user, customdata);
3114 ListBaseT<LinkData> *gpu_materials,
3116 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
3118 for (
LinkData &link : *gpu_materials) {
3122 if (gpu_material_texture.iuser_available) {
3123 callback(gpu_material_texture.ima,
id, &gpu_material_texture.iuser, customdata);
3131 bool skip_nested_nodes,
3133 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
3135 switch (
GS(
id->name)) {
3137 Object *ob = id_cast<Object *>(
id);
3139 callback(id_cast<Image *>(ob->
data), &ob->
id, ob->
iuser, customdata);
3144 Material *ma = id_cast<Material *>(
id);
3145 if (ma->nodetree && !skip_nested_nodes) {
3152 Light *light = id_cast<Light *>(
id);
3153 if (light->nodetree && !skip_nested_nodes) {
3159 World *world = id_cast<World *>(
id);
3160 if (world->nodetree && !skip_nested_nodes) {
3167 Tex *tex = id_cast<Tex *>(
id);
3169 callback(tex->
ima, &tex->
id, &tex->
iuser, customdata);
3177 bNodeTree *ntree = id_cast<bNodeTree *>(
id);
3182 Camera *cam = id_cast<Camera *>(
id);
3184 callback(bgpic.
ima,
nullptr, &bgpic.
iuser, customdata);
3196 callback(sima->
image,
nullptr, &sima->
iuser, customdata);
3210 void callback(
Image *ima,
ID *iuser_id,
ImageUser *iuser,
void *customdata))
3212 for (
Scene *scene = mainp->
scenes.first(); scene; scene =
static_cast<Scene *
>(scene->id.next)) {
3230 for (
Light *light = mainp->
lights.first(); light; light =
static_cast<Light *
>(light->id.next)) {
3234 for (
World *world = mainp->
worlds.first(); world; world =
static_cast<World *
>(world->id.next)) {
3238 for (
Tex *tex = mainp->
textures.first(); tex; tex =
static_cast<Tex *
>(tex->id.next)) {
3242 for (
Camera *cam = mainp->
cameras.first(); cam; cam =
static_cast<Camera *
>(cam->id.next)) {
3255 Image *changed_image =
static_cast<Image *
>(customdata);
3269 Image *changed_image =
static_cast<Image *
>(customdata);
3271 if (ima == changed_image) {
3307 const int totviews = ima->views.count();
3308 for (
int i = 0; i < totviews; i++) {
3319 if (ima->tiles.is_single()) {
3341 if (ima ==
nullptr) {
3345 ima->runtime->cache_mutex.lock();
3366 if (base_tile->
gen_x == 0 || base_tile->
gen_y == 0) {
3369 base_tile->
gen_x = ibuf->
x;
3370 base_tile->
gen_y = ibuf->
y;
3382 ima->filepath[0] =
'\0';
3398 ima->filepath, udim_pattern, tile_format, base_tile->
tile_number);
3399 MEM_delete(udim_pattern);
3436 const int tot_files = tot_viewfiles * ima->tiles.count();
3452 printf(
"ERROR: Image \"%s\" not available. Keeping packed image\n", imapf.
filepath);
3466 ListBaseT<LinkData> new_tiles = {
nullptr,
nullptr};
3467 int new_start, new_range;
3470 STRNCPY(filepath, ima->filepath);
3481 int remaining_tile_number = base_tile->
tile_number;
3482 bool needs_final_cleanup =
true;
3488 for (
LinkData &new_tile : new_tiles) {
3491 if (new_tile_number == remaining_tile_number) {
3492 needs_final_cleanup =
false;
3497 if (needs_final_cleanup) {
3501 new_tiles.free_no_destruct();
3503 else if (ima->filepath[0] !=
'\0') {
3530 ima->runtime->cache_mutex.unlock();
3549 const char *rp_name =
"";
3551 for (rpass = rl->
passes.first(); rpass; rpass = rpass->
next, rp_index++) {
3552 if (rp_index == pass) {
3559 rp_name = rpass->
name;
3562 else if (rp_name[0] &&
STREQ(rpass->
name, rp_name) && (rpass->
view_id == view)) {
3569 if (rpass_ret ==
nullptr) {
3571 rpass_ret = rl->
passes.first();
3575 *r_passindex = (rpass == rpass_ret ? rp_index : pass);
3584 const int label_maxncpy)
3587 if (ima ==
nullptr ||
tile ==
nullptr) {
3591 if (
tile->label[0]) {
3598 ListBaseT<LinkData> *
tiles,
3612 bool all_valid_udim =
true;
3619 for (
int i = 0; i < dirs_num; i++) {
3620 if (!(dirs[i].type & S_IFREG)) {
3630 all_valid_udim =
false;
3635 min_udim =
min_ii(min_udim,
id);
3636 max_udim =
max_ii(max_udim,
id);
3639 MEM_SAFE_DELETE(udim_pattern);
3644 *r_tile_start = min_udim;
3645 *r_tile_range = max_udim - min_udim + 1;
3657 if (tile_number < 1001 || tile_number >
IMA_UDIM_MAX) {
3664 for (next_tile = ima->tiles.first(); next_tile; next_tile = next_tile->
next) {
3707 if (new_tile_number < 1001 || new_tile_number >
IMA_UDIM_MAX) {
3711 const int old_tile_number =
tile->tile_number;
3712 tile->tile_number = new_tile_number;
3715 const int totviews = ima->views.count();
3716 for (
int i = 0; i < totviews; i++) {
3759 if (tile_ibuf !=
nullptr) {
3770 return strstr(
filename,
"<UDIM>") !=
nullptr || strstr(
filename,
"<UVTILE>") !=
nullptr;
3776 "Only the file-name component should be used!");
3788 std::regex pattern(R
"((.*[._-])([12]\d{3})([._-].*))");
3789 if (std::regex_search(path, match, pattern)) {
3795 pattern = std::regex(R
"((.*)(u\d{1,2}_v\d{1,3})(\D.*))");
3796 if (std::regex_search(path, match, pattern)) {
3821 for (
int i = 0; i < dirs_num; i++) {
3822 if (!(dirs[i].type & S_IFREG)) {
3839 MEM_SAFE_DELETE(udim_pattern);
3846 if (filepath ==
nullptr || r_tile_format ==
nullptr) {
3850 if (strstr(filepath,
"<UDIM>") !=
nullptr) {
3854 if (strstr(filepath,
"<UVTILE>") !=
nullptr) {
3864 const char *pattern,
3868 if (filepath ==
nullptr || pattern ==
nullptr || r_tile_number ==
nullptr) {
3876 if (sscanf(filepath, pattern, &u) == 1) {
3882 if (sscanf(filepath, pattern, &u, &
v) == 2) {
3883 *r_tile_number = 1001 + (u - 1) + ((
v - 1) * 10);
3892 const char *pattern,
3896 if (filepath ==
nullptr || pattern ==
nullptr) {
3904 int u = ((tile_number - 1001) % 10);
3905 int v = ((tile_number - 1001) / 10);
3918 if (rr ==
nullptr) {
3923 short index = 0, rv_index, rl_index = 0;
3931 for (rl = rr->
layers.first(); rl; rl = rl->
next, rl_index++) {
3932 if (iuser->
layer == rl_index) {
3954 if ((iuser->
view < 0) ||
3987 return (view && (view->
next || view->
name[0]));
4003 if (rr && ima->views.count() == rr->
views.count()) {
4006 bool modified =
false;
4007 for (; rv; rv = rv->
next, iv = iv->
next) {
4019 ImageView *iv = MEM_new<ImageView>(
"Viewer Image View");
4028 std::scoped_lock
lock(ima->runtime->cache_mutex);
4036 if (ima->render_slot == ima->last_render_slot) {
4056 if (render_result) {
4058 std::scoped_lock
lock(ima->runtime->cache_mutex);
4066 if (ima->render_slot == ima->last_render_slot) {
4087 if (!ima->renderslots.first()) {
4089 ima->render_slot = 0;
4090 ima->last_render_slot = 0;
4092 else if (ima->render_slot >= ima->renderslots.count()) {
4093 ima->render_slot = 0;
4094 ima->last_render_slot = 0;
4100 if (last_slot && ima->render_slot != ima->last_render_slot) {
4101 last_slot->
render =
nullptr;
4105 if (free_current_slot) {
4114 ima->last_render_slot = ima->render_slot;
4125 ImageView *iv = MEM_new<ImageView>(
"Viewer Image View");
4140 if (left_iv ==
nullptr) {
4156 const char *
colorspace = ima->colorspace_settings.name;
4166 if (ima->rr !=
nullptr) {
4167 ima->rr->framenr = framenr;
4193 switch (ima->alpha_mode) {
4214 if (!is_multiview) {
4222 return ima->views.count();
4227 ImBuf *ibuf =
nullptr;
4232 if (ima->rr ==
nullptr || frame != ima->rr->framenr) {
4247 printf(
"error, multi is normal image\n");
4253 if (rpass && rpass->
ibuf) {
4264 else if (rpass ==
nullptr && iuser) {
4270 if (ibuf ==
nullptr && (ima->rr ==
nullptr || iuser)) {
4279 ImBuf *ibuf =
nullptr;
4284 if (ia->
anim ==
nullptr) {
4293 iuser_t.
view = view_id;
4298 ia->
anim =
openanim(filepath, flags, 0,
false, &ima->colorspace_settings);
4301 if (ia->
anim && iuser && iuser->
frames == 0) {
4308 int fra = frame - 1;
4310 fra = std::max(fra, 0);
4311 fra = std::min(fra, dur - 1);
4324 ImBuf *ibuf =
nullptr;
4331 for (
int i = 0; i < tot_viewfiles; i++) {
4333 ImageAnim *ia = MEM_new<ImageAnim>(
"Image Anim");
4338 if (!is_multiview) {
4343 const int totviews = ima->views.count();
4346 for (
int i = 0; i < tot_viewfiles; i++) {
4354 for (
int i = 0; i < totviews; i++) {
4359 ibuf = ibuf_arr[(iuser ? iuser->
multi_index : 0)];
4362 for (
int i = 0; i < totviews; i++) {
4363 if (ibuf_arr[i] != ibuf) {
4376 const bool has_packed,
4377 const bool is_sequence,
4381 ImBuf *ibuf =
nullptr;
4386 *r_cache_ibuf =
true;
4390 if (has_packed && !is_sequence) {
4400 &ima->colorspace_settings);
4411 ima->lastframe = cfra;
4416 if (!(is_sequence || is_tiled)) {
4425 iuser_t.
framenr = ima->lastframe;
4428 iuser_t.
view = view_id;
4452 *r_cache_ibuf =
false;
4463 if (!is_sequence && (has_packed ==
false) && (
G.fileflags &
G_FILE_AUTOPACK)) {
4468 imapf->
view = view_id;
4485 Image *ima,
ImageUser *iuser,
int entry,
int cfra,
bool is_sequence)
4487 ImBuf *ibuf =
nullptr;
4493 if (!(is_sequence || is_tiled)) {
4499 if (!is_sequence && has_packed) {
4500 const int totfiles = tot_viewfiles * ima->tiles.count();
4507 if (!is_multiview) {
4509 ibuf =
load_image_single(ima, iuser, cfra, 0, has_packed, is_sequence, &put_in_cache);
4516 const int totviews = ima->views.count();
4522 for (
int i = 0; i < tot_viewfiles; i++) {
4524 ima, iuser, cfra, i, has_packed, is_sequence, &cache_ibuf_arr[i]);
4529 tot_viewfiles == 1 && totviews >= 2)
4536 ibuf = ibuf_arr[ibuf_index];
4538 for (
int i = 0; i < totviews; i++) {
4539 if (cache_ibuf_arr[i]) {
4545 for (
int i = 0; i < totviews; i++) {
4546 if (ibuf_arr[i] != ibuf) {
4562 if (is_multilayer) {
4587 "Image (%s) has %d autosaved files but no `IMA_AUTOSAVE_TEMPPACK` flag! Restoring flag.",
4597 std::scoped_lock
lock(ima->runtime->cache_mutex);
4614 &ima->colorspace_settings);
4628 ImBuf *ibuf =
nullptr;
4630 if (ima->rr ==
nullptr) {
4640 if (rpass && rpass->
ibuf) {
4651 else if (rpass ==
nullptr && iuser) {
4657 if (ibuf ==
nullptr && ima->rr ==
nullptr) {
4660 else if (ibuf ==
nullptr && iuser) {
4673 ImBuf *pass_ibuf =
nullptr;
4675 const int from_render = (ima->render_slot == ima->last_render_slot);
4677 if (!(iuser && iuser->
scene)) {
4689 const int pass = iuser->
pass;
4690 int actview = iuser->
view;
4721 if (rv ==
nullptr) {
4722 rv = rres.
views.first();
4727 if (rv ==
nullptr) {
4728 pass_ibuf = rres.
ibuf;
4731 pass_ibuf = rv->
ibuf;
4743 else if (rres.
layers.first()) {
4749 pass_ibuf = rpass->
ibuf;
4769 if (ima->runtime->cache ==
nullptr) {
4784 pass_ibuf->
dither = dither;
4794 pass_ibuf->
x = rres.
rectx;
4795 pass_ibuf->
y = rres.
recty;
4807 frame = iuser ? iuser->
framenr : ima->lastframe;
4811 frame = iuser ? iuser->
framenr : ima->lastframe;
4814 frame = iuser ? iuser->
framenr : ima->lastframe;
4832 Image *ima,
ImageUser *iuser,
int *r_entry,
int *r_index,
bool *r_is_cached_empty)
4834 ImBuf *ibuf =
nullptr;
4839 entry = iuser ? iuser->
framenr : ima->lastframe;
4841 ima->lastframe = entry;
4845 entry = iuser ? iuser->
framenr : ima->lastframe;
4847 ima->lastframe = entry;
4850 entry = iuser ? iuser->
framenr : ima->lastframe;
4891 if (ima ==
nullptr) {
4896 if (
tile ==
nullptr) {
4912 const bool ensure_host_buffer,
4913 bool *r_load_failed,
4914 const bool cached_only)
4916 ImBuf *ibuf =
nullptr;
4917 int entry = 0,
index = 0;
4922 if (r_load_failed) {
4923 *r_load_failed =
false;
4931 bool is_cached_empty =
false;
4933 if (is_cached_empty) {
4934 if (r_load_failed) {
4935 *r_load_failed =
true;
4940 if (ibuf ==
nullptr && cached_only) {
4945 if (ibuf ==
nullptr) {
4985 ima, iuser, 0, entry,
false);
4997 if (base_tile->
gen_x == 0) {
4998 base_tile->
gen_x = 1024;
5000 if (base_tile->
gen_y == 0) {
5001 base_tile->
gen_y = 1024;
5042 if (ensure_host_buffer) {
5054 if (ima ==
nullptr) {
5058 std::scoped_lock
lock(ima->runtime->cache_mutex);
5065 Image *ima,
ImageUser *iuser,
void **r_lock,
bool *r_load_failed,
const bool cached_only)
5067 if (ima ==
nullptr) {
5071 std::scoped_lock
lock(ima->runtime->cache_mutex);
5077 const char *view_name)
5083 const int view_image = image_user.
view;
5084 const bool is_allview = (view_image == 0);
5096 return view_image - 1;
5102 const char *pass_name,
5103 const char *view_name)
5105 std::scoped_lock
lock(
image.runtime->cache_mutex);
5142 if (
lock !=
nullptr) {
5154 std::scoped_lock
lock(ima->runtime->cache_mutex);
5168 std::scoped_lock
lock(ima->runtime->cache_mutex);
5178 return ibuf !=
nullptr;
5185 if (image_ibuf ==
nullptr) {
5192 *r_width = image_ibuf->
x;
5195 *r_height = image_ibuf->
y;
5228 ImagePool *pool = MEM_new<ImagePool>(__func__);
5239 if (item->ibuf !=
nullptr) {
5240 std::scoped_lock
lock(item->image->runtime->cache_mutex);
5274 if (pool ==
nullptr) {
5306 item->
entry = entry;
5321 if (pool ==
nullptr) {
5337 if (r_is_in_range) {
5338 *r_is_in_range =
false;
5346 cfra = cfra - iuser->
sfra + 1;
5350 cfra = ((cfra) %
len);
5358 if (r_is_in_range) {
5359 *r_is_in_range =
true;
5366 else if (cfra >
len) {
5370 if (r_is_in_range) {
5371 *r_is_in_range =
true;
5377 framenr = std::min(framenr, iuser->
frames);
5380 framenr = ((framenr) %
len);
5381 while (framenr < 0) {
5390 framenr += iuser->
offset;
5430 int cfra = *
static_cast<int *
>(customdata);
5451 *
static_cast<bool *
>(customdata) =
true;
5459 bool has_animation =
false;
5460 bool skip_nested_nodes =
true;
5462 return has_animation;
5471 Depsgraph *depsgraph =
static_cast<Depsgraph *
>(customdata);
5490 bool skip_nested_nodes =
true;
5503 const bool resolve_udim,
5504 const bool resolve_multiview)
5529 else if (resolve_udim) {
5535 MEM_SAFE_DELETE(udim_pattern);
5553 ImBuf *ibuf =
nullptr;
5556 if (
image !=
nullptr) {
5560 if (ibuf && ibuf->
x > 0 && ibuf->
y > 0) {
5562 *r_height = ibuf->
y;
5565 iuser->
scene !=
nullptr)
5574 if (
image !=
nullptr) {
5584 r_size[0] =
float(width);
5585 r_size[1] =
float(height);
5607 uchar *pixels =
nullptr;
5618 pixels = MEM_dupalloc(pixels);
5637 float *pixels =
nullptr;
5648 pixels = MEM_dupalloc(pixels);
5668 return (ima->anims.is_empty() ==
false);
5673 return (ima->packedfiles.is_empty() ==
false);
5680 return ima->filepath[0] !=
'\0';
5700 bool is_dirty =
false;
5701 bool is_writable =
false;
5703 std::scoped_lock
lock(
image->runtime->cache_mutex);
5704 if (
image->runtime->cache !=
nullptr) {
5719 if (r_is_writable) {
5720 *r_is_writable = is_writable;
5741 std::scoped_lock
lock(
image->runtime->cache_mutex);
5742 if (
image->runtime->cache !=
nullptr) {
5747 if (ibuf !=
nullptr) {
5748 ibuf->
ftype = ftype;
5759 bool has_loaded_ibuf =
false;
5761 std::scoped_lock
lock(
image->runtime->cache_mutex);
5762 if (
image->runtime->cache !=
nullptr) {
5770 has_loaded_ibuf =
true;
5778 return has_loaded_ibuf;
5784 ImBuf *ibuf =
nullptr;
5786 std::scoped_lock
lock(
image->runtime->cache_mutex);
5787 if (
image->runtime->cache !=
nullptr) {
5792 if (current_ibuf !=
nullptr && current_ibuf->
filepath == filepath) {
5793 ibuf = current_ibuf;
5807 ImBuf *ibuf =
nullptr;
5809 std::scoped_lock
lock(
image->runtime->cache_mutex);
5810 if (
image->runtime->cache !=
nullptr) {
5839 if (!is_multiview) {
5845 for (
int i = 0; i < 2; i++) {
5853 char *filepath = ima->filepath;
5854 const char *ext =
nullptr;
5858 if (prefix[0] ==
'\0') {
5873 iv = ima->views.last();
5910 RenderSlot *slot = MEM_new<RenderSlot>(
"Image new Render Slot");
5911 if (name && name[0]) {
5915 int n = ima->renderslots.count() + 1;
5924 if (slot == ima->last_render_slot) {
5926 if (
G.is_rendering) {
5931 int num_slots = ima->renderslots.count();
5932 if (slot >= num_slots || num_slots == 1) {
5940 BLI_findlink(&ima->renderslots, ima->last_render_slot));
5943 if (current_slot == remove_slot) {
5945 BLI_findlink(&ima->renderslots, (slot == num_slots - 1) ? slot - 1 : slot + 1));
5948 next_slot = current_slot;
5953 if (remove_slot == current_last_slot) {
5957 if (current_slot == remove_slot) {
5958 next_last_slot = next_slot;
5961 next_last_slot = current_slot;
5964 if (iuser ==
nullptr || iuser->
scene ==
nullptr) {
5968 if (re !=
nullptr) {
5972 current_last_slot = next_last_slot;
5975 current_slot = next_slot;
5979 ima->render_slot =
BLI_findindex(&ima->renderslots, current_slot);
5980 ima->last_render_slot =
BLI_findindex(&ima->renderslots, current_last_slot);
5982 if (remove_slot->
render) {
5985 MEM_delete(remove_slot);
5992 if (slot == ima->last_render_slot) {
5996 if (
G.is_rendering) {
6011 if (render_slot->
render) {
6013 render_slot->
render =
nullptr;
6048 while (dash_pos < relname.
size() && relname[dash_pos] >=
'0' && relname[dash_pos] <=
'9') {
6051 if (dash_pos == 0 || dash_pos >= relname.
size() || relname[dash_pos] !=
'-') {
6057 if (relname.
size() != hex_len) {
6060 for (
const char c : relname) {
6061 if (!((c >=
'0' && c <=
'9') || (c >=
'A' && c <=
'F'))) {
6069 const char *source_filepath_abs,
6079 for (
uint i = 0; i < nentries; i++) {
6080 if (!(filelist[i].type & S_IFREG)) {
6087 if (
STREQ(filelist[i].path, source_filepath_abs)) {
6096 const char *source_filepath_abs,
6097 const char *texture_cache_dir,
6104 if (source_basename[0] ==
'\0') {
6110 if (texture_cache_dir && texture_cache_dir[0] !=
'\0') {
6112 STRNCPY(user_dir, texture_cache_dir);
6115 BLI_path_join(user_dir,
sizeof(user_dir), source_dir, texture_cache_dir);
6122 BLI_path_join(default_dir,
sizeof(default_dir), source_dir,
"blender_tx");
6126 if (user_dir[0] !=
'\0' && !
STREQ(user_dir, default_dir)) {
#define IMA_SIGNAL_COLORMANAGE
#define IMA_SIGNAL_SRC_CHANGE
#define IMA_SIGNAL_USER_NEW_IMAGE
#define IMA_SIGNAL_RELOAD
#define SH_NODE_TEX_IMAGE
#define CMP_NODE_CRYPTOMATTE
#define SH_NODE_TEX_ENVIRONMENT
File and directory operations.
#define BLI_path_join(...)
#define SNPRINTF(dst, format,...)
#define SNPRINTF_UTF8(dst, format,...)
#define STRNCPY_UTF8(dst, src)
Platform independent time functions.
const char * dirname(char *path)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_IMAGE
#define CLOG_ERROR(clg_ref,...)
#define CLOG_STR_ERROR(clg_ref, str)
#define CLOG_INFO(clg_ref,...)
#define ID_IS_LINKED(_id)
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
#define ID_BLEND_PATH(_bmain, _id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
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
Read Blender memory allocation and freeing.
int pad[32 - sizeof(int)]
#define IMA_INDEX_UDIM_ATLAS
#define IMA_MAKE_INDEX(entry, index)
#define IMA_INDEX_MISSING_LAYER
#define IMA_INDEX_ENTRY(index)
#define IMA_INDEX_UDIM_TILE_MAPPING
#define POINTER_FROM_INT(i)
#define UNUSED_VARS_NDEBUG(...)
#define POINTER_AS_INT(i)
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
#define BLI_assert_msg(a, msg)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
bool contains(const Key &key) const
constexpr StringRef drop_prefix(int64_t n) const
constexpr StringRef drop_known_prefix(StringRef prefix) const
constexpr StringRef drop_known_suffix(StringRef suffix) const
void append(const T &value)
constexpr bool startswith(StringRef prefix) const
constexpr int64_t size() const
void copy_utf8_truncated(char *dst, int64_t dst_size) const
constexpr bool endswith(StringRef suffix) const
CCL_NAMESPACE_BEGIN struct Options options
#define pf(_x, _i)
Prefetch 64.
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
float3x3 scale(float3x3 mat, float2 scale)
ccl_gpu_kernel_postfix ccl_global KernelWorkTile * tiles
const ccl_global KernelWorkTile * tile
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
std::string filename(const std::string_view &str, size_t pos)
BLI_INLINE Texture * wrap(MTLTexture *texture)
const Strip * strip_topmost_get(const Scene *scene, int frame)
bool BKE_scene_multiview_is_render_view_active(const RenderData *rd, const SceneRenderView *srv)
bool BKE_image_is_multiview(const Image *ima)
char * BKE_image_get_tile_strformat(const char *filepath, eUDIM_TILE_FORMAT *r_tile_format)
int BKE_image_get_tile_from_pos(Image *ima, const float uv[2], float r_uv[2], float r_ofs[2])
static ImBuf * image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
void BKE_image_buf_fill_color(unsigned char *rect, float *rect_float, int width, int height, const float color[4])
static void image_init_color_management(Image *ima)
static int tile_sort_cb(const void *a, const void *b)
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void IMB_colormanagement_assign_float_colorspace(ImBuf *ibuf, const char *name)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
RenderResult * BKE_image_acquire_renderresult(Scene *scene, Image *ima)
static bool imagecache_check_dirty(ImBuf *ibuf, void *, void *)
void BKE_icon_id_delete(ID *id)
static uint imagecache_hashhash(const void *key_v)
void IMB_cacheIter_step(ImBufCacheIter *iter)
void * IMB_cacheIter_getUserKey(ImBufCacheIter *iter)
void BKE_packedfile_blend_write(BlendWriter *writer, const PackedFile *pf)
void BLI_hostname_get(char *buffer, size_t buffer_maxncpy)
bool BKE_image_is_animated(Image *image)
static ImBuf * image_load_image_file(Image *ima, ImageUser *iuser, int entry, int cfra, bool is_sequence)
ImBuf * IMB_makeSingleUser(ImBuf *ibuf)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
static bool image_index_is_gpu_only(const int index)
void BKE_previewimg_id_free(ID *id)
char * STRNCPY(char(&dst)[N], const char *src)
bool BKE_stamp_is_known_field(const char *field_name)
void BKE_image_sort_tiles(Image *ima)
void BKE_image_multiview_index(const Image *ima, ImageUser *iuser)
bool BKE_image_scale(Image *image, int width, int height, ImageUser *iuser)
static void image_free_cached_frames(Image *image)
void BKE_ntree_update(Main &bmain, std::optional< Span< bNodeTree * > > modified_trees=std::nullopt, const NodeTreeUpdateExtraParams ¶ms={})
void BKE_image_texture_cache_filepaths_foreach(const char *source_filepath_abs, const char *cache_dir, blender::FunctionRef< void(blender::StringRef cache_filepath)> callback)
@ IMA_ALPHA_CHANNEL_PACKED
void BLF_position(int fontid, float x, float y, float z)
static void image_remove_all_tiles(Image *ima)
bool BKE_image_is_dirty(Image *image)
void * BKE_libblock_alloc_in_lib(Main *bmain, std::optional< Library * > owner_library, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
bool BKE_image_clear_renderslot(Image *ima, ImageUser *iuser, int slot)
PackedFile * BKE_packedfile_duplicate(const PackedFile *pf_src)
void StampCallback(void *data, const char *propname, char *propvalue, int propvalue_maxncpy)
void RE_ClearResult(Render *re)
void BKE_previewimg_blend_read(BlendDataReader *reader, PreviewImage *prv)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool RE_HasCombinedLayer(const RenderResult *result)
int BLF_width_max(int fontid) ATTR_WARN_UNUSED_RESULT
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
int64_t BLI_time_now_seconds_i()
static void image_buf_fill_isolated(void *usersata_v)
void BKE_ntree_update_tag_id_changed(Main *bmain, ID *id)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BKE_scene_multiview_view_id_get(const RenderData *rd, const char *viewname)
static void image_update_views_format(Image *ima, ImageUser *iuser)
static void image_init_multilayer_multiview(Image *ima, RenderResult *rr)
unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
static void imagecache_remove(Image *image, ImageCacheKey key)
ImBuf * BKE_image_get_first_ibuf(Image *image)
void BKE_image_release_renderresult(Scene *scene, Image *ima, RenderResult *render_result)
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
int BKE_icon_id_ensure(ID *id)
static int image_get_multiview_index(Image *ima, ImageUser *iuser)
void BKE_image_packfiles_from_mem(ReportList *reports, Image *ima, char *data, size_t data_len)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
void BKE_image_get_size(Image *image, ImageUser *iuser, int *r_width, int *r_height)
size_t IMB_get_pixel_count(const ImBuf *ibuf)
Get the length of the data of the given image buffer in pixels.
bool BKE_image_user_id_has_animation(ID *id)
void BLF_wordwrap(int fontid, int wrap_width, BLFWrapMode mode=BLFWrapMode::Minimal)
bool BKE_image_has_alpha(Image *image)
static void imagecache_keydata(void *userkey, int *framenr, int *proxy, int *render_flags)
Vector< uint8_t > IMB_save_image_to_buffer(ImBuf *ibuf, ImBufFlags flags)
bool BKE_image_has_loaded_ibuf(Image *image)
static void stampdata(const Scene *scene, Object *camera, StampData *stamp_data, int do_prefix, bool use_dynamic)
static bool imagecache_check_free_anim(ImBuf *ibuf, void *userkey, void *userdata)
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int channel_count, const ColorSpace *colorspace)
void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf)
void MOV_close(MovieReader *anim)
MINLINE void copy_v2_v2(float r[2], const float a[2])
static void image_abs_path(Main *bmain, Library *owner_library, const char *filepath, char *r_filepath_abs)
void BKE_render_result_stamp_info(Scene *scene, Object *camera, RenderResult *rr, bool allocate_only)
void BKE_previewimg_blend_write(BlendWriter *writer, const PreviewImage *prv)
static void image_editors_update_frame(Image *ima, ID *, ImageUser *iuser, void *customdata)
void IMB_cache_free(ImBufCache *cache)
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void RE_SwapResult(Render *re, RenderResult **rr)
void BKE_render_result_stamp_data(RenderResult *rr, const char *key, const char *value)
bool BKE_image_has_filepath(const Image *ima)
void IMB_mark_dirty(ImBuf *ibuf)
bool bool BLI_path_suffix(char *path, size_t path_maxncpy, const char *suffix, const char *sep) ATTR_NONNULL(1
StampData * BKE_stamp_data_copy(const StampData *stamp_data)
MINLINE int integer_digits_i(int i)
void(*)(ID *id, const IDCacheKey *cache_key, void **cache_p, uint flags, void *user_data) IDTypeForeachCacheFunctionCallback
static void image_free_data(ID *id)
bool BKE_image_fill_tile(Image *ima, ImageTile *tile)
void BKE_image_walk_all_users(const Main *mainp, void *customdata, void callback(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata))
ImageTile * BKE_image_get_tile(Image *ima, int tile_number)
void BKE_color_managed_colorspace_settings_copy(ColorManagedColorspaceSettings *colorspace_settings, const ColorManagedColorspaceSettings *settings)
eImbFileType BKE_imtype_to_ftype(char imtype, ImbFormatOptions *r_options)
static bool is_texture_cache_filename(StringRef relname, StringRef source_basename)
ImBuf * MOV_decode_frame(MovieReader *anim, int frame_index, IMB_Proxy_Size preview_size)
ImBuf * BKE_image_get_ibuf_with_name(Image *image, const char *filepath)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static void image_walk_ntree_all_users(bNodeTree *ntree, ID *id, void *customdata, void callback(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata))
ImBuf * IMB_cacheIter_getImBuf(ImBufCacheIter *iter)
static bool image_memorypack_imbuf(Image *ima, ImBuf *ibuf, int view, int tile_number, const char *filepath)
static void image_foreach_cache(ID *id, IDTypeForeachCacheFunctionCallback function_callback, void *user_data)
bool BKE_imbuf_write_stamp(const Scene *scene, const RenderResult *rr, ImBuf *ibuf, const char *filepath, const ImageFormatData *imf)
static void image_tag_frame_recalc(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata)
void BKE_packedfile_free(PackedFile *pf)
void BKE_image_user_id_eval_animation(Depsgraph *depsgraph, ID *id)
void BKE_image_stamp_buf(Scene *scene, Object *camera, const StampData *stamp_data_template, ImBuf *ibuf)
void BKE_image_all_free_anim_ibufs(Main *bmain, int except_frame)
bool BKE_image_tile_filepath_exists(const char *filepath)
void IMB_refImBuf(ImBuf *ibuf)
ImBufCache * IMB_cache_create(const char *name, int keysize, GHashHashFP hashfp, GHashCmpFP cmpfp)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
bool BKE_image_is_openexr(Image *ima)
const char * IMB_colormanagement_get_byte_colorspace(const ImBuf *ibuf)
void BKE_image_user_file_path(const ImageUser *iuser, const Image *ima, char *filepath)
static void copy_image_packedfiles(ListBaseT< ImagePackedFile > *lb_dst, const ListBaseT< ImagePackedFile > *lb_src)
static ImBuf * load_movie_single(Image *ima, ImageUser *iuser, int frame, const int view_id)
MINLINE void srgb_to_linearrgb_v4(float linear[4], const float srgb[4])
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
PackedFile * BKE_packedfile_new(ReportList *reports, const char *filepath_rel, const char *basepath)
const char * BKE_main_blendfile_path_from_global()
MINLINE int max_ii(int a, int b)
@ COLOR_ROLE_SCENE_LINEAR
@ COLOR_ROLE_DEFAULT_BYTE
ATTR_WARN_UNUSED_RESULT const BMVert * v
void IMB_cache_put(ImBufCache *cache, void *userkey, ImBuf *ibuf)
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
static void image_init_after_load(Image *ima, ImageUser *iuser, ImBuf *)
static ImBuf * image_get_render_result(Image *ima, ImageUser *iuser, void **r_lock)
int BKE_scene_multiview_num_views_get(const RenderData *rd)
static void image_walk_gpu_materials(ID *id, ListBaseT< LinkData > *gpu_materials, void *customdata, void callback(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata))
ExrReadHandle * IMB_exr_open_multilayer(const char *filepath)
void BKE_image_get_aspect(Image *image, float *r_aspx, float *r_aspy)
ImageTile * BKE_image_add_tile(Image *ima, int tile_number, const char *label)
int BLI_open(const char *filepath, int oflag, int pmode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static void image_init(Image *ima, eImageSource source, eImageType type)
static void image_blend_write(BlendWriter *writer, ID *id, const void *id_address)
BLI_INLINE ImBuf * image_pool_find_item(ImagePool *pool, Image *image, int entry, int index, bool *r_found)
void BKE_image_replace_imbuf(Image *image, ImBuf *ibuf)
void IMB_rectfill_area(ImBuf *ibuf, const float scene_linear_color[4], int x1, int y1, int x2, int y2)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
void BLF_disable(int fontid, FontFlags flag)
static ImBuf * image_get_cached_ibuf_for_index_entry(Image *ima, int index, int entry, bool *r_is_cached_empty)
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
Image * BKE_image_load_in_lib(Main *bmain, std::optional< Library * > owner_library, const char *filepath, bool check_open=true)
bool RE_RenderResult_is_stereo(const RenderResult *result)
static ImBuf * image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int entry, int frame)
void BKE_render_resolution(const RenderData *r, const bool use_crop, int *r_width, int *r_height)
size_t IMB_get_size_in_memory(const ImBuf *ibuf)
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
ImBuf * IMB_cache_get(ImBufCache *cache, void *userkey, bool *r_is_cached_empty)
void BKE_image_format_from_imbuf(ImageFormatData *im_format, const ImBuf *imbuf)
int int BKE_image_find_nearest_tile(const Image *image, const float co[2]) ATTR_NONNULL(2) ATTR_WARN_UNUSED_RESULT
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
void RE_FreeRenderResult(RenderResult *rr)
void IMB_cache_cleanup(ImBufCache *cache, bool(cleanup_check_cb)(ImBuf *ibuf, void *userkey, void *userdata), void *userdata)
ImageTile * BKE_image_get_tile_from_iuser(Image *ima, const ImageUser *iuser)
bool BKE_image_is_dirty_writable(Image *image, bool *r_is_writable)
bool IMB_save_image(ImBuf *ibuf, const char *filepath, ImBufFlags flags)
static ImBuf * image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void BKE_stamp_data_free(StampData *stamp_data)
ImBuf * IMB_load_image_from_filepath(const char *filepath, ImBufFlags flags, ColorManagedColorspaceSettings *colorspace_settings=nullptr)
RenderSlot * BKE_image_add_renderslot(Image *ima, const char *name)
static void metadata_get_field(void *data, const char *propname, char *propvalue, int propvalue_maxncpy)
int BKE_image_find_nearest_tile_with_offset(const Image *image, const float co[2], float r_uv_offset[2]) ATTR_NONNULL(2
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLO_read_data_is_undo(BlendDataReader *reader)
const char * imb_ext_movie[]
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
int BLI_findstringindex(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE bool image_quick_test(Image *ima, const ImageUser *iuser)
Render * RE_GetSceneRender(const Scene *scene)
void BLF_size(int fontid, float size)
ImBuf * BKE_image_acquire_ibuf_gpu(Image *ima, ImageUser *iuser, void **r_lock, bool *r_load_failed=nullptr, bool cached_only=false)
void BKE_image_set_filepath_from_tile_number(char *filepath, const char *pattern, eUDIM_TILE_FORMAT tile_format, int tile_number)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
MovieReader * MOV_open_file(const char *filepath, const ImBufFlags ib_flags, const int streamindex, const bool keep_original_colorspace, ColorManagedColorspaceSettings *colorspace_settings)
void BKE_image_editors_update_frame(const Main *bmain, int cfra)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
bool BKE_image_remove_tile(Image *ima, ImageTile *tile)
void IMB_freeImBuf(ImBuf *ibuf)
void BKE_icon_changed(int icon_id)
static uintptr_t image_mem_size(Image *image)
static void image_get_entry_and_index(Image *ima, ImageUser *iuser, int *r_entry, int *r_index)
const char * BKE_scene_find_last_marker_name(const Scene *scene, int frame)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static float distance_squared_to_udim(const float co[2], const float udim[2])
static ImageTile * imagetile_alloc(int tile_number)
static void image_foreach_texture_cache_path(BPathForeachPathData *bpath_data, const char *source_filepath_abs, const char *cache_dir)
ImBufCacheIter * IMB_cacheIter_new(ImBufCache *cache)
static int image_get_tile_number_from_iuser(const Image *ima, const ImageUser *iuser)
unsigned char * BKE_image_get_pixels_for_frame(Image *image, int frame, int tile)
Image * BKE_image_load_exists(Main *bmain, const char *filepath, bool check_open=true, bool *r_exists=nullptr)
void imagecache_put(Image *image, ImageCacheKey key, ImBuf *ibuf)
bool BKE_image_is_stereo(const Image *ima)
RenderPass * BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
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)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BMesh const char void * data
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BKE_image_free_packedfiles(Image *image)
static void image_blend_read_after_liblink(BlendLibReader *reader, ID *id)
bool BLI_path_is_abs_from_cwd(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
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
bool BKE_image_user_match(const ImageUser &a, const ImageUser &b)
static void image_foreach_expanded_path(BPathForeachPathData *bpath_data, const char *expanded_path, const eBPathForeachFlag flag)
void BKE_image_merge(Main *bmain, Image *dest, Image *source)
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
static int get_multilayer_view_index(const Image &image, const ImageUser &image_user, const char *view_name)
void IMB_colormanagement_colorspace_settings_set(ColorManagedColorspaceSettings *settings, const char *name)
void BKE_image_packfiles(ReportList *reports, Image *ima, const char *basepath)
void BKE_image_free_buffers_ex(Image *image, bool do_lock)
static void image_remove_ibuf(Image *ima, int index, int entry)
static ImBuf * imagecache_get(Image *image, ImageCacheKey key, bool *r_is_cached_empty)
MINLINE void copy_v2_v2_db(double r[2], const double a[2])
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
static bool image_remove_tile(Image *ima, ImageTile *tile)
RenderSlot * BKE_image_get_renderslot(Image *ima, int index)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void IMB_ensure_host_buffer(ImBuf *ibuf)
RenderResult * RE_MultilayerConvert(ExrReadHandle *exrhandle, const char *colorspace, bool predivide, int rectx, int recty)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
char BKE_image_alpha_mode_from_extension_ex(const char *filepath)
BLI_INLINE bool BLI_listbase_count_is_equal_to(const ListBase *listbase, const int count_cmp)
bool BKE_image_has_anim(Image *image)
LinkData * BLI_genericNodeN(void *data)
bool BKE_imbuf_alpha_test(ImBuf *ibuf)
MovieReader * openanim(const char *filepath, ImBufFlags ibuf_flags, int streamindex, bool keep_original_colorspace, ColorManagedColorspaceSettings *colorspace_settings)
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)
void IMB_partial_update_mark_full(ImBuf *ibuf)
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
void BKE_image_free_data(Image *image)
Image * BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
void BKE_image_free_views(Image *image)
void BKE_image_free_old_buffers(Main *bmain)
static void image_user_id_has_animation(Image *ima, ID *, ImageUser *, void *customdata)
void BKE_color_managed_colorspace_settings_init(ColorManagedColorspaceSettings *colorspace_settings)
bool IMB_cacheIter_done(ImBufCacheIter *iter)
void BKE_image_pool_free(ImagePool *pool)
void BKE_image_ensure_tile_token_filename_only(char *filename, size_t filename_maxncpy)
void BKE_id_free(Main *bmain, void *idv)
eEvaluationMode DEG_get_mode(const Depsgraph *graph)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BKE_bpath_foreach_path_readonly_process(BPathForeachPathData *bpath_data, const char *path)
int BLI_listbase_count_at_most(const ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BKE_image_free_gpu_udim_textures(Image *ima)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
void BKE_image_ensure_tile_token(char *filepath, size_t filepath_maxncpy)
bool BKE_scene_multiview_is_stereo3d(const RenderData *rd)
void BKE_image_free_all_textures(Main *bmain)
void IMB_exr_close(ExrReadHandle *handle)
static bool image_views_match_render_views(const Image *image, const RenderData *render_data)
void BKE_image_buf_fill_checker(unsigned char *rect, float *rect_float, int width, int height)
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)
static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int entry)
_W64 unsigned int uintptr_t
static RenderPass * image_render_pass_get(RenderLayer *rl, const int pass, const int view, int *r_passindex)
void BKE_imbuf_stamp_info(const RenderResult *rr, ImBuf *ibuf)
void void BLI_listbase_sort(ListBase *listbase, int(*cmp)(const void *, const void *)) ATTR_NONNULL(1
ListBaseT< GPUMaterialTexture > GPU_material_textures(GPUMaterial *material)
void BKE_image_init_imageuser(Image *ima, ImageUser *iuser)
static void image_free_tile(Image *ima, ImageTile *tile)
void IMB_colormanagement_assign_byte_colorspace(ImBuf *ibuf, const char *name)
static void image_free_packedfiles(Image *ima)
bool BLI_is_dir(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_image_backup_render(Scene *scene, Image *ima, bool free_current_slot)
bool BKE_image_autosave_memorypack(Image *ima)
ImBuf * IMB_allocImBuf(unsigned int x, unsigned int y, ImBufFlags flags)
bool BKE_image_get_tile_info(char *filepath, ListBaseT< LinkData > *tiles, int *r_tile_start, int *r_tile_range)
RenderResult * RE_AcquireResultRead(Render *re)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void BLF_buffer_col(int fontid, const float srgb_color[4]) ATTR_NONNULL(2)
void BKE_image_packfile_ensure(Main *bmain, Image *image, ReportList *reports, const char *data, int data_len)
void id_us_ensure_real(ID *id)
@ BKE_BPATH_FOREACH_PATH_EXPAND_TOKENS
@ BKE_BPATH_FOREACH_PATH_EXPAND_CACHES
@ BKE_BPATH_FOREACH_PATH_SKIP_PACKED
@ BKE_BPATH_FOREACH_PATH_EXPAND_SEQUENCES
@ BKE_BPATH_FOREACH_PATH_RELOAD_EDITED
@ BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN
void RE_ReleaseResultImage(Render *re)
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
void BKE_previewimg_id_copy(ID *new_id, const ID *old_id)
static ImBuf * add_ibuf_for_tile(Image *ima, ImageTile *tile)
void IMB_cache_set_getdata_callback(ImBufCache *cache, ImBufCacheGetKeyDataFP getdatafp)
ImBuf * IMB_load_image_from_memory(const unsigned char *mem, size_t size, ImBufFlags flags, const char *descr, const char *filepath=nullptr, ColorManagedColorspaceSettings *colorspace_settings=nullptr)
static void image_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int flag)
void BKE_bpath_sequence_filepaths_foreach(const char *abs_filepath, blender::FunctionRef< void(blender::StringRef frame_filepath)> callback)
static Set< const ImBuf * > image_multilayer_ibufs(const Image &ima)
int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT
void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries)
void void void BLI_path_split_file_part(const char *filepath, char *file, size_t file_maxncpy) ATTR_NONNULL(1
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()
static void image_free_autosave_packedfiles(Image *ima)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
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])
static void image_foreach_path(ID *id, BPathForeachPathData *bpath_data)
void BLI_task_isolate(void(*func)(void *userdata), void *userdata)
float * BKE_image_get_float_pixels_for_frame(Image *image, int frame, int tile)
void BKE_stamp_info_callback(void *data, StampData *stamp_data, StampCallback callback, bool noskip)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
@ IMA_USER_FRAME_IN_RANGE
bool BKE_bpath_foreach_path_fixed_process(BPathForeachPathData *bpath_data, char *path, size_t path_maxncpy)
void IMB_ImBufFromStereo3d(const Stereo3dFormat *s3d, ImBuf *ibuf_stereo3d, ImBuf **r_ibuf_left, ImBuf **r_ibuf_right)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
void IMB_byte_from_float(ImBuf *ibuf)
bool BLI_path_extension_check_array(const char *path, const char **ext_array) 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
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
static ImBufFlags imbuf_alpha_flags_for_image(Image *ima)
void IMB_metadata_foreach(const ImBuf *ibuf, IMBMetadataForeachCb callback, void *userdata)
ExrReadHandle * IMB_exr_open_multilayer_from_memory(const uchar *mem, size_t size)
void BKE_image_ensure_viewer_views(const RenderData *rd, Image *ima, ImageUser *iuser)
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
int BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT
static void image_tag_reload(Image *ima, ID *iuser_id, ImageUser *iuser, void *customdata)
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))
int BKE_image_get_tile_label(const Image *ima, const ImageTile *tile, char *label, int label_maxncpy)
StampData * BKE_stamp_info_from_scene_static(const Scene *scene)
ID_Type GS(const char *name)
bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
static void image_add_view(Image *ima, const char *viewname, const char *filepath)
void IMB_free_gpu_textures(ImBuf *ibuf)
static float distance_to_unit_interval(float x)
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 BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
static bool imagecache_hashcmp(const void *a_v, const void *b_v)
bool BKE_image_is_filename_tokenized(char *filepath)
static ImBuf * image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_entry, int *r_index, bool *r_is_cached_empty)
void BLI_path_sequence_encode(char *path, size_t path_maxncpy, const char *head, const char *tail, unsigned short numlen, int pic)
bool IMB_metadata_get_field(const IDProperty *metadata, const char *key, char *value, size_t value_maxncpy)
void BKE_image_alpha_mode_from_extension(Image *image)
void BKE_image_populate_cache_from_autosave(Image *ima)
void BLF_draw_buffer(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_NONNULL(2)
unsigned int BLI_ghashutil_strhash_p(const void *ptr)
RenderStats * RE_GetStats(Render *re)
static Image * image_alloc(Main *bmain, std::optional< Library * > owner_library, const char *name, eImageSource source, eImageType type)
bool BLO_read_lib_is_undo(BlendLibReader *reader)
bool BKE_image_source_is_file(const Image *ima)
static bool image_memorypack_imbuf_for_autosave(Image *ima, ImBuf *ibuf, int view, int tile_number, const char *filepath)
bool BKE_image_has_multiple_ibufs(Image *image)
static void image_blend_read_data(BlendDataReader *reader, ID *id)
static void scan_texture_cache_dir(const char *dir, const char *source_filepath_abs, StringRef source_basename, FunctionRef< void(StringRef cache_filepath)> callback)
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
void BKE_packedfile_blend_read(BlendDataReader *reader, PackedFile **pf_p, StringRefNull filepath)
static void image_init_data(ID *id)
MINLINE void copy_v4_v4(float r[4], const float a[4])
MINLINE void sub_v2_v2(float r[2], const float a[2])
ImagePool * BKE_image_pool_new()
static void metadata_set_field(void *data, const char *propname, char *propvalue, int)
void BKE_image_print_memlist(Main *bmain)
void BKE_image_clear_autosave(Image *image)
int BKE_image_sequence_guess_offset(Image *image)
void RE_ReleaseResult(Render *re)
void BKE_image_reassign_tile(Image *ima, ImageTile *tile, int new_tile_number)
bool BKE_image_has_packedfile(const Image *image)
static void image_colorspace_from_imbuf(Image *image, const ImBuf *ibuf)
bool IMB_colormanagement_space_name_is_data(const char *name)
static const char * stamp_metadata_fields[]
static void image_user_id_eval_animation(Image *ima, ID *, ImageUser *iuser, void *customdata)
void BKE_image_get_size_fl(Image *image, ImageUser *iuser, float r_size[2])
bool IMB_scale(ImBuf *ibuf, int2 new_size, IMBScaleFilter filter, bool threaded=true)
const char * BLI_path_slash_find(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
static ImBuf * image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock, const bool ensure_host_buffer, bool *r_load_failed=nullptr, const bool cached_only=false)
@ CMP_NODE_CRYPTOMATTE_SOURCE_IMAGE
void BKE_image_free_buffers(Image *image)
int MOV_get_duration_frames(const MovieReader *anim)
void BLI_thread_unlock(int type)
static void image_create_multilayer(Image *ima, ImBuf *ibuf, ExrReadHandle *handle, int framenr)
ImBuf * BKE_image_pool_acquire_ibuf(Image *ima, ImageUser *iuser, ImagePool *pool)
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)
void RE_ReferenceRenderResult(RenderResult *rr)
void IMB_cache_remove(ImBufCache *cache, void *userkey)
void BKE_image_file_format_set(Image *image, eImbFileType ftype, const ImbFormatOptions *options)
void BKE_imageuser_default(ImageUser *iuser)
PackedFile * BKE_packedfile_new_from_memory(const void *mem, int memlen, const ImplicitSharingInfo *sharing_info=nullptr)
int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_range)
MINLINE int min_ii(int a, int b)
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static void image_free_anims(Image *ima)
void BKE_scene_multiview_view_prefix_get(const Scene *scene, const char *filepath, char *r_prefix, const char **r_ext)
size_t BLI_timecode_string_from_time_simple(char *str, size_t maxncpy, double time_seconds) ATTR_NONNULL()
float DEG_get_ctime(const Depsgraph *graph)
void BKE_image_multilayer_stamp_info_callback(void *data, const Image &image, StampCallback callback, bool noskip)
void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int width, int height)
bool BKE_image_remove_renderslot(Image *ima, ImageUser *iuser, int slot)
MINLINE void zero_v2(float r[2])
@ UDIM_TILE_FORMAT_UVTILE
bool BKE_imbuf_write(ImBuf *ibuf, const char *filepath, const ImageFormatData *imf)
static void stampdata_from_template(StampData *stamp_data, const Scene *scene, const StampData *stamp_data_template, bool do_prefix)
bool BLI_path_extension_check_n(const char *path,...) ATTR_NONNULL(1) ATTR_SENTINEL(0)
bool BKE_image_get_tile_number_from_filepath(const char *filepath, const char *pattern, eUDIM_TILE_FORMAT tile_format, int *r_tile_number)
ImBuf * BKE_image_preview(Image *ima, short max_size, short *r_width, short *r_height)
const char * IMB_colormanagement_get_float_colorspace(const ImBuf *ibuf)
void IMB_cacheIter_free(ImBufCacheIter *iter)
bool BLI_file_ensure_parent_dir_exists(const char *filepath) ATTR_NONNULL(1)
bool BKE_image_is_multilayer(const Image *ima)
bool BKE_image_memorypack(Image *ima)
void BLF_enable(int fontid, FontFlags flag)
void RE_AcquireResultImage(Render *re, RenderResult *rr, const int view_id)
void IMB_metadata_set_field(IDProperty *metadata, const char *key, const char *value)
void BKE_image_pool_release_ibuf(Image *ima, ImBuf *ibuf, ImagePool *pool)
void BLI_thread_lock(int type)
MovieReader * openanim_noload(const char *filepath, ImBufFlags flags, int streamindex, bool keep_original_colorspace, ColorManagedColorspaceSettings *colorspace_settings)
bool BKE_imbuf_write_as(ImBuf *ibuf, const char *filepath, const ImageFormatData *imf, bool save_copy)
void BKE_stamp_info_from_imbuf(RenderResult *rr, ImBuf *ibuf)
Image * BKE_image_load(Main *bmain, const char *filepath, bool check_open=true)
static void metadata_copy_custom_fields(const char *field, const char *value, void *rr_v)
@ USER_TIMECODE_SMPTE_FULL
bool BKE_image_buffer_format_writable(ImBuf *ibuf)
void BKE_image_get_tile_uv(const Image *ima, const int tile_number, float r_uv[2])
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)
static int image_num_viewfiles(Image *ima)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
static void image_viewer_create_views(const RenderData *rd, Image *ima)
@ IDTYPE_FLAGS_NO_ANIMDATA
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
#define CALL(member, value_str)
#define TEXT_SIZE_CHECK(str, w, h)
#define TEXT_SIZE_CHECK_WORD_WRAP(str, w, h)
const char * absolute_base_path
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct_list(const ListBaseT< T > *list, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
unsigned int id_session_uid
const ColorSpace * colorspace
std::atomic< gpu::Texture * > texture
ImbFormatOptions foptions
ImBufByteBuffer byte_buffer
const uint8_t * byte_data() const
uint8_t * byte_data_for_write()
const float * float_data() const
float * float_data_for_write()
bool can_contain_alpha() const
struct MovieReader * anim
struct PackedFile * packedfile
struct ImagePackedFile * next
ListBaseT< ImagePoolItem > image_buffers
BLI_mempool * memory_pool
bke::library::LibraryRuntime * runtime
ListBaseT< wmWindowManager > wm
ListBaseT< bNodeTree > nodetrees
ListBaseT< Camera > cameras
ListBaseT< Light > lights
ListBaseT< World > worlds
ListBaseT< Material > materials
ListBaseT< Object > objects
ListBaseT< Image > images
ListBaseT< Scene > scenes
ListBaseT< Tex > textures
eObject_EmptyDrawType empty_drawtype
ListBaseT< SceneRenderView > views
ListBaseT< RenderPass > passes
struct RenderLayer * next
struct StampData * stamp_data
ListBaseT< RenderView > views
ListBaseT< RenderLayer > layers
struct RenderResult * render
ListBaseT< SpaceLink > spacedata
StampDataCustomField * prev
StampDataCustomField * next
char camera[STAMP_NAME_SIZE]
char cameralens[STAMP_NAME_SIZE]
char scene[STAMP_NAME_SIZE]
char rendertime[STAMP_NAME_SIZE]
char strip[STAMP_NAME_SIZE]
char memory[STAMP_NAME_SIZE]
ListBaseT< StampDataCustomField > custom_fields
struct bNodeTree * nodetree
ListBaseT< struct ScrArea > areabase
struct WorkSpaceInstanceHook * workspace_hook