diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_image_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 997a5f5ca45..c4ec0a84a2c 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -174,8 +174,9 @@ static void rna_Image_unpack(Image *image, Main *bmain, ReportList *reports, int if (!BKE_image_has_packedfile(image)) { BKE_report(reports, RPT_ERROR, "Image not packed"); } - else if (BKE_image_is_animated(image)) { - BKE_report(reports, RPT_ERROR, "Unpacking movies or image sequences not supported"); + else if (BKE_image_has_multiple_ibufs(image)) { + BKE_report( + reports, RPT_ERROR, "Unpacking movies, image sequences or tiled images not supported"); return; } else { @@ -215,11 +216,12 @@ static void rna_Image_scale(Image *image, ReportList *reports, int width, int he } } -static int rna_Image_gl_load(Image *image, ReportList *reports, int frame) +static int rna_Image_gl_load(Image *image, ReportList *reports, int frame, int tile_number) { - ImageUser iuser = {NULL}; + ImageUser iuser; + BKE_imageuser_default(&iuser); iuser.framenr = frame; - iuser.ok = true; + iuser.tile = tile_number; GPUTexture *tex = GPU_texture_from_blender(image, &iuser, GL_TEXTURE_2D); @@ -231,14 +233,15 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int frame) return GL_NO_ERROR; } -static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame) +static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame, int tile_number) { int error = GL_NO_ERROR; BKE_image_tag_time(image); - if (image->gputexture[TEXTARGET_TEXTURE_2D] == NULL) { - error = rna_Image_gl_load(image, reports, frame); + ImageTile *tile = BKE_image_get_tile(image, tile_number); + if (tile->gputexture[TEXTARGET_TEXTURE_2D] == NULL) { + error = rna_Image_gl_load(image, reports, frame, tile_number); } return error; @@ -333,6 +336,7 @@ void RNA_api_image(StructRNA *srna) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int( func, "frame", 0, 0, INT_MAX, "Frame", "Frame of image sequence or movie", 0, INT_MAX); + RNA_def_int(func, "tile_number", 0, 0, INT_MAX, "Tile", "Tile of a tiled image", 0, INT_MAX); /* return value */ parm = RNA_def_int( func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX); @@ -347,6 +351,7 @@ void RNA_api_image(StructRNA *srna) RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_int( func, "frame", 0, 0, INT_MAX, "Frame", "Frame of image sequence or movie", 0, INT_MAX); + RNA_def_int(func, "tile_number", 0, 0, INT_MAX, "Tile", "Tile of a tiled image", 0, INT_MAX); /* return value */ parm = RNA_def_int( func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX); |