Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-07 22:11:37 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-07 22:11:37 +0300
commit4ca2581b77112c488938f0a2dc226042e0390b71 (patch)
tree03c0457506781c244182dd4b73d6c4dbfbca658e /source/blender/editors/sculpt_paint
parent010c99deb271c629742e32f5e7922d357cafc9f3 (diff)
Sculpt Branch:
* Don't allow adding/removing multires levels in editmode. * Customdata code for swapping mdisps restored. * Fix inflate brush crashing with multires. * Smooth and layer brush don't work yet with multires, but at least avoids crashing now. * Fix threading issue with flatten brush.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index b39a2912c02..9a25cf21542 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -905,6 +905,10 @@ static void do_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int
float bstrength= ss->cache->bstrength;
int iteration, n;
+ /* XXX not working for multires yet */
+ if(!ss->fmap)
+ return;
+
for(iteration = 0; iteration < 2; ++iteration) {
#pragma omp parallel for private(n) schedule(static)
for(n=0; n<totnode; n++) {
@@ -999,7 +1003,6 @@ static void do_grab_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int t
BLI_pbvh_node_mark_update(nodes[n]);
}
-
}
static void do_layer_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int totnode)
@@ -1010,6 +1013,10 @@ static void do_layer_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, int
float lim= ss->cache->radius / 4;
int n;
+ /* XXX not working yet for multires */
+ if(!ss->mvert)
+ return;
+
if(ss->cache->flip)
lim = -lim;
@@ -1081,10 +1088,10 @@ static void do_inflate_brush(Sculpt *sd, SculptSession *ss, PBVHNode **nodes, in
if(sculpt_brush_test(&test, vd.co)) {
float fade = tex_strength(ss, brush, vd.co, test.dist)*bstrength;
float add[3];
+
+ if(vd.fno) copy_v3_v3(add, vd.fno);
+ else normal_short_to_float_v3(add, vd.no);
- add[0]= vd.no[0]/32767.0f;
- add[1]= vd.no[1]/32767.0f;
- add[2]= vd.no[2]/32767.0f;
mul_v3_fl(add, fade * ss->cache->radius);
add[0]*= ss->cache->scale[0];
add[1]*= ss->cache->scale[1];
@@ -1116,16 +1123,17 @@ static void calc_flatten_center(Sculpt *sd, SculptSession *ss, PBVHNode **nodes,
for(n=0; n<totnode; n++) {
PBVHVertexIter vd;
SculptBrushTest test;
+ int j;
sculpt_undo_push_node(ss, nodes[n]);
sculpt_brush_test_init(ss, &test);
BLI_pbvh_vertex_iter_begin(ss->tree, nodes[n], vd, PBVH_ITER_UNIQUE) {
if(sculpt_brush_test(&test, vd.co)) {
- for(i = 0; i < FLATTEN_SAMPLE_SIZE; ++i) {
- if(test.dist > outer_dist[i]) {
- copy_v3_v3(outer_co[i], vd.co);
- outer_dist[i] = test.dist;
+ for(j = 0; j < FLATTEN_SAMPLE_SIZE; ++j) {
+ if(test.dist > outer_dist[j]) {
+ copy_v3_v3(outer_co[j], vd.co);
+ outer_dist[j] = test.dist;
break;
}
}
@@ -1424,9 +1432,9 @@ void sculpt_update_mesh_elements(bContext *C, int need_fmap)
if((ss->multires = sculpt_multires_active(ob))) {
ss->totvert = dm->getNumVerts(dm);
ss->totface = dm->getNumFaces(dm);
- ss->mvert = dm->getVertDataArray(dm, CD_MVERT);
- ss->mface = dm->getFaceDataArray(dm, CD_MFACE);
- ss->face_normals = dm->getFaceDataArray(dm, CD_NORMAL);
+ ss->mvert= NULL;
+ ss->mface= NULL;
+ ss->face_normals= NULL;
}
else {
Mesh *me = get_mesh(ob);
@@ -1439,7 +1447,7 @@ void sculpt_update_mesh_elements(bContext *C, int need_fmap)
ss->ob = ob;
ss->tree = dm->getPBVH(ob, dm);
- ss->fmap = (need_fmap)? dm->getFaceMap(dm): NULL;
+ ss->fmap = (need_fmap && dm->getFaceMap)? dm->getFaceMap(dm): NULL;
if((ob->shapeflag & OB_SHAPE_LOCK) && !sculpt_multires_active(ob)) {
ss->kb= ob_get_keyblock(ob);