diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-22 15:48:23 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-22 15:49:49 +0300 |
commit | dfca3522942944cb7fd3943696fb06a118df3ba2 (patch) | |
tree | 4727f1a5f51ed9793398459b7ba5849833950b77 /release | |
parent | f4d6e66b25d154736f3e312de2df39702053f94a (diff) |
StudioLight: Better API
In stead of a single refresh function that re-init the whole system. The
API now supports adding and removing. Which will be much faster and less
flickering of missing icons when adding/removing lights
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 4108487b6f5..b6f77505410 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -2456,7 +2456,7 @@ class WM_OT_studiolight_install(Operator): for filepath in filepaths: shutil.copy(str(filepath), str(path_studiolights)) - userpref.studio_lights_refresh() + userpref.studio_lights.new(str(path_studiolights.joinpath(filepath.name)), self.orientation) # print message msg = ( @@ -2490,26 +2490,11 @@ class WM_OT_studiolight_uninstall(Operator): 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() + userpref.studio_lights.remove(studio_light) return {'FINISHED'} return {'CANCELLED'} -class WM_OT_studiolight_expand(Operator): - bl_idname = "wm.studiolight_expand" - bl_label = "Expand Studio Light" - index = bpy.props.IntProperty() - - def execute(self, context): - userpref = context.user_preferences - for studio_light in userpref.studio_lights: - if studio_light.index == self.index: - studio_light.show_expanded = not studio_light.show_expanded - break - - return {'FINISHED'} - - class WM_OT_studiolight_userpref_show(Operator): """Show light user preferences""" bl_idname = "wm.studiolight_userpref_show" @@ -2576,7 +2561,6 @@ classes = ( WM_OT_owner_disable, WM_OT_owner_enable, WM_OT_url_open, - WM_OT_studiolight_expand, WM_OT_studiolight_install, WM_OT_studiolight_uninstall, WM_OT_studiolight_userpref_show, |