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:
-rw-r--r--release/scripts/ui/properties_render.py1
-rwxr-xr-xsource/blender/freestyle/intern/application/Controller.cpp12
-rwxr-xr-xsource/blender/freestyle/intern/application/Controller.h3
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp1
-rw-r--r--source/blender/freestyle/intern/python/BPy_Nature.cpp6
-rwxr-xr-xsource/blender/freestyle/intern/view_map/FEdgeXDetector.cpp25
-rwxr-xr-xsource/blender/freestyle/intern/view_map/FEdgeXDetector.h7
-rwxr-xr-xsource/blender/freestyle/intern/winged_edge/Nature.h2
-rw-r--r--source/blender/makesdna/DNA_freestyle_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_scene.c5
10 files changed, 63 insertions, 0 deletions
diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py
index bcfb34a20ac..f69cf309304 100644
--- a/release/scripts/ui/properties_render.py
+++ b/release/scripts/ui/properties_render.py
@@ -185,6 +185,7 @@ class RENDER_PT_layers(RenderButtonsPanel):
col.prop(freestyle, "sphere_radius", text="Sphere Radius")
col.prop(freestyle, "ridges_and_valleys", text="Ridges and Valleys")
col.prop(freestyle, "suggestive_contours", text="Suggestive Contours")
+ col.prop(freestyle, "material_boundaries", text="Material Boundaries")
col.prop(freestyle, "dkr_epsilon", text="Dkr Epsilon")
col.operator("scene.freestyle_module_add", text="Add Style Module")
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index 76c9023df57..707f4e7118c 100755
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -114,6 +114,7 @@ Controller::Controller()
_ComputeRidges = true;
_ComputeSteerableViewMap = false;
_ComputeSuggestive = true;
+ _ComputeMaterialBoundaries = true;
_sphereRadius = 1.0;
init_options();
@@ -466,6 +467,7 @@ void Controller::ComputeViewMap()
edgeDetector.enableOrthographicProjection(proj[3][3] != 0.0);
edgeDetector.enableRidgesAndValleysFlag(_ComputeRidges);
edgeDetector.enableSuggestiveContours(_ComputeSuggestive);
+ edgeDetector.enableMaterialBoundaries(_ComputeMaterialBoundaries);
edgeDetector.setSphereRadius(_sphereRadius);
edgeDetector.setSuggestiveContourKrDerivativeEpsilon(_suggestiveContourKrDerivativeEpsilon);
edgeDetector.processShapes(*_winged_edge);
@@ -647,6 +649,7 @@ void Controller::setComputeRidgesAndValleysFlag(bool iBool){
bool Controller::getComputeRidgesAndValleysFlag() const {
return _ComputeRidges;
}
+
void Controller::setComputeSuggestiveContoursFlag(bool b){
_ComputeSuggestive = b;
}
@@ -654,6 +657,15 @@ void Controller::setComputeSuggestiveContoursFlag(bool b){
bool Controller::getComputeSuggestiveContoursFlag() const {
return _ComputeSuggestive;
}
+
+void Controller::setComputeMaterialBoundariesFlag(bool b){
+ _ComputeMaterialBoundaries = b;
+}
+
+bool Controller::getComputeMaterialBoundariesFlag() const {
+ return _ComputeMaterialBoundaries;
+}
+
void Controller::setComputeSteerableViewMapFlag(bool iBool){
_ComputeSteerableViewMap = iBool;
}
diff --git a/source/blender/freestyle/intern/application/Controller.h b/source/blender/freestyle/intern/application/Controller.h
index 422707d3c1f..739e49c16ca 100755
--- a/source/blender/freestyle/intern/application/Controller.h
+++ b/source/blender/freestyle/intern/application/Controller.h
@@ -119,6 +119,8 @@ public:
bool getComputeRidgesAndValleysFlag() const ;
void setComputeSuggestiveContoursFlag(bool b);
bool getComputeSuggestiveContoursFlag() const ;
+ void setComputeMaterialBoundariesFlag(bool b);
+ bool getComputeMaterialBoundariesFlag() const ;
void setComputeSteerableViewMapFlag(bool iBool);
bool getComputeSteerableViewMapFlag() const;
@@ -222,6 +224,7 @@ private:
bool _EnableQI;
bool _ComputeRidges;
bool _ComputeSuggestive;
+ bool _ComputeMaterialBoundaries;
real _sphereRadius;
real _suggestiveContourKrDerivativeEpsilon;
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 1b22e1003d3..3aadbbb8deb 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -162,6 +162,7 @@ extern "C" {
controller->setSphereRadius( config->sphere_radius );
controller->setComputeRidgesAndValleysFlag( (config->flags & FREESTYLE_RIDGES_AND_VALLEYS_FLAG) ? true : false);
controller->setComputeSuggestiveContoursFlag( (config->flags & FREESTYLE_SUGGESTIVE_CONTOURS_FLAG) ? true : false);
+ controller->setComputeMaterialBoundariesFlag( (config->flags & FREESTYLE_MATERIAL_BOUNDARIES_FLAG) ? true : false);
controller->setSuggestiveContourKrDerivativeEpsilon( config->dkr_epsilon ) ;
cout << "Sphere radius : " << controller->getSphereRadius() << endl;
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp
index 3907ea75a66..be038d424e6 100644
--- a/source/blender/freestyle/intern/python/BPy_Nature.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp
@@ -174,6 +174,10 @@ static PyLongObject _Nature_SUGGESTIVE_CONTOUR = {
PyVarObject_HEAD_INIT(&Nature_Type, 1)
{ Nature::SUGGESTIVE_CONTOUR }
};
+static PyLongObject _Nature_MATERIAL_BOUNDARY = {
+ PyVarObject_HEAD_INIT(&Nature_Type, 1)
+ { Nature::MATERIAL_BOUNDARY }
+};
#define BPy_Nature_POINT ((PyObject *)&_Nature_POINT)
#define BPy_Nature_S_VERTEX ((PyObject *)&_Nature_S_VERTEX)
@@ -188,6 +192,7 @@ static PyLongObject _Nature_SUGGESTIVE_CONTOUR = {
#define BPy_Nature_RIDGE ((PyObject *)&_Nature_RIDGE)
#define BPy_Nature_VALLEY ((PyObject *)&_Nature_VALLEY)
#define BPy_Nature_SUGGESTIVE_CONTOUR ((PyObject *)&_Nature_SUGGESTIVE_CONTOUR)
+#define BPy_Nature_MATERIAL_BOUNDARY ((PyObject *)&_Nature_MATERIAL_BOUNDARY)
//-------------------MODULE INITIALIZATION--------------------------------
int Nature_Init( PyObject *module )
@@ -216,6 +221,7 @@ int Nature_Init( PyObject *module )
PyDict_SetItemString( Nature_Type.tp_dict, "RIDGE", BPy_Nature_RIDGE );
PyDict_SetItemString( Nature_Type.tp_dict, "VALLEY", BPy_Nature_VALLEY );
PyDict_SetItemString( Nature_Type.tp_dict, "SUGGESTIVE_CONTOUR", BPy_Nature_SUGGESTIVE_CONTOUR );
+ PyDict_SetItemString( Nature_Type.tp_dict, "MATERIAL_BOUNDARY", BPy_Nature_MATERIAL_BOUNDARY );
return 0;
}
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index 0551fd3ac15..ecab4fc413c 100755
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -64,6 +64,8 @@ void FEdgeXDetector::processShapes(WingedEdge& we) {
if (progressBarDisplay)
_pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
processBorderShape(wxs);
+ if(_computeMaterialBoundaries)
+ processMaterialBoundaryShape(wxs);
processCreaseShape(wxs);
if(_computeRidgesAndValleys)
processRidgesAndValleysShape(wxs);
@@ -679,6 +681,29 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) {
sc_layer->removeSmoothEdge();
}
+// MATERIAL_BOUNDARY
+////////////////////
+void FEdgeXDetector::processMaterialBoundaryShape(WXShape* iWShape) {
+
+ if(!_computeViewIndependant)
+ return;
+ // Make a pass on the edges to detect material boundaries
+ vector<WEdge*>::iterator we, weend;
+ vector<WEdge*> &wedges = iWShape->getEdgeList();
+ for(we=wedges.begin(), weend=wedges.end();
+ we!=weend;
+ ++we){
+ ProcessMaterialBoundaryEdge((WXEdge*)(*we));
+ }
+}
+
+void FEdgeXDetector::ProcessMaterialBoundaryEdge(WXEdge *iEdge)
+{
+ // check whether the edge is a material boundary?
+ if(iEdge->GetaFace()->frs_materialIndex() != iEdge->GetbFace()->frs_materialIndex()){
+ iEdge->AddNature(Nature::MATERIAL_BOUNDARY);
+ }
+}
// Build Smooth edges
/////////////////////
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
index 28034f3f42b..e0d76b5b0f9 100755
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
@@ -55,6 +55,7 @@ public:
_meanEdgeSize = 0;
_computeRidgesAndValleys = true;
_computeSuggestiveContours = true;
+ _computeMaterialBoundaries = true;
_sphereRadius = 1.0;
_orthographicProjection = false;
_changes = false;
@@ -103,6 +104,10 @@ public:
}
}
+ // MATERIAL BOUNDARY
+ virtual void FEdgeXDetector::processMaterialBoundaryShape(WXShape* iWShape);
+ virtual void FEdgeXDetector::ProcessMaterialBoundaryEdge(WXEdge *iEdge);
+
// EVERYBODY
virtual void buildSmoothEdges(WXShape* iShape);
@@ -111,6 +116,7 @@ public:
inline void enableOrthographicProjection(bool b) {_orthographicProjection = b;}
inline void enableRidgesAndValleysFlag(bool b) {_computeRidgesAndValleys = b;}
inline void enableSuggestiveContours(bool b) {_computeSuggestiveContours = b;}
+ inline void enableMaterialBoundaries(bool b) {_computeMaterialBoundaries = b;}
/*! 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
@@ -142,6 +148,7 @@ protected:
bool _computeRidgesAndValleys;
bool _computeSuggestiveContours;
+ bool _computeMaterialBoundaries;
real _sphereRadius; // expressed as a ratio of the mean edge size
bool _changes;
diff --git a/source/blender/freestyle/intern/winged_edge/Nature.h b/source/blender/freestyle/intern/winged_edge/Nature.h
index 1f165e677f5..52c9c60d8c7 100755
--- a/source/blender/freestyle/intern/winged_edge/Nature.h
+++ b/source/blender/freestyle/intern/winged_edge/Nature.h
@@ -69,6 +69,8 @@ namespace Nature {
static const EdgeNature VALLEY = (1 << 4); // 16
/*! true for suggestive contours */
static const EdgeNature SUGGESTIVE_CONTOUR = (1 << 5); // 32
+ /*! true for material boundaries */
+ static const EdgeNature MATERIAL_BOUNDARY = (1 << 6); // 64
} // end of namespace Nature
diff --git a/source/blender/makesdna/DNA_freestyle_types.h b/source/blender/makesdna/DNA_freestyle_types.h
index fb07f33b533..459a6e8cf9f 100644
--- a/source/blender/makesdna/DNA_freestyle_types.h
+++ b/source/blender/makesdna/DNA_freestyle_types.h
@@ -5,6 +5,7 @@
#define FREESTYLE_SUGGESTIVE_CONTOURS_FLAG 1
#define FREESTYLE_RIDGES_AND_VALLEYS_FLAG 2
+#define FREESTYLE_MATERIAL_BOUNDARIES_FLAG 4
typedef struct FreestyleModuleConfig {
struct FreestyleModuleConfig *next, *prev;
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 22cfb1c0a78..8c98ec74961 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1511,6 +1511,11 @@ static void rna_def_freestyle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys.");
RNA_def_property_update(prop, NC_SCENE, NULL);
+ prop= RNA_def_property(srna, "material_boundaries", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
+ RNA_def_property_ui_text(prop, "Material boundaries", "Enable material boundaries.");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
prop= RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
RNA_def_property_range(prop, 0.0, 1000.0);