diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-01 18:16:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-01 18:45:37 +0300 |
commit | cc092e9ab0c2e1877fe5d33724c1fdc5fb16b522 (patch) | |
tree | 5bb4ce3915653fc17ce3e2df97c2fa8fbff574eb | |
parent | 825a93d7cddd0fb28431f12b0927b45b8eca4125 (diff) |
Cleanup: name of image poll function
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index b9d5c927092..a8dfad85232 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -213,14 +213,7 @@ static ImageUser *image_user_from_context(const bContext *C) } } -static bool image_buffer_exists_from_context_no_image_user(bContext *C) -{ - Image *ima = image_from_context(C); - - return BKE_image_has_ibuf(ima, NULL); -} - -static bool image_buffer_exists_from_context(bContext *C) +static bool image_from_context_has_data_poll(bContext *C) { Image *ima = image_from_context(C); ImageUser *iuser = image_user_from_context(C); @@ -236,6 +229,16 @@ static bool image_buffer_exists_from_context(bContext *C) return has_buffer; } +/** + * Use this when the image buffer is accessed without the image user. + */ +static bool image_from_contect_has_data_poll_no_image_user(bContext *C) +{ + Image *ima = image_from_context(C); + + return BKE_image_has_ibuf(ima, NULL); +} + static bool image_not_packed_poll(bContext *C) { /* Do not run 'replace' on packed images, it does not give user expected results at all. */ @@ -2061,7 +2064,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) static bool image_save_as_poll(bContext *C) { - if (!image_buffer_exists_from_context(C)) { + if (!image_from_context_has_data_poll(C)) { return false; } @@ -2162,7 +2165,7 @@ static bool image_file_path_saveable(bContext *C, Image *ima, ImageUser *iuser) static bool image_save_poll(bContext *C) { /* Can't save if there are no pixels. */ - if (image_buffer_exists_from_context(C) == false) { + if (image_from_context_has_data_poll(C) == false) { return false; } @@ -2332,7 +2335,7 @@ void IMAGE_OT_save_sequence(wmOperatorType *ot) /* api callbacks */ ot->exec = image_save_sequence_exec; - ot->poll = image_buffer_exists_from_context; + ot->poll = image_from_context_has_data_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2862,7 +2865,7 @@ void IMAGE_OT_invert(wmOperatorType *ot) /* api callbacks */ ot->exec = image_invert_exec; - ot->poll = image_buffer_exists_from_context_no_image_user; + ot->poll = image_from_contect_has_data_poll_no_image_user; /* properties */ prop = RNA_def_boolean(ot->srna, "invert_r", 0, "Red", "Invert Red Channel"); @@ -2951,7 +2954,7 @@ void IMAGE_OT_resize(wmOperatorType *ot) /* api callbacks */ ot->invoke = image_scale_invoke; ot->exec = image_scale_exec; - ot->poll = image_buffer_exists_from_context_no_image_user; + ot->poll = image_from_contect_has_data_poll_no_image_user; /* properties */ RNA_def_int_vector(ot->srna, "size", 2, NULL, 1, INT_MAX, "Size", "", 1, SHRT_MAX); |