Page MenuHome

Triangulate modifier add side limit
ClosedPublic

Authored by Ish Bosamiya (ish_bosamiya) on Feb 16 2019, 6:28 PM.
Tokens
"Love" token, awarded by monio."Love" token, awarded by symstract."Love" token, awarded by Dheim."Love" token, awarded by fin.eskimo."Love" token, awarded by hitrpr."Love" token, awarded by koloved."Love" token, awarded by fiendish55."Love" token, awarded by avpiedra."Like" token, awarded by amonpaike."Like" token, awarded by ThinkingPolygons."Love" token, awarded by michaelknubben."Love" token, awarded by manitwo."Yellow Medal" token, awarded by duarteframos.

Details

Summary

Currently the triangulate modifier triangulates all the faces. It is often important to only triangulate faces with certain number of verticies or higher.

In this patch, an extra option is added to the modifier which limits the triangulation only to faces with higher number of verticies.

This feature has been requested by the community on Right-Click Select.

Video has been attached to illustrate the feature.

Diff Detail

Repository
rB Blender

Event Timeline

Makes sense. It's often times useful to be able to triangulate only N-gons, for example.

@Campbell Barton (campbellbarton) ?

Brecht Van Lommel (brecht) requested changes to this revision.Feb 21 2019, 11:20 AM
Brecht Van Lommel (brecht) added inline comments.
source/blender/bmesh/tools/bmesh_triangulate.c
106

This should be >=, if the meaning is the minimum number of vertices a face must have to be triangulated?

And then the default value would be 4.

source/blender/makesrna/intern/rna_modifier.c
4371–4372

Rename min_no_of_verts -> min_number_vertices

4373

Use RNA_def_property_range(prop, 4, INT_MAX);, not a soft UI range.

4374

Rename Number Of Verts > Number of Vertices

source/blender/modifiers/intern/MOD_triangulate.c
76

This also needs to be initialized for existing modifiers, in versioning_280.c.

See for example DNA_struct_elem_find(fd->filesdna, "ShrinkwrapModifierData", "char", "shrinkMode") for a similar case.

This revision now requires changes to proceed.Feb 21 2019, 11:20 AM
  • Test: Triangulate now works for polygons with 5 sides and more
  • UI almost implemented
  • refactor: variable name change
  • UI: make ui better
  • Not part of Triangulation Feature
  • Refactor: UI change
  • Add versioning to min_number_vertices modifier option
Ish Bosamiya (ish_bosamiya) marked 5 inline comments as done.Feb 21 2019, 5:23 PM

I have updated the code to reflect the changes that were asked.
I have used arc to update the diff, so sorry for adding all the local commit messages as a comment, I should have kept only the recent commit messages (will take care next time :) )

Brecht Van Lommel (brecht) requested changes to this revision.Feb 21 2019, 6:10 PM

Thanks for the updates, a few more comments.

source/blender/alembic/intern/abc_mesh.cc
555

3 -> 4

source/blender/blenloader/intern/versioning_280.c
2809–2819

This code should go below the /* Versioning code until next subversion bump goes here. */ comment.

Otherwise files saved with current 2.80.45 before this patch will not be affected by it.

source/blender/bmesh/operators/bmo_triangulate.c
50

3 -> 4

source/blender/editors/sculpt_paint/sculpt.c
5427

3 -> 4

This revision now requires changes to proceed.Feb 21 2019, 6:10 PM
  • Fix triangulation issue
  • shift versioning code to prevent loading problems with 2.80.45
This revision is now accepted and ready to land.Feb 27 2019, 3:13 PM

@Brecht Van Lommel (brecht), should this be merged, or do we come back to this patch when Blender 2.8 is released?

This revision was automatically updated to reflect the committed changes.