[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35290] trunk/blender: Fix #26218: texture paint

Sergey Sharybin g.ulairi at gmail.com
Tue Mar 1 18:58:12 CET 2011


Revision: 35290
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35290
Author:   nazgul
Date:     2011-03-01 17:58:12 +0000 (Tue, 01 Mar 2011)
Log Message:
-----------
Fix #26218: texture paint
- Added option "Fixed Texture" to the UI. Because of strange reason,
  this feature was implemented but hidden from users.
  Would be cool, if somebody familiar with 2d texture paiting check.
- Fixed some issues in existing code of fixed texture paiting.
  It now handles brush radius and curve correct.
- Also fixed issue with paiting with texture from node tree - it used
  to be painted with regular brush color instead of texture.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_image.py
    trunk/blender/release/scripts/ui/space_view3d_toolbar.py
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/makesrna/intern/rna_brush.c

Modified: trunk/blender/release/scripts/ui/space_image.py
===================================================================
--- trunk/blender/release/scripts/ui/space_image.py	2011-03-01 17:32:17 UTC (rev 35289)
+++ trunk/blender/release/scripts/ui/space_image.py	2011-03-01 17:58:12 UTC (rev 35290)
@@ -685,6 +685,7 @@
 
         col = layout.column()
         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
+        col.prop(brush, "use_fixed_texture")
 
 
 class IMAGE_PT_tools_brush_tool(BrushButtonsPanel, bpy.types.Panel):

Modified: trunk/blender/release/scripts/ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/ui/space_view3d_toolbar.py	2011-03-01 17:32:17 UTC (rev 35289)
+++ trunk/blender/release/scripts/ui/space_view3d_toolbar.py	2011-03-01 17:58:12 UTC (rev 35290)
@@ -694,6 +694,8 @@
         col = layout.column()
 
         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
+        if brush.use_paint_texture:
+            col.prop(brush, "use_fixed_texture")
 
         if context.sculpt_object:
             #XXX duplicated from properties_texture.py

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2011-03-01 17:32:17 UTC (rev 35289)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2011-03-01 17:58:12 UTC (rev 35290)
@@ -593,7 +593,7 @@
 					dst[2]= FTOCHAR(rgba[2]);
 					dst[3]= FTOCHAR(rgba[3]);
 				}
-				else {
+				else if (texfall == 2) {
 					dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
 
 					brush_sample_tex(brush, xy, rgba, 0);
@@ -601,6 +601,14 @@
 					dst[1] = FTOCHAR(rgba[1]*brush->rgb[1]);
 					dst[2] = FTOCHAR(rgba[2]*brush->rgb[2]);
 					dst[3] = FTOCHAR(rgba[3]*alpha*brush_curve_strength_clamp(brush, dist, radius));
+				} else {
+					dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
+
+					brush_sample_tex(brush, xy, rgba, 0);
+					dst[0]= crgb[0];
+					dst[1]= crgb[1];
+					dst[2]= crgb[2];
+					dst[3] = FTOCHAR(rgba[3]*alpha*brush_curve_strength_clamp(brush, dist, radius));
 				}
 			}
 		}
@@ -870,11 +878,8 @@
 		flt= cache->flt;
 		size= (cache->size)? cache->size: diameter;
 
-		if (!(mtex && mtex->tex) || (mtex->tex->type==0)) {
-			brush_imbuf_new(brush, flt, 0, size, &cache->ibuf);
-		}
-		else if (brush->flag & BRUSH_FIXED_TEX) {
-			brush_imbuf_new(brush, flt, 0, size, &cache->maskibuf);
+		if (brush->flag & BRUSH_FIXED_TEX) {
+			brush_imbuf_new(brush, flt, 3, size, &cache->maskibuf);
 			brush_painter_fixed_tex_partial_update(painter, pos);
 		}
 		else

Modified: trunk/blender/source/blender/makesrna/intern/rna_brush.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_brush.c	2011-03-01 17:32:17 UTC (rev 35289)
+++ trunk/blender/source/blender/makesrna/intern/rna_brush.c	2011-03-01 17:58:12 UTC (rev 35290)
@@ -665,11 +665,10 @@
 	RNA_def_property_ui_text(prop, "Restore Mesh", "Allows a single dot to be carefully positioned");
 	RNA_def_property_update(prop, 0, "rna_Brush_update");
 
-	/* not exposed in the interface yet
-	prop= RNA_def_property(srna, "fixed_tex", PROP_BOOLEAN, PROP_NONE);
+	prop= RNA_def_property(srna, "use_fixed_texture", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX);
 	RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position");
-	RNA_def_property_update(prop, 0, "rna_Brush_update"); */
+	RNA_def_property_update(prop, 0, "rna_Brush_update");
 	
 	/* only for projection paint, TODO, other paint modes */
 	prop= RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);




More information about the Bf-blender-cvs mailing list