PBVH depth: Improve detection with normal orientation in trim

This commit is contained in:
Pablo Dobarro 2021-02-07 19:33:35 +01:00
parent d927f54da6
commit eea78bd112
2 changed files with 14 additions and 7 deletions

View File

@ -1098,9 +1098,17 @@ static void sculpt_gesture_trim_calculate_depth(bContext *C, SculptGestureContex
/* When using normal orientation, if the stroke started over the mesh, position the mid point
* at 0 distance from the shape plane. This positions the trimming shape half inside of the
* surface. */
mid_point_depth = ss->gesture_initial_hit ?
0.0f :
(trim_operation->depth_back + trim_operation->depth_front) * 0.5f;
if (SCULPT_GESTURE_TRIM_LOCATION_DEPTH_VOLUME) {
mid_point_depth = ss->gesture_initial_hit ?
dist_signed_to_plane_v3(world_space_gesture_initial_location,
shape_plane) :
(trim_operation->depth_back + trim_operation->depth_front) * 0.5f;
}
else {
mid_point_depth = ss->gesture_initial_hit ?
0.0f :
(trim_operation->depth_back + trim_operation->depth_front) * 0.5f;
}
}
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;

View File

@ -119,7 +119,7 @@ static EnumPropertyItem prop_sculpt_expand_target_type_items[] = {
static bool sculpt_expand_state_get(SculptSession *ss, ExpandCache *expand_cache, const int i)
{
if (!SCULPT_vertex_visible_get(ss, i)) {
return false;
return false;
}
bool enabled = false;
@ -147,12 +147,11 @@ static bool sculpt_expand_state_get(SculptSession *ss, ExpandCache *expand_cache
static bool sculpt_expand_face_state_get(SculptSession *ss, ExpandCache *expand_cache, const int f)
{
if (ss->face_sets[f] <= 0) {
return false;
return false;
}
bool enabled = false;
if (expand_cache->snap_enabled_face_sets) {
const int face_set = ss->face_sets[f];
enabled = BLI_gset_haskey(expand_cache->snap_enabled_face_sets, POINTER_FROM_INT(face_set));
@ -1305,7 +1304,7 @@ static int sculpt_expand_modal(bContext *C, wmOperator *op, const wmEvent *event
case SCULPT_EXPAND_MODAL_BRUSH_GRADIENT_TOGGLE: {
expand_cache->brush_gradient = !expand_cache->brush_gradient;
if (expand_cache->brush_gradient) {
expand_cache->falloff_gradient = true;
expand_cache->falloff_gradient = true;
}
break;
}