[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51746] trunk/blender/source/blender: Fix: wrong brush drawn in image painting, image editor if uv sculpt is on.

Antony Riakiotakis kalast at gmail.com
Mon Oct 29 20:47:27 CET 2012


Revision: 51746
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51746
Author:   psy-fi
Date:     2012-10-29 19:47:26 +0000 (Mon, 29 Oct 2012)
Log Message:
-----------
Fix: wrong brush drawn in image painting, image editor if uv sculpt is on. Now the correct paint struct is returned and the image zoom is calculated correctly

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/paint.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c

Modified: trunk/blender/source/blender/blenkernel/intern/paint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/paint.c	2012-10-29 19:18:13 UTC (rev 51745)
+++ trunk/blender/source/blender/blenkernel/intern/paint.c	2012-10-29 19:47:26 UTC (rev 51746)
@@ -36,6 +36,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_brush_types.h"
+#include "DNA_space_types.h"
 
 #include "BLI_bitmap.h"
 #include "BLI_utildefines.h"
@@ -87,6 +88,7 @@
 Paint *paint_get_active_from_context(const bContext *C)
 {
 	Scene *sce = CTX_data_scene(C);
+	SpaceImage *sima;
 
 	if (sce) {
 		ToolSettings *ts = sce->toolsettings;
@@ -95,12 +97,12 @@
 		if (sce->basact && sce->basact->object)
 			obact = sce->basact->object;
 
-		if (CTX_wm_space_image(C) != NULL) {
+		if ((sima = CTX_wm_space_image(C)) != NULL) {
 			if (obact && obact->mode == OB_MODE_EDIT) {
-				if (ts->use_uv_sculpt)
+				if (sima->mode == SI_MODE_PAINT)
+					return &ts->imapaint.paint;
+				else if (ts->use_uv_sculpt)
 					return &ts->uvsculpt->paint;
-				else
-					return &ts->imapaint.paint;
 			}
 			else {
 				return &ts->imapaint.paint;

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2012-10-29 19:18:13 UTC (rev 51745)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c	2012-10-29 19:47:26 UTC (rev 51746)
@@ -5266,10 +5266,12 @@
 	if (!rv3d) {
 		SpaceImage *sima = CTX_wm_space_image(C);
 		ARegion *ar = CTX_wm_region(C);
-		
-		ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
 
-		return 1;
+		if (sima->mode == SI_MODE_PAINT) {
+			ED_space_image_get_zoom(sima, ar, zoomx, zoomy);
+
+			return 1;
+		}
 	}
 
 	*zoomx = *zoomy = 1;
@@ -5290,16 +5292,13 @@
 	Brush *brush = paint_brush(paint);
 
 	if (paint && brush && paint->flags & PAINT_SHOW_BRUSH) {
-		ToolSettings *ts;
 		float zoomx, zoomy;
 		const float size = (float)BKE_brush_size_get(scene, brush);
 		short use_zoom;
 		float pixel_size;
 		float alpha = 0.5f;
 
-		ts = scene->toolsettings;
-		use_zoom = get_imapaint_zoom(C, &zoomx, &zoomy) &&
-		           !(ts->use_uv_sculpt && (scene->basact->object->mode == OB_MODE_EDIT));
+		use_zoom = get_imapaint_zoom(C, &zoomx, &zoomy);
 
 		if (use_zoom) {
 			pixel_size = size * max_ff(zoomx, zoomy);




More information about the Bf-blender-cvs mailing list