[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42576] branches/soc-2008-mxcurioni: Updates on the Parameter Editor mode:

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Mon Dec 12 00:41:21 CET 2011


Revision: 42576
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42576
Author:   kjym3
Date:     2011-12-11 23:41:15 +0000 (Sun, 11 Dec 2011)
Log Message:
-----------
Updates on the Parameter Editor mode:

* Added a new chain splitting option for dividing chains into pieces having
a given curvilinear 2D length.

* Rearranged the UI controls of chain splitting options according to the
actual order of processing.

* Made changes for converting each view edge into a chain in the case of
not using chaining.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
    branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py
    branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2011-12-11 21:23:29 UTC (rev 42575)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2011-12-11 23:41:15 UTC (rev 42576)
@@ -818,6 +818,23 @@
             return True
         return False
 
+class Length2DThresholdUP0D(UnaryPredicate0D):
+    def __init__(self, length_limit):
+        UnaryPredicate0D.__init__(self)
+        self._length_limit = length_limit
+        self._t = 0.0
+    def getName(self):
+        return "Length2DThresholdUP0D"
+    def __call__(self, inter):
+        t = inter.t() # curvilinear abscissa
+        if t < self._t:
+            self._t = 0.0
+            return False
+        if t - self._t < self._length_limit:
+            return False
+        self._t = t
+        return True
+
 # Seed for random number generation
 
 class Seed:
@@ -939,6 +956,8 @@
                 Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(linestyle.rounds))
             else:
                 Operators.bidirectionalChain(pySketchyChainingIterator(linestyle.rounds))
+    else:
+        Operators.chain(ChainPredicateIterator(FalseUP1D(), FalseBP1D()), NotUP1D(upred))
     # split chains
     if linestyle.material_boundary:
         Operators.sequentialSplit(MaterialBoundaryUP0D())
@@ -946,6 +965,8 @@
         min_angle = linestyle.min_angle if linestyle.use_min_angle else None
         max_angle = linestyle.max_angle if linestyle.use_max_angle else None
         Operators.sequentialSplit(Curvature2DAngleThresholdUP0D(min_angle, max_angle))
+    if linestyle.use_split_length:
+        Operators.sequentialSplit(Length2DThresholdUP0D(linestyle.split_length), 1.0)
     # select chains
     if linestyle.use_min_length or linestyle.use_max_length:
         min_length = linestyle.min_length if linestyle.use_min_length else None

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	2011-12-11 21:23:29 UTC (rev 42575)
+++ branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py	2011-12-11 23:41:15 UTC (rev 42576)
@@ -598,30 +598,34 @@
             # Splitting
             col = layout.column()
             col.label(text="Splitting:")
-            sub = col.row()
-            subcol = sub.column()
-            subcol.prop(linestyle, "use_min_angle", text="Min Angle")
-            subsub = subcol.split()
+            row = col.row()
+            row.prop(linestyle, "material_boundary")
+            row = col.row()
+            sub = row.column()
+            sub.prop(linestyle, "use_min_angle", text="Min 2D Angle")
+            subsub = sub.split()
             subsub.prop(linestyle, "min_angle", text="")
             subsub.enabled = linestyle.use_min_angle
-            subcol = sub.column()
-            subcol.prop(linestyle, "use_max_angle", text="Max Angle")
-            subsub = subcol.split()
+            sub = row.column()
+            sub.prop(linestyle, "use_max_angle", text="Max 2D Angle")
+            subsub = sub.split()
             subsub.prop(linestyle, "max_angle", text="")
             subsub.enabled = linestyle.use_max_angle
+            col.prop(linestyle, "use_split_length", text="2D Length")
             row = col.row()
-            row.prop(linestyle, "material_boundary")
+            row.prop(linestyle, "split_length", text="")
+            row.enabled = linestyle.use_split_length
             # Selection
             col = layout.column()
             col.label(text="Selection:")
             sub = col.row()
             subcol = sub.column()
-            subcol.prop(linestyle, "use_min_length", text="Min Length")
+            subcol.prop(linestyle, "use_min_length", text="Min 2D Length")
             subsub = subcol.split()
             subsub.prop(linestyle, "min_length", text="")
             subsub.enabled = linestyle.use_min_length
             subcol = sub.column()
