diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2022-06-03 13:50:13 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2022-06-03 15:08:21 +0300 |
commit | cf6c8ae01b66a6260604e35c9c2d63bb06805e4f (patch) | |
tree | dea11bc07c891c6332fa0c677ae000dfa07ecc7f /source | |
parent | c4701a027fed83d2aea4f0f26a845e4d6852b1ff (diff) |
Fix T98573: Rescaling Image by python wrong
This did not refresh the Image editor, but more importantly this now
appeared cropped (a regression from the partial image updater).
Solved in the RNA function by:
- calling BKE_image_partial_update_mark_full_update
- sending appropriate notifier
Maniphest Tasks: T98573
Differential Revision: https://developer.blender.org/D15110
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 29f639fbe65..f46b820a9f9 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -197,11 +197,15 @@ static void rna_Image_update(Image *image, ReportList *reports) BKE_image_release_ibuf(image, ibuf, NULL); } -static void rna_Image_scale(Image *image, ReportList *reports, int width, int height) +static void rna_Image_scale(Image *image, bContext *C, 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); } + else { + BKE_image_partial_update_mark_full_update(image); + WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, image); + } } static int rna_Image_gl_load( @@ -318,7 +322,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); + RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); 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); |