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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_image_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 71196ea2a97..4d951b54c26 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -79,7 +79,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
if (ibuf == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Couldn't acquire buffer from image");
+ BKE_report(reports, RPT_ERROR, "Could not acquire buffer from image");
}
else {
ImBuf *write_ibuf;
@@ -91,7 +91,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
write_ibuf->dither = scene->r.dither_intensity;
if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
- BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
+ BKE_reportf(reports, RPT_ERROR, "Could not write image '%s'", path);
}
if (write_ibuf != ibuf)
@@ -101,7 +101,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
BKE_image_release_ibuf(image, lock);
}
else {
- BKE_reportf(reports, RPT_ERROR, "Scene not in context, couldn't get save parameters");
+ BKE_report(reports, RPT_ERROR, "Scene not in context, could not get save parameters");
}
}
@@ -115,7 +115,7 @@ static void rna_Image_save(Image *image, ReportList *reports)
if (image->packedfile) {
if (writePackedFile(reports, image->name, image->packedfile, 0) != RET_OK) {
- BKE_reportf(reports, RPT_ERROR, "Image \"%s\" could saved packed file to \"%s\"", image->id.name + 2, image->name);
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' could not save packed file to '%s'", image->id.name + 2, image->name);
}
}
else if (IMB_saveiff(ibuf, filename, ibuf->flags)) {
@@ -129,11 +129,11 @@ static void rna_Image_save(Image *image, ReportList *reports)
ibuf->userflags &= ~IB_BITMAPDIRTY;
}
else {
- BKE_reportf(reports, RPT_ERROR, "Image \"%s\" could not be saved to \"%s\"", image->id.name + 2, image->name);
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' could not be saved to '%s'", image->id.name + 2, image->name);
}
}
else {
- BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
}
}
@@ -142,7 +142,7 @@ static void rna_Image_pack(Image *image, ReportList *reports, int as_png)
ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
- BKE_reportf(reports, RPT_ERROR, "Can't pack edited image from disk, only as internal PNG");
+ BKE_report(reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG");
}
else {
if (as_png) {
@@ -179,17 +179,20 @@ static void rna_Image_update(Image *image, ReportList *reports)
ImBuf *ibuf = BKE_image_get_ibuf(image, NULL);
if (ibuf == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
return;
}
- IMB_rect_from_float(ibuf);
+ if (ibuf->rect)
+ IMB_rect_from_float(ibuf);
+
+ ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
}
static void rna_Image_scale(Image *image, ReportList *reports, int width, int height)
{
if (!BKE_image_scale(image, width, height)) {
- BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
}
}
@@ -205,7 +208,7 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int
ibuf = BKE_image_get_ibuf(image, NULL);
if (ibuf == NULL || ibuf->rect == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Image \"%s\" does not have any image data", image->id.name + 2);
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
return (int)GL_INVALID_OPERATION;
}
@@ -296,9 +299,9 @@ void RNA_api_image(StructRNA *srna)
func = RNA_def_function(srna, "scale", "rna_Image_scale");
RNA_def_function_ui_description(func, "Scale the image in pixels");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "width", 0, 1, 10000, "", "Width", 1, 10000);
+ parm = RNA_def_int(func, "width", 1, 1, 10000, "", "Width", 1, 10000);
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm = RNA_def_int(func, "height", 0, 1, 10000, "", "Height", 1, 10000);
+ parm = RNA_def_int(func, "height", 1, 1, 10000, "", "Height", 1, 10000);
RNA_def_property_flag(parm, PROP_REQUIRED);
func = RNA_def_function(srna, "gl_touch", "rna_Image_gl_touch");