From f84e8e76406a30bd15e6e55e41714e62826315aa Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Thu, 6 Oct 2011 02:04:43 +0000 Subject: Fine control of feature edge selection with mesh face and edge marks. New "face marks" and "edge marks" have been introduced in mesh data blocks. In the edit mode of a mesh object, face marks can be put to selected faces by choosing Mesh >> Faces >> Mark Freestyle Face from the menu of a 3D View window or Ctrl-F >> Mark Freestyle Face from the context menu. Similarly, edge marks can be put to selected edges by Mesh >> Edges >> Mark Freestyle Edge or Ctrl-E >> Mark Freestyle Edge. These marks should work fine with the Subdivision surface modifier. Moreover, two new conditions for feature edge selection have been added to the Parameter Editor mode as described below: 1. The Selection by Edge Types option has now the new Edge Mark type, which can be used to (de)select feature edges having edge marks. This option can be used to add to (or remove from) the view map arbitrary edges of mesh objects. 2. Selection by Face Marks option has been newly introduced, in which face marks are used for feature edge selection in two ways. One option is called "One Face" which is to (de)select feature edges if one of faces on the left and right of each feature edge has a face mark. The other option is "Both Faces" to (de)select feature edges if both faces on the left and right have a face mark. --- .../intern/winged_edge/WingedEdgeBuilder.cpp | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp') diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index a0a80b7ef64..40c14eafe72 100755 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -102,6 +102,8 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { // else if(_current_frs_material) // shape.setFrsMaterial(*_current_frs_material); + const IndexedFaceSet::FaceEdgeMark *faceEdgeMarks = ifs.faceEdgeMarks(); + // sets the current WShape to shape _current_wshape = &shape; @@ -128,6 +130,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { new_normals, frs_materials, texCoords, + faceEdgeMarks, vindices, nindices, mindices, @@ -139,6 +142,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { new_normals, frs_materials, texCoords, + faceEdgeMarks, vindices, nindices, mindices, @@ -150,6 +154,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { new_normals, frs_materials, texCoords, + faceEdgeMarks, vindices, nindices, mindices, @@ -163,6 +168,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) { mindices += numVertexPerFace[index]; if(tindices) tindices += numVertexPerFace[index]; + faceEdgeMarks++; } delete[] new_vertices; @@ -219,6 +225,7 @@ void WingedEdgeBuilder::buildTriangleStrip( const real *vertices, const real *normals, vector& iMaterials, const real *texCoords, + const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, const unsigned *vindices, const unsigned *nindices, const unsigned *mindices, @@ -232,6 +239,7 @@ void WingedEdgeBuilder::buildTriangleStrip( const real *vertices, vector triangleVertices; vector triangleNormals; vector triangleTexCoords; + vector triangleFaceEdgeMarks; while(nDoneVertices < nvertices) { @@ -270,10 +278,14 @@ void WingedEdgeBuilder::buildTriangleStrip( const real *vertices, triangleTexCoords.push_back(Vec2r(texCoords[tindices[nTriangle+1]], texCoords[tindices[nTriangle+1]+1])); } } + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::FACE_MARK) != 0); + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::EDGE_MARK_V1V2) != 0); + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::EDGE_MARK_V2V3) != 0); + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[nTriangle/3] & IndexedFaceSet::EDGE_MARK_V3V1) != 0); if(mindices) - currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, mindices[nTriangle/3]); + currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, mindices[nTriangle/3]); else - currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, 0); + currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, 0); nDoneVertices++; // with a strip, each triangle is one vertex more nTriangle++; } @@ -283,6 +295,7 @@ void WingedEdgeBuilder::buildTriangleFan( const real *vertices, const real *normals, vector& iMaterials, const real *texCoords, + const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, const unsigned *vindices, const unsigned *nindices, const unsigned *mindices, @@ -295,6 +308,7 @@ void WingedEdgeBuilder::buildTriangles(const real *vertices, const real *normals, vector& iMaterials, const real *texCoords, + const IndexedFaceSet::FaceEdgeMark *iFaceEdgeMarks, const unsigned *vindices, const unsigned *nindices, const unsigned *mindices, @@ -304,6 +318,7 @@ void WingedEdgeBuilder::buildTriangles(const real *vertices, vector triangleVertices; vector triangleNormals; vector triangleTexCoords; + vector triangleFaceEdgeMarks; // Each triplet of vertices is considered as an independent triangle for(unsigned i = 0; i < nvertices / 3; i++) @@ -321,11 +336,16 @@ void WingedEdgeBuilder::buildTriangles(const real *vertices, triangleTexCoords.push_back(Vec2r(texCoords[tindices[3*i+1]],texCoords[tindices[3*i+1]+1])); triangleTexCoords.push_back(Vec2r(texCoords[tindices[3*i+2]], texCoords[tindices[3*i+2]+1])); } + + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::FACE_MARK) != 0); + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V1V2) != 0); + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V2V3) != 0); + triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V3V1) != 0); } if(mindices) - currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, mindices[0]); + currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, mindices[0]); else - currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords,0); + currentShape->MakeFace(triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, 0); } -- cgit v1.2.3