Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-12 00:35:03 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2011-11-12 00:35:03 +0400
commite7a4d454350beb1ce20f3d7d2d091451a885eefe (patch)
tree4709f76bb57fadbd7dcf85204be2ff5cd0d5b13e /source/blender
parent80e398e7b2cfbdf0192b11734cb02b378b423d65 (diff)
Added to the Parameter Editor mode new stroke geometry modifier `Blueprint'
that produces a blueprint using circular, elliptic, and square contour strokes. Related changes and bug fixes were made as follows: * The randomness in radius and center has been transformed into optional parameters of the pyBluePrintCirclesShader and pyBluePrintEllipsesShader. Also a new optional parameter to control the randomness of backbone stretching has been added to the pyBluePrintSquaresShader. * A bug in the pyBluePrintSquaresShader that invisible stroke vertices at corners of rectangular contour strokes were not properly drawn. The problem was due to the changes of the / operator between Python 2.x to 3.x. Even when the two operands of the division operator are integers, Python 3.x gives a floating-point number when the quotient is not an integer. The fix was just to replace the / operator by the // operator for integer division. * An unpleasant discontinuity in circular and elliptical contour strokes was fixed. * The length parameter of the Backbone Stretcher geometry modifier has been renamed to `backbone_length' in line with the parameter of the same name in the pyBluePrintSquaresShader.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/linestyle.c18
-rw-r--r--source/blender/blenloader/intern/writefile.c3
-rw-r--r--source/blender/makesdna/DNA_linestyle_types.h22
-rw-r--r--source/blender/makesrna/RNA_access.h1
-rw-r--r--source/blender/makesrna/intern/rna_linestyle.c51
5 files changed, 88 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c
index a8d8038e7f9..0c48590410e 100644
--- a/source/blender/blenkernel/intern/linestyle.c
+++ b/source/blender/blenkernel/intern/linestyle.c
@@ -63,7 +63,8 @@ static char *modifier_name[LS_MODIFIER_NUM] = {
"Tip Remover",
"Calligraphy",
"Polygonalization",
- "Guiding Lines"};
+ "Guiding Lines",
+ "Blueprint"};
static void default_linestyle_settings(FreestyleLineStyle *linestyle)
{
@@ -398,6 +399,9 @@ int FRS_add_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, int type)
case LS_MODIFIER_GUIDING_LINES:
size = sizeof(LineStyleGeometryModifier_GuidingLines);
break;
+ case LS_MODIFIER_BLUEPRINT:
+ size = sizeof(LineStyleGeometryModifier_Blueprint);
+ break;
default:
return -1; /* unknown modifier type */
}
@@ -435,7 +439,7 @@ int FRS_add_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, int type)
((LineStyleGeometryModifier_PerlinNoise2D *)m)->angle = 45.0;
break;
case LS_MODIFIER_BACKBONE_STRETCHER:
- ((LineStyleGeometryModifier_BackboneStretcher *)m)->amount = 10.0;
+ ((LineStyleGeometryModifier_BackboneStretcher *)m)->backbone_length = 10.0;
break;
case LS_MODIFIER_TIP_REMOVER:
((LineStyleGeometryModifier_TipRemover *)m)->tip_length = 10.0;
@@ -446,6 +450,14 @@ int FRS_add_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, int type)
case LS_MODIFIER_GUIDING_LINES:
((LineStyleGeometryModifier_GuidingLines *)m)->offset = 0.0;
break;
+ case LS_MODIFIER_BLUEPRINT:
+ ((LineStyleGeometryModifier_Blueprint *)m)->flags = LS_MODIFIER_BLUEPRINT_CIRCLES;
+ ((LineStyleGeometryModifier_Blueprint *)m)->rounds = 1;
+ ((LineStyleGeometryModifier_Blueprint *)m)->backbone_length = 10.f;
+ ((LineStyleGeometryModifier_Blueprint *)m)->random_radius = 3;
+ ((LineStyleGeometryModifier_Blueprint *)m)->random_center = 5;
+ ((LineStyleGeometryModifier_Blueprint *)m)->random_backbone = 5;
+ break;
}
add_to_modifier_list(&linestyle->geometry_modifiers, m);
return 0;
@@ -474,6 +486,8 @@ void FRS_remove_linestyle_geometry_modifier(FreestyleLineStyle *linestyle, LineS
break;
case LS_MODIFIER_GUIDING_LINES:
break;
+ case LS_MODIFIER_BLUEPRINT:
+ break;
}
BLI_freelinkN(&linestyle->geometry_modifiers, m);
}
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index b37364e830b..3accc871548 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2723,6 +2723,9 @@ static void write_linestyle_geometry_modifiers(WriteData *wd, ListBase *modifier
case LS_MODIFIER_GUIDING_LINES:
struct_name = "LineStyleGeometryModifier_GuidingLines";
break;
+ case LS_MODIFIER_BLUEPRINT:
+ struct_name = "LineStyleGeometryModifier_Blueprint";
+ break;
default:
struct_name = "LineStyleGeometryModifier"; // this should not happen
}
diff --git a/source/blender/makesdna/DNA_linestyle_types.h b/source/blender/makesdna/DNA_linestyle_types.h
index a34a4285e55..a73dd707caa 100644
--- a/source/blender/makesdna/DNA_linestyle_types.h
+++ b/source/blender/makesdna/DNA_linestyle_types.h
@@ -64,7 +64,8 @@ typedef struct LineStyleModifier {
#define LS_MODIFIER_CALLIGRAPHY 13
#define LS_MODIFIER_POLYGONIZATION 14
#define LS_MODIFIER_GUIDING_LINES 15
-#define LS_MODIFIER_NUM 16
+#define LS_MODIFIER_BLUEPRINT 16
+#define LS_MODIFIER_NUM 17
/* LineStyleModifier::flags */
#define LS_MODIFIER_ENABLED 1
@@ -284,7 +285,7 @@ typedef struct LineStyleGeometryModifier_PerlinNoise2D {
typedef struct LineStyleGeometryModifier_BackboneStretcher {
struct LineStyleModifier modifier;
- float amount;
+ float backbone_length;
int pad;
} LineStyleGeometryModifier_BackboneStretcher;
@@ -313,6 +314,23 @@ typedef struct LineStyleGeometryModifier_GuidingLines {
} LineStyleGeometryModifier_GuidingLines;
+/* LineStyleGeometryModifier_BluePrintLines::shape */
+#define LS_MODIFIER_BLUEPRINT_CIRCLES 1
+#define LS_MODIFIER_BLUEPRINT_ELLIPSES 2
+#define LS_MODIFIER_BLUEPRINT_SQUARES 4
+
+typedef struct LineStyleGeometryModifier_Blueprint {
+ struct LineStyleModifier modifier;
+
+ int flags;
+ unsigned int rounds;
+ float backbone_length;
+ unsigned int random_radius;
+ unsigned int random_center;
+ unsigned int random_backbone;
+
+} LineStyleGeometryModifier_Blueprint;
+
/* Calligraphic thickness modifier */
typedef struct LineStyleThicknessModifier_Calligraphy {
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 67d4b2deee1..1e0231fd4a6 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -299,6 +299,7 @@ extern StructRNA RNA_LineStyleColorModifier_Material;
extern StructRNA RNA_LineStyleGeometryModifier;
extern StructRNA RNA_LineStyleGeometryModifier_BackboneStretcher;
extern StructRNA RNA_LineStyleGeometryModifier_BezierCurve;
+extern StructRNA RNA_LineStyleGeometryModifier_Blueprint;
extern StructRNA RNA_LineStyleGeometryModifier_GuidingLines;
extern StructRNA RNA_LineStyleGeometryModifier_PerlinNoise1D;
extern StructRNA RNA_LineStyleGeometryModifier_PerlinNoise2D;
diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c
index 6ae8bd2253e..58be8fc62c4 100644
--- a/source/blender/makesrna/intern/rna_linestyle.c
+++ b/source/blender/makesrna/intern/rna_linestyle.c
@@ -61,6 +61,7 @@ EnumPropertyItem linestyle_thickness_modifier_type_items[] ={
EnumPropertyItem linestyle_geometry_modifier_type_items[] ={
{LS_MODIFIER_BACKBONE_STRETCHER, "BACKBONE_STRETCHER", ICON_MODIFIER, "Backbone Stretcher", ""},
{LS_MODIFIER_BEZIER_CURVE, "BEZIER_CURVE", ICON_MODIFIER, "Bezier Curve", ""},
+ {LS_MODIFIER_BLUEPRINT, "BLUEPRINT", ICON_MODIFIER, "Blueprint", ""},
{LS_MODIFIER_GUIDING_LINES, "GUIDING_LINES", ICON_MODIFIER, "Guiding Lines", ""},
{LS_MODIFIER_PERLIN_NOISE_1D, "PERLIN_NOISE_1D", ICON_MODIFIER, "Perlin Noise 1D", ""},
{LS_MODIFIER_PERLIN_NOISE_2D, "PERLIN_NOISE_2D", ICON_MODIFIER, "Perlin Noise 2D", ""},
@@ -154,6 +155,8 @@ static StructRNA *rna_LineStyle_geometry_modifier_refine(struct PointerRNA *ptr)
return &RNA_LineStyleGeometryModifier_Polygonalization;
case LS_MODIFIER_GUIDING_LINES:
return &RNA_LineStyleGeometryModifier_GuidingLines;
+ case LS_MODIFIER_BLUEPRINT:
+ return &RNA_LineStyleGeometryModifier_Blueprint;
default:
return &RNA_LineStyleGeometryModifier;
}
@@ -378,6 +381,12 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
+ static EnumPropertyItem blueprint_shape_items[] = {
+ {LS_MODIFIER_BLUEPRINT_CIRCLES, "CIRCLES", 0, "Circles", "Draw a blueprint using circular contour strokes"},
+ {LS_MODIFIER_BLUEPRINT_ELLIPSES, "ELLIPSES", 0, "Ellipses", "Draw a blueprint using elliptic contour strokes"},
+ {LS_MODIFIER_BLUEPRINT_SQUARES, "SQUARES", 0, "Squares", "Draw a blueprint using square contour strokes"},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "LineStyleModifier", NULL);
RNA_def_struct_ui_text(srna, "Line Style Modifier", "Base type to define modifiers");
@@ -651,9 +660,9 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Backbone Stretcher", "Stretch the beginning and the end of stroke backbone");
rna_def_geometry_modifier(srna);
- prop= RNA_def_property(srna, "amount", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amount");
- RNA_def_property_ui_text(prop, "Amount", "Amount of stretching");
+ prop= RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "backbone_length");
+ RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
RNA_def_property_update(prop, NC_SCENE, NULL);
srna= RNA_def_struct(brna, "LineStyleGeometryModifier_TipRemover", "LineStyleGeometryModifier");
@@ -683,6 +692,42 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna)
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);
+ srna= RNA_def_struct(brna, "LineStyleGeometryModifier_Blueprint", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Blueprint", "Produce a blueprint using circular, elliptic, and square contour strokes");
+ rna_def_geometry_modifier(srna);
+
+ prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, blueprint_shape_items);
+ RNA_def_property_ui_text(prop, "Shape", "Select the shape of blueprint contour strokes");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "rounds");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in contour strokes");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "backbone_length");
+ RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "random_radius", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_radius");
+ RNA_def_property_ui_text(prop, "Random Radius", "Randomness of the radius");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "random_center", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_center");
+ RNA_def_property_ui_text(prop, "Random Center", "Randomness of the center");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "random_backbone", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_backbone");
+ RNA_def_property_ui_text(prop, "Random Backbone", "Randomness of the backbone stretching");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
}
static void rna_def_linestyle(BlenderRNA *brna)