Skip to content

Commit

Permalink
Merge pull request #51 from atticus-lv/1.5.0
Browse files Browse the repository at this point in the history
1.5.0
  • Loading branch information
atticus-lv authored Jun 4, 2024
2 parents 3d5e197 + 95ba10a commit f1bc9ef
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
<a href="https://atticus-lv.gitee.io/super_io/#/">
[Gitee]
</a>
Blender 2.83 ~ 3.2
Blender 2.83 ~ 3.6 (1.4.8 and lower) 4.0+ (1.5.0)
</p>

# 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)
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -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/#/",
Expand Down
78 changes: 78 additions & 0 deletions __make_addon_zip.py
Original file line number Diff line number Diff line change
@@ -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()


0 comments on commit f1bc9ef

Please sign in to comment.