diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-22 13:30:27 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-22 13:31:20 +0300 |
commit | 0427eca2a6761e1b8a8fd9a44434c2f0e94df75e (patch) | |
tree | 9b8037bfe6986b86f4d0ad36cb3d0b0644826dc2 /release | |
parent | e402c363888fc1fea38ffcf30b19502da46244d9 (diff) |
StudioLight: remove caches when removing studiolight
Cache files were not deleted and when uploading a new file with the same
name resulted in using the old cache file.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 14 |
1 files changed, 9 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'} |