[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43902] branches/soc-2008-mxcurioni: Reorganization of two view map construction parameters.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sun Feb 5 12:37:40 CET 2012


Revision: 43902
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43902
Author:   kjym3
Date:     2012-02-05 11:37:39 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Reorganization of two view map construction parameters.

* Sphere radius and Kr derivative epsilon were removed from the
Parameter Editor mode.  Now sphere radius of 1.0 and Kr derivative
epsilon of 0.0 are used by default.  The rationale of the removal
is two-fold: little predictability and very minor artistic values.
The effects of these parameters are hard to estimate in advance,
which likely leads to a frustration of users due to repeated
trials and unpredicted results.  Therefore, the two parameters
are considered to have quite limited artistic values.  Proper
definitions of the two parameters more and less require the
knowledge of differential geometry and would not make sense to
most artists for which the Parameter Editor is intended.

* Sphere radius and Kr derivative epsilon are still available in
the Python Scripting mode, but now in an "advanced options" section
that is disabled and hidden by default.  This way new users are
properly warned, while expert users with specific technical needs
can enable these options if they want.  The same default values
mentioned above are used when the two parameters are disabled.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c

Modified: branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py	2012-02-05 11:30:26 UTC (rev 43901)
+++ branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py	2012-02-05 11:37:39 UTC (rev 43902)
@@ -207,12 +207,11 @@
         col.prop(freestyle, "raycasting_algorithm", text="Raycasting Algorithm")
         col.prop(freestyle, "mode", text="Control Mode")
 
+        col.label(text="Edge Detection Options:")
+        col.prop(freestyle, "use_smoothness")
+        col.prop(freestyle, "crease_angle")
+
         if freestyle.mode == "EDITOR":
-            col.label(text="Edge Detection Options:")
-            col.prop(freestyle, "use_smoothness")
-            col.prop(freestyle, "crease_angle")
-            col.prop(freestyle, "sphere_radius")
-            col.prop(freestyle, "kr_derivative_epsilon")
 
             lineset = freestyle.linesets.active
 
@@ -236,15 +235,14 @@
 
         else: # freestyle.mode == "SCRIPT"
 
-            col.prop(freestyle, "use_smoothness")
-            col.prop(freestyle, "crease_angle")
-            col.prop(freestyle, "sphere_radius")
+            col.prop(freestyle, "use_material_boundaries")
             col.prop(freestyle, "use_ridges_and_valleys")
             col.prop(freestyle, "use_suggestive_contours")
-            sub = col.row()
-            sub.prop(freestyle, "kr_derivative_epsilon")
-            sub.active = freestyle.use_suggestive_contours
-            col.prop(freestyle, "use_material_boundaries")
+            col.prop(freestyle, "use_advanced_options")
+            if freestyle.use_advanced_options:
+                col.prop(freestyle, "sphere_radius")
+                col.prop(freestyle, "kr_derivative_epsilon")
+            col.separator()
             col.operator("scene.freestyle_module_add")
 
             for i, module in enumerate(freestyle.modules):

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	2012-02-05 11:30:26 UTC (rev 43901)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2012-02-05 11:37:39 UTC (rev 43902)
@@ -34,6 +34,9 @@
 #include "../../FRS_freestyle.h"
 #include "../../FRS_freestyle_config.h"
 
+#define DEFAULT_SPHERE_RADIUS  1.0f
+#define DEFAULT_DKR_EPSILON    0.0f
+
 	// Freestyle configuration
 	static short freestyle_is_initialized = 0;
 	static Config::Path *pathconfig = NULL;
@@ -330,10 +333,15 @@
 		}
 		
 		// set parameters
+		if (config->mode == FREESTYLE_CONTROL_SCRIPT_MODE && (config->flags & FREESTYLE_ADVANCED_OPTIONS_FLAG)) {
+			controller->setSphereRadius( config->sphere_radius );
+			controller->setSuggestiveContourKrDerivativeEpsilon( config->dkr_epsilon );
+		} else {
+			controller->setSphereRadius( DEFAULT_SPHERE_RADIUS );
+			controller->setSuggestiveContourKrDerivativeEpsilon( DEFAULT_DKR_EPSILON );
+		}
 		controller->setFaceSmoothness( (config->flags & FREESTYLE_FACE_SMOOTHNESS_FLAG) ? true : false);
 		controller->setCreaseAngle( config->crease_angle );
-		controller->setSphereRadius( config->sphere_radius );
-		controller->setSuggestiveContourKrDerivativeEpsilon( config->dkr_epsilon ) ;
 		controller->setVisibilityAlgo( config->raycasting_algorithm );
 
 		cout << "Crease angle : " << controller->getCreaseAngle() << endl;
@@ -500,8 +508,8 @@
 
 		config->modules.first = config->modules.last = NULL;
 		config->flags = 0;
-		config->sphere_radius = 1.0f;
-		config->dkr_epsilon = 0.001f;
+		config->sphere_radius = DEFAULT_SPHERE_RADIUS;
+		config->dkr_epsilon = DEFAULT_DKR_EPSILON;
 		config->crease_angle = 134.43f;
 
 		config->linesets.first = config->linesets.last = NULL;

Modified: branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h	2012-02-05 11:30:26 UTC (rev 43901)
+++ branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_freestyle_types.h	2012-02-05 11:37:39 UTC (rev 43902)
@@ -40,6 +40,7 @@
 #define FREESTYLE_RIDGES_AND_VALLEYS_FLAG   2
 #define FREESTYLE_MATERIAL_BOUNDARIES_FLAG  4
 #define FREESTYLE_FACE_SMOOTHNESS_FLAG      8
+#define FREESTYLE_ADVANCED_OPTIONS_FLAG     16
 
 /* FreestyleConfig::mode */
 #define FREESTYLE_CONTROL_SCRIPT_MODE  1

Modified: branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c	2012-02-05 11:30:26 UTC (rev 43901)
+++ branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_scene.c	2012-02-05 11:37:39 UTC (rev 43902)
@@ -2523,6 +2523,11 @@
 	RNA_def_property_ui_text(prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
+	prop= RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
+	RNA_def_property_ui_text(prop, "Advanced Edge Detection Options", "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
+	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);




More information about the Bf-blender-cvs mailing list