[Bf-blender-cvs] [1255ac1] master: Fix T45462: Do not enale 'replace image' op with packed images.

Bastien Montagne noreply at git.blender.org
Fri Jul 17 12:24:28 CEST 2015


Commit: 1255ac12a6650a00aaaa529ec4818ce1e247e360
Author: Bastien Montagne
Date:   Fri Jul 17 12:11:52 2015 +0200
Branches: master
https://developer.blender.org/rB1255ac12a6650a00aaaa529ec4818ce1e247e360

Fix T45462: Do not enale 'replace image' op with packed images.

===================================================================

M	source/blender/editors/space_image/image_ops.c

===================================================================

diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 840bbff..ac0f327 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;




More information about the Bf-blender-cvs mailing list