Brushstroke Tools: Initial Version #328

Merged
Simon Thommes merged 229 commits from SimonThommes/blender-studio-tools:brushstroke_tools-initial-version into main 2024-11-06 15:03:47 +01:00
2 changed files with 13 additions and 3 deletions
Showing only changes of commit 01504e5f78 - Show all commits

View File

@ -2,6 +2,8 @@ import bpy
from . import utils, settings
import os
def update_resource_path(self, context):
utils.update_asset_lib_path()
class BSBST_OT_copy_resources_to_path(bpy.types.Operator):
"""
Remove the active Style Preset Library.
@ -34,8 +36,8 @@ class BSBST_OT_copy_resources_to_path(bpy.types.Operator):
class BSBST_preferences(bpy.types.AddonPreferences):
bl_idname = __package__
resource_path: bpy.props.StringProperty(name='Resource Directory', subtype='DIR_PATH', )
import_relative_path: bpy.props.BoolProperty(name='Relative Path', default=True )
resource_path: bpy.props.StringProperty(name='Resource Directory', subtype='DIR_PATH', update=update_resource_path)
import_relative_path: bpy.props.BoolProperty(name='Relative Path', default=True)
import_method: bpy.props.EnumProperty(name='Import Method', default='APPEND',
items= [('APPEND', 'Append', 'Append data-blocks and pack image data as local to this file.', 'APPEND_BLEND', 0),\
('LINK', 'Link', 'Link data-blocks from resource directory.', 'LINK_BLEND', 1),

View File

@ -249,7 +249,7 @@ def ensure_resources():
def register_asset_lib():
asset_libs = bpy.context.preferences.filepaths.asset_libraries
if asset_lib_name in [a.name for a in asset_libs]:
return
return asset_libs[asset_lib_name]
lib = asset_libs.new()
lib.name = asset_lib_name
lib.path = get_resource_directory()
@ -262,6 +262,14 @@ def unregister_asset_lib():
return
asset_libs.remove(lib)
def update_asset_lib_path():
asset_libs = bpy.context.preferences.filepaths.asset_libraries
if asset_lib_name not in [a.name for a in asset_libs]:
register_asset_lib()
return
lib = asset_libs[asset_lib_name]
lib.path = get_resource_directory()
def transfer_modifier(modifier_name, target_obj, source_obj):
"""
Core taken from https://projects.blender.org/studio/blender-studio-pipeline