Brushstroke Tools: Initial Version #328
@ -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,7 +36,7 @@ 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', )
|
||||
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),\
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user