[Bf-blender-cvs] [37d3a33] strand_editmode: Use the "official" brush size calculated by blenkernel and subdivide the stroke step to avoid tunneling.

Lukas Tönne noreply at git.blender.org
Mon Apr 20 14:23:34 CEST 2015


Commit: 37d3a3331e37ae8178c29df887bafc03e21426c2
Author: Lukas Tönne
Date:   Tue Dec 2 18:38:55 2014 +0100
Branches: strand_editmode
https://developer.blender.org/rB37d3a3331e37ae8178c29df887bafc03e21426c2

Use the "official" brush size calculated by blenkernel and subdivide
the stroke step to avoid tunneling.

===================================================================

M	source/blender/editors/hair/hair_edit.c
M	source/blender/editors/hair/hair_stroke.c

===================================================================

diff --git a/source/blender/editors/hair/hair_edit.c b/source/blender/editors/hair/hair_edit.c
index 1c84d21..c3ce3e6 100644
--- a/source/blender/editors/hair/hair_edit.c
+++ b/source/blender/editors/hair/hair_edit.c
@@ -259,16 +259,12 @@ static int hair_stroke_init(bContext *C, wmOperator *op)
 {
 	Scene *scene = CTX_data_scene(C);
 	Object *ob = CTX_data_active_object(C);
-//	ParticleEditSettings *pset = PE_settings(scene);
 	BMEditStrands *edit = BKE_editstrands_from_object(ob);
 	ARegion *ar = CTX_wm_region(C);
 	
 	HairStroke *stroke;
 	float min[3], max[3], center[3];
 	
-//	if (pset->brushtype < 0)
-//		return 0;
-
 	/* set the 'distance factor' for grabbing (used in comb etc) */
 	hair_bm_min_max(edit, min, max);
 	mid_v3_v3v3(center, min, max);
@@ -283,9 +279,6 @@ static int hair_stroke_init(bContext *C, wmOperator *op)
 
 	stroke->zfac = ED_view3d_calc_zfac(ar->regiondata, center, NULL);
 
-	/* cache view depths and settings for re-use */
-//	PE_set_view3d_data(C, &stroke->data);
-
 	return 1;
 }
 
@@ -319,8 +312,7 @@ static bool hair_stroke_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
 	sub_v2_v2v2(mdelta, mouse, stroke->lastmouse);
 	delta_max = max_ff(fabsf(mdelta[0]), fabsf(mdelta[1]));
 	
-//	totsteps = delta_max / (0.2f * pe_brush_size_get(scene, brush)) + 1;
-	totsteps = 1; // XXX TODO determine brush size for the above
+	totsteps = delta_max / (0.2f * BKE_brush_size_get(scene, settings->brush)) + 1;
 	mul_v2_fl(mdelta, 1.0f / (float)totsteps);
 	
 	hair_set_view3d_data(C, &tool_data);
diff --git a/source/blender/editors/hair/hair_stroke.c b/source/blender/editors/hair/hair_stroke.c
index 9188703..12eb355 100644
--- a/source/blender/editors/hair/hair_stroke.c
+++ b/source/blender/editors/hair/hair_stroke.c
@@ -41,6 +41,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_view3d_types.h"
 
+#include "BKE_brush.h"
 #include "BKE_edithair.h"
 
 #include "bmesh.h"
@@ -110,7 +111,7 @@ BLI_INLINE bool test_inside_circle(HairToolData *data, BMVert *v, float radsq, f
 
 BLI_INLINE float factor_vertex(HairToolData *data, BMVert *v)
 {
-	const float rad = data->settings->brush->size * 0.5f;
+	const float rad = BKE_brush_size_get(data->scene, data->settings->brush) * 0.5f;
 	const float radsq = rad*rad;
 	
 	float dist;




More information about the Bf-blender-cvs mailing list