[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55256] trunk/blender: Two new Features:

Antony Riakiotakis kalast at gmail.com
Thu Mar 14 03:27:39 CET 2013


Revision: 55256
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55256
Author:   psy-fi
Date:     2013-03-14 02:27:36 +0000 (Thu, 14 Mar 2013)
Log Message:
-----------
Two new Features:

* Support for Rake in projective paint (2D painting will be a separate
commit)
* Support for smooth stroke across all paint systems

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py
    trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    trunk/blender/source/blender/blenkernel/BKE_brush.h
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
    trunk/blender/source/blender/makesrna/intern/rna_brush.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py	2013-03-13 22:15:59 UTC (rev 55255)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_paint_common.py	2013-03-14 02:27:36 UTC (rev 55256)
@@ -85,18 +85,23 @@
 
     # angle and texture_angle_source
     col = layout.column()
-    if sculpt:
-        col.active = brush.sculpt_capabilities.has_texture_angle_source
-        col.label(text="Angle:")
-        if brush.sculpt_capabilities.has_random_texture_angle:
+    col.active = brush.brush_capabilities.has_texture_angle_source
+    col.label(text="Angle:")
+    if brush.brush_capabilities.has_random_texture_angle:
+        if sculpt:
+            if brush.sculpt_capabilities.has_random_texture_angle:
+                col.prop(brush, "texture_angle_source_random", text="")
+            else:
+                col.prop(brush, "texture_angle_source_no_random", text="")
+        
+        else:
             col.prop(brush, "texture_angle_source_random", text="")
-        else:
-            col.prop(brush, "texture_angle_source_no_random", text="")
+    else:
+        col.prop(brush, "texture_angle_source_no_random", text="")
+    col = layout.column()
+    col.active = brush.brush_capabilities.has_texture_angle
+    col.prop(tex_slot, "angle", text="")
 
-        col = layout.column()
-        col.active = brush.sculpt_capabilities.has_texture_angle
-        col.prop(tex_slot, "angle", text="")
-
     # scale and offset
     split = layout.split()
     split.prop(tex_slot, "offset")

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-03-13 22:15:59 UTC (rev 55255)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2013-03-14 02:27:36 UTC (rev 55256)
@@ -766,19 +766,18 @@
 
         brush_texture_settings(col, brush, context.sculpt_object)
 
-        if context.sculpt_object:
-            # use_texture_overlay and texture_overlay_alpha
-            col = layout.column(align=True)
-            col.active = brush.sculpt_capabilities.has_overlay
-            col.label(text="Overlay:")
+        # use_texture_overlay and texture_overlay_alpha
+        col = layout.column(align=True)
+        col.active = brush.brush_capabilities.has_overlay
+        col.label(text="Overlay:")
 
-            row = col.row()
-            if brush.use_texture_overlay:
-                row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
-            else:
-                row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
-            sub = row.row()
-            sub.prop(brush, "texture_overlay_alpha", text="Alpha")
+        row = col.row()
+        if brush.use_texture_overlay:
+            row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_OFF')
+        else:
+            row.prop(brush, "use_texture_overlay", toggle=True, text="", icon='RESTRICT_VIEW_ON')
+        sub = row.row()
+        sub.prop(brush, "texture_overlay_alpha", text="Alpha")
 
 
 class VIEW3D_PT_tools_brush_stroke(Panel, View3DPaintPanel):
@@ -855,18 +854,17 @@
 
             col.separator()
 
-            if not image_paint:
-                col.prop(brush, "use_smooth_stroke")
+            col.prop(brush, "use_smooth_stroke")
 
-                col = layout.column()
-                col.active = brush.use_smooth_stroke
-                col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
-                col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
+            col = layout.column()
+            col.active = brush.use_smooth_stroke
+            col.prop(brush, "smooth_stroke_radius", text="Radius", slider=True)
+            col.prop(brush, "smooth_stroke_factor", text="Factor", slider=True)
 
             col.separator()
 
             col = layout.column()
-            col.active = brush.sculpt_capabilities.has_spacing
+            col.active = brush.brush_capabilities.has_spacing
             col.prop(brush, "use_space")
 
             row = col.row(align=True)

Modified: trunk/blender/source/blender/blenkernel/BKE_brush.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_brush.h	2013-03-13 22:15:59 UTC (rev 55255)
+++ trunk/blender/source/blender/blenkernel/BKE_brush.h	2013-03-14 02:27:36 UTC (rev 55256)
@@ -69,10 +69,8 @@
 float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */
 
 /* sampling */
