Skip to content
Snippets Groups Projects
Commit 83f84dfd authored by Dany Lebel's avatar Dany Lebel
Browse files

Solved error message with presets menu when no path specified

parent 1ec5762e
No related branches found
No related tags found
No related merge requests found
...@@ -95,31 +95,31 @@ class PALETTE_MT_menu(bpy.types.Menu): ...@@ -95,31 +95,31 @@ class PALETTE_MT_menu(bpy.types.Menu):
import bpy.utils import bpy.utils
layout = self.layout layout = self.layout
if not searchpaths[0]:
if not searchpaths:
layout.label("* Missing Paths *") layout.label("* Missing Paths *")
# collect paths # collect paths
files = [] else :
for directory in searchpaths: files = []
files.extend([(f, os.path.join(directory, f)) for f in os.listdir(directory)]) for directory in searchpaths:
files.extend([(f, os.path.join(directory, f)) for f in os.listdir(directory)])
files.sort() files.sort()
for f, filepath in files: for f, filepath in files:
if f.startswith("."): if f.startswith("."):
continue continue
preset_name = bpy.path.display_name(f) preset_name = bpy.path.display_name(f)
props = layout.operator(operator, text=preset_name) props = layout.operator(operator, text=preset_name)
for attr, value in props_default.items(): for attr, value in props_default.items():
setattr(props, attr, value) setattr(props, attr, value)
props.filepath = filepath props.filepath = filepath
if operator == "palette.load_gimp_palette": if operator == "palette.load_gimp_palette":
props.menu_idname = self.bl_idname props.menu_idname = self.bl_idname
def draw_preset(self, context): def draw_preset(self, context):
"""Define these on the subclass """Define these on the subclass
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment