[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41435] branches/soc-2008-mxcurioni: Added two stroke geometry modifiers: Parameterization and Guiding Lines.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Tue Nov 1 10:47:41 CET 2011


Revision: 41435
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41435
Author:   kjym3
Date:     2011-11-01 09:47:41 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
Added two stroke geometry modifiers: Parameterization and Guiding Lines.

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/blenloader/intern/writefile.c
    branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h
    branches/soc-2008-mxcurioni/source/blender/makesrna/RNA_access.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-11-01 09:47:19 UTC (rev 41434)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py	2011-11-01 09:47:41 UTC (rev 41435)
@@ -977,6 +977,12 @@
         elif m.type == "TIP_REMOVER":
             shaders_list.append(TipRemoverShader(
                 m.tip_length))
+        elif m.type == "POLYGONIZATION":
+            shaders_list.append(PolygonalizationShader(
+                m.error))
+        elif m.type == "GUIDING_LINES":
+            shaders_list.append(GuidingLinesShader(
+                m.offset))
     color = linestyle.color
     shaders_list.append(ConstantColorShader(color.r, color.g, color.b, linestyle.alpha))
     shaders_list.append(ConstantThicknessShader(linestyle.thickness))

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-11-01 09:47:19 UTC (rev 41434)
+++ branches/soc-2008-mxcurioni/release/scripts/startup/bl_ui/properties_render.py	2011-11-01 09:47:41 UTC (rev 41435)
@@ -544,6 +544,12 @@
             elif modifier.type == "TIP_REMOVER":
                 box.prop(modifier, "tip_length")
 
+            elif modifier.type == "POLYGONIZATION":
+                box.prop(modifier, "error")
+
+            elif modifier.type == "GUIDING_LINES":
+                box.prop(modifier, "offset")
+
     def draw(self, context):
         layout = self.layout
 

Modified: branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c	2011-11-01 09:47:19 UTC (rev 41434)
+++ branches/soc-2008-mxcurioni/source/blender/blenkernel/intern/linestyle.c	2011-11-01 09:47:41 UTC (rev 41435)
@@ -61,7 +61,9 @@
 	"Perlin Noise 2D",
 	"Backbone Stretcher",
 	"Tip Remover",
-	"Calligraphy"};
+	"Calligraphy",
+	"Polygonalization",
+	"Guiding Lines"};
 
 static void default_linestyle_settings(FreestyleLineStyle *linestyle)
 {
@@ -390,6 +392,12 @@
 	case LS_MODIFIER_TIP_REMOVER:
 		size = sizeof(LineStyleGeometryModifier_TipRemover);
 		break;
+	case LS_MODIFIER_POLYGONIZATION:
+		size = sizeof(LineStyleGeometryModifier_Polygonalization);
+		break;
+	case LS_MODIFIER_GUIDING_LINES:
+		size = sizeof(LineStyleGeometryModifier_GuidingLines);
+		break;
 	default:
 		return -1; /* unknown modifier type */
 	}
@@ -432,6 +440,12 @@
 	case LS_MODIFIER_TIP_REMOVER:
 		((LineStyleGeometryModifier_TipRemover *)m)->tip_length = 10.0;
 		break;
+	case LS_MODIFIER_POLYGONIZATION:
+		((LineStyleGeometryModifier_Polygonalization *)m)->error = 10.0;
+		break;
+	case LS_MODIFIER_GUIDING_LINES:
+		((LineStyleGeometryModifier_GuidingLines *)m)->offset = 0.0;
+		break;
 	}
 	add_to_modifier_list(&linestyle->geometry_modifiers, m);
 	return 0;
@@ -456,6 +470,10 @@
 		break;
 	case LS_MODIFIER_TIP_REMOVER:
 		break;
+	case LS_MODIFIER_POLYGONIZATION:
+		break;
+	case LS_MODIFIER_GUIDING_LINES:
+		break;
 	}
 	BLI_freelinkN(&linestyle->geometry_modifiers, m);
 }

Modified: branches/soc-2008-mxcurioni/source/blender/blenloader/intern/writefile.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/blenloader/intern/writefile.c	2011-11-01 09:47:19 UTC (rev 41434)
+++ branches/soc-2008-mxcurioni/source/blender/blenloader/intern/writefile.c	2011-11-01 09:47:41 UTC (rev 41435)
@@ -2674,6 +2674,12 @@
 		case LS_MODIFIER_TIP_REMOVER:
 			struct_name = "LineStyleGeometryModifier_TipRemover";
 			break;
+		case LS_MODIFIER_POLYGONIZATION:
+			struct_name = "LineStyleGeometryModifier_Polygonalization";
+			break;
+		case LS_MODIFIER_GUIDING_LINES:
+			struct_name = "LineStyleGeometryModifier_GuidingLines";
+			break;
 		default:
 			struct_name = "LineStyleGeometryModifier"; // this should not happen
 		}

Modified: branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h	2011-11-01 09:47:19 UTC (rev 41434)
+++ branches/soc-2008-mxcurioni/source/blender/makesdna/DNA_linestyle_types.h	2011-11-01 09:47:41 UTC (rev 41435)
@@ -62,7 +62,9 @@
 #define LS_MODIFIER_BACKBONE_STRETCHER     11
 #define LS_MODIFIER_TIP_REMOVER            12
 #define LS_MODIFIER_CALLIGRAPHY            13
