Merge branch 'blender-v3.0-release'
This commit is contained in:
commit
ffd3dd6376
|
@ -150,10 +150,6 @@ struct RenderData;
|
|||
struct RenderPass;
|
||||
struct RenderResult;
|
||||
|
||||
/* ima->ok */
|
||||
#define IMA_OK 1
|
||||
#define IMA_OK_LOADED 2
|
||||
|
||||
/* signals */
|
||||
/* reload only frees, doesn't read until image_get_ibuf() called */
|
||||
#define IMA_SIGNAL_RELOAD 0
|
||||
|
|
|
@ -140,7 +140,6 @@ static void camera_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
BLO_read_list(reader, &ca->bg_images);
|
||||
|
||||
LISTBASE_FOREACH (CameraBGImage *, bgpic, &ca->bg_images) {
|
||||
bgpic->iuser.ok = 1;
|
||||
bgpic->iuser.scene = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -1128,7 +1127,6 @@ CameraBGImage *BKE_camera_background_image_new(Camera *cam)
|
|||
|
||||
bgpic->scale = 1.0f;
|
||||
bgpic->alpha = 0.5f;
|
||||
bgpic->iuser.ok = 1;
|
||||
bgpic->iuser.flag |= IMA_ANIM_ALWAYS;
|
||||
bgpic->flag |= CAM_BGIMG_FLAG_EXPANDED;
|
||||
|
||||
|
|
|
@ -340,9 +340,7 @@ static void image_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
BLO_read_data_address(reader, &ima->preview);
|
||||
BKE_previewimg_blend_read(reader, ima->preview);
|
||||
BLO_read_data_address(reader, &ima->stereo3d_format);
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
tile->ok = IMA_OK;
|
||||
}
|
||||
|
||||
ima->lastused = 0;
|
||||
ima->gpuflag = 0;
|
||||
BLI_listbase_clear(&ima->gpu_refresh_areas);
|
||||
|
@ -464,12 +462,12 @@ static void imagecache_remove(Image *image, int index)
|
|||
IMB_moviecache_remove(image->cache, &key);
|
||||
}
|
||||
|
||||
static struct ImBuf *imagecache_get(Image *image, int index)
|
||||
static struct ImBuf *imagecache_get(Image *image, int index, bool *r_is_cached_empty)
|
||||
{
|
||||
if (image->cache) {
|
||||
ImageCacheKey key;
|
||||
key.index = index;
|
||||
return IMB_moviecache_get(image->cache, &key);
|
||||
return IMB_moviecache_get(image->cache, &key, r_is_cached_empty);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -540,10 +538,6 @@ void BKE_image_free_buffers_ex(Image *ima, bool do_lock)
|
|||
|
||||
BKE_image_free_gputextures(ima);
|
||||
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
tile->ok = IMA_OK;
|
||||
}
|
||||
|
||||
if (do_lock) {
|
||||
BLI_mutex_unlock(ima->runtime.cache_mutex);
|
||||
}
|
||||
|
@ -575,7 +569,6 @@ static void image_init(Image *ima, short source, short type)
|
|||
}
|
||||
|
||||
ImageTile *tile = MEM_callocN(sizeof(ImageTile), "Image Tiles");
|
||||
tile->ok = IMA_OK;
|
||||
tile->tile_number = 1001;
|
||||
BLI_addtail(&ima->tiles, tile);
|
||||
|
||||
|
@ -610,25 +603,25 @@ static Image *image_alloc(Main *bmain, const char *name, short source, short typ
|
|||
* call IMB_freeImBuf to de-reference the image buffer after
|
||||
* it's done handling it.
|
||||
*/
|
||||
static ImBuf *image_get_cached_ibuf_for_index_entry(Image *ima, int index, int entry)
|
||||
static ImBuf *image_get_cached_ibuf_for_index_entry(Image *ima,
|
||||
int index,
|
||||
int entry,
|
||||
bool *r_is_cached_empty)
|
||||
{
|
||||
if (index != IMA_NO_INDEX) {
|
||||
index = IMA_MAKE_INDEX(entry, index);
|
||||
}
|
||||
|
||||
return imagecache_get(ima, index);
|
||||
return imagecache_get(ima, index, r_is_cached_empty);
|
||||
}
|
||||
|
||||
/* no ima->ibuf anymore, but listbase */
|
||||
static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int entry)
|
||||
{
|
||||
if (ibuf) {
|
||||
if (index != IMA_NO_INDEX) {
|
||||
index = IMA_MAKE_INDEX(entry, index);
|
||||
}
|
||||
|
||||
imagecache_put(ima, index, ibuf);
|
||||
if (index != IMA_NO_INDEX) {
|
||||
index = IMA_MAKE_INDEX(entry, index);
|
||||
}
|
||||
|
||||
imagecache_put(ima, index, ibuf);
|
||||
}
|
||||
|
||||
static void image_remove_ibuf(Image *ima, int index, int entry)
|
||||
|
@ -905,11 +898,6 @@ Image *BKE_image_load_exists_ex(Main *bmain, const char *filepath, bool *r_exist
|
|||
if (BLI_path_cmp(strtest, str) == 0) {
|
||||
if ((BKE_image_has_anim(ima) == false) || (ima->id.us == 0)) {
|
||||
id_us_plus(&ima->id); /* officially should not, it doesn't link here! */
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
if (tile->ok == 0) {
|
||||
tile->ok = IMA_OK;
|
||||
}
|
||||
}
|
||||
if (r_exists) {
|
||||
*r_exists = true;
|
||||
}
|
||||
|
@ -1097,9 +1085,6 @@ Image *BKE_image_add_generated(Main *bmain,
|
|||
image_add_view(ima, names[view_id], "");
|
||||
}
|
||||
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
|
||||
return ima;
|
||||
}
|
||||
|
||||
|
@ -1122,8 +1107,6 @@ Image *BKE_image_add_from_imbuf(Main *bmain, ImBuf *ibuf, const char *name)
|
|||
if (ima) {
|
||||
STRNCPY(ima->filepath, ibuf->name);
|
||||
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
}
|
||||
|
||||
return ima;
|
||||
|
@ -1174,7 +1157,7 @@ bool BKE_image_memorypack(Image *ima)
|
|||
int i;
|
||||
|
||||
for (i = 0, iv = ima->views.first; iv; iv = iv->next, i++) {
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, i, 0);
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, i, 0, NULL);
|
||||
|
||||
if (!ibuf) {
|
||||
ok = false;
|
||||
|
@ -1194,7 +1177,7 @@ bool BKE_image_memorypack(Image *ima)
|
|||
ima->views_format = R_IMF_VIEWS_INDIVIDUAL;
|
||||
}
|
||||
else {
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, IMA_NO_INDEX, 0);
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, IMA_NO_INDEX, 0, NULL);
|
||||
|
||||
if (ibuf) {
|
||||
ok = ok && image_memorypack_imbuf(ima, ibuf, ibuf->name);
|
||||
|
@ -1284,6 +1267,10 @@ static uintptr_t image_mem_size(Image *image)
|
|||
|
||||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
IMB_moviecacheIter_step(iter);
|
||||
if (ibuf == NULL) {
|
||||
continue;
|
||||
}
|
||||
ImBuf *ibufm;
|
||||
int level;
|
||||
|
||||
|
@ -1305,8 +1292,6 @@ static uintptr_t image_mem_size(Image *image)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMB_moviecacheIter_step(iter);
|
||||
}
|
||||
IMB_moviecacheIter_free(iter);
|
||||
}
|
||||
|
@ -3506,7 +3491,6 @@ static void image_tag_frame_recalc(Image *ima, ID *iuser_id, ImageUser *iuser, v
|
|||
|
||||
if (ima == changed_image && BKE_image_is_animated(ima)) {
|
||||
iuser->flag |= IMA_NEED_FRAME_RECALC;
|
||||
iuser->ok = 1;
|
||||
|
||||
if (iuser_id) {
|
||||
/* Must copy image user changes to CoW datablock. */
|
||||
|
@ -3520,7 +3504,6 @@ static void image_tag_reload(Image *ima, ID *iuser_id, ImageUser *iuser, void *c
|
|||
Image *changed_image = customdata;
|
||||
|
||||
if (ima == changed_image) {
|
||||
iuser->ok = 1;
|
||||
if (iuser->scene) {
|
||||
image_update_views_format(ima, iuser);
|
||||
}
|
||||
|
@ -3534,7 +3517,6 @@ static void image_tag_reload(Image *ima, ID *iuser_id, ImageUser *iuser, void *c
|
|||
void BKE_imageuser_default(ImageUser *iuser)
|
||||
{
|
||||
memset(iuser, 0, sizeof(ImageUser));
|
||||
iuser->ok = 1;
|
||||
iuser->frames = 100;
|
||||
iuser->sfra = 1;
|
||||
}
|
||||
|
@ -3594,7 +3576,6 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
|
|||
BKE_image_free_buffers(ima);
|
||||
|
||||
if (iuser) {
|
||||
iuser->ok = 1;
|
||||
if (iuser->scene) {
|
||||
image_update_views_format(ima, iuser);
|
||||
}
|
||||
|
@ -3609,7 +3590,7 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
|
|||
|
||||
if (ima->source == IMA_SRC_GENERATED) {
|
||||
if (ima->gen_x == 0 || ima->gen_y == 0) {
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, IMA_NO_INDEX, 0);
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, IMA_NO_INDEX, 0, NULL);
|
||||
if (ibuf) {
|
||||
ima->gen_x = ibuf->x;
|
||||
ima->gen_y = ibuf->y;
|
||||
|
@ -3649,10 +3630,6 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
|
|||
*/
|
||||
BKE_image_free_buffers(ima);
|
||||
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
tile->ok = 1;
|
||||
}
|
||||
|
||||
if (iuser) {
|
||||
image_tag_frame_recalc(ima, NULL, iuser, ima);
|
||||
}
|
||||
|
@ -3700,7 +3677,6 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
|
|||
break;
|
||||
case IMA_SIGNAL_USER_NEW_IMAGE:
|
||||
if (iuser) {
|
||||
iuser->ok = 1;
|
||||
if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_TILED)) {
|
||||
if (ima->type == IMA_TYPE_MULTILAYER) {
|
||||
BKE_image_init_imageuser(ima, iuser);
|
||||
|
@ -3710,15 +3686,6 @@ void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
|
|||
break;
|
||||
case IMA_SIGNAL_COLORMANAGE:
|
||||
BKE_image_free_buffers(ima);
|
||||
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
tile->ok = 1;
|
||||
}
|
||||
|
||||
if (iuser) {
|
||||
iuser->ok = 1;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3818,7 +3785,6 @@ ImageTile *BKE_image_add_tile(struct Image *ima, int tile_number, const char *la
|
|||
}
|
||||
|
||||
ImageTile *tile = MEM_callocN(sizeof(ImageTile), "image new tile");
|
||||
tile->ok = IMA_OK;
|
||||
tile->tile_number = tile_number;
|
||||
|
||||
if (next_tile) {
|
||||
|
@ -3883,14 +3849,14 @@ void BKE_image_reassign_tile(struct Image *ima, ImageTile *tile, int new_tile_nu
|
|||
if (BKE_image_is_multiview(ima)) {
|
||||
const int totviews = BLI_listbase_count(&ima->views);
|
||||
for (int i = 0; i < totviews; i++) {
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, i, old_tile_number);
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, i, old_tile_number, NULL);
|
||||
image_remove_ibuf(ima, i, old_tile_number);
|
||||
image_assign_ibuf(ima, ibuf, i, new_tile_number);
|
||||
IMB_freeImBuf(ibuf);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, 0, old_tile_number);
|
||||
ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, 0, old_tile_number, NULL);
|
||||
image_remove_ibuf(ima, 0, old_tile_number);
|
||||
image_assign_ibuf(ima, ibuf, 0, new_tile_number);
|
||||
IMB_freeImBuf(ibuf);
|
||||
|
@ -3949,7 +3915,6 @@ bool BKE_image_fill_tile(struct Image *ima,
|
|||
if (tile_ibuf != NULL) {
|
||||
image_assign_ibuf(ima, tile_ibuf, 0, tile->tile_number);
|
||||
BKE_image_release_ibuf(ima, tile_ibuf, NULL);
|
||||
tile->ok = IMA_OK;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -4227,9 +4192,7 @@ static void image_init_after_load(Image *ima, ImageUser *iuser, ImBuf *UNUSED(ib
|
|||
/* Images should never get loaded if the corresponding tile does not exist,
|
||||
* but we should at least not crash if it happens due to a bug elsewhere. */
|
||||
BLI_assert(tile != NULL);
|
||||
if (tile != NULL) {
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
}
|
||||
UNUSED_VARS_NDEBUG(tile);
|
||||
}
|
||||
|
||||
static int imbuf_alpha_flags_for_image(Image *ima)
|
||||
|
@ -4264,8 +4227,7 @@ static int image_num_files(Image *ima)
|
|||
return BLI_listbase_count(&ima->views);
|
||||
}
|
||||
|
||||
static ImBuf *load_sequence_single(
|
||||
Image *ima, ImageUser *iuser, int frame, const int view_id, bool *r_assign)
|
||||
static ImBuf *load_sequence_single(Image *ima, ImageUser *iuser, int frame, const int view_id)
|
||||
{
|
||||
struct ImBuf *ibuf;
|
||||
char name[FILE_MAX];
|
||||
|
@ -4315,19 +4277,11 @@ static ImBuf *load_sequence_single(
|
|||
}
|
||||
else {
|
||||
image_init_after_load(ima, iuser, ibuf);
|
||||
*r_assign = true;
|
||||
}
|
||||
#else
|
||||
image_init_after_load(ima, iuser, ibuf);
|
||||
*r_assign = true;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser);
|
||||
if (tile != NULL) {
|
||||
tile->ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
@ -4337,13 +4291,10 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int entry,
|
|||
struct ImBuf *ibuf = NULL;
|
||||
const bool is_multiview = BKE_image_is_multiview(ima);
|
||||
const int totfiles = image_num_files(ima);
|
||||
bool assign = false;
|
||||
|
||||
if (!is_multiview) {
|
||||
ibuf = load_sequence_single(ima, iuser, frame, 0, &assign);
|
||||
if (assign) {
|
||||
image_assign_ibuf(ima, ibuf, 0, entry);
|
||||
}
|
||||
ibuf = load_sequence_single(ima, iuser, frame, 0);
|
||||
image_assign_ibuf(ima, ibuf, 0, entry);
|
||||
}
|
||||
else {
|
||||
const int totviews = BLI_listbase_count(&ima->views);
|
||||
|
@ -4352,7 +4303,7 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int entry,
|
|||
ibuf_arr = MEM_mallocN(sizeof(ImBuf *) * totviews, "Image Views Imbufs");
|
||||
|
||||
for (int i = 0; i < totfiles; i++) {
|
||||
ibuf_arr[i] = load_sequence_single(ima, iuser, frame, i, &assign);
|
||||
ibuf_arr[i] = load_sequence_single(ima, iuser, frame, i);
|
||||
}
|
||||
|
||||
if (BKE_image_is_stereo(ima) && ima->views_format == R_IMF_VIEWS_STEREO_3D) {
|
||||
|
@ -4362,10 +4313,8 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int entry,
|
|||
/* return the original requested ImBuf */
|
||||
ibuf = ibuf_arr[(iuser ? iuser->multi_index : 0)];
|
||||
|
||||
if (assign) {
|
||||
for (int i = 0; i < totviews; i++) {
|
||||
image_assign_ibuf(ima, ibuf_arr[i], i, entry);
|
||||
}
|
||||
for (int i = 0; i < totviews; i++) {
|
||||
image_assign_ibuf(ima, ibuf_arr[i], i, entry);
|
||||
}
|
||||
|
||||
/* "remove" the others (decrease their refcount) */
|
||||
|
@ -4385,7 +4334,6 @@ static ImBuf *image_load_sequence_file(Image *ima, ImageUser *iuser, int entry,
|
|||
static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int entry, int frame)
|
||||
{
|
||||
struct ImBuf *ibuf = NULL;
|
||||
ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser);
|
||||
|
||||
/* either we load from RenderResult, or we have to load a new one */
|
||||
|
||||
|
@ -4427,13 +4375,6 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int e
|
|||
}
|
||||
// else printf("pass not found\n");
|
||||
}
|
||||
else {
|
||||
tile->ok = 0;
|
||||
}
|
||||
|
||||
if (iuser) {
|
||||
iuser->ok = tile->ok;
|
||||
}
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
@ -4445,8 +4386,6 @@ static ImBuf *load_movie_single(Image *ima, ImageUser *iuser, int frame, const i
|
|||
|
||||
ia = BLI_findlink(&ima->anims, view_id);
|
||||
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
|
||||
if (ia->anim == NULL) {
|
||||
char str[FILE_MAX];
|
||||
int flags = IB_rect;
|
||||
|
@ -4488,12 +4427,6 @@ static ImBuf *load_movie_single(Image *ima, ImageUser *iuser, int frame, const i
|
|||
if (ibuf) {
|
||||
image_init_after_load(ima, iuser, ibuf);
|
||||
}
|
||||
else {
|
||||
tile->ok = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
tile->ok = 0;
|
||||
}
|
||||
|
||||
return ibuf;
|
||||
|
@ -4504,7 +4437,6 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
|
|||
struct ImBuf *ibuf = NULL;
|
||||
const bool is_multiview = BKE_image_is_multiview(ima);
|
||||
const int totfiles = image_num_files(ima);
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
|
||||
if (totfiles != BLI_listbase_count_at_most(&ima->anims, totfiles + 1)) {
|
||||
image_free_anims(ima);
|
||||
|
@ -4535,12 +4467,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
|
|||
}
|
||||
|
||||
for (int i = 0; i < totviews; i++) {
|
||||
if (ibuf_arr[i]) {
|
||||
image_assign_ibuf(ima, ibuf_arr[i], i, frame);
|
||||
}
|
||||
else {
|
||||
tile->ok = 0;
|
||||
}
|
||||
image_assign_ibuf(ima, ibuf_arr[i], i, frame);
|
||||
}
|
||||
|
||||
/* return the original requested ImBuf */
|
||||
|
@ -4557,19 +4484,11 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
|
|||
MEM_freeN(ibuf_arr);
|
||||
}
|
||||
|
||||
if (iuser) {
|
||||
iuser->ok = tile->ok;
|
||||
}
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
static ImBuf *load_image_single(Image *ima,
|
||||
ImageUser *iuser,
|
||||
int cfra,
|
||||
const int view_id,
|
||||
const bool has_packed,
|
||||
bool *r_assign)
|
||||
static ImBuf *load_image_single(
|
||||
Image *ima, ImageUser *iuser, int cfra, const int view_id, const bool has_packed)
|
||||
{
|
||||
char filepath[FILE_MAX];
|
||||
struct ImBuf *ibuf = NULL;
|
||||
|
@ -4631,7 +4550,6 @@ static ImBuf *load_image_single(Image *ima,
|
|||
#endif
|
||||
{
|
||||
image_init_after_load(ima, iuser, ibuf);
|
||||
*r_assign = true;
|
||||
|
||||
/* Make packed file for auto-pack. */
|
||||
if ((has_packed == false) && (G.fileflags & G_FILE_AUTOPACK)) {
|
||||
|
@ -4644,10 +4562,6 @@ static ImBuf *load_image_single(Image *ima,
|
|||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser);
|
||||
tile->ok = 0;
|
||||
}
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
@ -4658,7 +4572,6 @@ static ImBuf *load_image_single(Image *ima,
|
|||
static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
||||
{
|
||||
struct ImBuf *ibuf = NULL;
|
||||
bool assign = false;
|
||||
const bool is_multiview = BKE_image_is_multiview(ima);
|
||||
const int totfiles = image_num_files(ima);
|
||||
bool has_packed = BKE_image_has_packedfile(ima);
|
||||
|
@ -4675,10 +4588,8 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
|||
}
|
||||
|
||||
if (!is_multiview) {
|
||||
ibuf = load_image_single(ima, iuser, cfra, 0, has_packed, &assign);
|
||||
if (assign) {
|
||||
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
||||
}
|
||||
ibuf = load_image_single(ima, iuser, cfra, 0, has_packed);
|
||||
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
|
||||
}
|
||||
else {
|
||||
struct ImBuf **ibuf_arr;
|
||||
|
@ -4688,7 +4599,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
|||
ibuf_arr = MEM_callocN(sizeof(ImBuf *) * totviews, "Image Views Imbufs");
|
||||
|
||||
for (int i = 0; i < totfiles; i++) {
|
||||
ibuf_arr[i] = load_image_single(ima, iuser, cfra, i, has_packed, &assign);
|
||||
ibuf_arr[i] = load_image_single(ima, iuser, cfra, i, has_packed);
|
||||
}
|
||||
|
||||
/* multi-views/multi-layers OpenEXR files directly populate ima, and return NULL ibuf... */
|
||||
|
@ -4701,10 +4612,8 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
|||
int i = (iuser && iuser->multi_index < totviews) ? iuser->multi_index : 0;
|
||||
ibuf = ibuf_arr[i];
|
||||
|
||||
if (assign) {
|
||||
for (i = 0; i < totviews; i++) {
|
||||
image_assign_ibuf(ima, ibuf_arr[i], i, 0);
|
||||
}
|
||||
for (i = 0; i < totviews; i++) {
|
||||
image_assign_ibuf(ima, ibuf_arr[i], i, 0);
|
||||
}
|
||||
|
||||
/* "remove" the others (decrease their refcount) */
|
||||
|
@ -4718,11 +4627,6 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
|
|||
MEM_freeN(ibuf_arr);
|
||||
}
|
||||
|
||||
if (iuser) {
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
iuser->ok = tile->ok;
|
||||
}
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
|
@ -4755,14 +4659,6 @@ static ImBuf *image_get_ibuf_multilayer(Image *ima, ImageUser *iuser)
|
|||
}
|
||||
}
|
||||
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
if (ibuf == NULL) {
|
||||
tile->ok = 0;
|
||||
}
|
||||
if (iuser) {
|
||||
iuser->ok = tile->ok;
|
||||
}
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
|
@ -4880,7 +4776,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
|
|||
}
|
||||
}
|
||||
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, IMA_NO_INDEX, 0);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, IMA_NO_INDEX, 0, NULL);
|
||||
|
||||
/* make ibuf if needed, and initialize it */
|
||||
if (ibuf == NULL) {
|
||||
|
@ -4957,9 +4853,6 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **r_loc
|
|||
|
||||
ibuf->dither = dither;
|
||||
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
|
@ -5016,7 +4909,8 @@ static void image_get_entry_and_index(Image *ima, ImageUser *iuser, int *r_entry
|
|||
* call IMB_freeImBuf to de-reference the image buffer after
|
||||
* it's done handling it.
|
||||
*/
|
||||
static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_entry, int *r_index)
|
||||
static ImBuf *image_get_cached_ibuf(
|
||||
Image *ima, ImageUser *iuser, int *r_entry, int *r_index, bool *r_is_cached_empty)
|
||||
{
|
||||
ImBuf *ibuf = NULL;
|
||||
int entry = 0, index = image_get_multiview_index(ima, iuser);
|
||||
|
@ -5024,42 +4918,30 @@ static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_entry,
|
|||
/* see if we already have an appropriate ibuf, with image source and type */
|
||||
if (ima->source == IMA_SRC_MOVIE) {
|
||||
entry = iuser ? iuser->framenr : ima->lastframe;
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry, r_is_cached_empty);
|
||||
ima->lastframe = entry;
|
||||
}
|
||||
else if (ima->source == IMA_SRC_SEQUENCE) {
|
||||
if (ima->type == IMA_TYPE_IMAGE) {
|
||||
entry = iuser ? iuser->framenr : ima->lastframe;
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry, r_is_cached_empty);
|
||||
ima->lastframe = entry;
|
||||
|
||||
/* counter the fact that image is set as invalid when loading a frame
|
||||
* that is not in the cache (through image_acquire_ibuf for instance),
|
||||
* yet we have valid frames in the cache loaded */
|
||||
if (ibuf) {
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
|
||||
if (iuser) {
|
||||
iuser->ok = tile->ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ima->type == IMA_TYPE_MULTILAYER) {
|
||||
entry = iuser ? iuser->framenr : ima->lastframe;
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry, r_is_cached_empty);
|
||||
}
|
||||
}
|
||||
else if (ima->source == IMA_SRC_FILE) {
|
||||
if (ima->type == IMA_TYPE_IMAGE) {
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, 0);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, 0, r_is_cached_empty);
|
||||
}
|
||||
else if (ima->type == IMA_TYPE_MULTILAYER) {
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, 0);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, 0, r_is_cached_empty);
|
||||
}
|
||||
}
|
||||
else if (ima->source == IMA_SRC_GENERATED) {
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, 0);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, 0, r_is_cached_empty);
|
||||
}
|
||||
else if (ima->source == IMA_SRC_VIEWER) {
|
||||
/* always verify entirely, not that this shouldn't happen
|
||||
|
@ -5069,17 +4951,7 @@ static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_entry,
|
|||
else if (ima->source == IMA_SRC_TILED) {
|
||||
if (ELEM(ima->type, IMA_TYPE_IMAGE, IMA_TYPE_MULTILAYER)) {
|
||||
entry = image_get_tile_number_from_iuser(ima, iuser);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry);
|
||||
|
||||
if ((ima->type == IMA_TYPE_IMAGE) && ibuf != NULL) {
|
||||
ImageTile *tile = BKE_image_get_tile(ima, entry);
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
|
||||
/* iuser->ok is useless for tiled images because iuser->tile changes all the time. */
|
||||
if (iuser != NULL) {
|
||||
iuser->ok = 1;
|
||||
}
|
||||
}
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry, r_is_cached_empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5100,19 +4972,10 @@ BLI_INLINE bool image_quick_test(Image *ima, const ImageUser *iuser)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (iuser) {
|
||||
if (iuser->ok == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ImageTile *tile = BKE_image_get_tile_from_iuser(ima, iuser);
|
||||
if (tile == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (tile->ok == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5135,7 +4998,11 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
ibuf = image_get_cached_ibuf(ima, iuser, &entry, &index);
|
||||
bool is_cached_empty = false;
|
||||
ibuf = image_get_cached_ibuf(ima, iuser, &entry, &index, &is_cached_empty);
|
||||
if (is_cached_empty) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ibuf == NULL) {
|
||||
/* we are sure we have to load the ibuf, using source and type */
|
||||
|
@ -5197,8 +5064,6 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
|
|||
ima->gen_color,
|
||||
&ima->colorspace_settings);
|
||||
image_assign_ibuf(ima, ibuf, index, 0);
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
}
|
||||
else if (ima->source == IMA_SRC_VIEWER) {
|
||||
if (ima->type == IMA_TYPE_R_RESULT) {
|
||||
|
@ -5215,7 +5080,7 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
|
|||
|
||||
/* XXX anim play for viewer nodes not yet supported */
|
||||
entry = 0; // XXX iuser ? iuser->framenr : 0;
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry);
|
||||
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry, NULL);
|
||||
|
||||
if (!ibuf) {
|
||||
/* Composite Viewer, all handled in compositor */
|
||||
|
@ -5290,7 +5155,7 @@ bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser)
|
|||
|
||||
BLI_mutex_lock(ima->runtime.cache_mutex);
|
||||
|
||||
ibuf = image_get_cached_ibuf(ima, iuser, NULL, NULL);
|
||||
ibuf = image_get_cached_ibuf(ima, iuser, NULL, NULL, NULL);
|
||||
|
||||
if (!ibuf) {
|
||||
ibuf = image_acquire_ibuf(ima, iuser, NULL);
|
||||
|
@ -5525,18 +5390,6 @@ void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
|
|||
ima->gpuframenr = iuser->framenr;
|
||||
}
|
||||
|
||||
if (iuser->ok == 0) {
|
||||
iuser->ok = 1;
|
||||
}
|
||||
|
||||
if (ima) {
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
if (tile->ok == 0) {
|
||||
tile->ok = IMA_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
iuser->flag &= ~IMA_NEED_FRAME_RECALC;
|
||||
}
|
||||
}
|
||||
|
@ -5822,7 +5675,7 @@ bool BKE_image_is_dirty_writable(Image *image, bool *r_is_writable)
|
|||
|
||||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
if (ibuf->userflags & IB_BITMAPDIRTY) {
|
||||
if (ibuf != NULL && ibuf->userflags & IB_BITMAPDIRTY) {
|
||||
is_writable = BKE_image_buffer_format_writable(ibuf);
|
||||
is_dirty = true;
|
||||
break;
|
||||
|
@ -5866,8 +5719,10 @@ void BKE_image_file_format_set(Image *image, int ftype, const ImbFormatOptions *
|
|||
|
||||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ImBuf *ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
ibuf->ftype = ftype;
|
||||
ibuf->foptions = *options;
|
||||
if (ibuf != NULL) {
|
||||
ibuf->ftype = ftype;
|
||||
ibuf->foptions = *options;
|
||||
}
|
||||
IMB_moviecacheIter_step(iter);
|
||||
}
|
||||
IMB_moviecacheIter_free(iter);
|
||||
|
@ -5908,7 +5763,7 @@ ImBuf *BKE_image_get_ibuf_with_name(Image *image, const char *name)
|
|||
|
||||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ImBuf *current_ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
if (STREQ(current_ibuf->name, name)) {
|
||||
if (current_ibuf != NULL && STREQ(current_ibuf->name, name)) {
|
||||
ibuf = current_ibuf;
|
||||
IMB_refImBuf(ibuf);
|
||||
break;
|
||||
|
@ -5941,7 +5796,9 @@ ImBuf *BKE_image_get_first_ibuf(Image *image)
|
|||
|
||||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
IMB_refImBuf(ibuf);
|
||||
if (ibuf != NULL) {
|
||||
IMB_refImBuf(ibuf);
|
||||
}
|
||||
break;
|
||||
}
|
||||
IMB_moviecacheIter_free(iter);
|
||||
|
|
|
@ -373,15 +373,14 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
|
|||
/* Check if image has been updated and tagged to be updated (full or partial). */
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
if (((ima->gpuflag & IMA_GPU_REFRESH) != 0) ||
|
||||
((ibuf == NULL || tile == NULL || !tile->ok) &&
|
||||
((ima->gpuflag & IMA_GPU_PARTIAL_REFRESH) != 0))) {
|
||||
((ibuf == NULL || tile == NULL) && ((ima->gpuflag & IMA_GPU_PARTIAL_REFRESH) != 0))) {
|
||||
image_free_gpu(ima, true);
|
||||
BLI_freelistN(&ima->gpu_refresh_areas);
|
||||
ima->gpuflag &= ~(IMA_GPU_REFRESH | IMA_GPU_PARTIAL_REFRESH);
|
||||
}
|
||||
else if (ima->gpuflag & IMA_GPU_PARTIAL_REFRESH) {
|
||||
BLI_assert(ibuf);
|
||||
BLI_assert(tile && tile->ok);
|
||||
BLI_assert(tile);
|
||||
ImagePartialRefresh *refresh_area;
|
||||
while ((refresh_area = BLI_pophead(&ima->gpu_refresh_areas))) {
|
||||
const int tile_offset_x = refresh_area->tile_x * IMA_PARTIAL_REFRESH_TILE_SIZE;
|
||||
|
@ -417,7 +416,7 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
|
|||
|
||||
/* Check if we have a valid image. If not, we return a dummy
|
||||
* texture with zero bind-code so we don't keep trying. */
|
||||
if (tile == NULL || tile->ok == 0) {
|
||||
if (tile == NULL) {
|
||||
*tex = image_gpu_texture_error_create(textarget);
|
||||
return *tex;
|
||||
}
|
||||
|
|
|
@ -842,7 +842,7 @@ static ImBuf *get_imbuf_cache(MovieClip *clip, const MovieClipUser *user, int fl
|
|||
key.render_flag = 0;
|
||||
}
|
||||
|
||||
return IMB_moviecache_get(clip->cache->moviecache, &key);
|
||||
return IMB_moviecache_get(clip->cache->moviecache, &key, NULL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -754,13 +754,11 @@ void ntreeBlendReadData(BlendDataReader *reader, bNodeTree *ntree)
|
|||
}
|
||||
case SH_NODE_TEX_IMAGE: {
|
||||
NodeTexImage *tex = (NodeTexImage *)node->storage;
|
||||
tex->iuser.ok = 1;
|
||||
tex->iuser.scene = nullptr;
|
||||
break;
|
||||
}
|
||||
case SH_NODE_TEX_ENVIRONMENT: {
|
||||
NodeTexEnvironment *tex = (NodeTexEnvironment *)node->storage;
|
||||
tex->iuser.ok = 1;
|
||||
tex->iuser.scene = nullptr;
|
||||
break;
|
||||
}
|
||||
|
@ -769,7 +767,6 @@ void ntreeBlendReadData(BlendDataReader *reader, bNodeTree *ntree)
|
|||
case CMP_NODE_VIEWER:
|
||||
case CMP_NODE_SPLITVIEWER: {
|
||||
ImageUser *iuser = (ImageUser *)node->storage;
|
||||
iuser->ok = 1;
|
||||
iuser->scene = nullptr;
|
||||
break;
|
||||
}
|
||||
|
@ -783,7 +780,6 @@ void ntreeBlendReadData(BlendDataReader *reader, bNodeTree *ntree)
|
|||
}
|
||||
case TEX_NODE_IMAGE: {
|
||||
ImageUser *iuser = (ImageUser *)node->storage;
|
||||
iuser->ok = 1;
|
||||
iuser->scene = nullptr;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -4170,7 +4170,6 @@ void BKE_object_empty_draw_type_set(Object *ob, const int value)
|
|||
if (ob->type == OB_EMPTY && ob->empty_drawtype == OB_EMPTY_IMAGE) {
|
||||
if (!ob->iuser) {
|
||||
ob->iuser = MEM_callocN(sizeof(ImageUser), "image user");
|
||||
ob->iuser->ok = 1;
|
||||
ob->iuser->flag |= IMA_ANIM_ALWAYS;
|
||||
ob->iuser->frames = 100;
|
||||
ob->iuser->sfra = 1;
|
||||
|
|
|
@ -1615,7 +1615,6 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area)
|
|||
SpaceImage *sima = (SpaceImage *)sl;
|
||||
|
||||
sima->iuser.scene = NULL;
|
||||
sima->iuser.ok = 1;
|
||||
sima->scopes.waveform_1 = NULL;
|
||||
sima->scopes.waveform_2 = NULL;
|
||||
sima->scopes.waveform_3 = NULL;
|
||||
|
|
|
@ -185,7 +185,6 @@ static void texture_blend_read_data(BlendDataReader *reader, ID *id)
|
|||
BLO_read_data_address(reader, &tex->preview);
|
||||
BKE_previewimg_blend_read(reader, tex->preview);
|
||||
|
||||
tex->iuser.ok = 1;
|
||||
tex->iuser.scene = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1384,7 +1384,6 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
|
||||
tex->iuser.frames = 1;
|
||||
tex->iuser.sfra = 1;
|
||||
tex->iuser.ok = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4517,7 +4517,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "tiles")) {
|
||||
for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
|
||||
ImageTile *tile = MEM_callocN(sizeof(ImageTile), "Image Tile");
|
||||
tile->ok = 1;
|
||||
tile->tile_number = 1001;
|
||||
BLI_addtail(&ima->tiles, tile);
|
||||
}
|
||||
|
|
|
@ -391,7 +391,6 @@ static void do_version_ntree_242_2(bNodeTree *ntree)
|
|||
iuser->sfra = nia->sfra;
|
||||
iuser->offset = nia->nr - 1;
|
||||
iuser->cycl = nia->cyclic;
|
||||
iuser->ok = 1;
|
||||
|
||||
node->storage = iuser;
|
||||
MEM_freeN(nia);
|
||||
|
@ -399,7 +398,6 @@ static void do_version_ntree_242_2(bNodeTree *ntree)
|
|||
else {
|
||||
ImageUser *iuser = node->storage = MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
iuser->sfra = 1;
|
||||
iuser->ok = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -173,8 +173,6 @@ void ViewerOperation::init_image()
|
|||
if (ibuf->x > 0 && ibuf->y > 0) {
|
||||
imb_addrectfloatImBuf(ibuf);
|
||||
}
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
tile->ok = IMA_OK_LOADED;
|
||||
|
||||
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ static struct GPUTexture *gpencil_image_texture_get(Image *image, bool *r_alpha_
|
|||
struct GPUTexture *gpu_tex = NULL;
|
||||
void *lock;
|
||||
|
||||
iuser.ok = true;
|
||||
ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
|
||||
|
||||
if (ibuf != NULL && ibuf->rect != NULL) {
|
||||
|
|
|
@ -314,11 +314,8 @@ static void bake_targets_refresh(BakeTargets *targets)
|
|||
|
||||
if (ima) {
|
||||
LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
|
||||
if (tile->ok == IMA_OK_LOADED) {
|
||||
BKE_image_free_gputextures(ima);
|
||||
DEG_id_tag_update(&ima->id, 0);
|
||||
break;
|
||||
}
|
||||
BKE_image_free_gputextures(ima);
|
||||
DEG_id_tag_update(&ima->id, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -976,7 +976,6 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even
|
|||
rj->anim = is_animation;
|
||||
rj->write_still = is_write_still && !is_animation;
|
||||
rj->iuser.scene = scene;
|
||||
rj->iuser.ok = 1;
|
||||
rj->reports = op->reports;
|
||||
rj->orig_layer = 0;
|
||||
rj->last_layer = 0;
|
||||
|
|
|
@ -836,7 +836,6 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op)
|
|||
BKE_image_backup_render(oglrender->scene, oglrender->ima, true);
|
||||
|
||||
oglrender->iuser.scene = scene;
|
||||
oglrender->iuser.ok = 1;
|
||||
|
||||
/* create render result */
|
||||
RE_InitState(oglrender->re, NULL, &scene->r, &scene->view_layers, NULL, sizex, sizey, NULL);
|
||||
|
|
|
@ -1476,14 +1476,8 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
|
|||
return;
|
||||
}
|
||||
|
||||
ImageTile *tile = BKE_image_get_tile(ima, 0);
|
||||
/* tile->ok is zero when Image cannot load */
|
||||
if (tile->ok == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* setup dummy image user */
|
||||
iuser.ok = iuser.framenr = 1;
|
||||
iuser.framenr = 1;
|
||||
iuser.scene = sp->scene;
|
||||
|
||||
/* elubie: this needs to be changed: here image is always loaded if not
|
||||
|
|
|
@ -916,8 +916,6 @@ static bool paint_2d_ensure_tile_canvas(ImagePaintState *s, int i)
|
|||
|
||||
s->tiles[i].cache.lastdiameter = -1;
|
||||
|
||||
s->tiles[i].iuser.ok = true;
|
||||
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(s->image, &s->tiles[i].iuser, NULL);
|
||||
if (ibuf != NULL) {
|
||||
if (ibuf->channels != 4) {
|
||||
|
@ -1683,7 +1681,6 @@ void *paint_2d_new_stroke(bContext *C, wmOperator *op, int mode)
|
|||
for (int i = 0; i < s->num_tiles; i++) {
|
||||
s->tiles[i].iuser = sima->iuser;
|
||||
}
|
||||
s->tiles[0].iuser.ok = true;
|
||||
|
||||
zero_v2(s->tiles[0].uv_origin);
|
||||
|
||||
|
|
|
@ -729,10 +729,6 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg))
|
|||
{
|
||||
RNAUpdateCb *cb = (RNAUpdateCb *)arg_cb;
|
||||
|
||||
/* ideally this would be done by RNA itself, but there we have
|
||||
* no image user available, so we just update this flag here */
|
||||
cb->iuser->ok = 1;
|
||||
|
||||
/* we call update here on the pointer property, this way the
|
||||
* owner of the image pointer can still define its own update
|
||||
* and notifier */
|
||||
|
|
|
@ -2227,7 +2227,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
|
|||
iter = IMB_moviecacheIter_new(image->cache);
|
||||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
if (ibuf->userflags & IB_BITMAPDIRTY) {
|
||||
if (ibuf != NULL && ibuf->userflags & IB_BITMAPDIRTY) {
|
||||
if (first_ibuf == NULL) {
|
||||
first_ibuf = ibuf;
|
||||
}
|
||||
|
@ -2251,7 +2251,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
|
|||
while (!IMB_moviecacheIter_done(iter)) {
|
||||
ibuf = IMB_moviecacheIter_getImBuf(iter);
|
||||
|
||||
if (ibuf->userflags & IB_BITMAPDIRTY) {
|
||||
if (ibuf != NULL && ibuf->userflags & IB_BITMAPDIRTY) {
|
||||
char name[FILE_MAX];
|
||||
BLI_strncpy(name, ibuf->name, sizeof(name));
|
||||
|
||||
|
|
|
@ -668,7 +668,6 @@ static UndoImageHandle *uhandle_add(ListBase *undo_handles, Image *image, ImageU
|
|||
uh->image_ref.ptr = image;
|
||||
uh->iuser = *iuser;
|
||||
uh->iuser.scene = NULL;
|
||||
uh->iuser.ok = 1;
|
||||
BLI_addtail(undo_handles, uh);
|
||||
return uh;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ void IMB_moviecache_set_priority_callback(struct MovieCache *cache,
|
|||
|
||||
void IMB_moviecache_put(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
|
||||
bool IMB_moviecache_put_if_possible(struct MovieCache *cache, void *userkey, struct ImBuf *ibuf);
|
||||
struct ImBuf *IMB_moviecache_get(struct MovieCache *cache, void *userkey);
|
||||
struct ImBuf *IMB_moviecache_get(struct MovieCache *cache, void *userkey, bool *r_is_cached_empty);
|
||||
void IMB_moviecache_remove(struct MovieCache *cache, void *userkey);
|
||||
bool IMB_moviecache_has_frame(struct MovieCache *cache, void *userkey);
|
||||
void IMB_moviecache_free(struct MovieCache *cache);
|
||||
|
|
|
@ -342,7 +342,7 @@ static ImBuf *colormanage_cache_get_ibuf(ImBuf *ibuf,
|
|||
|
||||
*cache_handle = NULL;
|
||||
|
||||
cache_ibuf = IMB_moviecache_get(moviecache, key);
|
||||
cache_ibuf = IMB_moviecache_get(moviecache, key, NULL);
|
||||
|
||||
*cache_handle = cache_ibuf;
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@ typedef struct MovieCacheItem {
|
|||
ImBuf *ibuf;
|
||||
MEM_CacheLimiterHandleC *c_handle;
|
||||
void *priority_data;
|
||||
/* Indicates that #ibuf is null, because there was an error during load. */
|
||||
bool added_empty;
|
||||
} MovieCacheItem;
|
||||
|
||||
static unsigned int moviecache_hashhash(const void *keyv)
|
||||
|
@ -141,11 +143,16 @@ static void check_unused_keys(MovieCache *cache)
|
|||
while (!BLI_ghashIterator_done(&gh_iter)) {
|
||||
const MovieCacheKey *key = BLI_ghashIterator_getKey(&gh_iter);
|
||||
const MovieCacheItem *item = BLI_ghashIterator_getValue(&gh_iter);
|
||||
bool remove;
|
||||
|
||||
BLI_ghashIterator_step(&gh_iter);
|
||||
|
||||
remove = !item->ibuf;
|
||||
if (item->added_empty) {
|
||||
/* Don't remove entries that have been added empty. Those indicate that the image couldn't be
|
||||
* loaded correctly. */
|
||||
continue;
|
||||
}
|
||||
|
||||
bool remove = !item->ibuf;
|
||||
|
||||
if (remove) {
|
||||
PRINT("%s: cache '%s' remove item %p without buffer\n", __func__, cache->name, item);
|
||||
|
@ -309,7 +316,9 @@ static void do_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf, boo
|
|||
IMB_moviecache_init();
|
||||
}
|
||||
|
||||
IMB_refImBuf(ibuf);
|
||||
if (ibuf != NULL) {
|
||||
IMB_refImBuf(ibuf);
|
||||
}
|
||||
|
||||
key = BLI_mempool_alloc(cache->keys_pool);
|
||||
key->cache_owner = cache;
|
||||
|
@ -324,6 +333,7 @@ static void do_moviecache_put(MovieCache *cache, void *userkey, ImBuf *ibuf, boo
|
|||
item->cache_owner = cache;
|
||||
item->c_handle = NULL;
|
||||
item->priority_data = NULL;
|
||||
item->added_empty = ibuf == NULL;
|
||||
|
||||
if (cache->getprioritydatafp) {
|
||||
item->priority_data = cache->getprioritydatafp(userkey);
|
||||
|
@ -365,7 +375,7 @@ bool IMB_moviecache_put_if_possible(MovieCache *cache, void *userkey, ImBuf *ibu
|
|||
size_t mem_in_use, mem_limit, elem_size;
|
||||
bool result = false;
|
||||
|
||||
elem_size = get_size_in_memory(ibuf);
|
||||
elem_size = (ibuf == NULL) ? 0 : get_size_in_memory(ibuf);
|
||||
mem_limit = MEM_CacheLimiter_get_maximum();
|
||||
|
||||
BLI_mutex_lock(&limitor_lock);
|
||||
|
@ -389,7 +399,7 @@ void IMB_moviecache_remove(MovieCache *cache, void *userkey)
|
|||
BLI_ghash_remove(cache->hash, &key, moviecache_keyfree, moviecache_valfree);
|
||||
}
|
||||
|
||||
ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey)
|
||||
ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey, bool *r_is_cached_empty)
|
||||
{
|
||||
MovieCacheKey key;
|
||||
MovieCacheItem *item;
|
||||
|
@ -398,6 +408,10 @@ ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey)
|
|||
key.userkey = userkey;
|
||||
item = (MovieCacheItem *)BLI_ghash_lookup(cache->hash, &key);
|
||||
|
||||
if (r_is_cached_empty) {
|
||||
*r_is_cached_empty = false;
|
||||
}
|
||||
|
||||
if (item) {
|
||||
if (item->ibuf) {
|
||||
BLI_mutex_lock(&limitor_lock);
|
||||
|
@ -408,6 +422,9 @@ ImBuf *IMB_moviecache_get(MovieCache *cache, void *userkey)
|
|||
|
||||
return item->ibuf;
|
||||
}
|
||||
if (r_is_cached_empty) {
|
||||
*r_is_cached_empty = true;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -51,16 +51,13 @@ typedef struct ImageUser {
|
|||
/** Offset within movie, start frame in global time. */
|
||||
int offset, sfra;
|
||||
/** Cyclic flag. */
|
||||
char _pad0, cycl;
|
||||
char ok;
|
||||
char cycl;
|
||||
|
||||
/** Multiview current eye - for internal use of drawing routines. */
|
||||
char multiview_eye;
|
||||
short pass;
|
||||
char _pad1[2];
|
||||
|
||||
int tile;
|
||||
int _pad2;
|
||||
|
||||
/** Listbase indices, for menu browsing or retrieve buffer. */
|
||||
short multi_index, view, layer;
|
||||
|
@ -112,9 +109,7 @@ typedef struct ImageTile {
|
|||
|
||||
struct ImageTile_Runtime runtime;
|
||||
|
||||
char ok;
|
||||
char _pad[3];
|
||||
|
||||
char _pad[4];
|
||||
int tile_number;
|
||||
char label[64];
|
||||
} ImageTile;
|
||||
|
|
|
@ -75,7 +75,6 @@ static void rna_Image_save_render(
|
|||
void *lock;
|
||||
|
||||
iuser.scene = scene;
|
||||
iuser.ok = 1;
|
||||
|
||||
ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
|
||||
|
||||
|
|
|
@ -141,7 +141,6 @@ static void cmp_node_image_create_outputs(bNodeTree *ntree,
|
|||
* So we manually construct image user to be sure first
|
||||
* image from sequence (that one which is set as filename
|
||||
* for image data-block) is used for sockets detection. */
|
||||
load_iuser.ok = 1;
|
||||
load_iuser.framenr = offset;
|
||||
|
||||
/* make sure ima->type is correct */
|
||||
|
@ -411,7 +410,6 @@ static void node_composit_init_image(bNodeTree *ntree, bNode *node)
|
|||
node->storage = iuser;
|
||||
iuser->frames = 1;
|
||||
iuser->sfra = 1;
|
||||
iuser->ok = 1;
|
||||
iuser->flag |= IMA_ANIM_ALWAYS;
|
||||
|
||||
/* setup initial outputs */
|
||||
|
|
|
@ -38,7 +38,6 @@ static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node
|
|||
ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage = iuser;
|
||||
iuser->sfra = 1;
|
||||
iuser->ok = 1;
|
||||
node->custom1 = 50; /* default 50% split */
|
||||
|
||||
node->id = (ID *)BKE_image_ensure_viewer(G.main, IMA_TYPE_COMPOSITE, "Viewer Node");
|
||||
|
|
|
@ -44,7 +44,6 @@ static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node)
|
|||
ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage = iuser;
|
||||
iuser->sfra = 1;
|
||||
iuser->ok = 1;
|
||||
node->custom3 = 0.5f;
|
||||
node->custom4 = 0.5f;
|
||||
|
||||
|
|
|
@ -101,7 +101,6 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
|||
ImageUser *iuser = MEM_callocN(sizeof(ImageUser), "node image user");
|
||||
node->storage = iuser;
|
||||
iuser->sfra = 1;
|
||||
iuser->ok = 1;
|
||||
iuser->flag |= IMA_ANIM_ALWAYS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue