diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-11 18:50:49 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-11-11 18:50:49 +0300 |
commit | 55a7e73b7d4a12cd60940ef2100e80860135629f (patch) | |
tree | dad195488785c0d4d43a18725ef51676e63bb5b4 /source/blender/editors/sculpt_paint/sculpt.c | |
parent | 34644821de7b76d5b5a83d9497c18c0553618b2b (diff) |
Fix #19368: sculpting with subsurf modifier applied did not update correct.
Fix #19438: sculpt anchored + texture did not center texture correctly.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 7575464fd57..bf8195825d7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -140,6 +140,7 @@ typedef struct StrokeCache { float flip; float pressure; float mouse[2]; + float tex_mouse[2]; /* The rest is temporary storage that isn't saved as a property */ @@ -777,8 +778,8 @@ static float tex_strength(Sculpt *sd, SculptSession *ss, float *point, const flo avg= get_texcache_pixel_bilinear(ss, ss->texcache_side*px/sx, ss->texcache_side*py/sy); } else if(tex->brush_map_mode == MTEX_MAP_MODE_FIXED) { - float fx= (point_2d[0] - ss->cache->mouse[0]) / bsize; - float fy= (point_2d[1] - ss->cache->mouse[1]) / bsize; + float fx= (point_2d[0] - ss->cache->tex_mouse[0]) / bsize; + float fy= (point_2d[1] - ss->cache->tex_mouse[1]) / bsize; float angle= atan2(fy, fx) - rot; float flen= sqrtf(fx*fx + fy*fy); @@ -1096,7 +1097,7 @@ char sculpt_modifiers_active(Object *ob) ModifierData *md; for(md= modifiers_getVirtualModifierList(ob); md; md= md->next) { - if(md->mode & eModifierMode_Realtime && md->type != eModifierType_Multires) + if(modifier_isEnabled(md, eModifierMode_Realtime) && md->type != eModifierType_Multires) return 1; } @@ -1292,8 +1293,8 @@ static void sculpt_update_cache_invariants(Sculpt *sd, SculptSession *ss, bConte RNA_float_get_array(op->ptr, "initial_mouse", cache->initial_mouse); cache->depth = RNA_float_get(op->ptr, "depth"); - cache->mouse[0] = cache->initial_mouse[0]; - cache->mouse[1] = cache->initial_mouse[1]; + copy_v2_v2(cache->mouse, cache->initial_mouse); + copy_v2_v2(cache->tex_mouse, cache->initial_mouse); /* Truly temporary data that isn't stored in properties */ @@ -1371,6 +1372,9 @@ static void sculpt_update_cache_variants(Sculpt *sd, SculptSession *ss, PointerR else cache->radius = cache->initial_radius; + if(!(brush->flag & BRUSH_ANCHORED)) + copy_v2_v2(cache->tex_mouse, cache->mouse); + if(brush->flag & BRUSH_ANCHORED) { dx = cache->mouse[0] - cache->initial_mouse[0]; dy = cache->mouse[1] - cache->initial_mouse[1]; @@ -1527,6 +1531,9 @@ static void sculpt_flush_update(bContext *C) multires_mark_as_modified(ob); } + if(sculpt_modifiers_active(ob)) + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + ED_region_tag_redraw(ar); } |