diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-07-17 13:11:52 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-07-17 13:19:57 +0300 |
commit | 1255ac12a6650a00aaaa529ec4818ce1e247e360 (patch) | |
tree | 0acaa7c5de6ba4fbfe40bb558f4d6af4c2183b53 /source/blender/editors | |
parent | 37017d149e8f399eab43d916e14ce9a49b5ef025 (diff) |
Fix T45462: Do not enale 'replace image' op with packed images.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 840bbff3973..ac0f327af0d 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -165,6 +165,17 @@ static int space_image_buffer_exists_poll(bContext *C) return 0; } +static int image_not_packed_poll(bContext *C) +{ + SpaceImage *sima = CTX_wm_space_image(C); + + /* Do not run 'replace' on packed images, it does not give user expected results at all. */ + if (sima && sima->image && BLI_listbase_is_empty(&sima->image->packedfiles)) { + return true; + } + return false; +} + static int space_image_file_exists_poll(bContext *C) { if (space_image_buffer_exists_poll(C)) { @@ -1405,7 +1416,7 @@ void IMAGE_OT_replace(wmOperatorType *ot) /* api callbacks */ ot->exec = image_replace_exec; ot->invoke = image_replace_invoke; - ot->poll = space_image_poll; + ot->poll = image_not_packed_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; |