Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-10-06 06:04:43 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-10-06 06:04:43 +0400
commitf84e8e76406a30bd15e6e55e41714e62826315aa (patch)
treee4a077ee05de21155421b35854162ad5f29c53b3 /source/blender/freestyle/intern/view_map
parentcb4f6629279ba9792cc46114fe603bebff11c6a3 (diff)
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.
Diffstat (limited to 'source/blender/freestyle/intern/view_map')
-rwxr-xr-xsource/blender/freestyle/intern/view_map/FEdgeXDetector.cpp21
-rwxr-xr-xsource/blender/freestyle/intern/view_map/FEdgeXDetector.h11
-rwxr-xr-xsource/blender/freestyle/intern/view_map/Silhouette.h25
-rwxr-xr-xsource/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp8
4 files changed, 65 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index 93e3354cb6a..1cbed8a87c6 100755
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -72,6 +72,7 @@ void FEdgeXDetector::processShapes(WingedEdge& we) {
if(_computeSuggestiveContours)
processSuggestiveContourShape(wxs);
processSilhouetteShape(wxs);
+ processEdgeMarksShape(wxs);
if (progressBarDisplay)
_pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
@@ -708,6 +709,26 @@ void FEdgeXDetector::ProcessMaterialBoundaryEdge(WXEdge *iEdge)
}
}
+// EDGE MARKS
+/////////////
+
+void FEdgeXDetector::processEdgeMarksShape(WXShape* iShape) {
+ // Make a pass on the edges to detect material boundaries
+ vector<WEdge*>::iterator we, weend;
+ vector<WEdge*> &wedges = iShape->getEdgeList();
+ for(we=wedges.begin(), weend=wedges.end();
+ we!=weend;
+ ++we){
+ ProcessEdgeMarks((WXEdge*)(*we));
+ }
+}
+
+void FEdgeXDetector::ProcessEdgeMarks(WXEdge *iEdge) {
+ if (iEdge->GetMark()) {
+ iEdge->AddNature(Nature::EDGE_MARK);
+ }
+}
+
// Build Smooth edges
/////////////////////
void FEdgeXDetector::buildSmoothEdges(WXShape* iShape){
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
index d08d75a84b6..d73a086f81d 100755
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
@@ -127,6 +127,10 @@ public:
virtual void processMaterialBoundaryShape(WXShape* iWShape);
virtual void ProcessMaterialBoundaryEdge(WXEdge *iEdge);
+ // EDGE MARKS
+ virtual void processEdgeMarksShape(WXShape* iShape);
+ virtual void ProcessEdgeMarks(WXEdge *iEdge);
+
// EVERYBODY
virtual void buildSmoothEdges(WXShape* iShape);
@@ -142,6 +146,12 @@ public:
_changes=true;
}
}
+ inline void enableFaceMarks(bool b) {
+ if (b != _faceMarks) {
+ _faceMarks = b;
+ _changes=true;
+ }
+ }
/*! Sets the radius of the geodesic sphere around each vertex (for the curvature computation)
* \param r
* The radius of the sphere expressed as a ratio of the mean edge size
@@ -175,6 +185,7 @@ protected:
bool _computeSuggestiveContours;
bool _computeMaterialBoundaries;
bool _faceSmoothness;
+ bool _faceMarks;
real _sphereRadius; // expressed as a ratio of the mean edge size
real _creaseAngle; // [-1, 1] compared with the inner product of face normals
bool _changes;
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h
index e7533f659d6..d0952ec8933 100755
--- a/source/blender/freestyle/intern/view_map/Silhouette.h
+++ b/source/blender/freestyle/intern/view_map/Silhouette.h
@@ -798,6 +798,8 @@ protected:
Vec3r _bNormal; // When following the edge, normal of the left face
unsigned _aFrsMaterialIndex;
unsigned _bFrsMaterialIndex;
+ bool _aFaceMark;
+ bool _bFaceMark;
public:
/*! Returns the string "FEdgeSharp" . */
@@ -807,10 +809,12 @@ public:
/*! Default constructor. */
inline FEdgeSharp() : FEdge(){
_aFrsMaterialIndex = _bFrsMaterialIndex = 0;
+ _aFaceMark = _bFaceMark = false;
}
/*! Builds an FEdgeSharp going from vA to vB. */
inline FEdgeSharp(SVertex *vA, SVertex *vB) : FEdge(vA, vB){
_aFrsMaterialIndex = _bFrsMaterialIndex = 0;
+ _aFaceMark = _bFaceMark = false;
}
/*! Copy constructor. */
inline FEdgeSharp(FEdgeSharp& iBrother) : FEdge(iBrother){
@@ -818,6 +822,9 @@ public:
_bNormal = iBrother._bNormal;
_aFrsMaterialIndex = iBrother._aFrsMaterialIndex;
_bFrsMaterialIndex = iBrother._bFrsMaterialIndex;
+ _aFaceMark = iBrother._aFaceMark;
+ _bFaceMark = iBrother._bFaceMark;
+
}
/*! Destructor. */
virtual ~FEdgeSharp() {}
@@ -853,6 +860,12 @@ public:
* left of the FEdge.
*/
const FrsMaterial& bFrsMaterial() const ;
+ /*! Returns the face mark of the face lying on the right of the FEdge.
+ * If this FEdge is a border, it has no Face on its right and thus
+ * false is returned. */
+ inline bool aFaceMark() const {return _aFaceMark;}
+ /*! Returns the face mark of the face lying on the left of the FEdge. */
+ inline bool bFaceMark() const {return _bFaceMark;}
/*! Sets the normal to the face lying on the right of the FEdge. */
inline void setNormalA(const Vec3r& iNormal) {_aNormal = iNormal;}
@@ -862,6 +875,10 @@ public:
inline void setaFrsMaterialIndex(unsigned i) {_aFrsMaterialIndex = i;}
/*! Sets the index of the material lying on the left of the FEdge.*/
inline void setbFrsMaterialIndex(unsigned i) {_bFrsMaterialIndex = i;}
+ /*! Sets the face mark of the face lying on the right of the FEdge. */
+ inline void setaFaceMark(bool iFaceMark) {_aFaceMark = iFaceMark;}
+ /*! Sets the face mark of the face lying on the left of the FEdge. */
+ inline void setbFaceMark(bool iFaceMark) {_bFaceMark = iFaceMark;}
};
@@ -879,6 +896,7 @@ protected:
// Vec3r _VisibilityPointB; // using its 2 extremity points A and B
void * _Face; // In case of exact silhouette, Face is the WFace crossed by Fedge
// NON GERE PAR LE COPY CONSTRUCTEUR
+ bool _FaceMark;
public:
/*! Returns the string "FEdgeSmooth" . */
virtual string getExactTypeName() const {
@@ -887,12 +905,14 @@ public:
/*! Default constructor. */
inline FEdgeSmooth() : FEdge(){
_Face=0;
+ _FaceMark = false;
_FrsMaterialIndex = 0;
_isSmooth = true;
}
/*! Builds an FEdgeSmooth going from vA to vB. */
inline FEdgeSmooth(SVertex *vA, SVertex *vB) : FEdge(vA, vB){
_Face=0;
+ _FaceMark = false;
_FrsMaterialIndex = 0;
_isSmooth = true;
@@ -901,6 +921,7 @@ public:
inline FEdgeSmooth(FEdgeSmooth& iBrother) : FEdge(iBrother){
_Normal = iBrother._Normal;
_Face = iBrother._Face;
+ _FaceMark = iBrother._FaceMark;
_FrsMaterialIndex = iBrother._FrsMaterialIndex;
_isSmooth = true;
}
@@ -913,6 +934,8 @@ public:
}
inline void * face() const {return _Face;}
+ /*! Returns the face mark of the face it is running across. */
+ inline bool faceMark() const {return _FaceMark;}
/*! Returns the normal to the Face it is running accross. */
inline const Vec3r& normal() {return _Normal;}
/*! Returns the index of the material of the face it is running accross. */
@@ -921,6 +944,8 @@ public:
const FrsMaterial& frs_material() const ;
inline void setFace(void * iFace) {_Face = iFace;}
+ /*! Sets the face mark of the face it is running across. */
+ inline void setFaceMark(bool iFaceMark) {_FaceMark = iFaceMark;}
/*! Sets the normal to the Face it is running accross. */
inline void setNormal(const Vec3r& iNormal) {_Normal = iNormal;}
/*! Sets the index of the material of the face it is running accross. */
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
index 3e0979f684f..47c4ec05e4f 100755
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
@@ -472,6 +472,7 @@ FEdge * ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer
fe->setId(_currentFId);
fe->setFrsMaterialIndex(ifl.fl->getFace()->frs_materialIndex());
fe->setFace(ifl.fl->getFace());
+ fe->setFaceMark(ifl.fl->getFace()->GetMark());
fe->setNormal(normal);
fe->setPreviousEdge(feprevious);
if(feprevious)
@@ -585,19 +586,24 @@ FEdge * ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge& iwe)
// get the faces normals and the material indices
Vec3r normalA, normalB;
unsigned matA(0), matB(0);
+ bool faceMarkA = false, faceMarkB = false;
if(iwe.order){
normalB = (iwe.e->GetbFace()->GetNormal());
matB = (iwe.e->GetbFace()->frs_materialIndex());
+ faceMarkB = (iwe.e->GetbFace()->GetMark());
if(!(iwe.e->nature() & Nature::BORDER)) {
normalA = (iwe.e->GetaFace()->GetNormal());
matA = (iwe.e->GetaFace()->frs_materialIndex());
+ faceMarkA = (iwe.e->GetaFace()->GetMark());
}
}else{
normalA = (iwe.e->GetbFace()->GetNormal());
matA = (iwe.e->GetbFace()->frs_materialIndex());
+ faceMarkA = (iwe.e->GetbFace()->GetMark());
if(!(iwe.e->nature() & Nature::BORDER)) {
normalB = (iwe.e->GetaFace()->GetNormal());
matB = (iwe.e->GetaFace()->frs_materialIndex());
+ faceMarkB = (iwe.e->GetaFace()->GetMark());
}
}
// Creates the corresponding feature edge
@@ -607,6 +613,8 @@ FEdge * ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge& iwe)
fe->setId(_currentFId);
fe->setaFrsMaterialIndex(matA);
fe->setbFrsMaterialIndex(matB);
+ fe->setaFaceMark(faceMarkA);
+ fe->setbFaceMark(faceMarkB);
fe->setNormalA(normalA);
fe->setNormalB(normalB);
fe->setPreviousEdge(feprevious);