[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [17378] branches/soc-2008-mxcurioni/source /blender: Made changes to enable features line parameters (ridges/ valleys and suggestive contours) and add corresponding UI controls to the Freestyle tab in the Scene buttons .

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sun Nov 9 14:14:41 CET 2008


Revision: 17378
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17378
Author:   kjym3
Date:     2008-11-09 14:14:41 +0100 (Sun, 09 Nov 2008)

Log Message:
-----------
Made changes to enable features line parameters (ridges/valleys and suggestive contours) and add corresponding UI controls to the Freestyle tab in the Scene buttons.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
    branches/soc-2008-mxcurioni/source/blender/src/buttons_scene.c

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h	2008-11-09 12:59:01 UTC (rev 17377)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/FRS_freestyle.h	2008-11-09 13:14:41 UTC (rev 17378)
@@ -1,11 +1,17 @@
 #ifndef FRS_FREESTYLE_H
 #define FRS_FREESTYLE_H
 
+#define FREESTYLE_SUGGESTIVE_CONTOURS_FLAG  1
+#define FREESTYLE_RIDGES_AND_VALLEYS_FLAG   2
+
 #ifdef __cplusplus
 extern "C" {
 #endif	
 	
 	extern char style_module[255];
+	extern int freestyle_flags;
+	extern float freestyle_sphere_radius;
+	extern float freestyle_dkr_epsilon;
 	
 	void FRS_initialize();
 	void FRS_prepare(Render* re);

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp	2008-11-09 12:59:01 UTC (rev 17377)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/Controller.cpp	2008-11-09 13:14:41 UTC (rev 17378)
@@ -1071,14 +1071,6 @@
 	setFrontBufferFlag(false);
 	setBackBufferFlag(true);
 
-	// Ridges and Valleys
-	setComputeRidgesAndValleysFlag( false );
-	
-	// Suggestive Contours
-	setComputeSuggestiveContoursFlag( false );
-	setSphereRadius(1);
-	setSuggestiveContourKrDerivativeEpsilon(0);
-
 	// soc: initialize canvas
 	_Canvas->init();
 }

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-11-09 12:59:01 UTC (rev 17377)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-11-09 13:14:41 UTC (rev 17378)
@@ -8,6 +8,8 @@
 extern "C" {
 #endif
 
+#include "../../FRS_freestyle.h"
+
 #include "DNA_camera_types.h"
 
 #include "render_types.h"
@@ -32,6 +34,9 @@
 	static AppGLWidget *view = NULL;
 
 	char style_module[255] = "";
+	int freestyle_flags;
+	float freestyle_sphere_radius = 1.0;
+	float freestyle_dkr_epsilon = 0.001;
 
 	void FRS_initialize(){
 		
@@ -99,6 +104,17 @@
 		controller->InsertStyleModule( 0, style_module );
 		controller->toggleLayer(0, true);
 		
+		// set parameters
+		controller->setSphereRadius(freestyle_sphere_radius);
+		controller->setComputeRidgesAndValleysFlag((freestyle_flags & FREESTYLE_RIDGES_AND_VALLEYS_FLAG) ? true : false);
+		controller->setComputeSuggestiveContoursFlag((freestyle_flags & FREESTYLE_SUGGESTIVE_CONTOURS_FLAG) ? true : false);
+		controller->setSuggestiveContourKrDerivativeEpsilon(freestyle_dkr_epsilon);
+
+		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;
+
 		// compute view map
 		controller->ComputeViewMap();
 		

Modified: branches/soc-2008-mxcurioni/source/blender/src/buttons_scene.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/src/buttons_scene.c	2008-11-09 12:59:01 UTC (rev 17377)
+++ branches/soc-2008-mxcurioni/source/blender/src/buttons_scene.c	2008-11-09 13:14:41 UTC (rev 17378)
@@ -3311,6 +3311,10 @@
 	uiBlockBeginAlign(block);
 	uiDefIconBut(block, BUT, B_FS_FRS, ICON_FILESEL, 10, 190, 20, 20, 0, 0, 0, 0, 0, "Open Fileselect to get style module");
 	uiDefBut(block, TEX,0,"", 31, 190, 279, 20, style_module, 0.0,79.0, 0, 0, "Style module path name");
+	uiDefButF(block, NUM, B_NOP, "Sphere Radius", 10,170,300,20, &freestyle_sphere_radius, 0.0f, 100.0f, 10, 2, "Sphere radius (x mean edge size)");
+	uiDefButBitI(block, TOG, FREESTYLE_RIDGES_AND_VALLEYS_FLAG, B_NOP, "Ridges and Valleys", 10, 150, 150, 20, &freestyle_flags, 0, 0, 0, 0, "Compute ridges and valleys");
+	uiDefButBitI(block, TOG, FREESTYLE_SUGGESTIVE_CONTOURS_FLAG, B_NOP, "Suggestive Contours", 10, 130, 150, 20, &freestyle_flags, 0, 0, 0, 0, "Compute suggestive contours");
+	uiDefButF(block, NUM, B_NOP, "kr Derivative Epsilon", 10,110,300,20, &freestyle_dkr_epsilon, 0.0f, 10.0f, 0.1, 3, "Suggestive contour kr derivative epsilon");
 	uiBlockEndAlign(block);
 
 





More information about the Bf-blender-cvs mailing list