From b4bef32bd9d43178454c678374c7eff2222e9d7b Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Wed, 21 Jan 2009 18:44:36 +0000 Subject: * Fixed a minor CMake error for WITH_YAFRAY option * Removed two unused sculpt DNA fields * Restored brush spacing option to sculpt --- source/blender/editors/sculpt/sculpt.c | 24 ++++++++++++++++-------- source/blender/editors/sculpt/stroke.c | 2 +- source/blender/makesdna/DNA_scene_types.h | 5 ++--- source/blender/render/CMakeLists.txt | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/sculpt/sculpt.c b/source/blender/editors/sculpt/sculpt.c index 6cea3ba1928..5af41a78658 100644 --- a/source/blender/editors/sculpt/sculpt.c +++ b/source/blender/editors/sculpt/sculpt.c @@ -146,7 +146,7 @@ typedef struct StrokeCache { ViewContext vc; bglMats *mats; - /* Mesh data can either come directly from a Mesh, or from a MultiresDM */ + /* Mesh data (not copied) can come either directly from a Mesh, or from a MultiresDM */ int multires; /* Special handling for multires meshes */ MVert *mvert; MFace *mface; @@ -163,6 +163,7 @@ typedef struct StrokeCache { float old_grab_location[3]; int symmetry; /* Symmetry index between 0 and 7 */ float view_normal[3], view_normal_symmetry[3]; + int last_dot[2]; /* Last location of stroke application */ } StrokeCache; typedef struct RectNode { @@ -997,14 +998,23 @@ static void do_symmetrical_brush_actions(Sculpt *sd, StrokeCache *cache) const char symm = sd->flags & 7; int i; - VecCopyf(sd->session->cache->location, sd->session->cache->true_location); - VecCopyf(sd->session->cache->grab_delta_symmetry, sd->session->cache->grab_delta); - sd->session->cache->symmetry = 0; + /* Brush spacing: only apply dot if next dot is far enough away */ + if(sd->brush->spacing > 0 && !(sd->brush->flag & BRUSH_ANCHORED) && !cache->first_time) { + int dx = cache->last_dot[0] - cache->mouse[0]; + int dy = cache->last_dot[1] - cache->mouse[1]; + if(sqrt(dx*dx+dy*dy) < sd->brush->spacing) + return; + } + memcpy(cache->last_dot, cache->mouse, sizeof(int) * 2); + + VecCopyf(cache->location, cache->true_location); + VecCopyf(cache->grab_delta_symmetry, cache->grab_delta); + cache->symmetry = 0; do_brush_action(sd, cache); for(i = 1; i <= symm; ++i) { if(symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5))) { - calc_brushdata_symm(sd->session->cache, i); + calc_brushdata_symm(cache, i); do_brush_action(sd, cache); } } @@ -1542,9 +1552,7 @@ static void sculpt_undo_push(Sculpt *sd) using the current brush. ****/ static int sculpt_brush_stroke_poll(bContext *C) { - // XXX: More to check for, of course - - return G.f & G_SCULPTMODE; + return G.f & G_SCULPTMODE && CTX_wm_area(C)->spacetype == SPACE_VIEW3D; } static void sculpt_load_mats(bglMats *mats, ViewContext *vc) diff --git a/source/blender/editors/sculpt/stroke.c b/source/blender/editors/sculpt/stroke.c index ffcb938a33f..554ff580358 100644 --- a/source/blender/editors/sculpt/stroke.c +++ b/source/blender/editors/sculpt/stroke.c @@ -174,7 +174,7 @@ static float sculpt_stroke_final_length(SculptStroke *stroke) /* If partial is nonzero, cuts off apply after that length has been processed */ static StrokePoint *sculpt_stroke_apply_generic(Sculpt *sd, SculptStroke *stroke, const int partial) { - const int sdspace = sd->spacing; + const int sdspace = 0; //XXX: sd->spacing; const short spacing = sdspace > 0 ? sdspace : 2; const int dots = sculpt_stroke_final_length(stroke) / spacing; int i; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 5adcb41c33d..1fe9908d961 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -387,11 +387,10 @@ typedef struct Sculpt float pivot[3]; int flags; /* For the Brush Shape */ - short texact, texnr, spacing; - char texrept, texsep, averaging; + short texact, texnr; + char texrept, texsep; /* Control tablet input */ char tablet_size, tablet_strength; - char pad[5]; } Sculpt; typedef struct VPaint { diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index c259e11a8c1..5465600d22b 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -34,7 +34,7 @@ SET(INC IF(NOT WITH_YAFRAY) ADD_DEFINITIONS(-DDISABLE_YAFRAY) -ENDIF(WITH_YAFRAY) +ENDIF(NOT WITH_YAFRAY) IF(WITH_OPENEXR) -- cgit v1.2.3