-#define LS_MODIFIER_NUM                    14
+#define LS_MODIFIER_POLYGONIZATION         14
+#define LS_MODIFIER_GUIDING_LINES          15
+#define LS_MODIFIER_NUM                    16
 
 /* LineStyleModifier::flags */
 #define LS_MODIFIER_ENABLED     1
@@ -295,6 +297,22 @@
 
 } LineStyleGeometryModifier_TipRemover;
 
+typedef struct LineStyleGeometryModifier_Polygonalization {
+	struct LineStyleModifier modifier;
+
+	float error;
+	int pad;
+
+} LineStyleGeometryModifier_Polygonalization;
+
+typedef struct LineStyleGeometryModifier_GuidingLines {
+	struct LineStyleModifier modifier;
+
+	float offset;
+	int pad;
+
+} LineStyleGeometryModifier_GuidingLines;
+
 /* Calligraphic thickness modifier */
 
 typedef struct LineStyleThicknessModifier_Calligraphy {

Modified: branches/soc-2008-mxcurioni/source/blender/makesrna/RNA_access.h
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesrna/RNA_access.h	2011-11-01 09:47:19 UTC (rev 41434)
+++ branches/soc-2008-mxcurioni/source/blender/makesrna/RNA_access.h	2011-11-01 09:47:41 UTC (rev 41435)
@@ -298,8 +298,10 @@
 extern StructRNA RNA_LineStyleGeometryModifier;
 extern StructRNA RNA_LineStyleGeometryModifier_BackboneStretcher;
 extern StructRNA RNA_LineStyleGeometryModifier_BezierCurve;
+extern StructRNA RNA_LineStyleGeometryModifier_GuidingLines;
 extern StructRNA RNA_LineStyleGeometryModifier_PerlinNoise1D;
 extern StructRNA RNA_LineStyleGeometryModifier_PerlinNoise2D;
+extern StructRNA RNA_LineStyleGeometryModifier_Polygonalization;
 extern StructRNA RNA_LineStyleGeometryModifier_Sampling;
 extern StructRNA RNA_LineStyleGeometryModifier_SinusDisplacement;
 extern StructRNA RNA_LineStyleGeometryModifier_SpatialNoise;

Modified: branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c	2011-11-01 09:47:19 UTC (rev 41434)
+++ branches/soc-2008-mxcurioni/source/blender/makesrna/intern/rna_linestyle.c	2011-11-01 09:47:41 UTC (rev 41435)
@@ -67,6 +67,8 @@
 	{LS_MODIFIER_PERLIN_NOISE_2D, "PERLIN_NOISE_2D", ICON_MODIFIER, "Perlin Noise 2D", ""},
 	{LS_MODIFIER_BACKBONE_STRETCHER, "BACKBONE_STRETCHER", ICON_MODIFIER, "Backbone Stretcher", ""},
 	{LS_MODIFIER_TIP_REMOVER, "TIP_REMOVER", ICON_MODIFIER, "Tip Remover", ""},
+	{LS_MODIFIER_POLYGONIZATION, "POLYGONIZATION", ICON_MODIFIER, "Polygonization", ""},
+	{LS_MODIFIER_GUIDING_LINES, "GUIDING_LINES", ICON_MODIFIER, "Guiding Lines", ""},
 	{0, NULL, 0, NULL, NULL}};
 
 #ifdef RNA_RUNTIME
@@ -148,6 +150,10 @@
 			return &RNA_LineStyleGeometryModifier_BackboneStretcher;
 		case LS_MODIFIER_TIP_REMOVER:
 			return &RNA_LineStyleGeometryModifier_TipRemover;
+		case LS_MODIFIER_POLYGONIZATION:
+			return &RNA_LineStyleGeometryModifier_Polygonalization;
+		case LS_MODIFIER_GUIDING_LINES:
+			return &RNA_LineStyleGeometryModifier_GuidingLines;
 		default:
 			return &RNA_LineStyleGeometryModifier;
 	}
@@ -659,6 +665,24 @@
 	RNA_def_property_ui_text(prop, "Tip Length", "Length of tips to be removed");
 	RNA_def_property_update(prop, NC_SCENE, NULL);
 
+	srna= RNA_def_struct(brna, "LineStyleGeometryModifier_Polygonalization", "LineStyleGeometryModifier");
+	RNA_def_struct_ui_text(srna, "Polygonalization", "Modify the stroke geometry so that it looks more \"polygonal\"");
+	rna_def_geometry_modifier(srna);
+
+	prop= RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "error");
+	RNA_def_property_ui_text(prop, "Error", "Maximum distance between the original stroke and its polygonal approximation");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
+
+	srna= RNA_def_struct(brna, "LineStyleGeometryModifier_GuidingLines", "LineStyleGeometryModifier");
+	RNA_def_struct_ui_text(srna, "Guiding Lines", "Modify the stroke geometry so that it corresponds to its main direction line");
+	rna_def_geometry_modifier(srna);
+
+	prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "offset");
+	RNA_def_property_ui_text(prop, "Offset", "Displacement that is applied to the main direction line along its normal");
+	RNA_def_property_update(prop, NC_SCENE, NULL);
+
 }
 
 static void rna_def_linestyle(BlenderRNA *brna)




More information about the Bf-blender-cvs mailing list