add filtering to window manager to only show folders and images since this is what the user wants to see when using this addon #104845

Merged
Germano Cavalcante merged 3 commits from DanielGrauer/blender-addons:brushset-import-filter-files into main 2023-09-25 22:06:29 +02:00

View File

@ -11,7 +11,7 @@ from bpy.props import (
bl_info = { bl_info = {
"name": "Import BrushSet", "name": "Import BrushSet",
"author": "Daniel Grauer (kromar), CansecoGPC", "author": "Daniel Grauer (kromar), CansecoGPC",
"version": (1, 3, 0), "version": (1, 3, 1),
"blender": (2, 80, 0), "blender": (2, 80, 0),
"location": "File > Import > BrushSet", "location": "File > Import > BrushSet",
"description": "Imports all image files from a folder.", "description": "Imports all image files from a folder.",
@ -61,6 +61,16 @@ class BrushSetImporter(bpy.types.Operator):
bl_idname = "import_image.brushset" bl_idname = "import_image.brushset"
bl_label = "Import BrushSet" bl_label = "Import BrushSet"
# creating a temporary filter to avoid overriding the users filters
temp_filters: bool = True
def draw(self, context):
if self.temp_filters:
context.space_data.params.use_filter = True
context.space_data.params.use_filter_folder = True
context.space_data.params.use_filter_image = True
self.temp_filters = False
directory: StringProperty( directory: StringProperty(
name="Directory", name="Directory",
description="Directory", description="Directory",