sourceextensions/blender/demos/game-assets.xtl

1⍝│ Blender, 4: game assets. X_eTaL makes the twelve tower defense pieces 2⍝│ for X_eTaL-games and everything published with them: it writes the 3⍝│ Python -- the launcher, and the bpy script describing each piece 4⍝│ (Td.xtl) -- Python runs Blender, Blender runs the script: each piece 5⍝│ is written as NAME.glb with its clips, rendered alone as NAME.png 6⍝│ and as two sheets of frames (NAME-turn.png, NAME-map.png), 7⍝│ shown close, one after another, turning and playing each clip, for 8⍝│ one video, and all twelve lined up for another. Then X_eTaL hashes every file (the digest extension) into 9⍝│ manifest.toml and writes the page that shows them, index.html, all 10⍝│ in work/td/site. just ext blender publish-td copies that into the 11⍝│ site, at blender/td/. 12⍝│ Page: blender/td/ the pieces in 3D (published) 13⍝│ Run: just demo blender game-assets (about five minutes) 14 15"bl:" u̲se< "Blender" 16"bp:" u̲se< "Bpy" 17"td:" u̲se< "Td" 18 19⍝│ the pieces' Python, then each rendered alone, its fallback sheets (a 20⍝│ turn and a map), then two videos (960 21⍝│ by 540): the pieces one after another, close, 5 seconds each, and 22⍝│ all twelve lined up, 8 seconds 23script ← ((ᵇᵖhead c̲at ᵗᵈall c̲at ᵇᵖreport c̲at ((0.55 0.62 0.72, 3.0) ᵇᵖl̲ights 0) c̲at ᵗᵈshow) c̲at 24 ((ᵗᵈs̲tills 320) c̲at ((256, 96) ᵗᵈs̲heets 0) c̲at ((0.0 0.0 0.0, 30.0, 0.042 0.205 0.058) ᵇᵖg̲round 0)) c̲at 25 ((960, 540, 150) ᵗᵈc̲loseups 0) c̲at (ᵇᵖv̲ideo "../closeups.mp4") c̲at ((960, 540, 240) ᵗᵈf̲ilm 0) c̲at ᵇᵖv̲ideo "../lineup.mp4") 26_ ← "work/td/run.py" ᵇˡw̲rite! ᵇᵖlauncher 27_ ← "work/td/assets.py" ᵇˡw̲rite! script 28"X_eTaL -> python -> Blender -> python: twelve pieces, their pictures, a video ..." 29r ← "work/td/run.py" ᵇˡr̲un! "work/td/assets.py work/td/site" 30"the run, and the error lines in Blender's log:" 31lines ← (n̲ot r = f̲irst "\n") p̲artition r 32d̲isclose 1 s̲elect lines 33d̲isclose 2 s̲elect lines 34"each piece's clips, read back from its .glb:" 35ᵇˡr̲ead "work/td/site/clips.txt" 36"the manifest (every file hashed) and the page:" 37m ← "work/td/site/manifest.toml" ᵇˡw̲rite! ("work/td/site", ᵇˡv̲ersion @) ᵗᵈm̲anifest 0 38p ← "work/td/site/index.html" ᵇˡw̲rite! ᵗᵈpage 39ᵇˡr̲ead "work/td/site/manifest.toml" 40"the files (bytes, path):" 41ᵇˡf̲iles "work/td/site"