Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Blender] Support bundled ZIP format distrubtion #60

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ rendered
particles_*
sim_*
*.bin
/build
33 changes: 28 additions & 5 deletions blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,35 @@
pass

if use_blender:
from . import addon
import sys
import os

def register():
addon.register()
bundle_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'bundle')

def unregister():
addon.unregister()
if os.path.exists(bundle_path):
def register():
print('Found Taichi-Elements/bundle at', bundle_path)
if bundle_path not in sys.path:
sys.path.insert(0, bundle_path)
# import addon after path is inserted, so that `import taichi` works
from . import addon
addon.register()

def unregister():
from . import addon
addon.unregister()
if bundle_path in sys.path:
sys.path.remove(bundle_path)

else:
print('Cannot find Taichi-Elements/bundle, assuming PyPI install.')
archibate marked this conversation as resolved.
Show resolved Hide resolved

from . import addon

def register():
addon.register()

def unregister():
addon.unregister()

# Otherwise act as a PyPI package
6 changes: 6 additions & 0 deletions blender/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
astor
colorama
dill
pybind11>=2.5.0
sourceinspect>=0.0.3
taichi
13 changes: 13 additions & 0 deletions make_bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e
rm -rf build/Taichi-Elements
mkdir -p build/Taichi-Elements/bundle
python3 -m pip install --no-deps -r blender/requirements.txt -t build/Taichi-Elements/bundle
cp -r blender/* build/Taichi-Elements
cp -r engine build/Taichi-Elements
rm -rf build/Taichi-Elements/bundle/include
rm -rf build/Taichi-Elements/bundle/*.dist-info
rm -rf build/Taichi-Elements/bundle/bin
rm -f build/Taichi-Elements.zip
cd build && zip -r Taichi-Elements.zip Taichi-Elements