-void BKE_brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float sampleco[3],
-                          float rgba[4], const int thread, struct ImagePool *pool);
 float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float point[3],
-                              float rgba[3], struct ImagePool *pool);
+                              float rgba[3], const int thread, struct ImagePool *pool);
 float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2],
                               float rgba[4], struct ImagePool *pool);
 void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size,

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2013-03-13 22:15:59 UTC (rev 55255)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2013-03-14 02:27:36 UTC (rev 55256)
@@ -472,52 +472,10 @@
 	return 0;
 }
 
-/* Brush Sampling for 3d brushes. Currently used for texture painting only, but should be generalized */
-void BKE_brush_sample_tex(const Scene *scene, Brush *brush, const float sampleco[3], float rgba[4], const int thread, struct ImagePool *pool)
-{
-	MTex *mtex = &brush->mtex;
-
-	if (mtex && mtex->tex) {
-		float tin, tr, tg, tb, ta;
-		int hasrgb;
-		const int radius = BKE_brush_size_get(scene, brush);
-
-		if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) {
-			hasrgb = externtex(mtex, sampleco, &tin, &tr, &tg, &tb, &ta, thread, pool);
-		}
-		else {
-			float co[3];
-
-			co[0] = sampleco[0] / radius;
-			co[1] = sampleco[1] / radius;
-			co[2] = 0.0f;
-
-			hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, thread, pool);
-		}
-
-		if (hasrgb) {
-			rgba[0] = tr;
-			rgba[1] = tg;
-			rgba[2] = tb;
-			rgba[3] = ta;
-		}
-		else {
-			rgba[0] = tin;
-			rgba[1] = tin;
-			rgba[2] = tin;
-			rgba[3] = 1.0f;
-		}
-	}
-	else {
-		rgba[0] = rgba[1] = rgba[2] = rgba[3] = 1.0f;
-	}
-}
-
-
 /* Return a multiplier for brush strength on a particular vertex. */
 float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
                               const float point[3],
-                              float rgba[3],
+                              float rgba[3], const int thread,
                               struct ImagePool *pool)
 {
 	UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
@@ -532,7 +490,7 @@
 		/* Get strength by feeding the vertex
 		 * location directly into a texture */
 		hasrgb = externtex(mtex, point, &intensity,
-		                   rgba, rgba + 1, rgba + 2, rgba + 3, 0, pool);
+		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
 	}
 	else {
 		float rotation = -mtex->rot;
@@ -587,7 +545,7 @@
 		co[2] = 0.0f;
 
 		hasrgb = externtex(mtex, co, &intensity,
-		                   rgba, rgba + 1, rgba + 2, rgba + 3, 0, pool);
+		                   rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool);
 	}
 
 	intensity += br->texture_sample_bias;

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-03-13 22:15:59 UTC (rev 55255)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-03-14 02:27:36 UTC (rev 55256)
@@ -3898,11 +3898,8 @@
 
 					if (ps->is_texbrush) {
 						MTex *mtex = &brush->mtex;
-						if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) {
-							sub_v2_v2v2(samplecos, projPixel->projCoSS, pos);
-						}
 						/* taking 3d copy to account for 3D mapping too. It gets concatenated during sampling */
-						else if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
+						if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
 							copy_v3_v3(samplecos, projPixel->worldCoSS);
 						}
 						else {
@@ -3914,7 +3911,7 @@
 					if (falloff > 0.0f) {
 						if (ps->is_texbrush) {
 							/* note, for clone and smear, we only use the alpha, could be a special function */
-							BKE_brush_sample_tex(ps->scene, brush, samplecos, rgba, thread_index, pool);
+							BKE_brush_sample_tex_3D(ps->scene, brush, samplecos, rgba, thread_index, pool);
 							alpha = rgba[3];
 						}
 						else {

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-03-13 22:15:59 UTC (rev 55255)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_intern.h	2013-03-14 02:27:36 UTC (rev 55256)
@@ -66,7 +66,8 @@
 
 bool paint_space_stroke_enabled(struct Brush *br, enum PaintMode mode);
 bool paint_supports_dynamic_size(struct Brush *br, enum PaintMode mode);
-bool paint_supports_moving_texture(struct Brush *br, enum PaintMode mode);
+bool paint_supports_dynamic_tex_coords(struct Brush *br, enum PaintMode mode);
+bool paint_supports_smooth_stroke(struct Brush *br, enum PaintMode mode);
 bool paint_supports_jitter(enum PaintMode mode);
 
 struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf);

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-03-13 22:15:59 UTC (rev 55255)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-03-14 02:27:36 UTC (rev 55256)
@@ -312,19 +312,12 @@

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list