diff options
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 36 |
2 files changed, 45 insertions, 5 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index b0a5e19d269..4108487b6f5 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -2478,16 +2478,20 @@ class WM_OT_studiolight_uninstall(Operator): bl_label = "Uninstall Studio Light" index = bpy.props.IntProperty() + def _remove_path(self, path): + if path.exists(): + path.unlink() + def execute(self, context): import pathlib userpref = context.user_preferences for studio_light in userpref.studio_lights: if studio_light.index == self.index: - path = pathlib.Path(studio_light.path) - if path.exists(): - path.unlink() - userpref.studio_lights_refresh() - return {'FINISHED'} + self._remove_path(pathlib.Path(studio_light.path)) + self._remove_path(pathlib.Path(studio_light.path_irr_cache)) + self._remove_path(pathlib.Path(studio_light.path_sh_cache)) + userpref.studio_lights_refresh() + return {'FINISHED'} return {'CANCELLED'} diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index d6e6eb31dc3..b617d1ba9be 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -692,6 +692,32 @@ static int rna_UserDef_studiolight_path_length(PointerRNA *ptr) return strlen(sl->path); } +/* StudioLight.path_irr_cache */ +static void rna_UserDef_studiolight_path_irr_cache_get(PointerRNA *ptr, char *value) +{ + StudioLight *sl = (StudioLight *)ptr->data; + BLI_strncpy(value, sl->path_irr_cache, FILE_MAX); +} + +static int rna_UserDef_studiolight_path_irr_cache_length(PointerRNA *ptr) +{ + StudioLight *sl = (StudioLight *)ptr->data; + return strlen(sl->path_irr_cache); +} + +/* StudioLight.path_sh_cache */ +static void rna_UserDef_studiolight_path_sh_cache_get(PointerRNA *ptr, char *value) +{ + StudioLight *sl = (StudioLight *)ptr->data; + BLI_strncpy(value, sl->path_sh_cache, FILE_MAX); +} + +static int rna_UserDef_studiolight_path_sh_cache_length(PointerRNA *ptr) +{ + StudioLight *sl = (StudioLight *)ptr->data; + return strlen(sl->path_sh_cache); +} + /* StudioLight.index */ static int rna_UserDef_studiolight_index_get(PointerRNA *ptr) { @@ -3270,6 +3296,16 @@ static void rna_def_userdef_studiolight(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Path", ""); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "path_irr_cache", PROP_STRING, PROP_DIRPATH); + RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_path_irr_cache_get", "rna_UserDef_studiolight_path_irr_cache_length", NULL); + RNA_def_property_ui_text(prop, "Irradiance Cache Path", "Path where the irradiance cache is stored"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "path_sh_cache", PROP_STRING, PROP_DIRPATH); + RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_path_sh_cache_get", "rna_UserDef_studiolight_path_sh_cache_length", NULL); + RNA_def_property_ui_text(prop, "SH Cache Path", "Path where the spherical harmonics cache is stored"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_define_verify_sdna(true); } |