diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 0b009dba651..9b3d12b159d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -107,7 +107,7 @@ struct MultiresModifierData *sculpt_multires_active(Scene *scene, Object *ob) Mesh *me= (Mesh*)ob->data; ModifierData *md; - if(!CustomData_get_layer(&me->fdata, CD_MDISPS)) { + if(!CustomData_get_layer(&me->ldata, CD_MDISPS)) { /* multires can't work without displacement layer */ return NULL; } @@ -203,6 +203,8 @@ typedef struct StrokeCache { float mouse[2]; float bstrength; float tex_mouse[2]; + + rctf prect; /* The rest is temporary storage that isn't saved as a property */ @@ -253,6 +255,15 @@ static int sculpt_get_redraw_rect(ARegion *ar, RegionView3D *rv3d, float bb_min[3], bb_max[3], pmat[4][4]; int i, j, k; +/* if (G.rt == 1) { + rect->xmin = ob->sculpt->cache->prect.xmin; + rect->xmax = ob->sculpt->cache->prect.xmax; + rect->ymin = ob->sculpt->cache->prect.ymin; + rect->ymax = ob->sculpt->cache->prect.ymax; + + return rect->xmin < rect->xmax && rect->ymin < rect->ymax;; + } +*/ ED_view3d_ob_project_mat_get(rv3d, ob, pmat); if(!pbvh) @@ -307,6 +318,7 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, PBVH *pbvh= ob->sculpt->pbvh; BoundBox bb; bglMats mats; + StrokeCache *cache = ob->sculpt->cache; rcti rect; memset(&bb, 0, sizeof(BoundBox)); @@ -335,6 +347,13 @@ void sculpt_get_redraw_planes(float planes[4][4], ARegion *ar, /* clear redraw flag from nodes */ if(pbvh) BLI_pbvh_update(pbvh, PBVH_UpdateRedraw, NULL); + + /*clear prect*/ + cache->prect.xmin = FLT_MAX; + cache->prect.xmax = -FLT_MAX; + cache->prect.ymin = FLT_MAX; + cache->prect.ymax = -FLT_MAX; + } /************************ Brush Testing *******************/ @@ -1364,7 +1383,7 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode proxy= BLI_pbvh_node_add_proxy(ss->pbvh, nodes[n])->co; sculpt_brush_test_init(ss, &test); - + BLI_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { if(sculpt_brush_test(&test, vd.co)) { const float fade = bstrength*tex_strength(ss, brush, vd.co, test.dist)*frontface(brush, an, vd.no, vd.fno); @@ -2193,7 +2212,6 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod float bstrength = ss->cache->bstrength; const float radius = ss->cache->radius; - float an[3]; float fc[3]; float offset = get_offset(sd, ss); @@ -2290,7 +2308,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3]) for (a= 0; a < me->totvert; a++, mvert++) VECCOPY(mvert->co, vertCos[a]); - mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); + mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); } /* apply new coords on active key block */ @@ -2523,7 +2541,7 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob) /* Modifiers could depend on mesh normals, so we should update them/ Note, then if sculpting happens on locked key, normals should be re-calculated after applying coords from keyblock on base mesh */ - mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); + mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL); } else if (ss->kb) sculpt_update_keyblock(ob); } @@ -2677,7 +2695,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_ if(mmd) { ss->multires = mmd; ss->totvert = dm->getNumVerts(dm); - ss->totface = dm->getNumFaces(dm); + ss->totface = dm->getNumTessFaces(dm); ss->mvert= NULL; ss->mface= NULL; ss->face_normals= NULL; @@ -2828,6 +2846,11 @@ static void sculpt_update_cache_invariants(bContext* C, Sculpt *sd, SculptSessio int mode; ss->cache = cache; + + cache->prect.xmin = FLT_MAX; + cache->prect.xmax = -FLT_MAX; + cache->prect.ymin = FLT_MAX; + cache->prect.ymax = -FLT_MAX; /* Set scaling adjustment */ ss->cache->scale[0] = 1.0f / ob->size[0]; @@ -3445,6 +3468,7 @@ static void sculpt_stroke_done(bContext *C, struct PaintStroke *UNUSED(stroke)) sculpt_cache_free(ss->cache); ss->cache = NULL; + sculpt_flush_update(C); sculpt_undo_push_end(); |