Skip to content

Commit 2321b2a

Browse files
TMHSDigitalclaude
andauthored
fix(examples): resolve --output against the working directory in three render paths (#223)
* fix(examples): resolve --output against the working directory in three render paths damped-track-aim, gn-sdf-remesh and turntable passed --output straight to scene.render.filepath. Blender resolves a relative filepath against the blend-file directory, which for a --background run with no .blend is the drive root, so the documented `-- --output aim.png` wrote to C:\ and the script exited with its "no file" code (10, 4, 4). Every other example already applies os.path.abspath. Closes #222 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com> * fix(examples): regenerate the three affected gallery pages (they inline the source) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com> --------- Signed-off-by: TMHSDigital <154358121+TMHSDigital@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 64abca3 commit 2321b2a

6 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎docs/gallery/damped-track-aim/index.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,9 @@ <h2>Source</h2>
672672
scene.view_settings.view_transform = <span class="s">&quot;Filmic&quot;</span>
673673
scene.view_settings.look = <span class="s">&quot;Medium High Contrast&quot;</span>
674674
scene.render.image_settings.file_format = <span class="s">&quot;PNG&quot;</span>
675+
<span class="c"># Blender resolves a relative filepath against the blend-file directory, which</span>
676+
<span class="c"># for a --background run with no .blend is the drive root, not the cwd.</span>
677+
path = os.path.abspath(path)
675678
scene.render.filepath = path
676679
bpy.ops.render.render(write_still=<span class="k">True</span>)
677680
<span class="k">return</span> os.path.exists(path) <span class="k">and</span> os.path.getsize(path) &gt; <span class="n">0</span>

‎docs/gallery/gn-sdf-remesh/index.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ <h2>Source</h2>
402402
<span class="k">try</span>: sc.eevee.taa_render_samples = <span class="n">64</span>
403403
<span class="k">except</span> Exception: <span class="k">pass</span>
404404
sc.render.resolution_x = <span class="n">1280</span>; sc.render.resolution_y = <span class="n">720</span>
405+
<span class="c"># Blender resolves a relative filepath against the blend-file directory, which</span>
406+
<span class="c"># for a --background run with no .blend is the drive root, not the cwd.</span>
407+
path = os.path.abspath(path)
405408
sc.render.image_settings.file_format = <span class="s">&#x27;PNG&#x27;</span>; sc.render.filepath = path
406409
<span class="c"># AgX would wash the crimson toward brick (docs/VISUAL-STYLE.md)</span>
407410
sc.view_settings.view_transform = <span class="s">&#x27;Standard&#x27;</span>

‎docs/gallery/turntable/index.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ <h2>Source</h2>
421421
<span class="c"># arbitrary turntable frame can land face-away and read as broken geometry.</span>
422422
sc.frame_set(<span class="n">4</span>)
423423
sc.render.resolution_x = <span class="n">1280</span>; sc.render.resolution_y = <span class="n">720</span>
424+
<span class="c"># Blender resolves a relative filepath against the blend-file directory, which</span>
425+
<span class="c"># for a --background run with no .blend is the drive root, not the cwd.</span>
426+
path = os.path.abspath(path)
424427
sc.render.image_settings.file_format = <span class="s">&#x27;PNG&#x27;</span>; sc.render.filepath = path
425428
<span class="c"># AgX would wash the copper toward beige (docs/VISUAL-STYLE.md)</span>
426429
sc.view_settings.view_transform = <span class="s">&#x27;Standard&#x27;</span>

‎examples/damped-track-aim/damped_track_aim.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,9 @@ def light(name, loc, energy, size, col):
367367
scene.view_settings.view_transform = "Filmic"
368368
scene.view_settings.look = "Medium High Contrast"
369369
scene.render.image_settings.file_format = "PNG"
370+
# Blender resolves a relative filepath against the blend-file directory, which
371+
# for a --background run with no .blend is the drive root, not the cwd.
372+
path = os.path.abspath(path)
370373
scene.render.filepath = path
371374
bpy.ops.render.render(write_still=True)
372375
return os.path.exists(path) and os.path.getsize(path) > 0

‎examples/gn-sdf-remesh/gn_sdf_remesh.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ def render_still(obj, path, engine):
9898
try: sc.eevee.taa_render_samples = 64
9999
except Exception: pass
100100
sc.render.resolution_x = 1280; sc.render.resolution_y = 720
101+
# Blender resolves a relative filepath against the blend-file directory, which
102+
# for a --background run with no .blend is the drive root, not the cwd.
103+
path = os.path.abspath(path)
101104
sc.render.image_settings.file_format = 'PNG'; sc.render.filepath = path
102105
# AgX would wash the crimson toward brick (docs/VISUAL-STYLE.md)
103106
sc.view_settings.view_transform = 'Standard'

‎examples/turntable/turntable.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ def render_still(obj, path, engine):
117117
# arbitrary turntable frame can land face-away and read as broken geometry.
118118
sc.frame_set(4)
119119
sc.render.resolution_x = 1280; sc.render.resolution_y = 720
120+
# Blender resolves a relative filepath against the blend-file directory, which
121+
# for a --background run with no .blend is the drive root, not the cwd.
122+
path = os.path.abspath(path)
120123
sc.render.image_settings.file_format = 'PNG'; sc.render.filepath = path
121124
# AgX would wash the copper toward beige (docs/VISUAL-STYLE.md)
122125
sc.view_settings.view_transform = 'Standard'

0 commit comments

Comments
 (0)