Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-10-02 13:07:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-10-02 14:07:58 +0300
commitb2a10fa615efcf403a9ca23005d86ca149ebf56b (patch)
treeac611243d2de0e5cb0ce7d5bc81ce27da7d5b561 /source/blender/editors/sculpt_paint/sculpt.c
parent9d34ae604827813ead8c9071ff1c346e9aff7e29 (diff)
Vertex Paint: projection options
This makes vertex paint match image painting more closely. - Add falloff shape option sphere/circle where sphere uses a 3D radius around the cursor and circle uses a 2D radius (projected), like previous releases. - Add normal angle option so you can control the falloff. - Add Cull option, to paint onto faces pointing away. Disabling normals, culling and using circle falloff allows you to paint through the mesh.
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 69ae47790a0..1698ab9e5c7 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -587,6 +587,24 @@ bool sculpt_brush_test_sphere_fast(const SculptBrushTest *test, const float co[3
return len_squared_v3v3(co, test->location) <= test->radius_squared;
}
+bool sculpt_brush_test_circle_sq(SculptBrushTest *test, const float co[3])
+{
+ float co_proj[3];
+ closest_to_plane_normalized_v3(co_proj, test->plane, co);
+ float distsq = len_squared_v3v3(co_proj, test->location);
+
+ if (distsq <= test->radius_squared) {
+ if (sculpt_brush_test_clipping(test, co)) {
+ return 0;
+ }
+ test->dist = distsq;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
bool sculpt_brush_test_cube(SculptBrushTest *test, const float co[3], float local[4][4])
{
float side = M_SQRT1_2;
@@ -1216,6 +1234,24 @@ bool sculpt_search_sphere_cb(PBVHNode *node, void *data_v)
return len_squared_v3(t) < data->radius_squared;
}
+/* 2D projection (distance to line). */
+bool sculpt_search_circle_cb(PBVHNode *node, void *data_v)
+{
+ SculptSearchCircleData *data = data_v;
+ float bb_min[3], bb_max[3];
+
+ if (data->original)
+ BKE_pbvh_node_get_original_BB(node, bb_min, bb_max);
+ else
+ BKE_pbvh_node_get_BB(node, bb_min, bb_min);
+
+ float dummy_co[3], dummy_depth;
+ const float dist_sq = dist_squared_ray_to_aabb(
+ data->dist_ray_to_aabb_precalc, bb_min, bb_max, dummy_co, &dummy_depth);
+
+ return dist_sq < data->radius_squared;
+}
+
/* Handles clipping against a mirror modifier and SCULPT_LOCK axis flags */
static void sculpt_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3])
{