diff options
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); |