Fix T61246: studiolights (un)install problems
- studiolights were not installed to their proper subfolder (thus not recognized on blender restart) - they were actually loaded with a wrong path which could lead to deletion of the original source file when uninstalled again
This commit is contained in:
parent
7325035e60
commit
478be344fa
Notes:
blender-bot
2023-02-14 03:49:22 +01:00
Referenced by issue #61274, Duplicate current workspace makes the workspace menu disappear Referenced by issue #61246, lookDev HDRIs deleting wrong file
|
@ -2465,15 +2465,15 @@ class WM_OT_studiolight_install(Operator):
|
|||
import shutil
|
||||
prefs = context.preferences
|
||||
|
||||
filepaths = [os.path.join(self.directory, e.name) for e in self.files]
|
||||
path_studiolights = bpy.utils.user_resource('DATAFILES', "studiolights", create=True)
|
||||
path_studiolights = os.path.join("studiolights", self.type.lower())
|
||||
path_studiolights = bpy.utils.user_resource('DATAFILES', path_studiolights, create=True)
|
||||
if not path_studiolights:
|
||||
self.report({'ERROR'}, "Failed to create Studio Light path")
|
||||
return {'CANCELLED'}
|
||||
|
||||
for filepath in filepaths:
|
||||
shutil.copy(filepath, path_studiolights)
|
||||
prefs.studio_lights.load(os.path.join(path_studiolights, filepath), self.type)
|
||||
for e in self.files:
|
||||
shutil.copy(os.path.join(self.directory, e.name), path_studiolights)
|
||||
prefs.studio_lights.load(os.path.join(path_studiolights, e.name), self.type)
|
||||
|
||||
# print message
|
||||
msg = (
|
||||
|
|
Loading…
Reference in New Issue