diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-10-28 20:09:51 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-10-28 20:09:51 +0400 |
commit | 5acd5d14970c829c2873623716a67beeb6da5278 (patch) | |
tree | f805a8fd6d5ae5ad4a6d9903f5c26b511a21c32b /source | |
parent | f252230216ce0b6e73ed69edb1c05a07ac1e373a (diff) |
Improvements of Freestyle GUI controls - Part 1.
This commit makes a set of fixes and improvements based on the results of
Freestyle branch review by Brecht. The discussion thread is:
http://lists.blender.org/pipermail/bf-committers/2012-October/037927.html
* The Layers panel and Freestyle-related panels in the Render tab of the
Properties window were moved to the newly created Render Layers tab.
The idea is to separate per render layer rendering options into a distinct
Properties window tab, and use the existing Render tab to accommodate
per scene rendering options.
* The new Freestyle panel was added in the Render tab. The panel header
contains a toggle button for globally enabling Freestyle, with the aim of making
Freestyle easier to find. Those Freestyle options in the Post Processing panel
were also moved to the new panel.
* GUI code was updated so that UI controls will be greyed out (instead of
being hidden) when Freestyle is disabled. Additional UI changes were also
made to reduce space consumption.
* The list of line sets was moved from the Freestyle panel to the Freestyle:
Line Sets panel.
* Old ray-casting algorithms were removed from the UI. Now only two
algorithms (culled and non-culled cumulative visibility detection algorithms)
are available, and the selection is done by the new "Culling" toggle button
within the edge detection options.
Diffstat (limited to 'source')
10 files changed, 28 insertions, 13 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 97ca210c3d0..dc8cf3b9116 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -8348,8 +8348,11 @@ static void do_versions(FileData *fd, Library *lib, Main *main) for(srl= sce->r.layers.first; srl; srl= srl->next) { if (srl->freestyleConfig.mode == 0) srl->freestyleConfig.mode= FREESTYLE_CONTROL_EDITOR_MODE; - if (srl->freestyleConfig.raycasting_algorithm == 0) - srl->freestyleConfig.raycasting_algorithm= FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE; + if (srl->freestyleConfig.raycasting_algorithm == FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE || + srl->freestyleConfig.raycasting_algorithm == FREESTYLE_ALGO_CULLED_ADAPTIVE_TRADITIONAL) { + srl->freestyleConfig.raycasting_algorithm= 0; /* deprecated */ + srl->freestyleConfig.flags |= FREESTYLE_CULLING; + } } } for(linestyle = main->linestyle.first; linestyle; linestyle = linestyle->id.next) { diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 7e232a02536..e5f5a4beac6 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -538,6 +538,7 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma switch (mainb) { case BCONTEXT_SCENE: case BCONTEXT_RENDER: + case BCONTEXT_RENDER_LAYER: found = buttons_context_path_scene(path); break; case BCONTEXT_WORLD: @@ -1032,7 +1033,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) name = RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL); if (name) { - if (!ELEM(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE) && ptr->type == &RNA_Scene) + if (!ELEM3(sbuts->mainb, BCONTEXT_RENDER, BCONTEXT_SCENE, BCONTEXT_RENDER_LAYER) && ptr->type == &RNA_Scene) uiItemLDrag(row, ptr, "", icon); /* save some space */ else uiItemLDrag(row, ptr, name, icon); diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index ebba7d92819..3c2d9ac2eee 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -128,6 +128,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) } (void)0 BUTTON_HEADER_CTX(BCONTEXT_RENDER, ICON_SCENE, N_("Render")); + BUTTON_HEADER_CTX(BCONTEXT_RENDER_LAYER, ICON_RENDERLAYERS, N_("Render Layers")); BUTTON_HEADER_CTX(BCONTEXT_SCENE, ICON_SCENE_DATA, N_("Scene")); BUTTON_HEADER_CTX(BCONTEXT_WORLD, ICON_WORLD, N_("World")); BUTTON_HEADER_CTX(BCONTEXT_OBJECT, ICON_OBJECT_DATA, N_("Object")); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index c894c1a980b..a24a292be06 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -155,6 +155,8 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) ED_region_panels(C, ar, vertical, "scene", sbuts->mainb); else if (sbuts->mainb == BCONTEXT_RENDER) ED_region_panels(C, ar, vertical, "render", sbuts->mainb); + else if (sbuts->mainb == BCONTEXT_RENDER_LAYER) + ED_region_panels(C, ar, vertical, "render_layer", sbuts->mainb); else if (sbuts->mainb == BCONTEXT_WORLD) ED_region_panels(C, ar, vertical, "world", sbuts->mainb); else if (sbuts->mainb == BCONTEXT_OBJECT) @@ -239,6 +241,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) switch (wmn->data) { case ND_RENDER_OPTIONS: buttons_area_redraw(sa, BCONTEXT_RENDER); + buttons_area_redraw(sa, BCONTEXT_RENDER_LAYER); break; case ND_FRAME: /* any buttons area can have animated properties so redraw all */ diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 5dcda3bd69c..b5e67597caa 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -352,7 +352,8 @@ extern "C" { } controller->setFaceSmoothness( (config->flags & FREESTYLE_FACE_SMOOTHNESS_FLAG) ? true : false); controller->setCreaseAngle( config->crease_angle ); - controller->setVisibilityAlgo( config->raycasting_algorithm ); + controller->setVisibilityAlgo( (config->flags & FREESTYLE_CULLING) ? + FREESTYLE_ALGO_CULLED_ADAPTIVE_CUMULATIVE : FREESTYLE_ALGO_ADAPTIVE_CUMULATIVE ); cout << "Crease angle : " << controller->getCreaseAngle() << endl; cout << "Sphere radius : " << controller->getSphereRadius() << endl; @@ -527,8 +528,6 @@ extern "C" { config->crease_angle = 134.43f; config->linesets.first = config->linesets.last = NULL; - - config->raycasting_algorithm = FREESTYLE_ALGO_REGULAR; } void FRS_free_freestyle_config( SceneRenderLayer* srl ) diff --git a/source/blender/makesdna/DNA_freestyle_types.h b/source/blender/makesdna/DNA_freestyle_types.h index f6e9421fa34..b78ea9a13bb 100644 --- a/source/blender/makesdna/DNA_freestyle_types.h +++ b/source/blender/makesdna/DNA_freestyle_types.h @@ -41,6 +41,7 @@ struct FreestyleLineStyle; #define FREESTYLE_MATERIAL_BOUNDARIES_FLAG 4 #define FREESTYLE_FACE_SMOOTHNESS_FLAG 8 #define FREESTYLE_ADVANCED_OPTIONS_FLAG 16 +#define FREESTYLE_CULLING 32 /* FreestyleConfig::mode */ #define FREESTYLE_CONTROL_SCRIPT_MODE 1 @@ -120,7 +121,7 @@ typedef struct FreestyleConfig { ListBase modules; int mode; /* scripting, editor */ - int raycasting_algorithm; /* regular, fast, very fast, etc. */ + int raycasting_algorithm; /* XXX deprecated */ int flags; /* suggestive contours, ridges/valleys, material boundaries */ float sphere_radius; float dkr_epsilon; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 2469656ecd7..9289d140b85 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -180,6 +180,7 @@ typedef enum eSpaceButtons_Context { BCONTEXT_MODIFIER = 10, BCONTEXT_CONSTRAINT = 11, BCONTEXT_BONE_CONSTRAINT = 12, + BCONTEXT_RENDER_LAYER = 13, /* always as last... */ BCONTEXT_TOT diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c index abb715f2471..62d69ee8732 100644 --- a/source/blender/makesrna/intern/rna_linestyle.c +++ b/source/blender/makesrna/intern/rna_linestyle.c @@ -1038,37 +1038,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"); 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"); 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"); 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"); 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"); 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"); RNA_def_property_update(prop, NC_LINESTYLE, NULL); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 24f17034ea1..e13a973334b 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2603,6 +2603,11 @@ static void rna_def_freestyle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Raycasting Algorithm", "Select the Freestyle raycasting algorithm"); RNA_def_property_update(prop, NC_SCENE, NULL); + prop= RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING); + RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored"); + RNA_def_property_update(prop, NC_SCENE, NULL); + prop= RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG); RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 51fb9d413da..e670adb1e87 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -1911,6 +1911,7 @@ static void rna_def_space_buttons(BlenderRNA *brna) static EnumPropertyItem buttons_context_items[] = { {BCONTEXT_SCENE, "SCENE", ICON_SCENE, "Scene", "Scene"}, {BCONTEXT_RENDER, "RENDER", ICON_SCENE_DATA, "Render", "Render"}, + {BCONTEXT_RENDER_LAYER, "RENDER_LAYER", ICON_RENDERLAYERS, "Render Layers", "Render Layers"}, {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"}, {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"}, {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Constraints"}, |