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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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"},
|
||||
|
||||
Reference in New Issue
Block a user