Cleanup: name of image poll function
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user