[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39352] branches/soc-2008-mxcurioni: New line style option for splitting chains of feature edges at material boundaries .

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sat Aug 13 02:05:27 CEST 2011


Revision: 39352
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39352
Author:   kjym3
Date:     2011-08-13 00:05:25 +0000 (Sat, 13 Aug 2011)
Log Message:
-----------
New line style option for splitting chains of feature edges at material boundaries.

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/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-08-12 22:33:00 UTC (rev 39351)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2011-08-13 00:05:25 UTC (rev 39352)
@@ -633,6 +633,26 @@
     def __call__(self, i1, i2):
         return self.__pred1(i1, i2) and self.__pred2(i1, i2)
 
+# predicates for splitting
+
+class MaterialBoundaryUP0D(UnaryPredicate0D):
+    def __call__(self, it):
+        if it.isBegin():
+            return False
+        it_prev = Interface0DIterator(it) 
+        it_prev.decrement()
+        v = it.getObject()
+        it.increment()
+        if it.isEnd():
+            return False
+        fe = v.getFEdge(it_prev.getObject())
+        idx1 = fe.materialIndex() if fe.isSmooth() else fe.bMaterialIndex()
+        print(1, fe, idx1)
+        fe = v.getFEdge(it.getObject())
+        idx2 = fe.materialIndex() if fe.isSmooth() else fe.bMaterialIndex()
+        print(2, fe, idx2)
+        return idx1 != idx2
+
 # main function for parameter processing
 
 def process(layer_name, lineset_name):
@@ -749,6 +769,9 @@
             Operators.sequentialSplit(DashedLineStartingUP0D(controller),
                                       DashedLineStoppingUP0D(controller),
                                       sampling)
+    # split chains of feature edges
+    if linestyle.material_boundary:
+        Operators.sequentialSplit(MaterialBoundaryUP0D())
     # prepare a list of stroke shaders
     color = linestyle.color
     shaders_list = [

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-08-12 22:33:00 UTC (rev 39351)
+++ branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py	2011-08-13 00:05:25 UTC (rev 39352)
@@ -477,6 +477,10 @@
             col.label(text="Chaining:")
             col.prop(linestyle, "same_object")
             col.separator()
+            col.label(text="Splitting:")
+            sub = col.row(align=True)
+            sub.prop(linestyle, "material_boundary")
+            col.separator()
             col.label(text="Caps:")
             sub = col.row(align=True)
             sub.prop(linestyle, "caps", expand=True)

Modified: branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h	2011-08-12 22:33:00 UTC (rev 39351)
+++ branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h	2011-08-13 00:05:25 UTC (rev 39352)
@@ -231,9 +231,10 @@
 #define LS_PANEL_MISC         6
 
 /* FreestyleLineStyle::flag */
-#define LS_DS_EXPAND    1 /* for animation editors */
-#define LS_SAME_OBJECT  2
-#define LS_DASHED_LINE  4
+#define LS_DS_EXPAND          1  /* for animation editors */
+#define LS_SAME_OBJECT        2
+#define LS_DASHED_LINE        4
+#define LS_MATERIAL_BOUNDARY  8
 
 /* FreestyleLineStyle::caps */
 #define LS_CAPS_BUTT    1

Modified: branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c	2011-08-12 22:33:00 UTC (rev 39351)
+++ branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c	2011-08-13 00:05:25 UTC (rev 39352)
@@ -505,6 +505,11 @@
 	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, "material_boundary", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MATERIAL_BOUNDARY);
+	RNA_def_property_ui_text(prop, "Material Boundary", "If true, chains of feature edges are split at material boundaries.");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
+
 	prop= RNA_def_property(srna, "use_dashed_line", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_DASHED_LINE);
 	RNA_def_property_ui_text(prop, "Dashed Line", "Enable or disable dashed line.");




More information about the Bf-blender-cvs mailing list