Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-01-11 14:25:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-11 14:25:20 +0400
commit274b2590fb0eedaadbd5e588f629df7cb69ba0d8 (patch)
treeb10be0fa18eafd0ff9756bfbbfe21bdeb7f7c0cf /source/blender/makesrna/intern/rna_image_api.c
parentc2508b6e1b8f330419762dd0badc3059a8d1f448 (diff)
Image API: add frame argument to gl_load(), gl_touch()
patch D103 by Krantz Geoffroy
Diffstat (limited to 'source/blender/makesrna/intern/rna_image_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index f0322bac756..71c0fa5584c 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -205,16 +205,20 @@ static void rna_Image_scale(Image *image, ReportList *reports, int width, int he
}
}
-static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int mag)
+static int rna_Image_gl_load(Image *image, ReportList *reports, int frame, int filter, int mag)
{
ImBuf *ibuf;
unsigned int *bind = &image->bindcode;
int error = GL_NO_ERROR;
+ ImageUser iuser = {NULL};
+ void *lock;
if (*bind)
return error;
+ iuser.framenr = frame;
+ iuser.ok = true;
- ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
+ ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
if (ibuf == NULL || ibuf->rect == NULL) {
BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
@@ -252,7 +256,7 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
return error;
}
-static int rna_Image_gl_touch(Image *image, ReportList *reports, int filter, int mag)
+static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame, int filter, int mag)
{
unsigned int *bind = &image->bindcode;
int error = GL_NO_ERROR;
@@ -260,7 +264,7 @@ static int rna_Image_gl_touch(Image *image, ReportList *reports, int filter, int
BKE_image_tag_time(image);
if (*bind == 0)
- error = rna_Image_gl_load(image, reports, filter, mag);
+ error = rna_Image_gl_load(image, reports, frame, filter, mag);
return error;
}
@@ -319,6 +323,8 @@ void RNA_api_image(StructRNA *srna)
func = RNA_def_function(srna, "gl_touch", "rna_Image_gl_touch");
RNA_def_function_ui_description(func, "Delay the image from being cleaned from the cache due inactivity");
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, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
"The texture minifying function to use if the image wasn't loaded", -INT_MAX, INT_MAX);
RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
@@ -330,10 +336,13 @@ void RNA_api_image(StructRNA *srna)
func = RNA_def_function(srna, "gl_load", "rna_Image_gl_load");
RNA_def_function_ui_description(func, "Load the image into OpenGL graphics memory");
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, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
"The texture minifying function", -INT_MAX, INT_MAX);
RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
"The texture magnification function", -INT_MAX, INT_MAX);
+
/* return value */
parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
RNA_def_function_return(func, parm);