Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
efd88ba
fix bugs: now works in a blender 2.79b
PavelBlend Aug 23, 2018
9ed2f97
UI fix
PavelBlend Aug 25, 2018
465c62f
Hide Molecular Panel
PavelBlend Aug 25, 2018
dde2ca4
remove old realesee
PavelBlend Aug 26, 2018
a730885
remove old Molecular Core (with Python)
PavelBlend Aug 26, 2018
978fe55
move sources dir in root folder
PavelBlend Aug 26, 2018
5f49168
remove binary files
PavelBlend Aug 26, 2018
79d9747
edit setup bat
PavelBlend Aug 26, 2018
811e4f3
rename 'setup' files to 'setup32'
PavelBlend Aug 26, 2018
1a643ec
remove ToDo.txt file
PavelBlend Aug 26, 2018
c2ca48b
edit README.md
PavelBlend Aug 26, 2018
ac87b8e
1.0.4
PavelBlend Aug 26, 2018
fc01026
precision=6 for all parameters
PavelBlend Sep 2, 2018
d935b0c
deleted global variables
PavelBlend Sep 2, 2018
ec53b13
divided into modules
PavelBlend Sep 2, 2018
fda459d
addd git ignore file
PavelBlend Sep 3, 2018
30c5fdf
Linking Group and Activate Others Linking Options
PavelBlend Sep 3, 2018
e9eca10
#9 Groups as an integer value
PavelBlend Sep 3, 2018
9cc2bfc
refactor cmolcore.pyx: PEP8
PavelBlend Sep 20, 2018
450c8ca
clear export data
PavelBlend Oct 2, 2018
8b5674a
move descriptions text in module
PavelBlend Oct 7, 2018
a675c9c
ui: PEP8 refactor
PavelBlend Oct 7, 2018
2ddfc17
operators: PEP8 refactor
PavelBlend Oct 7, 2018
c0db8f9
ui: fix bug in particles number
PavelBlend Oct 8, 2018
fa1ef3f
ui: enable props when others links property
PavelBlend Oct 8, 2018
9b935ca
minor edits
PavelBlend Oct 8, 2018
806d221
minor edits
PavelBlend Oct 8, 2018
e6598ec
minor edits
PavelBlend Oct 8, 2018
fe9f173
move labels text in module
PavelBlend Oct 8, 2018
2c2913c
move props text in props_define function
PavelBlend Oct 8, 2018
bc2fcca
rename cmolcore to core
PavelBlend Oct 8, 2018
ba7ef6d
free memory
PavelBlend Oct 8, 2018
1adadee
fix bug in memory free
PavelBlend Oct 8, 2018
5ccd791
1.0.5
PavelBlend Oct 8, 2018
410d782
support python 3.7 (blender daily build)
PavelBlend Mar 2, 2019
40563fc
support win 32 bit
PavelBlend Mar 2, 2019
d79e000
make release script
PavelBlend Mar 2, 2019
78a50ee
1.0.6
PavelBlend Mar 2, 2019
68e643b
support blender 2.80
PavelBlend Mar 4, 2019
bba0e77
1.0.7
PavelBlend Mar 4, 2019
cd71670
fix errors in 2.80
PavelBlend Apr 21, 2019
0eae152
adapt setup.py for mac (and linux)
scorpion81 May 12, 2019
da83817
Create make_release_linux_mac.py
scorpion81 May 12, 2019
bc9edf7
Rename make_release.py to make_release_win.py
scorpion81 May 12, 2019
dccfacf
add platform.system() == "Linux" check
scorpion81 May 12, 2019
c8c0d2f
fix, use "expected" linux .so name now
scorpion81 May 12, 2019
64d17d5
molecular should work again now in 2.8
scorpion81 Jun 17, 2019
9098613
attempt to automate windows build, too
scorpion81 Jun 17, 2019
6251559
use sys.executable for subprocess
scorpion81 Jun 17, 2019
e388c9c
fix for linux build script, and added author
scorpion81 Jun 17, 2019
6ef5330
fix to reset particle cache prior to resimulation
scorpion81 Jun 18, 2019
7005e56
minor fixes
scorpion81 Aug 9, 2019
151fdcd
version bump due to a few fixes
scorpion81 Aug 9, 2019
b7fe1eb
fixed baked UV rendering
scorpion81 Aug 15, 2019
030a6ac
refactor
PavelBlend Apr 22, 2020
2ec794b
refactor make release script
PavelBlend Apr 22, 2020
148a6e6
refactor ui
PavelBlend Apr 22, 2020
bfe1103
fix tools panel name
PavelBlend Apr 22, 2020
7db9567
total time info
PavelBlend Apr 29, 2020
a04ce12
adapt release file for linux/mac and version is 1.11 now
scorpion81 Apr 29, 2020
10d1fb1
unified release script
scorpion81 Apr 29, 2020
59909cb
fix uv baking
PavelBlend Apr 29, 2020
6796b23
removed hardcoded 37m, use major minor abiflags instead
scorpion81 May 2, 2020
88a68f2
Create molecular-build.yml
scorpion81 Oct 9, 2020
838e2e2
create 3 building jobs, one for each os
scorpion81 Oct 9, 2020
d0c52cc
trying to get the build job working
scorpion81 Oct 9, 2020
e8e4b1e
fix attempt for build system
scorpion81 Oct 9, 2020
ac2bf32
add language level 3 for cython
scorpion81 Oct 9, 2020
efa8a71
hopefully this fixes the language level warning
scorpion81 Oct 9, 2020
41e21df
fix for build error in windows with python 3.8.x
scorpion81 Oct 9, 2020
006cd84
Update time library for Python 3.3+
Oct 6, 2020
16fb143
Update time library for Python 3.3+
Oct 6, 2020
1282e3e
bump version of core.pyx
scorpion81 Oct 9, 2020
84dc688
bump version of addon to 1.1.2
scorpion81 Oct 9, 2020
9dc0089
attempt to get correct version for packaging
scorpion81 Oct 9, 2020
6e7e309
how does this work....
scorpion81 Oct 9, 2020
574bdc6
another try
scorpion81 Oct 9, 2020
546d18a
another fix attempt for getting a version
scorpion81 Oct 9, 2020
4112a0f
string tinkering...
scorpion81 Oct 9, 2020
777649d
another approach to get the version
scorpion81 Oct 9, 2020
fb20d03
hrmpf...
scorpion81 Oct 9, 2020
a9d2534
and another try...
scorpion81 Oct 9, 2020
b14c9d3
broken pipe ? wtf...
scorpion81 Oct 9, 2020
be987ad
test
scorpion81 Oct 9, 2020
f448b6a
fix for file name glitch (hopefully)
scorpion81 Oct 9, 2020
f5cdda5
damn parenthesis...
scorpion81 Oct 9, 2020
eea04eb
update artifact creation rules for mac and linux
scorpion81 Oct 9, 2020
add0be0
fix for loading error (undefined symbols)
scorpion81 Oct 9, 2020
2c83d83
change linux runner to ubuntu 18.04
scorpion81 Oct 9, 2020
d4cd1bd
try to additionally link math lib (lm)
scorpion81 Oct 9, 2020
c6e0203
put status badge into readme
scorpion81 Oct 9, 2020
60385f5
hrmpf, blender 2.90.1 still uses python 3.7
scorpion81 Oct 11, 2020
5f931c7
linux: attempt to statically link against python
scorpion81 Jan 15, 2021
cba4ce6
Revert "linux: attempt to statically link against python"
scorpion81 Jan 15, 2021
04e7cb2
fix english grammar
bugcatching Oct 26, 2020
fe11cab
compile against python 3.9 for blender 2.93+
scorpion81 Jul 16, 2021
6f6bdfc
attempt installing libpython.a for linux
scorpion81 Jul 16, 2021
e47fb96
fix: forgot sudo
scorpion81 Jul 16, 2021
cd5896c
fix: corrected package name
scorpion81 Jul 16, 2021
dc4db01
update used python version to 3.10
scorpion81 May 14, 2022
54d565d
fix syntax error with python 3.10
scorpion81 May 14, 2022
2f932a0
version bump
scorpion81 May 14, 2022
1f6400d
build a "fat" binary for mac os
scorpion81 May 14, 2022
cc8cc23
removed dead links
scorpion81 May 14, 2022
ee0c683
Hmm, M1 seems to be arm64e, not arm64
scorpion81 May 14, 2022
c94b0a1
attempt to automate draft releases
scorpion81 May 21, 2022
30b747c
action yml syntax error fixes
scorpion81 May 21, 2022
bcbd5c9
fix workflow logic
scorpion81 May 21, 2022
462460d
yet another fix
scorpion81 May 21, 2022
1dd167c
hrm, cache doesnt work here, using artifacts again
scorpion81 May 21, 2022
e3482db
try to upload this now
scorpion81 May 21, 2022
9a55a13
gah, forgot to checkout the repo
scorpion81 May 21, 2022
675953a
fixes for type error and crash and version bump
scorpion81 Aug 12, 2022
831b3f4
added some UV Baking information to the readme
scorpion81 Aug 12, 2022
c0a0ff4
some clarification attempt
scorpion81 Aug 21, 2022
b074275
update fat binary for arm64
scorpion81 Sep 2, 2022
50b75b8
added some readme how to build manually
scorpion81 Sep 2, 2022
14ce062
update/recompilation to Python 3.11, used in Blender 4.1
scorpion81 Apr 20, 2024
54fd98a
build linux version on ubuntu 22.04 runner
scorpion81 Apr 20, 2024
9040f80
fix to adapt to changes in blender API related to contexts
scorpion81 Apr 20, 2024
06445ad
Update core.pyx
scorpion81 Jan 11, 2025
d01a76a
Update __init__.py
scorpion81 Jan 11, 2025
0efcd6c
Update molecular-build.yml
scorpion81 Jan 11, 2025
7541750
Update core.pyx
scorpion81 Jan 11, 2025
ac06b6e
Update setup.py
scorpion81 Jan 11, 2025
8100938
Update molecular-build.yml
scorpion81 Jan 11, 2025
1151ae8
Update setup.py
scorpion81 Jan 11, 2025
8f8ad0e
Update molecular-build.yml
scorpion81 Jan 11, 2025
2a70cbc
Update __init__.py
scorpion81 Jan 11, 2025
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
135 changes: 135 additions & 0 deletions .github/workflows/molecular-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Molecular Addon for Blender

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build_windows:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest cython==3.0.0
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build with Cython
id: build
# run: echo "::set-output name=version::$(python make_release.py)"
# force bash shell on windows too
shell: bash
run: echo "version=$(python make_release.py)" >> $GITHUB_OUTPUT
- name: Upload windows zip
uses: actions/upload-artifact@v4
with:
path: molecular_${{ steps.build.outputs.version }}_win.zip
name: molecular_win

