{"id":13760345,"url":"https://github.com/darwin/blender-clojure","last_synced_at":"2025-06-20T11:33:44.188Z","repository":{"id":42924049,"uuid":"244197041","full_name":"darwin/blender-clojure","owner":"darwin","description":"[EXPERIMENTAL] Blender scripting with ClojureScript. Live-coding Blender environment using modern cljs tools.","archived":false,"fork":false,"pushed_at":"2022-03-26T06:22:23.000Z","size":631,"stargazers_count":32,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T10:00:05.909Z","etag":null,"topics":["blender","blender-scripts","clojure","clojurescript","hylang","python3","v8"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darwin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-01T17:55:10.000Z","updated_at":"2024-05-31T07:57:47.000Z","dependencies_parsed_at":"2022-08-30T10:42:24.646Z","dependency_job_id":null,"html_url":"https://github.com/darwin/blender-clojure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/darwin/blender-clojure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darwin%2Fblender-clojure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darwin%2Fblender-clojure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darwin%2Fblender-clojure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darwin%2Fblender-clojure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darwin","download_url":"https://codeload.github.com/darwin/blender-clojure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darwin%2Fblender-clojure/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260936904,"owners_count":23085567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blender","blender-scripts","clojure","clojurescript","hylang","python3","v8"],"created_at":"2024-08-03T13:01:08.318Z","updated_at":"2025-06-20T11:33:39.159Z","avatar_url":"https://github.com/darwin.png","language":"Clojure","funding_links":[],"categories":["Clojure"],"sub_categories":[],"readme":"# Clojure and Blender\n\nThis is an experimental attempt to enable Blender scripting in ClojureScript.\n\nTechnically we extend Blender with a Python3 script (see [driver](driver)) \nwhich embeds V8 Javascript engine and manages running ClojureScript-generated Javascript in there.\n\nCrazy? Maybe, but it works surprisingly well.\n\nActually, there is more to it:\n\n* We use [shadow-cljs](https://github.com/thheller/shadow-cljs) as our build tool, hot code reloading and REPL \n* We implement minimal set of web APIs for shadow-cljs to work (it thinks it talks to a browser)\n* We expose Blender's [Python APIs](https://docs.blender.org/api/current/index.html) in the Javascript context\n* We generate [bcljs library](bcljs) wrapping Python APIs for more idiomatic ClojureScript access\n\nPlease see examples in [sandboxes/shadow](sandboxes/shadow) to get the feel for it.\n\nThis project also supports writing your scripts in [hylang](https://github.com/hylang/hy). \nSee [docs/hylang.md](docs/hylang.md) for details.  \n\n### Initial setup\n\nTested under macOS, should work under Linux as well.\n\n```bash\n# note: this is probably not needed under macOS if you put Blender to /Applications/Blender.app \n# a pro tip: it is convenient to use direnv for this\nexport BCLJ_BLENDER_PATH=\"/path/to/your/blender\"\nexport BCLJ_BLENDER_PYTHON_PATH=\"/path/to/your/blender/and/its/python\"\n```\n\n#### Python dependencies\n\n* Run `./scripts/install-deps.sh` to install our dependencies (creates Python virtual env under `.venv`).\n\n#### Python V8 module\n\nUnfortunately you have to compile V8 by hand. We provide a script which worked for us under macOS:\n\n```bash\n# this script should compile and install fresh v8 python module under venv/lib/.../site-packages\n./scripts/prepare-v8.sh\n```\n\n#### NPM dependencies\n\nYou should keep your npm deps fresh as well:\n\n```bash\ncd sandboxes/shadow\nnpm install\n```\n\n#### Generate bcljs library\n\nThe generator is currently under development so to prevent churn we don't commit generated library.\n\nYou have to generate it yourself:\n\n```bash\ncd tools\n./scripts/generate-xml.sh\n./scripts/buidl-api.sh\n```\n\nIt will ask to specify Blender binary path and Blender source code repo path on your machine.\nInstead of passing it via command-line options you can set it via env variables, here are mine:\n\n```text\n❯ env | grep BLENDER\nBLENDER_BINARY_PATH=/Applications/Blender.app/Contents/MacOS/Blender\nBLENDER_REPO_DIR=/Users/darwin/lab/blender \n```\n\nThe generated source files are rsynced into [bcljs/src/gen](bcljs/src/gen).\nSee the [tools/readme.md](tools/readme.md) for more details.\n\n## A typical workflow\n\nIn one terminal session, compile and watch shadow-cljs sandbox: \n```bash\ncd sandboxes/shadow\nshadow-cljs watch sandbox\n```\n```text\nshadow-cljs - config: /Users/darwin/lab/blender-clojure/sandboxes/shadow/shadow-cljs.edn  cli version: 2.8.90  node: v13.8.0\nshadow-cljs - starting via \"clojure\"\nshadow-cljs - server version: 2.8.90 running at http://localhost:9630\nshadow-cljs - nREPL server started on port 64170\nshadow-cljs - watching build :sandbox\n[:sandbox] Configuring build.\n[:sandbox] Compiling ...\n[:sandbox] Build completed. (137 files, 1 compiled, 0 warnings, 1.72s)\n```\n\nIn another terminal session, start Blender with blender-clojure driver:\n```bash\n./scripts/blender.sh\n```\n```text\nBCLJ_BLENDER_PATH=/Applications/Blender.app/Contents/MacOS/Blender\nBCLJ_BLENDER_PYTHON_PATH=/Applications/Blender.app/Contents/Resources/2.82/python\nBCLJ_PACKAGES_DIR=/Users/darwin/lab/blender-clojure/.venv/lib/python3.7/site-packages\n+ exec /Applications/Blender.app/Contents/MacOS/Blender assets/blank.blend --python /Users/darwin/lab/blender-clojure/driver/src/entry.py\nRead prefs: /Users/darwin/Library/Application Support/Blender/2.82/config/userpref.blend\nfound bundled python: /Applications/Blender.app/Contents/Resources/2.82/python\nRead blend: /Users/darwin/lab/blender-clojure/assets/blank.blend\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nStarting blender-clojure driver...\nhy 0.18.0 using CPython(default) 3.7.4 on Darwin in Blender 2.82 (sub 7)\nConnecting via websockets to 'ws://localhost:9630/ws/worker/sandbox/e452c1e2-aef2-4fc0-af73-6d8a0870e2f0/aed44a0b-5b5e-411b-977f-c70d7f60e120/browser'\nconsole.log Hello from bpg.sandbox\nconsole.log bpg.sandbox.init() called!\nconsole.log shadow-cljs: WebSocket connected!\nconsole.log shadow-cljs: REPL session start successful\n```\n\nIn another terminal session, connect to running Blender via REPL:\n```bash\ncd sandboxes/shadow\nshadow-cljs cljs-repl sandbox\n```\n```text\nshadow-cljs - config: /Users/darwin/lab/blender-clojure/sandboxes/shadow/shadow-cljs.edn  cli version: 2.8.90  node: v13.8.0\nshadow-cljs - connected to server\nbpg.sandbox=\u003e (+ 1 2)\n3\n\n\u003e\n```\n\nTo start from scratch:\n```bash\n./scripts/nuke.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarwin%2Fblender-clojure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarwin%2Fblender-clojure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarwin%2Fblender-clojure/lists"}