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:
authorLukas Stockner <lukas.stockner@freenet.de>2019-12-18 03:05:02 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2019-12-18 03:05:02 +0300
commit850aa3a6cfe1f4c2cab170c82d4ccba3eedae0d0 (patch)
tree1eebd31b52b285300992d5646f7c8332d07dac8d /source/blender/editors/space_image
parente0cd5b980fc5042241d7bd318e97cbc5156eb076 (diff)
Image Editor: Disable tile operators if tile 1001 is missing
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_ops.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index eb9181f96fa..04d5661ca77 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -4212,13 +4212,6 @@ void IMAGE_OT_clear_render_border(wmOperatorType *ot)
/* ********************* Add tile operator ****************** */
-static bool tile_poll(bContext *C)
-{
- Image *ima = CTX_data_edit_image(C);
-
- return (ima != NULL && ima->source == IMA_SRC_TILED);
-}
-
static bool do_fill_tile(PointerRNA *ptr, Image *ima, ImageTile *tile)
{
float color[4];
@@ -4284,6 +4277,13 @@ static void def_fill_tile(StructOrFunctionRNA *srna)
RNA_def_boolean(srna, "alpha", 1, "Alpha", "Create an image with an alpha channel");
}
+static bool tile_add_poll(bContext *C)
+{
+ Image *ima = CTX_data_edit_image(C);
+
+ return (ima != NULL && ima->source == IMA_SRC_TILED && BKE_image_has_ibuf(ima, NULL));
+}
+
static int tile_add_exec(bContext *C, wmOperator *op)
{
Image *ima = CTX_data_edit_image(C);
@@ -4374,7 +4374,7 @@ void IMAGE_OT_tile_add(wmOperatorType *ot)
ot->idname = "IMAGE_OT_tile_add";
/* api callbacks */
- ot->poll = tile_poll;
+ ot->poll = tile_add_poll;
ot->exec = tile_add_exec;
ot->invoke = tile_add_invoke;
ot->ui = tile_add_draw;
@@ -4433,6 +4433,17 @@ void IMAGE_OT_tile_remove(wmOperatorType *ot)
/* ********************* Fill tile operator ****************** */
+static bool tile_fill_poll(bContext *C)
+{
+ Image *ima = CTX_data_edit_image(C);
+
+ if (ima != NULL && ima->source == IMA_SRC_TILED) {
+ /* Filling secondary tiles is only allowed if the primary tile exists. */
+ return (ima->active_tile_index == 0) || BKE_image_has_ibuf(ima, NULL);
+ }
+ return false;
+}
+
static int tile_fill_exec(bContext *C, wmOperator *op)
{
Image *ima = CTX_data_edit_image(C);
@@ -4480,7 +4491,7 @@ void IMAGE_OT_tile_fill(wmOperatorType *ot)
ot->idname = "IMAGE_OT_tile_fill";
/* api callbacks */
- ot->poll = tile_poll;
+ ot->poll = tile_fill_poll;
ot->exec = tile_fill_exec;
ot->invoke = tile_fill_invoke;
ot->ui = tile_fill_draw;