build_linux:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
# attempt to install libpython.a for 3.11
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install libpython3.11-dev
python -m pip install --upgrade pip
pip install flake8 pytest cython==3.0.0
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build with Cython
id: build
#run: echo "::set-output name=version::$(python make_release.py)"
run: echo "version=$(python make_release.py)" >> $GITHUB_OUTPUT
- name: Upload linux zip
uses: actions/upload-artifact@v4
with:
path: molecular_${{ steps.build.outputs.version }}_linux.zip
name: molecular_linux

build_macos:

runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest cython==3.0.0
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Build with Cython
id: build
#run: echo "::set-output name=version::$(python make_release.py)"
run: echo "version=$(python make_release.py)" >> $GITHUB_OUTPUT
- name: Upload mac zip
uses: actions/upload-artifact@v4
with:
path: molecular_${{ steps.build.outputs.version }}_mac.zip
name: molecular_mac

upload_draft:

name: Upload zips as draft release assets
runs-on: ubuntu-latest
needs: [build_windows, build_linux, build_macos]

steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v4
with:
name: molecular_win

- uses: actions/download-artifact@v4
with:
name: molecular_linux

- uses: actions/download-artifact@v4
with:
name: molecular_mac

- name: Uploading
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: $GITHUB_REPOSITORY
run: python .github/workflows/release.py --path . --files `ls *.zip`
49 changes: 49 additions & 0 deletions .github/workflows/release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import requests, argparse, json, os

