[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56432] trunk/blender: Fix projection paint clone/soften/smear no longer working with textures,
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed May 1 05:28:14 CEST 2013
Revision: 56432
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56432
Author: blendix
Date: 2013-05-01 03:28:14 +0000 (Wed, 01 May 2013)
Log Message:
-----------
Fix projection paint clone/soften/smear no longer working with textures,
Moved the code after the masking check so we can skip the texture lookup
if the pixel is done, is a bit faster. Also hide the color wheel for these
tools, only did it for 2D paint in previous commit.
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2013-05-01 02:53:45 UTC (rev 56431)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py 2013-05-01 03:28:14 UTC (rev 56432)
@@ -687,9 +687,11 @@
elif context.image_paint_object and brush:
col = layout.column()
- col.template_color_picker(brush, "color", value_slider=True)
- col.prop(brush, "color", text="")
+ if brush.image_tool == 'DRAW' and brush.blend not in ('ERASE_ALPHA', 'ADD_ALPHA'):
+ col.template_color_picker(brush, "color", value_slider=True)
+ col.prop(brush, "color", text="")
+
row = col.row(align=True)
self.prop_unified_size(row, context, brush, "size", slider=True, text="Radius")
self.prop_unified_size(row, context, brush, "use_pressure_size")
@@ -825,7 +827,7 @@
@classmethod
def poll(cls, context):
brush = context.tool_settings.image_paint.brush
- return (context.image_paint_object and brush and brush.image_tool != 'SOFTEN')
+ return (context.image_paint_object and brush)
def draw(self, context):
layout = self.layout
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c 2013-05-01 02:53:45 UTC (rev 56431)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c 2013-05-01 03:28:14 UTC (rev 56432)
@@ -3833,35 +3833,7 @@
if (falloff > 0.0f) {
float texrgb[3];
float mask = falloff;
- float mixalpha = 1.0;
- if (ps->is_texbrush) {
- MTex *mtex = &brush->mtex;
- float samplecos[3];
- float texrgba[4];
-
- /* taking 3d copy to account for 3D mapping too. It gets concatenated during sampling */
- if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
- copy_v3_v3(samplecos, projPixel->worldCoSS);
- }
- else {
- copy_v2_v2(samplecos, projPixel->projCoSS);
- samplecos[2] = 0.0f;
- }
-
- /* note, for clone and smear, we only use the alpha, could be a special function */
- BKE_brush_sample_tex_3D(ps->scene, brush, samplecos, texrgba, thread_index, pool);
-
- copy_v3_v3(texrgb, texrgba);
- mixalpha *= texrgba[3];
- }
-
- if (ps->is_maskbrush) {
- mixalpha *= BKE_brush_sample_masktex(ps->scene, ps->brush, projPixel->projCoSS, thread_index, pool);
- }
-
- CLAMP(mask, 0.0f, 1.0f);
-
if (ps->do_masking) {
/* masking to keep brush contribution to a pixel limited. note we do not do
* a simple max(mask, mask_accum), as this is very sensitive to spacing and
@@ -3886,6 +3858,31 @@
else
mask *= brush_alpha;
+ if (ps->is_texbrush) {
+ MTex *mtex = &brush->mtex;
+ float samplecos[3];
+ float texrgba[4];
+
+ /* taking 3d copy to account for 3D mapping too. It gets concatenated during sampling */
+ if (mtex->brush_map_mode == MTEX_MAP_MODE_3D) {
+ copy_v3_v3(samplecos, projPixel->worldCoSS);
+ }
+ else {
+ copy_v2_v2(samplecos, projPixel->projCoSS);
+ samplecos[2] = 0.0f;
+ }
+
+ /* note, for clone and smear, we only use the alpha, could be a special function */
+ BKE_brush_sample_tex_3D(ps->scene, brush, samplecos, texrgba, thread_index, pool);
+
+ copy_v3_v3(texrgb, texrgba);
+ mask *= texrgba[3];
+ }
+
+ if (ps->is_maskbrush) {
+ mask *= BKE_brush_sample_masktex(ps->scene, ps->brush, projPixel->projCoSS, thread_index, pool);
+ }
+
/* extra mask for normal, layer stencil, .. */
mask *= ((float)projPixel->mask) * (1.0f / 65535.0f);
@@ -3925,8 +3922,8 @@
else do_projectpaint_soften(ps, projPixel, mask, softenArena, &softenPixels);
break;
default:
- if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, texrgb, mask * mixalpha);
- else do_projectpaint_draw(ps, projPixel, texrgb, mask * mixalpha);
+ if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, texrgb, mask);
+ else do_projectpaint_draw(ps, projPixel, texrgb, mask);
break;
}
}
More information about the Bf-blender-cvs
mailing list