[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51631] trunk/blender/source/blender/ editors/space_image: Bugfix #27585

Ton Roosendaal ton at blender.org
Thu Oct 25 18:58:52 CEST 2012


Revision: 51631
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51631
Author:   ton
Date:     2012-10-25 16:58:52 +0000 (Thu, 25 Oct 2012)
Log Message:
-----------
Bugfix #27585

Oldie: Texture buttons - "Add New Image" - crashes on changing X or Y resolution.

I've greyed out these buttons now, changing image memory that's in use by the
preview render is not supported.

A real fix I did was assigning the new image to the texture, that was missing.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_image/image_buttons.c
    trunk/blender/source/blender/editors/space_image/image_ops.c

Modified: trunk/blender/source/blender/editors/space_image/image_buttons.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_buttons.c	2012-10-25 16:49:06 UTC (rev 51630)
+++ trunk/blender/source/blender/editors/space_image/image_buttons.c	2012-10-25 16:58:52 UTC (rev 51631)
@@ -722,8 +722,10 @@
 				split = uiLayoutSplit(layout, 0.0f, FALSE);
 
 				col = uiLayoutColumn(split, TRUE);
+				uiLayoutSetEnabled(col, 0);
 				uiItemR(col, &imaptr, "generated_width", 0, "X", ICON_NONE);
 				uiItemR(col, &imaptr, "generated_height", 0, "Y", ICON_NONE);
+				
 				uiItemR(col, &imaptr, "use_generated_float", 0, NULL, ICON_NONE);
 
 				uiItemR(split, &imaptr, "generated_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);

Modified: trunk/blender/source/blender/editors/space_image/image_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_ops.c	2012-10-25 16:49:06 UTC (rev 51630)
+++ trunk/blender/source/blender/editors/space_image/image_ops.c	2012-10-25 16:58:52 UTC (rev 51631)
@@ -1682,16 +1682,24 @@
 		RNA_property_pointer_set(&ptr, prop, idptr);
 		RNA_property_update(C, &ptr, prop);
 	}
-	else if (sima)
+	else if (sima) {
 		ED_space_image_set(sima, scene, obedit, ima);
+	}
+	else {
+		Tex *tex = CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data;
+		if (tex && tex->type == TEX_IMAGE) {
+			tex->ima= ima;
+			ED_area_tag_redraw(CTX_wm_area(C));
+		}
+	}
 
-	// XXX other users?
 	BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE);
 	
 	return OPERATOR_FINISHED;
 }
 
 /* XXX, Ton is not a fan of OK buttons but using this function to avoid undo/redo bug while in mesh-editmode, - campbell */
+/* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */
 static int image_new_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
 	return WM_operator_props_dialog_popup(C, op, 300, 100);




More information about the Bf-blender-cvs mailing list