Fix Python error removing studio lights in user preferences.

This commit is contained in:
Brecht Van Lommel 2018-07-17 14:21:16 +02:00
parent 6d8e36b723
commit 117a5c0ac7
2 changed files with 12 additions and 5 deletions

View File

@ -2499,9 +2499,12 @@ class WM_OT_studiolight_uninstall(Operator):
userpref = context.user_preferences
for studio_light in userpref.studio_lights:
if studio_light.index == self.index:
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))
if len(studio_light.path) > 0:
self._remove_path(pathlib.Path(studio_light.path))
if len(studio_light.path_irr_cache) > 0:
self._remove_path(pathlib.Path(studio_light.path_irr_cache))
if len(studio_light.path_sh_cache) > 0:
self._remove_path(pathlib.Path(studio_light.path_sh_cache))
userpref.studio_lights.remove(studio_light)
return {'FINISHED'}
return {'CANCELLED'}

View File

@ -683,7 +683,9 @@ static void rna_UserDef_studiolight_path_irr_cache_get(PointerRNA *ptr, char *va
if (sl->path_irr_cache) {
BLI_strncpy(value, sl->path_irr_cache, FILE_MAX);
}
value[0] = 0x00;
else {
value[0] = '\0';
}
}
static int rna_UserDef_studiolight_path_irr_cache_length(PointerRNA *ptr)
@ -702,7 +704,9 @@ static void rna_UserDef_studiolight_path_sh_cache_get(PointerRNA *ptr, char *val
if (sl->path_sh_cache) {
BLI_strncpy(value, sl->path_sh_cache, FILE_MAX);
}
value[0] = 0x00;
else {
value[0] = '\0';
}
}
static int rna_UserDef_studiolight_path_sh_cache_length(PointerRNA *ptr)