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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user