[Bf-blender-cvs] [26a806e430b] soc-2017-sculpting_brush: Added details in brush and few modification in files

decoda noreply at git.blender.org
Sat Jun 10 09:38:05 CEST 2017


Commit: 26a806e430bb319ce150b7bc80436070d7b07ff1
Author: decoda
Date:   Sat Jun 10 02:08:43 2017 +0530
Branches: soc-2017-sculpting_brush
https://developer.blender.org/rB26a806e430bb319ce150b7bc80436070d7b07ff1

Added details in brush and few modification in files

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

M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/bmesh/operators/bmo_triangulate.c
M	source/blender/bmesh/tools/bmesh_triangulate.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 259826a6a2b..d2f43a2d79e 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1525,7 +1525,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 				ParticleEditSettings *pset = &ts->particle;
 				for (int a = 0; a < PE_TOT_BRUSH; a++) {
 					if (pset->brush[a].count == 0) {
-						pset->brush[a].count = 11;
+						pset->brush[a].count = 10;
 					}
 				}
 			}
diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c
index 4e8bace59e0..19986d6132d 100644
--- a/source/blender/bmesh/operators/bmo_triangulate.c
+++ b/source/blender/bmesh/operators/bmo_triangulate.c
@@ -270,4 +270,4 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
 	}
 
 	BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_EDGE | BM_FACE, ELE_NEW);
-}
+}
\ No newline at end of file
diff --git a/source/blender/bmesh/tools/bmesh_triangulate.c b/source/blender/bmesh/tools/bmesh_triangulate.c
index ce1bc46d5e8..9b5f587064b 100644
--- a/source/blender/bmesh/tools/bmesh_triangulate.c
+++ b/source/blender/bmesh/tools/bmesh_triangulate.c
@@ -159,3 +159,11 @@ void BM_mesh_triangulate(
 		BLI_edgehash_free(pf_ehash, NULL);
 	}
 }
+
+void BM_mesh_clip_project(
+	BMesh *bm, const int quad_method, const int ngon_method, const bool tag_only,
+	BMOperator *op, BMOpSlot *slot_facemap_out, BMOpSlot *slot_facemap_double_out)
+{
+	BMIter iter;
+	BMFace *face;
+}
\ No newline at end of file
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index bcbb92e4468..b08e50ad509 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -658,6 +658,9 @@ typedef struct SculptBrushTest {
 
 	/* View3d clipping - only set rv3d for clipping */
 	RegionView3D *clip_rv3d;
+
+
+
 } SculptBrushTest;
 
 static void sculpt_brush_test_init(SculptSession *ss, SculptBrushTest *test)
@@ -3052,10 +3055,65 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t
 	            ((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT), false);
 }
 
+static void do_clip_brush_task_cb_ex(
+	void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id)
+{
+	SculptThreadedTaskData *data = userdata;
+	SculptSession *ss = data->ob->sculpt;
+	Brush *brush = data->brush;
+
+	PBVHVertexIter vd;
+	SculptBrushTest test;
+
+
+	SculptOrigVertData orig_data;
+	float(*proxy)[3];
+	const float bstrength = ss->cache->bstrength;
+
+	sculpt_orig_vert_data_init(&orig_data, data->ob, data->nodes[n]);
+
+	proxy = BKE_pbvh_node_add_proxy(ss->pbvh, data->nodes[n])->co;
+
+	sculpt_brush_test_init(ss, &test);
+
+	BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
+	{
+		sculpt_orig_vert_data_update(&orig_data, &vd);
+
+		if (sculpt_brush_test(&test, vd.co)) { /*initially vd = orig_data*/
+			float vec[3] = { 0 };
+			const float fade = bstrength * tex_strength(
+				ss, brush, vd.co, test.dist, vd.no, NULL, vd.mask ? *vd.mask : 0.0f,
+				thread_id);
+			/*
+			sub_v3_v3v3(vec, orig_data.co, ss->cache->location);
+			axis_angle_normalized_to_mat3(rot, ss->cache->sculpt_normal_symm, angle * fade);
+			mul_v3_m3v3(proxy[vd.i], rot, vec);
+			add_v3_v3(proxy[vd.i], ss->cache->location); */
+			mul_v3_v3fl(proxy[vd.i], vd.co, 1.5); /*just testing the working*/
+			BM_vert_kill(ss->bm, vd.bm_vert);
+			if (vd.mvert)
+				vd.mvert->flag |= ME_VERT_PBVH_UPDATE;
+		}
+	}
+	BKE_pbvh_vertex_iter_end;
+}
+
 static void do_clip_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)  /*clipping*/
 {
-	// some functions in future
+	SculptSession *ss = ob->sculpt;
+	Brush *brush = BKE_paint_brush(&sd->paint);
 
+	/*static const int flip[8] = { 1, -1, -1, 1, -1, 1, 1, -1 };
+	const float angle = ss->cache->vertex_rotation * flip[ss->cache->mirror_symmetry_pass];*/
+
+	SculptThreadedTaskData data = {
+		.sd = sd, .ob = ob, .brush = brush, .nodes = nodes,
+	};
+
+	BLI_task_parallel_range_ex(
+		0, totnode, &data, NULL, 0, do_clip_brush_task_cb_ex,
+		((sd->flags & SCULPT_USE_OPENMP) && totnode > SCULPT_THREADED_LIMIT), false);
 }
 
 static void do_fill_brush_task_cb_ex(
@@ -4042,7 +4100,7 @@ static void sculpt_update_cache_invariants(
 		copy_v2_v2(cache->initial_mouse, mouse);
 	else
 		zero_v2(cache->initial_mouse);
-
+	
 	mode = RNA_enum_get(op->ptr, "mode");
 	cache->invert = mode == BRUSH_STROKE_INVERT;
 	cache->alt_smooth = mode == BRUSH_STROKE_SMOOTH;




More information about the Bf-blender-cvs mailing list