diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-25 14:39:56 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-25 14:39:56 +0300 |
commit | cbb23d96bb4644bd4fdeadbfd790694e57983c53 (patch) | |
tree | 544b5674164199f17f423b94f976cdf12dadc756 /source/blender/makesrna | |
parent | aab5a7a4af19335f07231b30f86df8d2fc7bc9e7 (diff) |
Added simplification back for quicker preview renders with less subdivision
levels, child particles, and shadow/SSS/AO quality.. Now also works on what
is displayed in the 3d view instead of only rendering, see panel in the scene
properties.
Most file changes were to make scene available in the isDisabled modifier
callback function.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 58 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui_api.c | 1 |
3 files changed, 58 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index a4fdf60dbb3..9e6f20cf4e6 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -540,14 +540,12 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna) prop= RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "levels"); - RNA_def_property_range(prop, 0, INT_MAX); RNA_def_property_ui_range(prop, 0, 6, 1, 0); RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform."); RNA_def_property_update(prop, 0, "rna_Modifier_update"); prop= RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "renderLevels"); - RNA_def_property_range(prop, 0, INT_MAX); RNA_def_property_ui_range(prop, 0, 6, 1, 0); RNA_def_property_ui_text(prop, "Render Levels", "Number of subdivisions to perform when rendering."); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 8ae96b473f0..4c5fa1bea8c 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -29,6 +29,8 @@ #include "rna_internal.h" +#include "DNA_group_types.h" +#include "DNA_modifier_types.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" @@ -628,6 +630,33 @@ static void rna_Scene_editmesh_select_mode_update(Main *bmain, Scene *scene, Poi WM_main_add_notifier(NC_SCENE|ND_TOOLSETTINGS, NULL); } +static void object_simplify_update(Object *ob) +{ + ModifierData *md; + + for(md=ob->modifiers.first; md; md=md->next) + if(ELEM3(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) + ob->recalc |= OB_RECALC_DATA; + + if(ob->dup_group) { + GroupObject *gob; + + for(gob=ob->dup_group->gobject.first; gob; gob=gob->next) + object_simplify_update(gob->ob); + } +} + +static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + Base *base; + + for(base= scene->base.first; base; base= base->next) + object_simplify_update(base->object); + + DAG_ids_flush_update(0); + WM_main_add_notifier(NC_GEOM|ND_DATA, NULL); +} + #else static void rna_def_transform_orientation(BlenderRNA *brna) @@ -2362,11 +2391,38 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine."); + /* simplify */ + prop= RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SIMPLIFY); + RNA_def_property_ui_text(prop, "Use Simplify", "Enable simplification of scene for quicker preview renders."); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + + prop= RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf"); + RNA_def_property_ui_range(prop, 0, 6, 1, 0); + RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level."); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + + prop= RNA_def_property(srna, "simplify_child_particles", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "simplify_particles"); + RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage."); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + + prop= RNA_def_property(srna, "simplify_shadow_samples", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "simplify_shadowsamples"); + RNA_def_property_ui_range(prop, 1, 16, 1, 0); + RNA_def_property_ui_text(prop, "Simplify Shadow Samples", "Global maximum shadow samples."); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + + prop= RNA_def_property(srna, "simplify_ao_sss", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "simplify_aosss"); + RNA_def_property_ui_text(prop, "Simplify AO and SSS", "Global approximate AA and SSS quality factor."); + RNA_def_property_update(prop, 0, "rna_Scene_simplify_update"); + /* Scene API */ RNA_api_scene_render(srna); } - /* scene.objects */ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) { diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index c344173afb3..cd7051fc171 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -299,6 +299,7 @@ void RNA_api_ui_layout(StructRNA *srna) parm= RNA_def_string(func, "text", "", 0, "", "Custom label to display in UI."); func= RNA_def_function(srna, "template_modifier", "uiTemplateModifier"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); parm= RNA_def_pointer(func, "data", "Modifier", "", "Modifier data."); RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL); parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in."); |