Merge branch 'master' into sculpt-dev

This commit is contained in:
Pablo Dobarro 2021-04-27 21:31:00 +02:00
commit 901d6e68d7
3 changed files with 52 additions and 5 deletions

View File

@ -356,7 +356,7 @@ class StrokePanel(BrushPanel):
col.operator("paintcurve.draw")
col.separator()
if brush.use_space:
if brush.use_space or brush.use_line or brush.use_curve:
col.separator()
row = col.row(align=True)
col.prop(brush, "dash_ratio", text="Dash Ratio")

View File

@ -1190,14 +1190,43 @@ static void paint_line_strokes_spacing(bContext *C,
const float new_pos[2])
{
UnifiedPaintSettings *ups = stroke->ups;
Paint *paint = BKE_paint_get_active_from_context(C);
Brush *brush = BKE_paint_brush(paint);
ePaintMode mode = BKE_paintmode_get_active_from_context(C);
ARegion *region = CTX_wm_region(C);
const bool use_scene_spacing = paint_stroke_use_scene_spacing(brush, mode);
float mouse[2], dmouse[2];
float length;
float d_world_space_position[3] = {0.0f};
float world_space_position_old[3], world_space_position_new[3];
sub_v2_v2v2(dmouse, new_pos, old_pos);
copy_v2_v2(stroke->last_mouse_position, old_pos);
length = normalize_v2(dmouse);
if (use_scene_spacing) {
bool hit_old = SCULPT_stroke_get_location(C, world_space_position_old, old_pos);
bool hit_new = SCULPT_stroke_get_location(C, world_space_position_new, new_pos);
mul_m4_v3(stroke->vc.obact->obmat, world_space_position_old);
mul_m4_v3(stroke->vc.obact->obmat, world_space_position_new);
if (hit_old && hit_new && stroke->stroke_over_mesh) {
sub_v3_v3v3(d_world_space_position, world_space_position_new, world_space_position_old);
length = len_v3(d_world_space_position);
stroke->stroke_over_mesh = true;
}
else {
length = 0.0f;
zero_v3(d_world_space_position);
stroke->stroke_over_mesh = hit_new;
if (stroke->stroke_over_mesh) {
copy_v3_v3(stroke->last_world_space_position, world_space_position_old);
}
}
}
else {
sub_v2_v2v2(dmouse, new_pos, old_pos);
length = normalize_v2(dmouse);
}
BLI_assert(length >= 0.0f);
@ -1211,8 +1240,18 @@ static void paint_line_strokes_spacing(bContext *C,
*length_residue = 0.0;
if (length >= spacing) {
mouse[0] = stroke->last_mouse_position[0] + dmouse[0] * spacing_final;
mouse[1] = stroke->last_mouse_position[1] + dmouse[1] * spacing_final;
if (use_scene_spacing) {
float final_world_space_position[3];
normalize_v3(d_world_space_position);
mul_v3_v3fl(final_world_space_position, d_world_space_position, spacing_final);
add_v3_v3v3(
final_world_space_position, world_space_position_old, final_world_space_position);
ED_view3d_project(region, final_world_space_position, mouse);
}
else {
mouse[0] = stroke->last_mouse_position[0] + dmouse[0] * spacing_final;
mouse[1] = stroke->last_mouse_position[1] + dmouse[1] * spacing_final;
}
ups->overlap_factor = paint_stroke_integrate_overlap(stroke->brush, 1.0);
@ -1308,6 +1347,13 @@ static bool paint_stroke_curve_end(bContext *C, wmOperator *op, PaintStroke *str
if (!stroke->stroke_started) {
stroke->last_pressure = 1.0;
copy_v2_v2(stroke->last_mouse_position, data + 2 * j);
if (paint_stroke_use_scene_spacing(br, BKE_paintmode_get_active_from_context(C))) {
stroke->stroke_over_mesh = SCULPT_stroke_get_location(
C, stroke->last_world_space_position, data + 2 * j);
mul_m4_v3(stroke->vc.obact->obmat, stroke->last_world_space_position);
}
stroke->stroke_started = stroke->test_start(C, op, stroke->last_mouse_position);
if (stroke->stroke_started) {

View File

@ -939,6 +939,7 @@ static GeometrySet compute_geometry(const DerivedNodeTree &tree,
eval_params.handle_map = &handle_map;
eval_params.modifier_ = nmd;
eval_params.depsgraph = ctx->depsgraph;
eval_params.self_object = ctx->object;
eval_params.log_socket_value_fn = log_socket_value;
blender::modifiers::geometry_nodes::evaluate_geometry_nodes(eval_params);