programextensions/blender/demos/hello.xtl
Blender, 1: X_eTaL runs Blender. The program writes two Python files -- the launcher, which runs Blender in the background (with its factory settings, so the run never depends on yours), and the script Blender runs inside, which writes a report -- then runs the launcher with python3 and reads the report back. The chain: X_eTaL, the extension, python3, Blender, Python inside Blender. Run: just demo blender hello
launcher : Char
the launcher: python3 run.py SCRIPT ARGS runs Blender in the background on SCRIPT, passing ARGS after "--"; Blender's exit status is its own (a Python error inside makes it 1)
launcher ← "import os, subprocess, sys\nblender = os.environ.get(\"XETAL_BLENDER\") or sys.exit(\"no Blender found\")\nrun = [blender, \"--background\", \"--factory-startup\", \"--python-exit-code\", \"1\", \"--python\", sys.argv[1], \"--\"] + sys.argv[2:]\nsys.exit(subprocess.run(run).returncode)\n"
Used in: _
inside : Char
the script Blender runs: the objects of the scene it starts with, written to the file named after "--"
inside ← "import bpy, sys\nout = sys.argv[sys.argv.index(\"--\") + 1]\nnames = sorted(o.name for o in bpy.data.objects)\nopen(out, \"w\").write(\"objects: \" + \" \".join(names) + \"\\n\")\n"
Used in: _