Skip to content

Commit

Permalink
One bug fix one optimization (#63)
Browse files Browse the repository at this point in the history
Bug
 - The error message in the case where the imported glTF file is missing
   the expected camera referenced a non-existent variable.

Fix
 - There's no reason to reset *and* opening a .blend file. So, we only
   reset if there's no blender file. It saves a fraction of a second.
  • Loading branch information
SeanCurtis-TRI authored Aug 28, 2023
1 parent c4a33f8 commit deef51d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,12 @@ def render_image(self, *, params: RenderParams, output_path: Path):
"""
Renders the current scene with the given parameters.
"""
# Always reset the scene to start with.
self.reset_scene()

# Load the blend file to set up the basic scene if provided; otherwise,
# a default lighting is added.
# the scene gets reset with default lighting.
if self._blend_file is not None:
bpy.ops.wm.open_mainfile(filepath=str(self._blend_file))
else:
self.reset_scene()
self.add_default_light_source()

# Apply the user's custom settings.
Expand Down Expand Up @@ -183,7 +181,7 @@ def render_image(self, *, params: RenderParams, output_path: Path):
if camera is None:
_logger.error(
"Camera node not found. Check the input glTF file "
f"'{params.input_path}'."
f"'{params.scene}'."
)
return

Expand Down

0 comments on commit deef51d

Please sign in to comment.