diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-06-27 04:03:34 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-06-27 04:03:34 +0400 |
commit | 0f5c19c32c058a861efb7018e145278ac6beda2b (patch) | |
tree | 0d9ab580fe74697614c163350ba8f2604029b9ff /source | |
parent | 7abdf9b953cb3d67307b537acbfd7610ff282f47 (diff) |
More on the new GUI for the Parameter Editor mode. This is a WIP commit.
* Moved render layer-specific Freestyle options to a separate "Freestyle"
tab (in addition to the "Freestyle: Line Style" tab that has been introduced
in the previous commit).
* Added UI controls for specifying feature edge selection criteria in the
Parameter Editor mode. Feature edge selection starts with a set of all
feature edges in the view map. Each line set specifies edge selection
criteria (e.g., to select only visible crease edges) by enabling appropriate
UI controls (e.g., by turning on the "Crease" and "Visibility" toggle
buttons). Selected criteria are combined by logical conjunction. Logical
disjunction (e.g., "crease edges or contours") is represented by two or
more line sets.
* Slightly rearranged several UI controls in the Python Scripting mode.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/linestyle.c | 7 | ||||
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_freestyle_types.h | 26 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 100 |
4 files changed, 138 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/linestyle.c b/source/blender/blenkernel/intern/linestyle.c index 0abf83fe422..1f768fee0ec 100644 --- a/source/blender/blenkernel/intern/linestyle.c +++ b/source/blender/blenkernel/intern/linestyle.c @@ -38,6 +38,11 @@ #include "BKE_linestyle.h" #include "BKE_main.h" +static void default_linestyle_settings(FreestyleLineStyle *linestyle) +{ + +} + FreestyleLineStyle *FRS_new_linestyle(char *name, struct Main *main) { FreestyleLineStyle *linestyle; @@ -47,7 +52,7 @@ FreestyleLineStyle *FRS_new_linestyle(char *name, struct Main *main) linestyle = (FreestyleLineStyle *)alloc_libblock(&main->linestyle, ID_LS, name); - /* todo: default parameter settings */ + default_linestyle_settings(linestyle); return linestyle; } diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 3aa399f4af3..13e5fcc7715 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -317,9 +317,9 @@ extern "C" { config->modules.first = config->modules.last = NULL; config->flags = 0; - config->sphere_radius = 1.0; - config->dkr_epsilon = 0.001; - config->crease_angle = 134.43; + config->sphere_radius = 1.0f; + config->dkr_epsilon = 0.001f; + config->crease_angle = 134.43f; config->linesets.first = config->linesets.last = NULL; } @@ -372,6 +372,14 @@ extern "C" { lineset->linestyle = FRS_new_linestyle("LineStyle", NULL); lineset->flags |= FREESTYLE_LINESET_ENABLED; + lineset->selection = 0; + lineset->crease_angle = 134.43f; + lineset->sphere_radius = 1.0f; + lineset->dkr_epsilon = 0.001f; + lineset->qi = FREESTYLE_QI_VISIBLE; + lineset->qi_start = 0; + lineset->qi_end = 100; + lineset->objects.first = lineset->objects.last = NULL; if (lineset_index > 0) sprintf(lineset->name, "LineSet %i", lineset_index+1); else diff --git a/source/blender/makesdna/DNA_freestyle_types.h b/source/blender/makesdna/DNA_freestyle_types.h index 8444f6bd29a..2fcfdd40cf6 100644 --- a/source/blender/makesdna/DNA_freestyle_types.h +++ b/source/blender/makesdna/DNA_freestyle_types.h @@ -17,6 +17,23 @@ #define FREESTYLE_LINESET_CURRENT 1 #define FREESTYLE_LINESET_ENABLED 2 +/* FreestyleLineSet::selection */ +#define FREESTYLE_SEL_SILHOUETTE 1 +#define FREESTYLE_SEL_BORDER 2 +#define FREESTYLE_SEL_CREASE 4 +#define FREESTYLE_SEL_RIDGE 8 +#define FREESTYLE_SEL_VALLEY 16 +#define FREESTYLE_SEL_SUGGESTIVE_CONTOUR 32 +#define FREESTYLE_SEL_MATERIAL_BOUNDARY 64 +#define FREESTYLE_SEL_CONTOUR 128 +#define FREESTYLE_SEL_EXTERNAL_CONTOUR 256 +#define FREESTYLE_SEL_VISIBILITY 512 + +/* FreestyleLineSet::qi */ +#define FREESTYLE_QI_VISIBLE 1 +#define FREESTYLE_QI_HIDDEN 2 +#define FREESTYLE_QI_RANGE 3 + typedef struct FreestyleLineStyle { ID id; @@ -27,7 +44,14 @@ typedef struct FreestyleLineSet { char name[32]; /* line set name */ int flags; - int pad; + int selection; /* feature edge selection */ + + float crease_angle; + float sphere_radius; + float dkr_epsilon; + short qi; /* quantitative invisibility */ + short pad; + int qi_start, qi_end; FreestyleLineStyle *linestyle; /* line style */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 66784f6cbfc..0b4bb260013 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1540,6 +1540,12 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode", "Basic mode for interactive style parameter editing"}, {0, NULL, 0, NULL, NULL}}; + static EnumPropertyItem visibility_items[] ={ + {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible edges."}, + {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden edges."}, + {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range", "Select edges within a range of quantitative invisibility (QI) values."}, + {0, NULL, 0, NULL, NULL}}; + /* FreestyleLineSet */ srna= RNA_def_struct(brna, "FreestyleLineSet", NULL); @@ -1568,7 +1574,93 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "objects", NULL); RNA_def_property_struct_type(prop, "Object"); - RNA_def_property_ui_text(prop, "Target objects", "A list of objects on which stylized lines are drawn."); + RNA_def_property_ui_text(prop, "Target Objects", "A list of objects on which stylized lines are drawn."); + + prop= RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_SILHOUETTE); + RNA_def_property_ui_text(prop, "Silhouette", "Select silhouette edges."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_BORDER); + RNA_def_property_ui_text(prop, "Border", "Select border edges."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_CREASE); + RNA_def_property_ui_text(prop, "Crease", "Select crease edges."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_ridge", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_RIDGE); + RNA_def_property_ui_text(prop, "Ridge", "Select ridges."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_valley", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VALLEY); + RNA_def_property_ui_text(prop, "Valley", "Select valleys."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_SUGGESTIVE_CONTOUR); + RNA_def_property_ui_text(prop, "Suggestive Contour", "Select suggestive contours."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_MATERIAL_BOUNDARY); + RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_CONTOUR); + RNA_def_property_ui_text(prop, "Contour", "Select contours."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EXTERNAL_CONTOUR); + RNA_def_property_ui_text(prop, "External Contour", "Select external contours."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "select_visibility", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY); + RNA_def_property_ui_text(prop, "Visibility", "Select edges based on visibility."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "crease_angle"); + RNA_def_property_range(prop, 0.0, 180.0); + RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold in degrees (between 0 and 180) for detecting crease edges."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "sphere_radius"); + RNA_def_property_range(prop, 0.0, 1000.0); + RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "dkr_epsilon", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon"); + RNA_def_property_range(prop, 0.0, 1000.0); + RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "qi"); + RNA_def_property_enum_items(prop, visibility_items); + RNA_def_property_ui_text(prop, "Visibility", "Select edges based on visibility."); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "qi_start"); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range"); + RNA_def_property_update(prop, NC_SCENE, NULL); + + prop= RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "qi_end"); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range"); + RNA_def_property_update(prop, NC_SCENE, NULL); /* FreestyleModuleSettings */ @@ -1616,19 +1708,19 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "material_boundaries", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG); - RNA_def_property_ui_text(prop, "Material boundaries", "Enable material boundaries."); + RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries."); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "sphere_radius"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Sphere Radius", "*TBD*"); + RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures."); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "dkr_epsilon", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon"); RNA_def_property_range(prop, 0.0, 1000.0); - RNA_def_property_ui_text(prop, "Dkr Epsilon", "*TBD*"); + RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours."); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_NONE); |