diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-25 12:42:27 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-25 12:42:27 +0300 |
commit | 1c05f30e4dcbf05a7dc1a700cd76dc8c3d70601d (patch) | |
tree | 7d56406f87484b007abdf4d6b2906f139de0ba63 /source/blender/geometry | |
parent | 53113a2e571972e835f43217fea217066892e435 (diff) |
Curves: add warning when invalid uv map is used when adding curves
UV maps that are used for surface attachment must not have overlapping
uv islands, because then the same uv coordinate would correspond to
multiple surface positions.
Ref T99936.
Diffstat (limited to 'source/blender/geometry')
-rw-r--r-- | source/blender/geometry/GEO_add_curves_on_mesh.hh | 9 | ||||
-rw-r--r-- | source/blender/geometry/intern/add_curves_on_mesh.cc | 8 |
2 files changed, 15 insertions, 2 deletions
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 |