Revision: 21041
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21041
Author: nicholasbishop
Date: 2009-06-20 22:29:25 +0200 (Sat, 20 Jun 2009)
Log Message:
-----------
2.5/Sculpt:
Added a clay brush. It behaves like a combination of the flatten and draw
brushes.
Credit to Fredrik Hannson for the original patch (#18666)
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
branches/blender2.5/blender/source/blender/makesdna/DNA_brush_types.h
Modified:
branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c
2009-06-20 20:08:11 UTC (rev 21040)
+++ branches/blender2.5/blender/source/blender/editors/sculpt_paint/sculpt.c
2009-06-20 20:29:25 UTC (rev 21041)
@@ -248,8 +248,9 @@
switch(sd->brush->sculpt_tool){
case SCULPT_TOOL_DRAW:
case SCULPT_TOOL_INFLATE:
+ case SCULPT_TOOL_CLAY:
+ case SCULPT_TOOL_FLATTEN:
return alpha * dir * pressure * flip; /*XXX: not sure why? was
multiplied by G.vd->grid */;
- case SCULPT_TOOL_FLATTEN:
case SCULPT_TOOL_SMOOTH:
return alpha * 4 * pressure;
case SCULPT_TOOL_PINCH:
@@ -552,7 +553,7 @@
VecMulf(co, 1.0f / FLATTEN_SAMPLE_SIZE);
}
-static void do_flatten_brush(Sculpt *sd, SculptSession *ss, const ListBase
*active_verts)
+static void do_flatten_clay_brush(Sculpt *sd, SculptSession *ss, const
ListBase *active_verts, int clay)
{
ActiveData *node= active_verts->first;
/* area_normal and cntr define the plane towards which vertices are
squashed */
@@ -575,16 +576,23 @@
VecAddf(intr, intr, p1);
VecSubf(val, intr, co);
- VecMulf(val, node->Fade);
+ VecMulf(val, fabs(node->Fade));
VecAddf(val, val, co);
+ if(clay) {
+ /* Clay brush displaces after flattening */
+ float tmp[3];
+ VecCopyf(tmp, area_normal);
+ VecMulf(tmp, ss->cache->radius * node->Fade * 0.1);
+ VecAddf(val, val, tmp);
+ }
+
sculpt_clip(ss->cache, co, val);
node= node->next;
}
}
-
-
+
/* Uses symm to selectively flip any axis of a coordinate. */
static void flip_coord(float out[3], float in[3], const char symm)
{
@@ -852,8 +860,10 @@
do_layer_brush(sd, ss, &active_verts);
break;
case SCULPT_TOOL_FLATTEN:
- do_flatten_brush(sd, ss, &active_verts);
+ do_flatten_clay_brush(sd, ss, &active_verts, 0);
break;
+ case SCULPT_TOOL_CLAY:
+ do_flatten_clay_brush(sd, ss, &active_verts, 1);
}
/* Copy the modified vertices from mesh to the active key */
Modified:
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
===================================================================
---
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
2009-06-20 20:08:11 UTC (rev 21040)
+++
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_buttons.c
2009-06-20 20:29:25 UTC (rev 21041)
@@ -1132,9 +1132,10 @@
uiDefButC(block,ROW,B_REDR,"Pinch",cx+134,cy,67,19,&br->sculpt_tool,14.0,SCULPT_TOOL_PINCH,0,0,"Interactively
pinch areas of the model");
uiDefButC(block,ROW,B_REDR,"Inflate",cx+201,cy,67,19,&br->sculpt_tool,14,SCULPT_TOOL_INFLATE,0,0,"Push
vertices along the direction of their normals");
cy-= 20;
- uiDefButC(block,ROW,B_REDR,"Grab",
cx,cy,89,19,&br->sculpt_tool,14,SCULPT_TOOL_GRAB,0,0,"Grabs a group of vertices
and moves them with the mouse");
- uiDefButC(block,ROW,B_REDR,"Layer",
cx+89,cy,89,19,&br->sculpt_tool,14, SCULPT_TOOL_LAYER,0,0,"Adds a layer of
depth");
- uiDefButC(block,ROW,B_REDR,"Flatten",
cx+178,cy,90,19,&br->sculpt_tool,14, SCULPT_TOOL_FLATTEN,0,0,"Interactively
flatten areas of the model");
+ uiDefButC(block,ROW,B_REDR,"Grab",
cx,cy,67,19,&br->sculpt_tool,14,SCULPT_TOOL_GRAB,0,0,"Grabs a group of vertices
and moves them with the mouse");
+ uiDefButC(block,ROW,B_REDR,"Layer",
cx+67,cy,67,19,&br->sculpt_tool,14, SCULPT_TOOL_LAYER,0,0,"Adds a layer of
depth");
+ uiDefButC(block,ROW,B_REDR,"Flatten",
cx+134,cy,67,19,&br->sculpt_tool,14, SCULPT_TOOL_FLATTEN,0,0,"Interactively
flatten areas of the model");
+ uiDefButC(block,ROW,B_REDR,"Clay",
cx+201,cy,67,19,&br->sculpt_tool,14, SCULPT_TOOL_CLAY,0,0,"Build up depth
quickly");
cy-= 25;
uiBlockEndAlign(block);
}
Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_brush_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_brush_types.h
2009-06-20 20:08:11 UTC (rev 21040)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_brush_types.h
2009-06-20 20:29:25 UTC (rev 21041)
@@ -108,6 +108,7 @@
#define SCULPT_TOOL_GRAB 5
#define SCULPT_TOOL_LAYER 6
#define SCULPT_TOOL_FLATTEN 7
+#define SCULPT_TOOL_CLAY 8
#define PAINT_TOOL_DRAW 0
#define PAINT_TOOL_SOFTEN 1
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs