diff options
Diffstat (limited to 'source/blender')
6 files changed, 33 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc index 2757701675b..6c693376ad3 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc @@ -231,7 +231,12 @@ struct AddOperationExecutor { add_inputs.old_roots_kdtree = self_->curve_roots_kdtree_; } - geometry::add_curves_on_mesh(*curves_orig_, add_inputs); + const geometry::AddCurvesOnMeshOutputs add_outputs = geometry::add_curves_on_mesh( + *curves_orig_, add_inputs); + + if (add_outputs.uv_error) { + report_invalid_uv_map(stroke_extension.reports); + } DEG_id_tag_update(&curves_id_orig_->id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, &curves_id_orig_->id); diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc index 9803c6fdcc6..a180a232189 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc @@ -408,4 +408,9 @@ void report_missing_uv_map_on_evaluated_surface(ReportList *reports) reports, RPT_WARNING, TIP_("Missing UV map for attaching curves on evaluated surface")); } +void report_invalid_uv_map(ReportList *reports) +{ + BKE_report(reports, RPT_WARNING, TIP_("Invalid UV map: UV islands must not overlap")); +} + } // namespace blender::ed::sculpt_paint diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc index b07f5c74055..6ad3d0e4aad 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc +++ b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc @@ -277,7 +277,12 @@ struct DensityAddOperationExecutor { add_inputs.reverse_uv_sampler = &reverse_uv_sampler; add_inputs.old_roots_kdtree = self_->original_curve_roots_kdtree_; - geometry::add_curves_on_mesh(*curves_orig_, add_inputs); + const geometry::AddCurvesOnMeshOutputs add_outputs = geometry::add_curves_on_mesh( + *curves_orig_, add_inputs); + + if (add_outputs.uv_error) { + report_invalid_uv_map(stroke_extension.reports); + } DEG_id_tag_update(&curves_id_orig_->id, ID_RECALC_GEOMETRY); WM_main_add_notifier(NC_GEOM | ND_DATA, &curves_id_orig_->id); diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh b/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh index 4bb00a7d621..7d40ed80a65 100644 --- a/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh +++ b/source/blender/editors/sculpt_paint/curves_sculpt_intern.hh @@ -131,5 +131,6 @@ float transform_brush_radius(const float4x4 &transform, void report_missing_surface(ReportList *reports); void report_missing_uv_map_on_original_surface(ReportList *reports); void report_missing_uv_map_on_evaluated_surface(ReportList *reports); +void report_invalid_uv_map(ReportList *reports); } // namespace blender::ed::sculpt_paint diff --git a/source/blender/geometry/GEO_add_curves_on_mesh.hh b/source/blender/geometry/GEO_add_curves_on_mesh.hh index 68c8dc5b76b..2d2ba89a18f 100644 --- a/source/blender/geometry/GEO_add_curves_on_mesh.hh +++ b/source/blender/geometry/GEO_add_curves_on_mesh.hh @@ -40,12 +40,19 @@ struct AddCurvesOnMeshInputs { * interpolation is used. */ KDTree_3d *old_roots_kdtree = nullptr; + + bool r_uv_error = false; +}; + +struct AddCurvesOnMeshOutputs { + bool uv_error = false; }; /** * Generate new curves on a mesh surface with the given inputs. Existing curves stay intact. */ -void add_curves_on_mesh(bke::CurvesGeometry &curves, const AddCurvesOnMeshInputs &inputs); +AddCurvesOnMeshOutputs add_curves_on_mesh(bke::CurvesGeometry &curves, + const AddCurvesOnMeshInputs &inputs); float3 compute_surface_point_normal(const MLoopTri &looptri, const float3 &bary_coord, diff --git a/source/blender/geometry/intern/add_curves_on_mesh.cc b/source/blender/geometry/intern/add_curves_on_mesh.cc index aa04cedb5c5..7184d774a22 100644 --- a/source/blender/geometry/intern/add_curves_on_mesh.cc +++ b/source/blender/geometry/intern/add_curves_on_mesh.cc @@ -229,8 +229,11 @@ static void interpolate_position_with_interpolation(CurvesGeometry &curves, }); } -void add_curves_on_mesh(CurvesGeometry &curves, const AddCurvesOnMeshInputs &inputs) +AddCurvesOnMeshOutputs add_curves_on_mesh(CurvesGeometry &curves, + const AddCurvesOnMeshInputs &inputs) { + AddCurvesOnMeshOutputs outputs; + const bool use_interpolation = inputs.interpolate_length || inputs.interpolate_point_count || inputs.interpolate_shape; @@ -244,6 +247,7 @@ void add_curves_on_mesh(CurvesGeometry &curves, const AddCurvesOnMeshInputs &inp const float2 &uv = inputs.uvs[i]; const ReverseUVSampler::Result result = inputs.reverse_uv_sampler->sample(uv); if (result.type != ReverseUVSampler::ResultType::Ok) { + outputs.uv_error = true; continue; } const MLoopTri &looptri = *result.looptri; @@ -365,6 +369,8 @@ void add_curves_on_mesh(CurvesGeometry &curves, const AddCurvesOnMeshInputs &inp MutableSpan<int8_t> types_span = curves.curve_types_for_write(); types_span.drop_front(old_curves_num).fill(CURVE_TYPE_CATMULL_ROM); curves.update_curve_types(); + + return outputs; } } // namespace blender::geometry |