Skip to content

Commit

Permalink
wip: update render method in camera
Browse files Browse the repository at this point in the history
  • Loading branch information
hanson-hschang committed Sep 18, 2024
1 parent e6afde9 commit 572501c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bsr/_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,21 @@ def render(
"""
frame_manager = FrameManager()

# Set the current frame to 50
# check the type of the argument: frames
if frames is not None:
if isinstance(frames, int):
frames = (frames,)
elif isinstance(frames, (list, tuple)):
assert all(
isinstance(frame, int) for frame in frames
), "frames must be a list or tuple of integers"
frames = tuple(frames)
elif isinstance(frames, np.ndarray):
assert frames.ndim == 1, "frames must be a 1D array"
assert np.issubdtype(
frames.dtype, np.integer
), "frames must be an integer array"
frames = tuple(frames)
frames = tuple(int(frame) for frame in frames)
else:
raise ValueError(
"frames must be an integer, list, tuple or 1D numpy array"
Expand All @@ -325,7 +328,6 @@ def render(

max_frame_digits = len(str(np.max(frames)))
for frame in frames:
frame = int(frame)
frame_manager.frame_current = frame
bpy.context.scene.render.filepath = self.get_file_path(
frame, max_frame_digits
Expand Down

0 comments on commit 572501c

Please sign in to comment.