-            subcol.prop(linestyle, "use_max_length", text="Max Length")
+            subcol.prop(linestyle, "use_max_length", text="Max 2D Length")
             subsub = subcol.split()
             subsub.prop(linestyle, "max_length", text="")
             subsub.enabled = linestyle.use_max_length

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c	2011-12-11 21:23:29 UTC (rev 42575)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c	2011-12-11 23:41:15 UTC (rev 42576)
@@ -79,6 +79,7 @@
 	linestyle->max_angle = 0.0f;
 	linestyle->min_length = 0.0f;
 	linestyle->max_length = 10000.0f;
+	linestyle->split_length = 100;
 
 	linestyle->color_modifiers.first = linestyle->color_modifiers.last = NULL;
 	linestyle->alpha_modifiers.first = linestyle->alpha_modifiers.last = NULL;
@@ -140,6 +141,7 @@
 	new_linestyle->max_angle = linestyle->max_angle;
 	new_linestyle->min_length = linestyle->min_length;
 	new_linestyle->max_length = linestyle->max_length;
+	new_linestyle->split_length = linestyle->split_length;
 	new_linestyle->dash1 = linestyle->dash1;
 	new_linestyle->gap1 = linestyle->gap1;
 	new_linestyle->dash2 = linestyle->dash2;

Modified: branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h	2011-12-11 21:23:29 UTC (rev 42575)
+++ branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h	2011-12-11 23:41:15 UTC (rev 42576)
@@ -360,6 +360,7 @@
 #define LS_NO_CHAINING        64
 #define LS_MIN_2D_ANGLE       128
 #define LS_MAX_2D_ANGLE       256
+#define LS_SPLIT_LENGTH       512
 
 /* FreestyleLineStyle::chaining */
 #define LS_CHAINING_PLAIN    1
@@ -379,11 +380,11 @@
 	int flag, caps;
 	int chaining;
 	unsigned int rounds;
+	float split_length;
 	float min_angle, max_angle; /* for splitting */
 	float min_length, max_length;
 	unsigned short dash1, gap1, dash2, gap2, dash3, gap3;
 	int panel; /* for UI */
-	int pad1;
 
 	ListBase color_modifiers;
 	ListBase alpha_modifiers;

Modified: branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c	2011-12-11 21:23:29 UTC (rev 42575)
+++ branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c	2011-12-11 23:41:15 UTC (rev 42576)
@@ -823,6 +823,17 @@
 	RNA_def_property_ui_text(prop, "Same Object", "If true, only feature edges of the same object are joined");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
+	prop= RNA_def_property(srna, "use_split_length", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_LENGTH);
+	RNA_def_property_ui_text(prop, "Use Split Length", "Enable chain splitting by curvilinear 2D length");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
+
+	prop= RNA_def_property(srna, "split_length", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "split_length");
+	RNA_def_property_range(prop, 0.0f, 10000.0f);
+	RNA_def_property_ui_text(prop, "Split Length", "Curvilinear 2D length for chain splitting");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
+
 	prop= RNA_def_property(srna, "use_min_angle", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_ANGLE);
 	RNA_def_property_ui_text(prop, "Use Min 2D Angle", "Split chains at points with angles smaller than the minimum 2D angle");
@@ -853,7 +864,7 @@
 	prop= RNA_def_property(srna, "min_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "min_length");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
-	RNA_def_property_ui_text(prop, "Min 2D Length", "Minimum 2D length for the selection of chains");
+	RNA_def_property_ui_text(prop, "Min 2D Length", "Minimum curvilinear 2D length for the selection of chains");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
 	prop= RNA_def_property(srna, "use_max_length", PROP_BOOLEAN, PROP_NONE);
@@ -864,7 +875,7 @@
 	prop= RNA_def_property(srna, "max_length", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "max_length");
 	RNA_def_property_range(prop, 0.0f, 10000.0f);
-	RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum 2D length for the selection of chains");
+	RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum curvilinear 2D length for the selection of chains");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
 	prop= RNA_def_property(srna, "material_boundary", PROP_BOOLEAN, PROP_NONE);




More information about the Bf-blender-cvs mailing list