From 6644ff25f299288aa274b26665a4e2588f3d0222 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 3 Feb 2017 15:17:09 +0100 Subject: Update collection engine setings when updating collection values --- source/blender/makesrna/intern/rna_scene.c | 36 +++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 9eb54e32049..f292042d35d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2406,6 +2406,12 @@ RNA_LAYER_ENGINE_GET_SET_FLOAT(ssao_attenuation) #undef RNA_LAYER_ENGINE_GET_SET_FLOAT #undef RNA_LAYER_ENGINE_GET_SET +static void rna_CollectionEngineSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) +{ + SceneLayer *sl = CTX_data_scene_layer(C); + BKE_scene_layer_engine_settings_recalculate(sl); +} + /***********************************/ static void rna_LayerCollection_name_get(PointerRNA *ptr, char *value) @@ -5773,63 +5779,73 @@ static void rna_def_layer_collection_engine_settings_clay(BlenderRNA *brna) RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_type_get", "rna_LayerEngineSettings_type_set", NULL); RNA_def_property_enum_items(prop, clay_matcap_type); RNA_def_property_ui_text(prop, "Settings Type", "What settings to use for this material"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE); RNA_def_property_enum_funcs(prop, "rna_LayerEngineSettings_matcap_icon_get", "rna_LayerEngineSettings_matcap_icon_set", NULL); RNA_def_property_enum_items(prop, clay_matcap_items); RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture by this material"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "matcap_rotation", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_rotation_get", "rna_LayerEngineSettings_matcap_rotation_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Matcap Rotation", "Orientation of the matcap on the model"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "matcap_hue", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_hue_get", "rna_LayerEngineSettings_matcap_hue_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Matcap Hue shift", "Hue correction of the matcap"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "matcap_saturation", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_saturation_get", "rna_LayerEngineSettings_matcap_saturation_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Matcap Saturation", "Saturation correction of the matcap"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "matcap_value", PROP_FLOAT, PROP_FACTOR); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_matcap_value_get", "rna_LayerEngineSettings_matcap_value_set", NULL); RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_ui_text(prop, "Matcap Value", "Value correction of the matcap"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "ssao_factor_cavity", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_factor_cavity_get", "rna_LayerEngineSettings_ssao_factor_cavity_set", NULL); RNA_def_property_ui_text(prop, "Cavity Strength", "Strength of the Cavity effect"); RNA_def_property_range(prop, 0.0f, 250.0f); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "ssao_factor_edge", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_factor_edge_get", "rna_LayerEngineSettings_ssao_factor_edge_set", NULL); RNA_def_property_ui_text(prop, "Edge Strength", "Strength of the Edge effect"); RNA_def_property_range(prop, 0.0f, 250.0f); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "ssao_distance", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_distance_get", "rna_LayerEngineSettings_ssao_distance_set", NULL); RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect"); RNA_def_property_range(prop, 0.0f, 100000.0f); RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); prop = RNA_def_property(srna, "ssao_attenuation", PROP_FLOAT, PROP_NONE); RNA_def_property_float_funcs(prop, "rna_LayerEngineSettings_ssao_attenuation_get", "rna_LayerEngineSettings_ssao_attenuation_set", NULL); RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant"); RNA_def_property_range(prop, 1.0f, 100000.0f); RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_CollectionEngineSettings_update"); } static void rna_def_layer_collection_engine_settings(BlenderRNA *brna) -- cgit v1.2.3