Fix texture space not updating in edit mode.

This commit is contained in:
mano-wii
2018-11-25 17:47:54 -02:00
parent 9d7b767dd7
commit 3a038db576
3 changed files with 21 additions and 1 deletions

View File

@@ -876,7 +876,10 @@ void BKE_mesh_boundbox_calc(Mesh *me, float r_loc[3], float r_size[3])
if (!r_size) r_size = msize;
INIT_MINMAX(min, max);
if (!BKE_mesh_minmax(me, min, max)) {
if (!(me->edit_btmesh ?
BM_mesh_minmax(me->edit_btmesh->bm, min, max) :
BKE_mesh_minmax(me, min, max)))
{
min[0] = min[1] = min[2] = -1.0f;
max[0] = max[1] = max[2] = 1.0f;
}

View File

@@ -2499,3 +2499,18 @@ void BM_mesh_toolflags_set(BMesh *bm, bool use_toolflags)
bm->use_toolflags = use_toolflags;
}
/**
* Calculate the minimum and maximum coordinates of the box that encompasses this mesh.
*/
bool BM_mesh_minmax(BMesh *bm, float r_min[3], float r_max[3])
{
BMIter iter;
BMVert *v;
BM_ITER_MESH(v, &iter, bm, BM_VERTS_OF_MESH) {
minmax_v3v3_v3(r_min, r_max, v->co);
}
return (bm->totvert != 0);
}

View File

@@ -132,6 +132,8 @@ void BM_mesh_rebuild(
BMesh *bm, const struct BMeshCreateParams *params,
struct BLI_mempool *vpool, struct BLI_mempool *epool, struct BLI_mempool *lpool, struct BLI_mempool *fpool);
bool BM_mesh_minmax(BMesh *bm, float r_min[3], float r_max[3]);
typedef struct BMAllocTemplate {
int totvert, totedge, totloop, totface;
} BMAllocTemplate;