From 8c41c00ff7b67f885f67af835f1228f0ba42a455 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 18 Aug 2005 11:31:20 +0000 Subject: - added DerivedMesh.drawUVEdges function & implementations - removed DerivedMesh.drawLooseEdges and replaced with much more general drawEdgesFlag function that draws based edge flags. - switch DerivedMesh.drawFacesTex to give user control over which faces are drawn - added object_uvs_changed and object_tface_flags_changed functions to do object recalc flag flush/redraw queueing and added calls in appropriate places - added various edge flags to mark TFace information. This is used by the drawEdgesFlag routine and was the best way I could come up with to deal with drawing TFace information from modifier stack. Unfortunate side effects are (1) uses a lot of MEdge flags (although not needed in file so thats fine) and (2) requires recalculation of modifier stack on UV selection changes. #2 is disappointing but I could not find a better solution. - update UV mesh shadow drawing to use modifier result. At the moment just uses the final result but probably should be integrated with the editmode cage option. - convert draw_tfaces3D to use drawEdgesFlag routine which cleaned up the code quite a bit. - convert draw_tface_mesh to draw using result of modifier stack. Same comment about which result actually gets draw in FACESELECT mode as for UV editor shadow drawing applies. There is a still a bug in that selection is using the wrong mesh to draw. --- source/blender/blenkernel/BKE_DerivedMesh.h | 11 +- source/blender/blenkernel/intern/CCGSubSurf.c | 9 + source/blender/blenkernel/intern/CCGSubSurf.h | 1 + source/blender/blenkernel/intern/DerivedMesh.c | 226 ++++++++++++++++++++----- source/blender/blenkernel/intern/subsurf_ccg.c | 127 +++++++++----- source/blender/include/BDR_drawmesh.h | 2 - source/blender/include/BIF_editsima.h | 5 + source/blender/makesdna/DNA_meshdata_types.h | 16 +- source/blender/src/buttons_editing.c | 1 + source/blender/src/drawimage.c | 15 +- source/blender/src/drawmesh.c | 208 +++++++---------------- source/blender/src/drawobject.c | 2 +- source/blender/src/editface.c | 48 +++--- source/blender/src/editsima.c | 75 +++++--- source/blender/src/header_image.c | 6 +- 15 files changed, 461 insertions(+), 291 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index f221391d6f0..99d438743fa 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -127,15 +127,18 @@ struct DerivedMesh { /* Draw all vertices as bgl points (no options) */ void (*drawVerts)(DerivedMesh *dm); + /* Draw edges in the UV mesh (if exists) */ + void (*drawUVEdges)(DerivedMesh *dm); + /* Draw all edges as lines (no options) * * Also called for *final* editmode DerivedMeshes */ void (*drawEdges)(DerivedMesh *dm, int drawLooseEdges); - - /* Draw all edges without faces as lines (no options) */ - void (*drawLooseEdges)(DerivedMesh *dm); - + + /* Draw all edges for which (med->flag&mask)==value */ + void (*drawEdgesFlag)(DerivedMesh *dm, unsigned int mask, unsigned int value); + /* Draw all faces * o Set face normal or vertex normal based on inherited face flag * o Use inherited face material index to call setMaterial diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index bec741c64e6..2ed7d60e57e 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -2129,6 +2129,15 @@ CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *ss, CCGFace *f, int index) { return FACE_getEdges(f)[index]; } } +int ccgSubSurf_getFaceEdgeIndex(CCGSubSurf *ss, CCGFace *f, CCGEdge *e) { + int i; + + for (i=0; inumVerts; i++) + if (FACE_getEdges(f)[i]==e) + return i; + + return -1; +} void *ccgSubSurf_getFaceCenterData(CCGSubSurf *ss, CCGFace *f) { return FACE_getCenterData(f); } diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h index 4c522b1a827..547580bca6e 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.h +++ b/source/blender/blenkernel/intern/CCGSubSurf.h @@ -108,6 +108,7 @@ CCGFaceHDL ccgSubSurf_getFaceFaceHandle (CCGSubSurf *ss, CCGFace *f); int ccgSubSurf_getFaceNumVerts (CCGSubSurf *ss, CCGFace *f); CCGVert* ccgSubSurf_getFaceVert (CCGSubSurf *ss, CCGFace *f, int index); CCGEdge* ccgSubSurf_getFaceEdge (CCGSubSurf *ss, CCGFace *f, int index); +int ccgSubSurf_getFaceEdgeIndex (CCGSubSurf *ss, CCGFace *f, CCGEdge *e); int ccgSubSurf_getFaceAge (CCGSubSurf *ss, CCGFace *f); void* ccgSubSurf_getFaceUserData (CCGSubSurf *ss, CCGFace *f); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 6ed73192d56..eda5e3ff485 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -163,6 +163,41 @@ static void meshDM_drawVerts(DerivedMesh *dm) } glEnd(); } +static void meshDM_drawUVEdges(DerivedMesh *dm) +{ + MeshDerivedMesh *mdm = (MeshDerivedMesh*) dm; + Mesh *me = mdm->me; + int i; + + if (me->tface) { + glBegin(GL_LINES); + for (i=0; itotface; i++) { + if (me->mface[i].v3) { + TFace *tf = &me->tface[i]; + + if (!(tf->flag&TF_HIDE)) { + glVertex2fv(tf->uv[0]); + glVertex2fv(tf->uv[1]); + + glVertex2fv(tf->uv[1]); + glVertex2fv(tf->uv[2]); + + if (!me->mface[i].v4) { + glVertex2fv(tf->uv[2]); + glVertex2fv(tf->uv[0]); + } else { + glVertex2fv(tf->uv[2]); + glVertex2fv(tf->uv[3]); + + glVertex2fv(tf->uv[3]); + glVertex2fv(tf->uv[0]); + } + } + } + } + glEnd(); + } +} static void meshDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { MeshDerivedMesh *mdm = (MeshDerivedMesh*) dm; @@ -220,30 +255,94 @@ static void meshDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) glEnd(); } } -static void meshDM_drawLooseEdges(DerivedMesh *dm) +static void meshDM_drawEdgesFlag(DerivedMesh *dm, unsigned int mask, unsigned int value) { MeshDerivedMesh *mdm = (MeshDerivedMesh*) dm; - Mesh *me = mdm->me; - MFace *mface= me->mface; - MEdge *medge= me->medge; + Mesh *me= mdm->me; int a; + MFace *mface = me->mface; + int tfaceFlags = (ME_EDGE_TFSEL|ME_EDGE_TFACT|ME_EDGE_TFVISIBLE|ME_EDGE_TFACTFIRST|ME_EDGE_TFACTLAST); + + if ((mask&tfaceFlags) && me->tface) { + TFace *tface = me->tface; - if (medge) { glBegin(GL_LINES); - for(a=0; atotedge; a++, medge++) { - if ((medge->flag&ME_EDGEDRAW) && (medge->flag&ME_LOOSEEDGE)) { - glVertex3fv(mdm->verts[medge->v1].co); - glVertex3fv(mdm->verts[medge->v2].co); + for(a=0; atotface; a++, mface++, tface++) { + if (mface->v3) { + unsigned int flags = ME_EDGEDRAW|ME_EDGEMAPPED; + unsigned int flag0, flag1, flag2, flag3; + + if (tface->flag&TF_SELECT) flags |= ME_EDGE_TFSEL; + if (!(tface->flag&TF_HIDE)) flags |= ME_EDGE_TFVISIBLE; + + if (tface->flag&TF_ACTIVE) { + flags |= ME_EDGE_TFACT; + flag0 = flag1 = flag2 = flag3 = flags; + + flag0 |= ME_EDGE_TFACTFIRST; + flag3 |= ME_EDGE_TFACTLAST; + } else { + flag0 = flag1 = flag2 = flag3 = flags; + } + + if (mask&ME_SEAM) { + if (tface->unwrap&TF_SEAM1) flag0 |= ME_SEAM; + if (tface->unwrap&TF_SEAM2) flag1 |= ME_SEAM; + if (tface->unwrap&TF_SEAM3) flag2 |= ME_SEAM; + if (tface->unwrap&TF_SEAM4) flag3 |= ME_SEAM; + } + + if ((flag0&mask)==value) { + glVertex3fv(mdm->verts[mface->v1].co); + glVertex3fv(mdm->verts[mface->v2].co); + } + + if ((flag1&mask)==value) { + glVertex3fv(mdm->verts[mface->v2].co); + glVertex3fv(mdm->verts[mface->v3].co); + } + + if (mface->v4) { + if ((flag2&mask)==value) { + glVertex3fv(mdm->verts[mface->v3].co); + glVertex3fv(mdm->verts[mface->v4].co); + } + + if ((flag3&mask)==value) { + glVertex3fv(mdm->verts[mface->v4].co); + glVertex3fv(mdm->verts[mface->v1].co); + } + } else { + if ((flag3&mask)==value) { + glVertex3fv(mdm->verts[mface->v3].co); + glVertex3fv(mdm->verts[mface->v1].co); + } + } } } glEnd(); - } else { + } + else if(me->medge) { + MEdge *medge= me->medge; + + glBegin(GL_LINES); + for(a=me->totedge; a>0; a--, medge++) { + if (((medge->flag|ME_EDGEMAPPED)&mask)==value) { + glVertex3fv(mdm->verts[ medge->v1].co); + glVertex3fv(mdm->verts[ medge->v2].co); + } + } + glEnd(); + } + else { glBegin(GL_LINES); for(a=0; atotface; a++, mface++) { - if(!mface->v3) { - glVertex3fv(mdm->verts[mface->v1].co); - glVertex3fv(mdm->verts[mface->v2].co); - } + if (!mface->v3) { + if (((ME_EDGEDRAW|ME_LOOSEEDGE|ME_EDGEMAPPED)&mask)==value) { + glVertex3fv(mdm->verts[mface->v1].co); + glVertex3fv(mdm->verts[mface->v2].co); + } + } } glEnd(); } @@ -381,16 +480,20 @@ static void meshDM_drawFacesTex(DerivedMesh *dm, int (*setDrawParams)(TFace *tf, for (a=0; atotface; a++) { MFace *mf= &mface[a]; TFace *tf = tface?&tface[a]:NULL; + int flag; unsigned char *cp= NULL; - if(mf->v3==0) continue; - if(tf && ((tf->flag&TF_HIDE) || (tf->mode&TF_INVISIBLE))) continue; + if (mf->v3==0) continue; + + flag = setDrawParams(tf, mf->mat_nr); - if (setDrawParams(tf, mf->mat_nr)) { + if (flag==0) { + continue; + } else if (flag==1) { if (tf) { - cp= (unsigned char *) tf->col; + cp= (unsigned char*) tf->col; } else if (me->mcol) { - cp= (unsigned char *) &me->mcol[a*4]; + cp= (unsigned char*) &me->mcol[a*4]; } } @@ -463,9 +566,10 @@ static DerivedMesh *getMeshDerivedMesh(Mesh *me, Object *ob, float (*vertCos)[3] mdm->dm.drawVerts = meshDM_drawVerts; + mdm->dm.drawUVEdges = meshDM_drawUVEdges; mdm->dm.drawEdges = meshDM_drawEdges; - mdm->dm.drawLooseEdges = meshDM_drawLooseEdges; - + mdm->dm.drawEdgesFlag = meshDM_drawEdgesFlag; + mdm->dm.drawFacesSolid = meshDM_drawFacesSolid; mdm->dm.drawFacesColored = meshDM_drawFacesColored; mdm->dm.drawFacesTex = meshDM_drawFacesTex; @@ -989,38 +1093,73 @@ static void ssDM_drawMappedFacesEM(DerivedMesh *dm, int (*setDrawOptions)(void * } } -static void ssDM_drawLooseEdges(DerivedMesh *dm) +static void ssDM_drawVerts(DerivedMesh *dm) { SSDerivedMesh *ssdm = (SSDerivedMesh*) dm; DispListMesh *dlm = ssdm->dlm; + MVert *mvert= dlm->mvert; int i; - if (dlm->medge) { - MEdge *medge= dlm->medge; - + bglBegin(GL_POINTS); + for (i=0; itotvert; i++) { + bglVertex3fv(mvert[i].co); + } + bglEnd(); +} +static void ssDM_drawUVEdges(DerivedMesh *dm) +{ + SSDerivedMesh *ssdm = (SSDerivedMesh*) dm; + DispListMesh *dlm = ssdm->dlm; + int i; + + if (dlm->tface) { glBegin(GL_LINES); - for (i=0; itotedge; i++, medge++) { - if (medge->flag&ME_LOOSEEDGE) { - glVertex3fv(dlm->mvert[medge->v1].co); - glVertex3fv(dlm->mvert[medge->v2].co); + for (i=0; itotface; i++) { + if (dlm->mface[i].v3) { + TFace *tf = &dlm->tface[i]; + + if (!(tf->flag&TF_HIDE)) { + glVertex2fv(tf->uv[0]); + glVertex2fv(tf->uv[1]); + + glVertex2fv(tf->uv[1]); + glVertex2fv(tf->uv[2]); + + if (!dlm->mface[i].v4) { + glVertex2fv(tf->uv[2]); + glVertex2fv(tf->uv[0]); + } else { + glVertex2fv(tf->uv[2]); + glVertex2fv(tf->uv[3]); + + glVertex2fv(tf->uv[3]); + glVertex2fv(tf->uv[0]); + } + } } } glEnd(); } } - -static void ssDM_drawVerts(DerivedMesh *dm) +static void ssDM_drawEdgesFlag(DerivedMesh *dm, unsigned int mask, unsigned int value) { SSDerivedMesh *ssdm = (SSDerivedMesh*) dm; DispListMesh *dlm = ssdm->dlm; - MVert *mvert= dlm->mvert; + MVert *mvert = dlm->mvert; int i; - bglBegin(GL_POINTS); - for (i=0; itotvert; i++) { - bglVertex3fv(mvert[i].co); + if (dlm->medge) { + MEdge *medge= dlm->medge; + + glBegin(GL_LINES); + for (i=0; itotedge; i++, medge++) { + if ((medge->flag&mask)==value) { + glVertex3fv(mvert[medge->v1].co); + glVertex3fv(mvert[medge->v2].co); + } + } + glEnd(); } - bglEnd(); } static void ssDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { @@ -1181,12 +1320,16 @@ static void ssDM_drawFacesTex(DerivedMesh *dm, int (*setDrawParams)(TFace *tf, i for (a=0; atotface; a++) { MFace *mf= &mface[a]; TFace *tf = tface?&tface[a]:NULL; + int flag; unsigned char *cp= NULL; - if(mf->v3==0) continue; - if(tf && ((tf->flag&TF_HIDE) || (tf->mode&TF_INVISIBLE))) continue; + if (mf->v3==0) continue; + + flag = setDrawParams(tf, mf->mat_nr); - if (setDrawParams(tf, mf->mat_nr)) { + if (flag==0) { + continue; + } else if (flag==1) { if (tf) { cp= (unsigned char*) tf->col; } else if (dlm->mcol) { @@ -1320,9 +1463,10 @@ DerivedMesh *derivedmesh_from_displistmesh(DispListMesh *dlm, float (*vertexCos) ssdm->dm.drawVerts = ssDM_drawVerts; + ssdm->dm.drawUVEdges = ssDM_drawUVEdges; ssdm->dm.drawEdges = ssDM_drawEdges; - ssdm->dm.drawLooseEdges = ssDM_drawLooseEdges; - + ssdm->dm.drawEdgesFlag = ssDM_drawEdgesFlag; + ssdm->dm.drawFacesSolid = ssDM_drawFacesSolid; ssdm->dm.drawFacesColored = ssDM_drawFacesColored; ssdm->dm.drawFacesTex = ssDM_drawFacesTex; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index c971bc8aa42..e16ade4b7cc 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -196,6 +196,59 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg return faceBase + 1 + (gridSize-2)*numVerts + S*(gridSize-2)*(gridSize-2) + (y-1)*(gridSize-2) + (x-1); } } + +static unsigned int ss_getEdgeFlags(CCGSubSurf *ss, CCGEdge *e, int ssFromEditmesh, MEdge *medge, TFace *tface) +{ + unsigned int flags = ME_EDGEDRAW|ME_EDGERENDER|ME_EDGEMAPPED; + int j, N = ccgSubSurf_getEdgeNumFaces(ss, e); + + if (!N) flags |= ME_LOOSEEDGE; + + if (ssFromEditmesh) { + EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(ss, e); + + if (eed->seam) { + flags |= ME_SEAM; + } + } else { + int edgeIdx = (int) ccgSubSurf_getEdgeEdgeHandle(ss, e); + + /* Edges created by lib have handle of -1 */ + if (edgeIdx!=-1 && medge) { + MEdge *origMed = &medge[edgeIdx]; + + flags |= (origMed->flag&ME_SEAM); + } + + if (tface) { + for (j=0; jflag&TF_HIDE)) flags |= ME_EDGE_TFVISIBLE; + if (tf->flag&TF_SELECT) flags |= ME_EDGE_TFSEL; + + if (tf->flag&TF_ACTIVE) { + int fN = ccgSubSurf_getFaceNumVerts(ss, f); + int k = ccgSubSurf_getFaceEdgeIndex(ss, f, e); + + flags |= ME_EDGE_TFACT; + + if (k==0) { + flags |= ME_EDGE_TFACTFIRST; + } + else if (k==fN-1) { + flags |= ME_EDGE_TFACTLAST; + } + } + } + } + } + + return flags; +} + static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, int ssFromEditmesh, int drawInteriorEdges, Mesh *inMe, DispListMesh *inDLM, EditVert ***vertMap_r, EditEdge ***edgeMap_r, EditFace ***faceMap_r) { DispListMesh *dlm = MEM_callocN(sizeof(*dlm), "dlm"); int edgeSize = ccgSubSurf_getEdgeSize(ss); @@ -314,30 +367,13 @@ static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, i ei = ccgSubSurf_getEdgeIterator(ss); for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); + unsigned int flags = ss_getEdgeFlags(ss, e, ssFromEditmesh, medge, tface); + for (x=0; xmedge[i]; med->v1 = getEdgeIndex(ss, e, x, edgeSize); med->v2 = getEdgeIndex(ss, e, x+1, edgeSize); - med->flag = ME_EDGEDRAW|ME_EDGERENDER; - - if (!ccgSubSurf_getEdgeNumFaces(ss, e)) med->flag |= ME_LOOSEEDGE; - - if (ssFromEditmesh) { - EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(ss, e); - - if (eed->seam) { - med->flag|= ME_SEAM; - } - } else { - int edgeIdx = (int) ccgSubSurf_getEdgeEdgeHandle(ss, e); - - /* Edges created by lib have handle of -1 */ - if (edgeIdx!=-1 && medge) { - MEdge *origMed = &medge[edgeIdx]; - - med->flag|= (origMed->flag&ME_SEAM); - } - } + med->flag = flags; if (edgeMap) { edgeMap[i] = ccgDM_getEdgeHandle(ccgdm, e); @@ -428,6 +464,16 @@ static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, i numDataComponents = 4; } + for (S=0; Smat_nr; flag = origMFace->flag; } else { @@ -436,16 +482,6 @@ static DispListMesh *ss_to_displistmesh(CCGSubSurf *ss, CCGDerivedMesh *ccgdm, i flag = ef->flag; } - for (S=0; Stface) { TFace *tf = &dlm->tface[i]; tf->tpage = origTFace->tpage; @@ -917,18 +954,25 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { ccgFaceIterator_free(fi); ccgEdgeIterator_free(ei); } -static void ccgDM_drawLooseEdges(DerivedMesh *dm) { +static void ccgDM_drawEdgesFlag(DerivedMesh *dm, unsigned int mask, unsigned int value) { CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; CCGSubSurf *ss = ccgdm->ss; CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); int i, edgeSize = ccgSubSurf_getEdgeSize(ss); + MEdge *medge = NULL; + TFace *tface = NULL; + + if (!ccgdm->fromEditmesh) { + medge = ccgdm->dlm?ccgdm->dlm->medge:ccgdm->me->medge; + tface = ccgdm->dlm?ccgdm->dlm->tface:ccgdm->me->tface; + } for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); + VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); + unsigned int flags = ss_getEdgeFlags(ss, e, ccgdm->fromEditmesh, medge, tface); - if (!ccgSubSurf_getEdgeNumFaces(ss, e)) { - VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - + if ((flags&mask)==value) { glBegin(GL_LINE_STRIP); for (i=0; iss; @@ -1100,14 +1143,15 @@ static void ccgDM_drawFacesTex(DerivedMesh *dm, int (*setDrawParams)(TFace *tf, MFace *mf = &mface[index]; TFace *tf = tface?&tface[index]:NULL; unsigned char *cp= NULL; - - if(tf && ((tf->flag&TF_HIDE) || (tf->mode&TF_INVISIBLE))) continue; + int flag = setDrawParams(tf, mf->mat_nr); - if (setDrawParams(tf, mf->mat_nr)) { + if (flag==0) { + continue; + } else if (flag==1) { if (tf) { - cp= (unsigned char *) tf->col; + cp= (unsigned char*) tf->col; } else if (mcol) { - cp= (unsigned char *) &mcol[index*4]; + cp= (unsigned char*) &mcol[index*4]; } } @@ -1336,7 +1380,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int fromEditmesh, int d ccgdm->dm.drawVerts = ccgDM_drawVerts; ccgdm->dm.drawEdges = ccgDM_drawEdges; - ccgdm->dm.drawLooseEdges = ccgDM_drawLooseEdges; + ccgdm->dm.drawEdgesFlag = ccgDM_drawEdgesFlag; ccgdm->dm.drawFacesSolid = ccgDM_drawFacesSolid; ccgdm->dm.drawFacesColored = ccgDM_drawFacesColored; ccgdm->dm.drawFacesTex = ccgDM_drawFacesTex; @@ -1434,6 +1478,7 @@ DerivedMesh *subsurf_make_derived_from_mesh(Mesh *me, DispListMesh *dlm, Subsurf ss = _getSubSurf(NULL, smd->levels, 0, 1, useEdgeCreation, useSimple); ss_sync_from_mesh(ss, me, dlm, vertCos, useSimple); + ndlm = ss_to_displistmesh(ss, NULL, 0, drawInteriorEdges, me, dlm, NULL, NULL, NULL); if (dlm) displistmesh_free(dlm); diff --git a/source/blender/include/BDR_drawmesh.h b/source/blender/include/BDR_drawmesh.h index a6727198b23..c6bcf061fcc 100644 --- a/source/blender/include/BDR_drawmesh.h +++ b/source/blender/include/BDR_drawmesh.h @@ -73,8 +73,6 @@ void free_realtime_image(struct Image *ima); void free_all_realtime_images(void); void make_repbind(struct Image *ima); int set_tpage(struct TFace *tface); -void spack(unsigned int ucol); -void draw_tfaces3D(struct Object *ob, struct Mesh *me); void draw_tface_mesh(struct Object *ob, struct Mesh *me, int dt); void init_realtime_GL(void); diff --git a/source/blender/include/BIF_editsima.h b/source/blender/include/BIF_editsima.h index 5dd38f9d922..9bf2007a5ff 100644 --- a/source/blender/include/BIF_editsima.h +++ b/source/blender/include/BIF_editsima.h @@ -33,6 +33,11 @@ #define TF_PIN_MASK(id) (TF_PIN1 << id) #define TF_SEL_MASK(id) (TF_SEL1 << id) +struct Object; + +void object_uvs_changed(struct Object *ob); +void object_tface_flags_changed(struct Object *ob, int updateButtons); + int is_uv_tface_editing_allowed(void); int is_uv_tface_editing_allowed_silent(void); void borderselect_sima(void); diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index 83111e87aa9..76dc57cd70d 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -77,12 +77,18 @@ typedef struct MSticky { #define ME_HIDE 16 /* medge->flag (1=SELECT)*/ -#define ME_EDGEDRAW 2 -#define ME_SEAM 4 -#define ME_FGON 8 +#define ME_EDGEDRAW (1<<1) +#define ME_SEAM (1<<2) +#define ME_FGON (1<<3) // reserve 16 for ME_HIDE -#define ME_EDGERENDER 32 -#define ME_LOOSEEDGE 64 +#define ME_EDGERENDER (1<<5) +#define ME_EDGEMAPPED (1<<6) +#define ME_LOOSEEDGE (1<<7) +#define ME_EDGE_TFSEL (1<<8) +#define ME_EDGE_TFACT (1<<9) +#define ME_EDGE_TFVISIBLE (1<<10) +#define ME_EDGE_TFACTFIRST (1<<11) +#define ME_EDGE_TFACTLAST (1<<12) /* puno = vertexnormal (mface) */ #define ME_FLIPV1 1 diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c index b069cfe6e21..e69c646579c 100644 --- a/source/blender/src/buttons_editing.c +++ b/source/blender/src/buttons_editing.c @@ -515,6 +515,7 @@ void do_modifier_panels(unsigned short event) ob->softflag |= OB_SB_RESET; allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWIMAGE, 0); allqueue(REDRAWOOPS, 0); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); break; diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 3fd0ba7c131..8193809ca18 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -63,6 +63,8 @@ #include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_image.h" +#include "BKE_DerivedMesh.h" +#include "BKE_displist.h" #include "BDR_editface.h" #include "BDR_drawobject.h" @@ -267,14 +269,23 @@ void draw_tfaces(void) glLoadIdentity(); /* draw shadow mesh */ - if(G.sima->flag & SI_DRAWSHADOW){ + if((G.sima->flag & SI_DRAWSHADOW) && !(G.obedit==OBACT)){ + int dmNeedsFree; + DerivedMesh *dm = mesh_get_derived_final(OBACT, &dmNeedsFree); + + glColor3ub(112, 112, 112); + if (dm->drawUVEdges) dm->drawUVEdges(dm); + + if (dmNeedsFree) dm->release(dm); + } + else if(G.sima->flag & SI_DRAWSHADOW){ tface= me->tface; mface= me->mface; a= me->totface; while(a--) { if(tface->flag & TF_HIDE); else if(mface->v3) { - cpack(0x707070); + glColor3ub(112, 112, 112); glBegin(GL_LINE_LOOP); glVertex2fv(tface->uv[0]); glVertex2fv(tface->uv[1]); diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c index b66c7b1a5f6..854b3ffb9fe 100644 --- a/source/blender/src/drawmesh.c +++ b/source/blender/src/drawmesh.c @@ -489,84 +489,43 @@ void update_realtime_textures() } -void spack(unsigned int ucol) +static int draw_tfaces3D__drawFaceOpts(TFace *tface, int matnr) { - char *cp= (char *)&ucol; - - glColor3ub(cp[3], cp[2], cp[1]); + if (tface && !(tface->flag&TF_HIDE) && (tface->flag&TF_SELECT)) { + return 2; /* Don't set color */ + } else { + return 0; + } } - -void draw_tfaces3D(Object *ob, Mesh *me) +static void draw_tfaces3D(Object *ob, Mesh *me, DerivedMesh *dm) { - MFace *mface, *activeFace; - TFace *tface; - float co[3]; - int a, activeFaceInSelection= 0; - DerivedMesh *dm; - int dmNeedsFree; - - if(me==0 || me->tface==0) return; - - dm = mesh_get_derived_deform(ob, &dmNeedsFree); + int a; glEnable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); bglPolygonOffset(1.0); -#define PASSVERT(index) { dm->getVertCo(dm, index, co); glVertex3fv(co); } - - /* Draw (Hidden) Edges */ - if(G.f & G_DRAWEDGES || G.f & G_HIDDENEDGES){ - BIF_ThemeColor(TH_EDGE_FACESEL); - - mface= me->mface; - tface= me->tface; - for(a=me->totface; a>0; a--, mface++, tface++) { - if(mface->v3 && (G.f&G_DRAWEDGES)) { - if ((tface->flag&TF_HIDE) && !(G.f&G_HIDDENEDGES)) - continue; - - glBegin(GL_LINE_LOOP); - PASSVERT(mface->v1); - PASSVERT(mface->v2); - PASSVERT(mface->v3); - if(mface->v4) PASSVERT(mface->v4); - glEnd(); - } + /* Draw (Hidden) Edges */ + BIF_ThemeColor(TH_EDGE_FACESEL); + if((G.f & G_DRAWEDGES)){ + if (G.f&G_HIDDENEDGES) { + dm->drawEdgesFlag(dm, ME_EDGEMAPPED, ME_EDGEMAPPED); + } else { + dm->drawEdgesFlag(dm, ME_EDGE_TFVISIBLE, ME_EDGE_TFVISIBLE); } + } else { + dm->drawEdgesFlag(dm, ME_EDGE_TFVISIBLE|ME_EDGE_TFSEL, ME_EDGE_TFVISIBLE|ME_EDGE_TFSEL); } if(G.f & G_DRAWSEAMS) { BIF_ThemeColor(TH_EDGE_SEAM); glLineWidth(2); - glBegin(GL_LINES); - mface= me->mface; - tface= me->tface; - for(a=me->totface; a>0; a--, mface++, tface++) { - if (mface->v3 && !(tface->flag&TF_HIDE)) { - if(tface->unwrap & TF_SEAM1) { - PASSVERT(mface->v1); - PASSVERT(mface->v2); - } - - if(tface->unwrap & TF_SEAM2) { - PASSVERT(mface->v2); - PASSVERT(mface->v3); - } - - if(tface->unwrap & TF_SEAM3) { - PASSVERT(mface->v3); - PASSVERT(mface->v4?mface->v4:mface->v1); - } - - if(mface->v4 && (tface->unwrap & TF_SEAM4)) { - PASSVERT(mface->v4); - PASSVERT(mface->v1); - } - } + if (G.f&G_HIDDENEDGES) { + dm->drawEdgesFlag(dm, ME_EDGEMAPPED|ME_SEAM, ME_EDGEMAPPED|ME_SEAM); + } else { + dm->drawEdgesFlag(dm, ME_EDGE_TFVISIBLE|ME_SEAM, ME_EDGE_TFVISIBLE|ME_SEAM); } - glEnd(); glLineWidth(1); } @@ -577,86 +536,45 @@ void draw_tfaces3D(Object *ob, Mesh *me) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); BIF_ThemeColor4(TH_FACE_SELECT); - mface= me->mface; - tface= me->tface; - for(a=me->totface; a>0; a--, mface++, tface++) { - if(mface->v3 && !(tface->flag&TF_HIDE) && (tface->flag&TF_SELECT)) { - glBegin(mface->v4?GL_QUADS:GL_TRIANGLES); - PASSVERT(mface->v1); - PASSVERT(mface->v2); - PASSVERT(mface->v3); - if(mface->v4) PASSVERT(mface->v4); - glEnd(); - } - } + dm->drawFacesTex(dm, draw_tfaces3D__drawFaceOpts); + glDisable(GL_BLEND); } - /* Draw Stippled Outline for selected faces */ - activeFace = NULL; - mface= me->mface; - tface= me->tface; bglPolygonOffset(1.0); - for(a=me->totface; a>0; a--, mface++, tface++) { - if(mface->v3 && !(tface->flag&TF_HIDE) && (tface->flag & (TF_ACTIVE|TF_SELECT))) { - if(tface->flag & TF_ACTIVE) { - activeFace = mface; - activeFaceInSelection= (tface->flag & TF_SELECT); - } - else { - cpack(0x0); - glBegin(GL_LINE_LOOP); - PASSVERT(mface->v1); - PASSVERT(mface->v2); - PASSVERT(mface->v3); - if(mface->v4) PASSVERT(mface->v4); - glEnd(); - } - - if(tface->flag & TF_SELECT) { - cpack(0xFFFFFF); - setlinestyle(1); - glBegin(GL_LINE_LOOP); - PASSVERT(mface->v1); - PASSVERT(mface->v2); - PASSVERT(mface->v3); - if(mface->v4) PASSVERT(mface->v4); - glEnd(); - setlinestyle(0); - } - } - } - - /* Draw Active Face on top */ - /* colors: R=x G=y */ - if(activeFace) { - cpack(0xFF); - glBegin(GL_LINE_STRIP); - PASSVERT(activeFace->v1); - PASSVERT(activeFace->v4?activeFace->v4:activeFace->v3); - glEnd(); - cpack(0xFF00); - glBegin(GL_LINE_STRIP); - PASSVERT(activeFace->v1); - PASSVERT(activeFace->v2); - glEnd(); + /* Draw Stippled Outline for selected faces */ + cpack(0xFFFFFF); + setlinestyle(1); + dm->drawEdgesFlag(dm, ME_EDGE_TFVISIBLE|ME_EDGE_TFSEL, ME_EDGE_TFVISIBLE|ME_EDGE_TFSEL); + setlinestyle(0); + + /* Draw active face */ + for (a=0; atotface; a++) { + TFace *tf = &me->tface[a]; + + if (me->mface[a].v3 && (tf->flag&TF_ACTIVE)) { + if (!(tf->flag&TF_HIDE)) { + glColor3ub(255, 0, 0); + dm->drawEdgesFlag(dm, ME_EDGE_TFACTLAST, ME_EDGE_TFACTLAST); + glColor3ub(0, 255, 0); + dm->drawEdgesFlag(dm, ME_EDGE_TFACTFIRST, ME_EDGE_TFACTFIRST); + + if (tf->flag&TF_SELECT) { + glColor3ub(255, 255, 0); + } else { + glColor3ub(255, 0, 255); + } - if(activeFaceInSelection) cpack(0x00FFFF); - else cpack(0xFF00FF); + /* Draw remaining edges of active fact that are not first or last */ + dm->drawEdgesFlag(dm, ME_EDGE_TFACT|ME_EDGE_TFACTFIRST|ME_EDGE_TFACTLAST, ME_EDGE_TFACT|0|0); + } - glBegin(GL_LINE_STRIP); - PASSVERT(activeFace->v2); - PASSVERT(activeFace->v3); - if(activeFace->v4) PASSVERT(activeFace->v4); - glEnd(); - setlinestyle(0); + break; + } } bglPolygonOffset(0.0); // resets correctly now, even after calling accumulated offsets - - if (dmNeedsFree) - dm->release(dm); #undef PASSVERT } @@ -823,12 +741,14 @@ static int g_draw_tface_mesh_istex = 0; static unsigned char g_draw_tface_mesh_obcol[4]; static int draw_tface_mesh__set_draw(TFace *tface, int matnr) { + if (tface && ((tface->flag&TF_HIDE) || (tface->mode&TF_INVISIBLE))) return 0; + if (set_draw_settings_cached(0, g_draw_tface_mesh_istex, tface, g_draw_tface_mesh_islight, g_draw_tface_mesh_ob, matnr, TF_TWOSIDE)) { glColor3ub(0xFF, 0x00, 0xFF); - return 0; /* Don't set color */ + return 2; /* Don't set color */ } else if (tface && tface->mode&TF_OBCOL) { glColor3ubv(g_draw_tface_mesh_obcol); - return 0; /* Don't set color */ + return 2; /* Don't set color */ } else if (!tface) { Material *ma= give_current_material(g_draw_tface_mesh_ob, matnr); if(ma) glColor3f(ma->r, ma->g, ma->b); @@ -844,9 +764,12 @@ void draw_tface_mesh(Object *ob, Mesh *me, int dt) unsigned char obcol[4]; int a; short islight, istex; + DerivedMesh *dm; + int dmNeedsFree; if(me==NULL) return; + dm = mesh_get_derived_final(ob, &dmNeedsFree); glShadeModel(GL_SMOOTH); @@ -877,25 +800,16 @@ void draw_tface_mesh(Object *ob, Mesh *me, int dt) MFace *mface= me->mface; bProperty *prop = get_property(ob, "Text"); int editing= (G.f & (G_VERTEXPAINT+G_FACESELECT+G_TEXTUREPAINT+G_WEIGHTPAINT)) && (ob==((G.scene->basact) ? (G.scene->basact->object) : 0)); - DerivedMesh *dm; int start, totface; - int dmNeedsFree; - - if(editing) { - dm = mesh_get_derived_deform(ob, &dmNeedsFree); - } else { - dm = mesh_get_derived_final(ob, &dmNeedsFree); - } dm->drawFacesTex(dm, draw_tface_mesh__set_draw); - if (dmNeedsFree) dm->release(dm); - start = 0; totface = me->totface; if (!editing && prop && tface) { - dm = mesh_get_derived_deform(ob, &dmNeedsFree); + int dmNeedsFree; + DerivedMesh *dm = mesh_get_derived_deform(ob, &dmNeedsFree); tface+= start; for (a=start; atface) { + draw_tfaces3D(ob, me, dm); } /* XXX, bad patch - default_gl_light() calls diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c index 452ca3821c0..e2c9a8fff7f 100644 --- a/source/blender/src/drawobject.c +++ b/source/blender/src/drawobject.c @@ -1734,7 +1734,7 @@ static void draw_mesh_fancy(Object *ob, DerivedMesh *baseDM, DerivedMesh *dm, in } else { BIF_ThemeColor(TH_WIRE); } - dm->drawLooseEdges(dm); + dm->drawEdgesFlag(dm, ME_LOOSEEDGE, ME_LOOSEEDGE); } else if(dt==OB_SHADED) { if( (G.f & G_WEIGHTPAINT)) { diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c index 5b53db31dcf..e735f9c1254 100644 --- a/source/blender/src/editface.c +++ b/source/blender/src/editface.c @@ -64,11 +64,13 @@ #include "BKE_global.h" #include "BKE_mesh.h" #include "BKE_texture.h" +#include "BKE_object.h" #include "BSE_view.h" #include "BSE_edit.h" #include "BSE_drawview.h" /* for backdrawview3d */ +#include "BIF_editsima.h" #include "BIF_interface.h" #include "BIF_mywindow.h" #include "BIF_toolbox.h" @@ -589,6 +591,7 @@ void make_tfaces(Mesh *me) } } + void reveal_tface() { Mesh *me; @@ -610,8 +613,7 @@ void reveal_tface() BIF_undo_push("Reveal UV face"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + object_tface_flags_changed(OBACT, 0); } void hide_tface() @@ -644,10 +646,10 @@ void hide_tface() tface++; } + BIF_undo_push("Hide UV face"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); - + + object_tface_flags_changed(OBACT, 0); } void select_linked_tfaces(int mode) @@ -761,8 +763,8 @@ void select_linked_tfaces(int mode) MEM_freeN(linkflag); BIF_undo_push("Select linked UV face"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + + object_tface_flags_changed(OBACT, 0); } void deselectall_tface() @@ -795,8 +797,8 @@ void deselectall_tface() } BIF_undo_push("(De)select all UV face"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + + object_tface_flags_changed(OBACT, 0); } void selectswap_tface(void) @@ -820,8 +822,8 @@ void selectswap_tface(void) } BIF_undo_push("Select inverse UV face"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + + object_tface_flags_changed(OBACT, 0); } void rotate_uv_tface() @@ -886,10 +888,8 @@ void rotate_uv_tface() } BIF_undo_push("Rotate UV face"); - DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); - - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + + object_uvs_changed(OBACT); } void mirror_uv_tface() @@ -959,10 +959,8 @@ void mirror_uv_tface() } BIF_undo_push("Mirror UV face"); - DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); - - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + + object_uvs_changed(OBACT); } void minmax_tface(float *min, float *max) @@ -1111,9 +1109,8 @@ void face_select() /* image window redraw */ BIF_undo_push("Select UV face"); - allqueue(REDRAWIMAGE, 0); - allqueue(REDRAWBUTSEDIT, 0); - allqueue(REDRAWVIEW3D, 0); + + object_tface_flags_changed(OBACT, 1); } void face_borderselect() @@ -1173,8 +1170,7 @@ void face_borderselect() BIF_undo_push("Border Select UV face"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + object_tface_flags_changed(OBACT, 0); } #ifdef __APPLE__ glReadBuffer(GL_BACK); @@ -1772,7 +1768,7 @@ void get_same_uv(void) /* image window redraw */ BIF_undo_push("Get same UV"); - allqueue(REDRAWIMAGE, 0); - allqueue(REDRAWVIEW3D, 0); + + object_tface_flags_changed(OBACT, 0); } #endif /* NAN_TPT */ diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c index 93efcf66d6f..1e974bbdf84 100644 --- a/source/blender/src/editsima.c +++ b/source/blender/src/editsima.c @@ -63,6 +63,7 @@ #include "BKE_global.h" #include "BKE_mesh.h" #include "BKE_displist.h" +#include "BKE_object.h" #include "BKE_utildefines.h" #include "BIF_gl.h" @@ -96,7 +97,6 @@ void clever_numbuts_sima(void); void sel_uvco_inside_radius(short , TFace *, int , float *, float *, short); void uvedit_selectionCB(short , Object *, short *, float ); /* used in edit.c*/ - static int compuvvert(const void *u1, const void *u2) { const struct uvvertsort *v1=u1, *v2=u2; @@ -105,6 +105,36 @@ static int compuvvert(const void *u1, const void *u2) return 0; } +void object_uvs_changed(Object *ob) +{ + /* Unfortunately we also have to force an eval + * here because otherwise the modifier UVs might + * not be updated. Goes back to sillyness that + * recalc is done as part of view3d draw loop! + * + * Technically should scan all SpaceImas here. + */ + DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); + if(G.sima && (G.sima->flag & SI_DRAWSHADOW)) { + object_handle_update(ob); + } + + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWIMAGE, 0); +} + +void object_tface_flags_changed(Object *ob, int updateButtons) +{ + if (G.f&G_FACESELECT) { + DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); + object_handle_update(ob); + } + + if (updateButtons) allqueue(REDRAWBUTSEDIT, 0); + allqueue(REDRAWVIEW3D, 0); + allqueue(REDRAWIMAGE, 0); +} + int is_uv_tface_editing_allowed_silent(void) { Mesh *me; @@ -221,7 +251,7 @@ void clever_numbuts_sima(void) } } - allqueue(REDRAWVIEW3D, 0); + object_uvs_changed(OBACT); } } } @@ -690,7 +720,17 @@ void transform_tface_uv(int mode, int context) // 2 args, for callback xo= mval[0]; yo= mval[1]; - if(G.sima->lock) force_draw_plus(SPACE_VIEW3D, 0); + /* Need to force a recalculate since we may be + * drawing modified UVs. + */ + if(G.sima->flag & SI_DRAWSHADOW){ + DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); + object_handle_update(OBACT); + } + + if(G.sima->lock) { + force_draw_plus(SPACE_VIEW3D, 0); + } else force_draw(0); firsttime= 0; @@ -782,14 +822,10 @@ void transform_tface_uv(int mode, int context) // 2 args, for callback G.moving= 0; prop_size*= 3; - DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); - allqueue(REDRAWVIEW3D, 0); + object_uvs_changed(OBACT); if(event!=ESCKEY && event!=RIGHTMOUSE) BIF_undo_push("Transform UV"); - - scrarea_queue_headredraw(curarea); - scrarea_queue_winredraw(curarea); } void mirror_tface_uv(char mirroraxis) @@ -827,8 +863,7 @@ void mirror_tface_uv(char mirroraxis) } } - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + object_uvs_changed(OBACT); } void mirrormenu_tface_uv(void) @@ -898,8 +933,7 @@ void weld_align_tface_uv(char tool) } } - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + object_uvs_changed(OBACT); } void weld_align_menu_tface_uv(void) @@ -953,6 +987,7 @@ void select_swap_tface_uv(void) } BIF_undo_push("Select swap UV"); + allqueue(REDRAWIMAGE, 0); } @@ -1424,7 +1459,6 @@ void mouseco_to_curtile(void) scrarea_do_windraw(curarea); screen_swapbuffers(); - } G.sima->flag &= ~SI_EDITTILE; @@ -1469,9 +1503,10 @@ void hide_tface_uv(int swap) } } } + BIF_undo_push("Hide UV"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + + object_tface_flags_changed(OBACT, 0); } void reveal_tface_uv(void) @@ -1490,9 +1525,9 @@ void reveal_tface_uv(void) if(!(tface->flag & TF_SELECT)) tface->flag |= (TF_SELECT|TF_SEL1|TF_SEL2|TF_SEL3|TF_SEL4); - BIF_undo_push("Reveil UV"); - allqueue(REDRAWVIEW3D, 0); - allqueue(REDRAWIMAGE, 0); + BIF_undo_push("Reveal UV"); + + object_tface_flags_changed(OBACT, 0); } void stitch_uv_tface(int mode) @@ -1634,8 +1669,8 @@ void stitch_uv_tface(int mode) if(G.sima->flag & SI_CLIP_UV) tface_do_clip(); BIF_undo_push("Stitch UV"); - allqueue(REDRAWVIEW3D, 0); - scrarea_queue_winredraw(curarea); + + object_uvs_changed(OBACT); } void select_linked_tface_uv(int mode) diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c index 3a9bfe466a3..55fc3cb845d 100644 --- a/source/blender/src/header_image.c +++ b/source/blender/src/header_image.c @@ -45,6 +45,7 @@ #include "DNA_ID.h" #include "DNA_image_types.h" #include "DNA_mesh_types.h" +#include "DNA_object_types.h" #include "DNA_packedFile_types.h" #include "DNA_scene_types.h" #include "DNA_screen_types.h" @@ -58,6 +59,7 @@ #include "BKE_main.h" #include "BKE_packedFile.h" #include "BKE_utildefines.h" +#include "BKE_depsgraph.h" #include "BLI_blenlib.h" #include "BIF_drawimage.h" @@ -300,8 +302,8 @@ void do_image_buttons(unsigned short event) case B_CLIP_UV: tface_do_clip(); - allqueue(REDRAWIMAGE, 0); - allqueue(REDRAWVIEW3D, 0); + + if (OBACT) object_uvs_changed(OBACT); break; case B_SIMAGEPAINTTOOL: -- cgit v1.2.3