Fix for dashed line options not working as expected in some applications

when combined with geometry modifiers.

The problem is that users were not able to choose the time when the
dashed line options are applied.  Instead, the dashed line options were
applied only before geometry modifiers were employed.  Since dashes were
separate strokes, the geometry modifiers were processed dash by dash.
Depending on users' artistic intention, this may or may not lead to
expected stylization results, as reported by octane98 in the
BlenderArtists Freestyle thread on January 3, 2012.
http://blenderartists.org/forum/showthread.php?89986-Freestyle-for-Blender&p=2018592&viewfull=1#post2018592

Now the Strokes tab of the Freestyle Line Style panel has two sets of
dashed line options.  One is in the Splitting section of the Strokes tab
and used for splitting strokes by dashed line patterns.  The other set
is called "Dashed Line" and used to generate dashed lines based on the
strokes after the geometry modifiers are applied.  The two sets of
dashed line options are independent of each other, so that users can
enable one of them as well as both at the same time.
This commit is contained in:
Tamito Kajiyama
2012-11-04 23:52:26 +00:00
parent a9055460a9
commit dd633f1aff
4 changed files with 129 additions and 28 deletions

View File

@@ -390,6 +390,7 @@ typedef struct LineStyleThicknessModifier_Calligraphy {
#define LS_MIN_2D_ANGLE 128
#define LS_MAX_2D_ANGLE 256
#define LS_SPLIT_LENGTH 512
#define LS_SPLIT_PATTERN 1024
/* FreestyleLineStyle::chaining */
#define LS_CHAINING_PLAIN 1
@@ -420,6 +421,10 @@ typedef struct FreestyleLineStyle {
float split_length;
float min_angle, max_angle; /* for splitting */
float min_length, max_length;
unsigned short split_dash1, split_gap1;
unsigned short split_dash2, split_gap2;
unsigned short split_dash3, split_gap3;
int pad;
unsigned short dash1, gap1, dash2, gap2, dash3, gap3;
int panel; /* for UI */

View File

@@ -1019,6 +1019,47 @@ static void rna_def_linestyle(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum curvilinear 2D length for the selection of chains");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "use_split_pattern", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_PATTERN);
RNA_def_property_ui_text(prop, "Use Split Pattern", "Enable chain splitting by dashed line patterns");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "split_dash1", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "split_dash1");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Split Dash 1", "Length of the 1st dash for splitting");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "split_gap1", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "split_gap1");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Split Gap 1", "Length of the 1st gap for splitting");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "split_dash2", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "split_dash2");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Split Dash 2", "Length of the 2nd dash for splitting");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "split_gap2", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "split_gap2");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Split Gap 2", "Length of the 2nd gap for splitting");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "split_dash3", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "split_dash3");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Split Dash 3", "Length of the 3rd dash for splitting");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "split_gap3", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "split_gap3");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Split Gap 3", "Length of the 3rd gap for splitting");
RNA_def_property_update(prop, NC_LINESTYLE, 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");
@@ -1038,37 +1079,37 @@ static void rna_def_linestyle(BlenderRNA *brna)
prop= RNA_def_property(srna, "dash1", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "dash1");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Dash 1", "Length of the 1st dash");
RNA_def_property_ui_text(prop, "Dash 1", "Length of the 1st dash for dashed lines");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "gap1", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "gap1");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Gap 1", "Length of the 1st gap");
RNA_def_property_ui_text(prop, "Gap 1", "Length of the 1st gap for dashed lines");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "dash2", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "dash2");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Dash 2", "Length of the 2nd dash");
RNA_def_property_ui_text(prop, "Dash 2", "Length of the 2nd dash for dashed lines");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "gap2", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "gap2");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Gap 2", "Length of the 2nd gap");
RNA_def_property_ui_text(prop, "Gap 2", "Length of the 2nd gap for dashed lines");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "dash3", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "dash3");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Dash 3", "Length of the 3rd dash");
RNA_def_property_ui_text(prop, "Dash 3", "Length of the 3rd dash for dashed lines");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
prop= RNA_def_property(srna, "gap3", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "gap3");
RNA_def_property_range(prop, 0, USHRT_MAX);
RNA_def_property_ui_text(prop, "Gap 3", "Length of the 3rd gap");
RNA_def_property_ui_text(prop, "Gap 3", "Length of the 3rd gap for dashed lines");
RNA_def_property_update(prop, NC_LINESTYLE, NULL);
}