[Bf-blender-cvs] [c324c4d] master: Fix T47701: Image not fully updated after setting .pixels

Sergey Sharybin noreply at git.blender.org
Tue Mar 8 11:00:35 CET 2016


Commit: c324c4d57502e9056acaa85231ae330914972ee9
Author: Sergey Sharybin
Date:   Tue Mar 8 14:56:22 2016 +0500
Branches: master
https://developer.blender.org/rBc324c4d57502e9056acaa85231ae330914972ee9

Fix T47701: Image not fully updated after setting .pixels

The set callback was missing couple of things:

- Mipmaps should be updated after pixels changes
- GPU texture is invalid after setting pixels

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

M	source/blender/makesrna/intern/rna_image.c

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

diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 63fa598..f65aa90 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -62,6 +62,10 @@ static EnumPropertyItem image_source_items[] = {
 
 #ifdef RNA_RUNTIME
 
+#include "BKE_global.h"
+
+#include "GPU_draw.h"
+
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
@@ -399,7 +403,11 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
 				((unsigned char *)ibuf->rect)[i] = FTOCHAR(values[i]);
 		}
 
-		ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID;
+		ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID;
+		if (!G.background) {
+			GPU_free_image(ima);
+		}
+		WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
 	}
 
 	BKE_image_release_ibuf(ima, ibuf, lock);




More information about the Bf-blender-cvs mailing list