Skip to content

Commit 2ad21ac

Browse files
TMHSDigitalclaude
andcommitted
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>
1 parent 64abca3 commit 2ad21ac

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎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)