Fix T46247: Side-reported, bbox for zero-verts object with OSD subsurf and GPU compute would be -INF.

Trivial fix, to be backported to final 2.76 if possible.
This commit is contained in:
Bastien Montagne 2015-09-25 08:38:45 +02:00
parent de80e68768
commit b278e8742b
Notes: blender-bot 2024-04-29 13:07:32 +02:00
Referenced by commit 95763b8c8a, Revert "Fix T46247: Side-reported, bbox for zero-verts object with OSD subsurf and GPU compute would be -INF."
Referenced by issue #46247, Crash: OpenSubDiv Enable when Drivers are used with the Object (Windows)
1 changed files with 5 additions and 3 deletions

View File

@ -848,6 +848,11 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float r_min[3], float r_max[3])
int i, edgeSize = ccgSubSurf_getEdgeSize(ss);
int gridSize = ccgSubSurf_getGridSize(ss);
if (!ccgSubSurf_getNumVerts(ss)) {
r_min[0] = r_min[1] = r_min[2] = r_max[0] = r_max[1] = r_max[2] = 0.0f;
return;
}
#ifdef WITH_OPENSUBDIV
if (ccgdm->useGpuBackend) {
ccgSubSurf_getMinMax(ccgdm->ss, r_min, r_max);
@ -857,9 +862,6 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float r_min[3], float r_max[3])
CCG_key_top_level(&key, ss);
if (!ccgSubSurf_getNumVerts(ss))
r_min[0] = r_min[1] = r_min[2] = r_max[0] = r_max[1] = r_max[2] = 0.0;
for (ccgSubSurf_initVertIterator(ss, &vi); !ccgVertIterator_isStopped(&vi); ccgVertIterator_next(&vi)) {
CCGVert *v = ccgVertIterator_getCurrent(&vi);
float *co = ccgSubSurf_getVertData(ss, v);