Fix: ensure loaded path is folder and not file #104812
@ -50,18 +50,13 @@ ext_list = ['.bmp',
|
|||||||
|
|
||||||
fakeUser = False
|
fakeUser = False
|
||||||
|
|
||||||
def LoadBrushSet(filepath, filename):
|
def LoadBrushSet(directory):
|
||||||
|
|
||||||
# Ensure filepath is a path and not a file (this can happen when the user selects a file within the folder)
|
for file in os.listdir(directory):
|
||||||
if os.path.isfile(filepath):
|
path = os.path.join(directory + file)
|
||||||
path, file = os.path.split(filepath)
|
|
||||||
filepath = os.path.join(path + "\\")
|
|
||||||
|
|
||||||
for file in os.listdir(filepath):
|
|
||||||
path = (filepath + file)
|
|
||||||
|
|
||||||
# get folder name
|
# get folder name
|
||||||
(f1, f2) = os.path.split(filepath)
|
(f1, f2) = os.path.split(directory)
|
||||||
(f3, foldername) = os.path.split(f1)
|
(f3, foldername) = os.path.split(f1)
|
||||||
|
|
||||||
# filter files by extensions (filter images)
|
# filter files by extensions (filter images)
|
||||||
@ -93,22 +88,11 @@ class BrushSetImporter(bpy.types.Operator):
|
|||||||
bl_idname = "import_image.brushset"
|
bl_idname = "import_image.brushset"
|
||||||
bl_label = "Import BrushSet"
|
bl_label = "Import BrushSet"
|
||||||
|
|
||||||
filename: StringProperty(name = "File Name",
|
directory: bpy.props.StringProperty(name="Directory", options={"HIDDEN"})
|
||||||
description = "filepath",
|
|
||||||
default = "",
|
|
||||||
maxlen = 1024,
|
|
||||||
options = {'ANIMATABLE'},
|
|
||||||
subtype = 'NONE')
|
|
||||||
|
|
||||||
filepath: StringProperty(name = "File Name",
|
|
||||||
description = "filepath",
|
|
||||||
default = "",
|
|
||||||
maxlen = 1024,
|
|
||||||
options = {'ANIMATABLE'},
|
|
||||||
subtype = 'NONE')
|
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
LoadBrushSet(self.properties.filepath, self.properties.filename)
|
LoadBrushSet(self.directory)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
|
Loading…
Reference in New Issue
Block a user