Sync changes from upstream repository

Co-authored-by: Andrew Le Bihan <andy@mcneel.com>
Co-authored-by: Bozo <bozo@mcneel.com>
Co-authored-by: Bozo the Builder <bozo@mcneel.com>
Co-authored-by: croudyj <croudyj@gmail.com>
Co-authored-by: Dale Lear <dalelear@mcneel.com>
Co-authored-by: Rafael Pastrana <arpj@princeton.edu>
Co-authored-by: Steve Baer <steve@mcneel.com>
This commit is contained in:
Bozo the Builder
2023-08-04 07:39:16 -07:00
parent f1f34d78a7
commit 2dee21797d
17 changed files with 874 additions and 150 deletions

View File

@@ -3703,11 +3703,28 @@ unsigned int ON_SubDDisplayParameters::DisplayDensity() const
unsigned int ON_SubDDisplayParameters::DisplayDensity(const ON_SubD& subd) const
{
const unsigned display_density = this->m_display_density;
return
this->DisplayDensityIsAdaptive() ?
ON_SubDDisplayParameters::AbsoluteDisplayDensityFromSubD(display_density, subd)
const unsigned absolute_display_density
= this->DisplayDensityIsAdaptive()
? ON_SubDDisplayParameters::AbsoluteDisplayDensityFromSubD(display_density, subd)
: display_density
;
if (0 == absolute_display_density)
{
// If subd has ngons with n != 4, then the display density has to be >= 1.
ON_SubDFaceIdIterator fit(subd);
for (const ON_SubDFace* f = fit.FirstFace(); nullptr != f; f = fit.NextFace())
{
if (4 != f->m_edge_count && f->m_edge_count > 3 && f->m_edge_count <= ON_SubDFace::MaximumEdgeCount)
{
// This face will have f->m_edge_count subd mesh fragments of density 0.
// That's why the default quad face density must be >= 1.
return 1u;
}
}
}
return absolute_display_density;
}
const unsigned char ON_SubDDisplayParameters::GetRawDisplayDensityForExperts() const