diff options
author | Campbell Barton <campbell@blender.org> | 2022-06-14 07:30:06 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-06-14 07:30:06 +0300 |
commit | f89ea052f7de87e57599c2953d3e0693e7e6c713 (patch) | |
tree | b808fc2f480071892a4fd81aba8e9e8d2b30ee2c | |
parent | 9a063e85a5852163a3e5d1b5396dc3c04bb153b0 (diff) |
Cleanup: remove the need for image scale using a context
Scaling an image shouldn't depend on the current context.
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index d2b8b32eedc..be1e344d73f 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -160,15 +160,14 @@ static void rna_Image_update(Image *image, ReportList *reports) BKE_image_release_ibuf(image, ibuf, NULL); } -static void rna_Image_scale(Image *image, bContext *C, ReportList *reports, int width, int height) +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); + return; } - else { - BKE_image_partial_update_mark_full_update(image); - WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, image); - } + BKE_image_partial_update_mark_full_update(image); + WM_main_add_notifier(NC_IMAGE | NA_EDITED, image); } static int rna_Image_gl_load( @@ -285,7 +284,7 @@ void RNA_api_image(StructRNA *srna) func = RNA_def_function(srna, "scale", "rna_Image_scale"); RNA_def_function_ui_description(func, "Scale the buffer of the image, in pixels"); - RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); + RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_int(func, "width", 1, 1, INT_MAX, "", "Width", 1, INT_MAX); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); parm = RNA_def_int(func, "height", 1, 1, INT_MAX, "", "Height", 1, INT_MAX); |