diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-08 10:28:52 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-04-13 15:38:59 +0300 |
commit | 7b9fb3259157cea2df5e7b461d04f55cfa380031 (patch) | |
tree | a54e7d066283aeae384beb2ae99cc9a0e158bec5 /source/blender/makesrna/intern/rna_nodetree.c | |
parent | a1e2415ed51e2da97e3b182f18f462345a02ce14 (diff) |
Python API: remove preview/render resolution settings from API functions.
For correct results these must have been set already when the depsgraph was
created and evaluated, so all dependencies have appropriate resolutions too.
For particle we no longer backup and restore the viewport particles to avoid
overwriting them during render, as copy-on-write solves this for us. Even
without COW particles seem to work ok.
This also removes the particle simplification options based on camera. This
was never used much and only available in Blender Internal.
Differential Revision: https://developer.blender.org/D3148
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 3268f0a7cf7..012545cb5d2 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -67,6 +67,7 @@ #include "NOD_composite.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" const EnumPropertyItem rna_enum_node_socket_in_out_items[] = { { SOCK_IN, "IN", 0, "Input", "" }, @@ -3134,8 +3135,7 @@ static int point_density_vertex_color_source_from_shader(NodeShaderTexPointDensi } void rna_ShaderNodePointDensity_density_cache(bNode *self, - Depsgraph *depsgraph, - int settings) + Depsgraph *depsgraph) { NodeShaderTexPointDensity *shader_point_density = self->storage; PointDensity *pd = &shader_point_density->pd; @@ -3147,8 +3147,7 @@ void rna_ShaderNodePointDensity_density_cache(bNode *self, EvaluationContext eval_ctx; DEG_evaluation_context_init_from_depsgraph(&eval_ctx, depsgraph, - settings == 1 ? DAG_EVAL_RENDER : - DAG_EVAL_VIEWPORT); + DEG_get_mode(depsgraph)); /* Make sure there's no cached data. */ BKE_texture_pointdensity_free_data(pd); @@ -3184,7 +3183,6 @@ void rna_ShaderNodePointDensity_density_cache(bNode *self, void rna_ShaderNodePointDensity_density_calc(bNode *self, Depsgraph *depsgraph, - int settings, int *length, float **values) { @@ -3200,8 +3198,7 @@ void rna_ShaderNodePointDensity_density_calc(bNode *self, EvaluationContext eval_ctx; DEG_evaluation_context_init_from_depsgraph(&eval_ctx, depsgraph, - settings == 1 ? DAG_EVAL_RENDER : - DAG_EVAL_VIEWPORT); + DEG_get_mode(depsgraph)); /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */ *length = 4 * resolution * resolution * resolution; @@ -3224,7 +3221,6 @@ void rna_ShaderNodePointDensity_density_calc(bNode *self, void rna_ShaderNodePointDensity_density_minmax(bNode *self, Depsgraph *depsgraph, - int settings, float r_min[3], float r_max[3]) { @@ -3240,8 +3236,7 @@ void rna_ShaderNodePointDensity_density_minmax(bNode *self, EvaluationContext eval_ctx; DEG_evaluation_context_init_from_depsgraph(&eval_ctx, depsgraph, - settings == 1 ? DAG_EVAL_RENDER : - DAG_EVAL_VIEWPORT); + DEG_get_mode(depsgraph)); RE_point_density_minmax(&eval_ctx, pd, r_min, r_max); } @@ -4165,13 +4160,6 @@ static void def_sh_tex_pointdensity(StructRNA *srna) {0, NULL, 0, NULL, NULL} }; - /* TODO(sergey): Use some mnemonic names for the hardcoded values here. */ - static const EnumPropertyItem calc_mode_items[] = { - {0, "VIEWPORT", 0, "Viewport", "Canculate density using viewport settings"}, - {1, "RENDER", 0, "Render", "Canculate duplis using render settings"}, - {0, NULL, 0, NULL, NULL} - }; - prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "id"); RNA_def_property_struct_type(prop, "Object"); @@ -4234,12 +4222,10 @@ static void def_sh_tex_pointdensity(StructRNA *srna) func = RNA_def_function(srna, "cache_point_density", "rna_ShaderNodePointDensity_density_cache"); RNA_def_function_ui_description(func, "Cache point density data for later calculation"); RNA_def_pointer(func, "depsgraph", "Depsgraph", "", ""); - RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc"); RNA_def_function_ui_description(func, "Calculate point density"); RNA_def_pointer(func, "depsgraph", "Depsgraph", "", ""); - RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); /* TODO, See how array size of 0 works, this shouldnt be used. */ parm = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0); RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0); @@ -4248,7 +4234,6 @@ static void def_sh_tex_pointdensity(StructRNA *srna) func = RNA_def_function(srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax"); RNA_def_function_ui_description(func, "Calculate point density"); RNA_def_pointer(func, "depsgraph", "Depsgraph", "", ""); - RNA_def_enum(func, "settings", calc_mode_items, 1, "", "Calculate density for rendering"); parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS); RNA_def_property_array(parm, 3); RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); |