Brushstroke Tools: Initial Version #328
@ -54,6 +54,21 @@ class BSBST_brush_style(bpy.types.PropertyGroup):
|
||||
name: bpy.props.StringProperty(default='')
|
||||
filepath: bpy.props.StringProperty(default='')
|
||||
|
||||
class BSBST_UL_brush_styles(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||
resource_dir = utils.get_resource_directory()
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
split = layout.split(factor=0.4)
|
||||
split.label(text=item.name)
|
||||
row = split.row()
|
||||
row.active = False
|
||||
row.label(text=item.filepath.replace(resource_dir, '{LIB}/'), icon='FILE_FOLDER')
|
||||
elif self.layout_type == 'GRID':
|
||||
layout.label(text=item.name)
|
||||
|
||||
def draw_filter(self, context, layout):
|
||||
return
|
||||
|
||||
class BSBST_preferences(bpy.types.AddonPreferences):
|
||||
bl_idname = __package__
|
||||
|
||||
@ -64,11 +79,12 @@ class BSBST_preferences(bpy.types.AddonPreferences):
|
||||
('LINK', 'Link', 'Link data-blocks from resource directory.', 'LINK_BLEND', 1),
|
||||
])
|
||||
brush_styles: bpy.props.CollectionProperty(type=BSBST_brush_style)
|
||||
active_brush_style_index: bpy.props.IntProperty()
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
row = layout.row()
|
||||
row.label(text='Brushstrokes Library', icon='BRUSHES_ALL')
|
||||
row.label(text='Brushstrokes Library', icon='ASSET_MANAGER')
|
||||
layout.prop(self, 'import_method')
|
||||
if self.import_method == 'LINK':
|
||||
layout.prop(self, 'import_relative_path')
|
||||
@ -110,9 +126,21 @@ class BSBST_preferences(bpy.types.AddonPreferences):
|
||||
if self.import_method == 'LINK' and not self.resource_path:
|
||||
col.label(text='Linking the resources from the default addon directory is not recommended.', icon='ERROR')
|
||||
|
||||
style_box = layout.box()
|
||||
style_box_header = style_box.row(align=True)
|
||||
style_box_header.label(text=f'Brush Styles ({len(self.brush_styles)} loaded)', icon='BRUSHES_ALL')
|
||||
style_box_header.operator('brushstroke_tools.refresh_styles', text='', icon='FILE_REFRESH')
|
||||
if not self.brush_styles:
|
||||
style_box.label(text='No Brush styles found in library directory', icon='ERROR')
|
||||
else:
|
||||
style_box.template_list('BSBST_UL_brush_styles', "", self, "brush_styles",
|
||||
self, "active_brush_style_index", rows=3, maxrows=5, sort_lock=True)
|
||||
|
||||
|
||||
|
||||
classes = [
|
||||
BSBST_brush_style,
|
||||
BSBST_UL_brush_styles,
|
||||
BSBST_preferences,
|
||||
BSBST_OT_copy_resources_to_path,
|
||||
BSBST_OT_refresh_brushstroke_styles,
|
||||
|
Loading…
Reference in New Issue
Block a user