diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-09-11 23:57:38 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-09-11 23:57:38 +0400 |
commit | 6be21a91253a823f33060d354333b886c1b95b0a (patch) | |
tree | dcadcea96beebac71694307edb7fbe2c581c3dd9 /source/blender | |
parent | f045c18a78ba44b6b4144bf40af1d872ec898fda (diff) |
Implemented a calligraphic thickness modifier in the Parameter Editor mode.
Also fixed a typo in the docstring of the CalligraphicShader.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 13 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 3 | ||||
-rw-r--r-- | source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_linestyle_types.h | 14 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_access.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_linestyle.c | 24 |
6 files changed, 54 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index f36bdaf487f..88584633a49 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -60,7 +60,8 @@ static char *modifier_name[LS_MODIFIER_NUM] = { "Perlin Noise 1D", "Perlin Noise 2D", "Backbone Stretcher", - "Tip Remover"}; + "Tip Remover", + "Calligraphy"}; static void default_linestyle_settings(FreestyleLineStyle *linestyle) { @@ -286,6 +287,9 @@ int FRS_add_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, int type case LS_MODIFIER_MATERIAL: size = sizeof(LineStyleThicknessModifier_Material); break; + case LS_MODIFIER_CALLIGRAPHY: + size = sizeof(LineStyleThicknessModifier_Calligraphy); + break; default: return -1; /* unknown modifier type */ } @@ -320,6 +324,11 @@ int FRS_add_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, int type ((LineStyleThicknessModifier_Material *)m)->value_min = 0.0f; ((LineStyleThicknessModifier_Material *)m)->value_max = 1.0f; break; + case LS_MODIFIER_CALLIGRAPHY: + ((LineStyleThicknessModifier_Calligraphy *)m)->min_thickness = 1.0f; + ((LineStyleThicknessModifier_Calligraphy *)m)->max_thickness = 10.0f; + ((LineStyleThicknessModifier_Calligraphy *)m)->orientation = 60.0f; + break; } add_to_modifier_list(&linestyle->thickness_modifiers, m); @@ -341,6 +350,8 @@ void FRS_remove_linestyle_thickness_modifier(FreestyleLineStyle *linestyle, Line case LS_MODIFIER_MATERIAL: curvemapping_free(((LineStyleThicknessModifier_Material *)m)->curve); break; + case LS_MODIFIER_CALLIGRAPHY: + break; } BLI_freelinkN(&linestyle->thickness_modifiers, m); } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index f87492d39a2..1e09063c74f 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2621,6 +2621,9 @@ static void write_linestyle_thickness_modifiers(WriteData *wd, ListBase *modifie case LS_MODIFIER_MATERIAL: struct_name = "LineStyleThicknessModifier_Material"; break; + case LS_MODIFIER_CALLIGRAPHY: + struct_name = "LineStyleThicknessModifier_Calligraphy"; + break; default: struct_name = "LineStyleThicknessModifier"; // this should not happen } diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index 05f8d1299de..bb77d0ba5be 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -21,7 +21,7 @@ static char CalligraphicShader___doc__[] = " Builds a CalligraphicShader object.\n" "\n" " :arg iMinThickness: The minimum thickness in the direction\n" -" perpandicular to the main direction.\n" +" perpendicular to the main direction.\n" " :type iMinThickness: float\n" " :arg iMaxThickness: The maximum thickness in the main direction.\n" " :type iMaxThickness: float\n" diff --git a/source/blender/makesdna/DNA_linestyle_types.h b/source/blender/makesdna/DNA_linestyle_types.h index 94d2d4bb723..8b3b5a60181 100644 --- a/source/blender/makesdna/DNA_linestyle_types.h +++ b/source/blender/makesdna/DNA_linestyle_types.h @@ -61,7 +61,8 @@ typedef struct LineStyleModifier { #define LS_MODIFIER_PERLIN_NOISE_2D 10 #define LS_MODIFIER_BACKBONE_STRETCHER 11 #define LS_MODIFIER_TIP_REMOVER 12 -#define LS_MODIFIER_NUM 13 +#define LS_MODIFIER_CALLIGRAPHY 13 +#define LS_MODIFIER_NUM 14 /* LineStyleModifier::flags */ #define LS_MODIFIER_ENABLED 1 @@ -294,6 +295,17 @@ typedef struct LineStyleGeometryModifier_TipRemover { } LineStyleGeometryModifier_TipRemover; +/* Calligraphic thickness modifier */ + +typedef struct LineStyleThicknessModifier_Calligraphy { + struct LineStyleModifier modifier; + + float min_thickness, max_thickness; + float orientation; + int pad; + +} LineStyleThicknessModifier_Calligraphy; + /* FreestyleLineStyle::panel */ #define LS_PANEL_STROKES 1 #define LS_PANEL_COLOR 2 diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 48c5422b453..6bf5d33998d 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -303,6 +303,7 @@ extern StructRNA RNA_LineStyleGeometryModifier_TipRemover; extern StructRNA RNA_LineStyleModifier; extern StructRNA RNA_LineStyleThicknessModifier; extern StructRNA RNA_LineStyleThicknessModifier_AlongStroke; +extern StructRNA RNA_LineStyleThicknessModifier_Calligraphy; extern StructRNA RNA_LineStyleThicknessModifier_DistanceFromCamera; extern StructRNA RNA_LineStyleThicknessModifier_DistanceFromObject; extern StructRNA RNA_LineStyleThicknessModifier_Material; diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index fc12477b1ae..e5b5aee5541 100644 --- a/source/blender/makesrna/intern/rna_linestyle.c +++ b/source/blender/makesrna/intern/rna_linestyle.c @@ -55,6 +55,7 @@ EnumPropertyItem linestyle_thickness_modifier_type_items[] ={ {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""}, {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""}, {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""}, + {LS_MODIFIER_CALLIGRAPHY, "CALLIGRAPHY", ICON_MODIFIER, "Calligraphy", ""}, {0, NULL, 0, NULL, NULL}}; EnumPropertyItem linestyle_geometry_modifier_type_items[] ={ @@ -119,6 +120,8 @@ static StructRNA *rna_LineStyle_thickness_modifier_refine(struct PointerRNA *ptr return &RNA_LineStyleThicknessModifier_DistanceFromObject; case LS_MODIFIER_MATERIAL: return &RNA_LineStyleThicknessModifier_Material; + case LS_MODIFIER_CALLIGRAPHY: + return &RNA_LineStyleThicknessModifier_Calligraphy; default: return &RNA_LineStyleThicknessModifier; } @@ -485,6 +488,27 @@ static void rna_def_linestyle_modifiers(BlenderRNA *brna) rna_def_modifier_material_common(srna); rna_def_modifier_curve_common(srna, 0, 1); + srna= RNA_def_struct(brna, "LineStyleThicknessModifier_Calligraphy", "LineStyleThicknessModifier"); + RNA_def_struct_ui_text(srna, "Calligraphy", "Change line thickness so that stroke looks like made with a calligraphic pen."); + rna_def_thickness_modifier(srna); + + prop= RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "orientation"); + RNA_def_property_ui_text(prop, "Orientation", "Angle of the main direction."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "min_thickness", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "min_thickness"); + RNA_def_property_range(prop, 0.0f, 10000.0f); + RNA_def_property_ui_text(prop, "Min Thickness", "Minimum thickness in the direction perpendicular to the main direction."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "max_thickness", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "max_thickness"); + RNA_def_property_range(prop, 0.0f, 10000.0f); + RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness in the main direction."); + RNA_def_property_update(prop, NC_SCENE, NULL); + /* geometry modifiers */ srna= RNA_def_struct(brna, "LineStyleGeometryModifier", "LineStyleModifier"); |