[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31151] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/blender_interface/FRS_freestyle.cpp: Automatic configuration of feature edge detection options.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sun Aug 8 00:48:25 CEST 2010


Revision: 31151
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31151
Author:   kjym3
Date:     2010-08-08 00:48:25 +0200 (Sun, 08 Aug 2010)

Log Message:
-----------
Automatic configuration of feature edge detection options.

In the Parameter Editor mode, three feature edge detection
options (i.e., Ridges and Valleys, Suggestive Contours, and
Material Boundaries) are automatically configured based on
feature edge selection settings of linesets.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2010-08-07 20:57:45 UTC (rev 31150)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2010-08-07 22:48:25 UTC (rev 31151)
@@ -171,8 +171,14 @@
 				}
 			}
 			cout << endl;
+			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);
 			break;
 		case FREESTYLE_CONTROL_EDITOR_MODE:
+			int use_ridges_and_valleys = 0;
+			int use_suggestive_contours = 0;
+			int use_material_boundaries = 0;
 			cout << "Linesets:"<< endl;
 			for (FreestyleLineSet *lineset = (FreestyleLineSet *)config->linesets.first; lineset; lineset = lineset->next) {
 				if (lineset->flags & FREESTYLE_LINESET_ENABLED) {
@@ -180,25 +186,47 @@
 					Text *text = create_lineset_handler(srl->name, lineset->name);
 					controller->InsertStyleModule( layer_count, lineset->name, text );
 					controller->toggleLayer(layer_count, true);
+					if (!(lineset->selection & FREESTYLE_SEL_EDGE_TYPES) || !lineset->edge_types) {
+						++use_ridges_and_valleys;
+						++use_suggestive_contours;
+						++use_material_boundaries;
+					} else if (lineset->flags & FREESTYLE_LINESET_FE_NOT) {
+						if (!(lineset->edge_types & ~FREESTYLE_FE_RIDGE) ||
+							!(lineset->edge_types & ~FREESTYLE_FE_VALLEY) ||
+							(lineset->flags & FREESTYLE_LINESET_FE_AND))
+								++use_ridges_and_valleys;
+						if (lineset->edge_types & ~FREESTYLE_FE_SUGGESTIVE_CONTOUR)
+							++use_suggestive_contours;
+						if (lineset->edge_types & ~FREESTYLE_FE_MATERIAL_BOUNDARY)
+							++use_material_boundaries;
+					} else {
+						if (lineset->edge_types & (FREESTYLE_FE_RIDGE | FREESTYLE_FE_VALLEY))
+							++use_ridges_and_valleys;
+						if (lineset->edge_types & FREESTYLE_FE_SUGGESTIVE_CONTOUR)
+							++use_suggestive_contours;
+						if (lineset->edge_types & FREESTYLE_FE_MATERIAL_BOUNDARY)
+							++use_material_boundaries;
+					}
 					layer_count++;
 				}
 			}
+			controller->setComputeRidgesAndValleysFlag( use_ridges_and_valleys > 0 );
+			controller->setComputeSuggestiveContoursFlag( use_suggestive_contours > 0 );
+			controller->setComputeMaterialBoundariesFlag( use_material_boundaries > 0 );
 			break;
 		}
 		
 		// set parameters
 		controller->setCreaseAngle( config->crease_angle );
 		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 << "Crease angle : " << controller->getCreaseAngle() << endl;
 		cout << "Sphere radius : " << controller->getSphereRadius() << endl;
 		cout << "Redges and valleys : " << (controller->getComputeRidgesAndValleysFlag() ? "enabled" : "disabled") << endl;
 		cout << "Suggestive contours : " << (controller->getComputeSuggestiveContoursFlag() ? "enabled" : "disabled") << endl;
-		cout << "Suggestive contour dkr epsilon : " << controller->getSuggestiveContourKrDerivativeEpsilon() << endl;
+		cout << "Suggestive contour Kr derivative epsilon : " << controller->getSuggestiveContourKrDerivativeEpsilon() << endl;
+		cout << "Material boundaries : " << (controller->getComputeMaterialBoundariesFlag() ? "enabled" : "disabled") << endl;
 		cout << endl;
 
         // set diffuse and z depth passes





More information about the Bf-blender-cvs mailing list