[Bf-blender-cvs] [19ca00a] soc-2013-paint: Do image update in undo as well. Also bring back some property updates in layer creation, seems to help with layer panel updates.

Antony Riakiotakis noreply at git.blender.org
Tue Apr 22 19:12:11 CEST 2014


Commit: 19ca00a3276c4bbaafc00f2db032c825004c230b
Author: Antony Riakiotakis
Date:   Tue Apr 22 20:11:55 2014 +0300
https://developer.blender.org/rB19ca00a3276c4bbaafc00f2db032c825004c230b

Do image update in undo as well. Also bring back some property updates
in layer creation, seems to help with layer panel updates.

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

M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 77e909d..a1347af 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -377,7 +377,10 @@ void ED_image_undo_restore(bContext *C, ListBase *lb)
 			ibuf->userflags |= IB_MIPMAP_INVALID;  /* force mipmap recreatiom */
 		ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
 
+		IMB_partial_display_buffer_update_delayed(ibuf, tile->x * IMAPAINT_TILE_SIZE, tile->y * IMAPAINT_TILE_SIZE,
+		                                          (tile->x + 1) * IMAPAINT_TILE_SIZE, (tile->y + 1) * IMAPAINT_TILE_SIZE);
 		BKE_image_release_ibuf(ima, ibuf, NULL);
+		DAG_id_tag_update(&ima->id, 0);
 	}
 
 	IMB_freeImBuf(tmpibuf);
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 68a1898..a956fc7 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4837,6 +4837,8 @@ bool proj_paint_add_slot(bContext *C, int type, Material *ma)
 			char imagename[FILE_MAX];
 			char name[TEXNAME_MAX];
 			Main *bmain = CTX_data_main(C);
+			PointerRNA ptr, idptr;
+			PropertyRNA *prop;
 			Image *ima;
 
 			/* get the name of the texture layer type */
@@ -4858,6 +4860,18 @@ bool proj_paint_add_slot(bContext *C, int type, Material *ma)
 
 				ima = mtex->tex->ima = BKE_image_add_generated(bmain, width, height, imagename, 32, 0, IMA_GENTYPE_BLANK, color);
 
+				uiIDContextProperty(C, &ptr, &prop);
+
+				if (prop) {
+					/* when creating new ID blocks, use is already 1, but RNA
+					 * pointer se also increases user, so this compensates it */
+					ima->id.us--;
+
+					RNA_id_pointer_create(&ima->id, &idptr);
+					RNA_property_pointer_set(&ptr, prop, idptr);
+					RNA_property_update(C, &ptr, prop);
+				}
+
 				refresh_texpaint_image_cache(ma);
 				BKE_image_signal(ima, NULL, IMA_SIGNAL_USER_NEW_IMAGE);
 				WM_event_add_notifier(C, NC_TEXTURE | NA_ADDED, mtex->tex);




More information about the Bf-blender-cvs mailing list