parser = argparse.ArgumentParser(description='Parameters.')
parser.add_argument('--path', metavar='path', type=str, nargs='+',
help='path where to search for files')
parser.add_argument('--files', metavar='files', type=str, nargs='+',
help='name of files to upload')
args = parser.parse_args()
d = vars(args)

r = os.environ['GITHUB_REPOSITORY']
t = os.environ['GITHUB_TOKEN']
p = d['path'][0]
fi = d['files']

owner = r.split("/")[0]
name = r.split("/")[1]

j = {"tag_name":"v1.0.0", # can be manually edited on publishing this draft !
"target_commitish":"master",
"name": name,
"body":"Autogenerated release package",
"draft":True,
"prerelease":False,
"generate_release_notes":False},

js = json.dumps(j[0])

r = requests.post(
headers={'Accept': 'application/vnd.github.v3+json',
'Authorization': 'token {token}'.format(token=t)},
url='https://api.github.com/repos/{owner}/{name}/releases'.format(owner=owner, name=name),
data=js,
)

if "upload_url" in r.json():
u = r.json()["upload_url"].split("{")[0]

for f in fi:
pr = os.path.realpath(p)
pa = os.path.join(pr, f)
with open(pa, 'rb') as data:
r = requests.post(
headers={'Content-Type': 'application/zip',
'Authorization': 'token {token}'.format(token=t)},
url=u+'?name={name}'.format(name=f),
data=data.read()
)

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
__pycache__
*.pyd
build
*.c
*.html
.vscode
*.zip
58 changes: 52 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
![Molecular Addon for Blender](https://github.com/scorpion81/Blender-Molecular-Script/workflows/Molecular%20Addon%20for%20Blender/badge.svg)

Blender-Molecular-Script
========================

This is my molecular python script for blender.Inspired from the 2d simulator Really (1998) and Lagoa Multiphysic in Softimage.

To download the latest version go on my blog:
This is the molecular python script for blender, originally coded py Pyroevil. Inspired from the 2d simulator Really (1998) and Lagoa Multiphysic in Softimage.

http://pyroevil.com/molecular-script-download/
To download the latest version go to the release section of this repository.

The script can be installed like any other addons in Blender:
First way:
Expand All @@ -25,7 +25,53 @@ To activate the plugins:
- In the "Object" categories, you must find "Molecular"
- Check it , close the "Blender user preferences" windows and have fun.

How to manually build Molecular:
--------------------------------

In order for a manual recompilation clone this repo and just run

`python make_release.py`

from within the "Blender-Molecular-Script" folder on your desired platform,

with a python version matching blender's own being installed.
(and cython, too. install with pip for example)


Or alternatively, run

`python setup.py build_ext --inplace`

from the "sources" folder.


How to add UVs to molecular particle instances:
----------------------------------------------

This didnt seem to work in blender 3.2.x any more and was fixed in 1.1.4.
Should also apply to blender 3.1.x but that was not tested by me.

- Original Link:
https://blenderartists.org/t/moleculars-physics/521682/269

- Example File:
[test_UV_molecular.zip](https://github.com/scorpion81/Blender-Molecular-Script/files/9320719/test_UV_molecular.zip)

When the UV data is being baked during the simulation, it will be written into the angular velocity cache part
of the particle system at the moment.

Hence you can retrieve it via a particle info node later on in order to feed it into the vector socket of the
texture node. Note that the Particle Info Node belongs to the Material on the Sphere aka the object which is being instanced.
In the example blend file there is also a Particle Info Node on the Cube material, but it doesnt really belong there. Rather
it was added by mistake.

Example with 10x10x10 Grid:
![molecular_bake_uv](https://user-images.githubusercontent.com/1172149/184380338-b07cb5de-4d54-45e0-9fa8-2967f4fb29cc.jpeg)

Visit my blog about this script for donation, comments or more detail : http://pyroevil.com
Same Example with 30x30x30 Grid
![molecular_bake_uv_high](https://user-images.githubusercontent.com/1172149/184380364-9e4a1ff9-8924-4619-9d77-f191950c52e7.jpeg)

You can find older version in the release folder.
Remarks:
- only in cycles
- only in rendered viewport and render
- need to re-bake the sim for UVs after loading (not persistent, it seems)
31 changes: 0 additions & 31 deletions ToDo.txt

This file was deleted.

74 changes: 74 additions & 0 deletions make_release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
from molecular import bl_info
from zipfile import ZipFile, ZIP_DEFLATED
from os import path, walk, remove, chdir, getcwd
import shutil
import platform
import sys
import pathlib
from subprocess import Popen, PIPE

is_linux = platform.architecture()[1] == "ELF" or platform.system() == "Linux"
is_windows = platform.architecture()[1] == "WindowsPE" or platform.system() == "Windows"

#in python 3.8.x, sys.abiflags attribute doesnt seem to exist any more instead of returning empty string.
#so better check for existence here before accessing it.
abiflags = ''
if hasattr(sys, 'abiflags'):
abiflags = sys.abiflags

v = str(sys.version_info.major) + str(sys.version_info.minor) + abiflags

name = 'mac'
if is_linux:
name = 'linux'
elif is_windows:
name = 'win'

chdir(getcwd()+"//sources")

#TODO, blenders (or a compatible) python bin needs to be in $PATH, and if you use blender's you need to copy the python includes from SVN
#into the include folder of blenders python, too

version = '.'.join(map(str, bl_info['version']))

with Popen([sys.executable, "setup.py", "build_ext", "--inplace"], stdout=PIPE) as proc:
proc.stdout.read()
if is_linux: #TODO, test
shutil.move("core.cpython-{}-x86_64-linux-gnu.so".format(v), "..//molecular//core.cpython-{}-x86_64-linux-gnu.so".format(v))
elif is_windows:
shutil.move("core.cp{}-win_amd64.pyd".format(v), "..//molecular//core.cp{}-win_amd64.pyd".format(v))
else:
shutil.move("core.cpython-{}-darwin.so".format(v), "..//molecular//core.cpython-{}-darwin.so".format(v))

chdir("..")

with ZipFile('molecular_{}_'.format(('.'.join(map(str, bl_info['version'])))) + name +'.zip', 'w') as z:
for root, _, files in walk('molecular'):
for file in files:
if not file.endswith('.py') and not file.endswith('.so') and not file.endswith('.pyd'):
continue
z.write(path.join(root, file), compress_type=ZIP_DEFLATED)
#cleanup
chdir(getcwd()+"//molecular")
try:
if is_linux:
remove("core.cpython-{}-x86_64-linux-gnu.so".format(v))
elif is_windows:
remove("core.cp{}-win_amd64.pyd".format(v))
else:
remove("core.cpython-{}-darwin.so".format(v))
except:
pass
chdir("..")
chdir(getcwd()+"//sources")

try:
remove("core.html")
remove("core.c")
shutil.rmtree("build")
except:
pass

chdir("..")

print(version)
Loading