diff --git a/README.md b/README.md index 25995b5..a2c68c4 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,14 @@ [Gitee] - Blender 2.83 ~ 3.2 + Blender 2.83 ~ 3.6 (1.4.8 and lower) 4.0+ (1.5.0)

+# Notice + +> Since blender 4.1 has support Drag and Drop, this addon will be deprecated soon +> See new addon https://github.com/atticus-lv/CustomDragImport , a improve version of super_io (Import only now, support clipboard and drag import) + # Intro ![f_world](res/img/f_world.gif) @@ -27,7 +32,6 @@ importing and exporting blender files / Models / pictures With third-party Scripts, you are allowed to copy/paste among blender, Cinema 4d and Houdini > Support windows / Mac platforms(Not Fully Support, only win with c4d/houdini addon) -> # Contributing diff --git a/__init__.py b/__init__.py index f326aae..63d320f 100644 --- a/__init__.py +++ b/__init__.py @@ -1,8 +1,8 @@ bl_info = { "name": "Super IO (SPIO)", "author": "Atticus", - "blender": (2, 83, 0), - "version": (1, 4, 8), + "blender": (4, 1, 0), + "version": (1, 5, 0), "category": "Import-Export", "support": "COMMUNITY", "doc_url": "https://atticus-lv.gitee.io/super_io/#/", diff --git a/__make_addon_zip.py b/__make_addon_zip.py new file mode 100644 index 0000000..ef26645 --- /dev/null +++ b/__make_addon_zip.py @@ -0,0 +1,78 @@ +# coding: UTF-8 +import os +from pathlib import Path +import zipfile +import shutil + +parent_path = Path(__file__).parent + + +def get_tg_dir() -> Path: + tg_dir = parent_path.joinpath(parent_path.name) + if tg_dir.exists(): + shutil.rmtree(tg_dir) + tg_dir.mkdir() + + return tg_dir + + +def copy_files() -> Path: + tg_dir = get_tg_dir() + sub_dir = tg_dir.joinpath(parent_path.name) + sub_dir.mkdir() + + for file in parent_path.glob('*'): + if file.is_dir(): + if file.name == parent_path.name: continue + if file.name.startswith('__') or file.name.startswith('.'): continue + if file.is_dir() and file.name == 'docs': continue + + shutil.copytree(file, sub_dir.joinpath(file.name)) + + elif file.is_file(): + if file.name == __file__: continue + + shutil.copy(file, sub_dir.joinpath(file.name)) + + return tg_dir + + +def get_bl_addon_info() -> dict: + import re + rule = re.compile(r'bl_info\s*=\s*{.*?}', re.DOTALL) + with open(parent_path.joinpath('__init__.py'), 'r', encoding='utf-8') as f: + _bl_info = rule.findall(f.read()) + + if not _bl_info: + raise RuntimeError('bl_info not found') + bl_info = eval(_bl_info[0].split('=')[1]) + + return bl_info + + +def zip_dir(): + # read bl_info + bl_info = get_bl_addon_info() + print(f'Addon name: {bl_info.get("name", "")}') + print(f'Version: {bl_info.get("version", "")}') + + tg_dir = copy_files() + final_name = parent_path.name + ' v' + '.'.join([str(num) for num in bl_info['version']]) + '.zip' + zip_file = parent_path.joinpath(final_name) + if zip_file.exists(): + os.remove(zip_file) + + with zipfile.ZipFile(zip_file, 'w') as zip: + for root, dirs, files in os.walk(tg_dir): + for file in files: + zip.write(os.path.join(root, file), arcname=os.path.join(root, file).replace(str(tg_dir), '')) + print(f'Output: "{zip_file}"') + shutil.rmtree(tg_dir) + print('Cleaning') + + +if __name__ == '__main__': + copy_files() + zip_dir() + +