Skip to content

Commit

Permalink
Fix errorous warning about scene not found
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Baintner committed Jul 22, 2024
1 parent d1572ba commit 04c7e04
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions utils_bpy/render_settings_setter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ def __init__(self, scene: str = None, view_layers: List[str] = None) -> None:

def set_scene(self, scene_name: str) -> None:
"""Set the scene to be rendered."""
if scene_name not in bpy.data.scenes.keys():
print_utils.print_warning(f"Scene {scene_name} not found!")
else:
bpy.context.window.scene = bpy.data.scenes[scene_name]
if not scene_name and len(bpy.data.scenes) > 1:
print_utils.print_warning(
"There are more than one scenes, but you didn't tell me which scene to render! So I am"
" rendering the last used scene.")
if scene_name:
if scene_name not in bpy.data.scenes.keys():
print_utils.print_warning(f"Scene {scene_name} not found!")
else:
bpy.context.window.scene = bpy.data.scenes[scene_name]
if not scene_name and len(bpy.data.scenes) > 1:
print_utils.print_warning(
"There are more than one scenes, but you didn't tell me which scene to render! So I am"
" rendering the last used scene.")
self.current_scene_data = bpy.context.scene
self.current_scene_render = self.current_scene_data.render

Expand Down

0 comments on commit 04c7e04

Please sign in to comment.