34 lines
		
	
	
		
			962 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			962 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
 | |
| """
 | |
| Adapter for making an asset library of all  blender file found in a folder
 | |
| """
 | |
| 
 | |
| 
 | |
| from asset_library.adapters.adapter import AssetLibraryAdapter
 | |
| from asset_library.common.file_utils import copy_dir
 | |
| from bpy.props import StringProperty
 | |
| from os.path import expandvars
 | |
| 
 | |
| 
 | |
| class CopyFolderLibrary(AssetLibraryAdapter):
 | |
|     """Copy library folder from a server to a local disk for better performance"""
 | |
| 
 | |
|     name = "Copy Folder"
 | |
|     source_directory : StringProperty()
 | |
|     
 | |
|     includes : StringProperty() 
 | |
|     excludes : StringProperty() 
 | |
| 
 | |
|     def bundle(self):
 | |
|         src = expandvars(self.source_directory)
 | |
|         dst = expandvars(self.library_path)
 | |
| 
 | |
|         includes = [inc.strip() for inc in self.includes.split(',')]
 | |
|         excludes = [ex.strip() for ex in self.excludes.split(',')]
 | |
| 
 | |
|         print(f'Copy Folder from {src} to {dst}...')
 | |
|         copy_dir(
 | |
|             src, dst, only_recent=True,
 | |
|             excludes=excludes, includes=includes
 | |
|         )
 | |
|   |