Blender Kitsu: Refactor Shot Builder #183

Merged
Nick Alberelli merged 55 commits from TinyNick/blender-studio-pipeline:feature/shot-builder-2 into main 2023-12-21 23:58:21 +01:00
2 changed files with 8 additions and 12 deletions
Showing only changes of commit e25c2bd40b - Show all commits

View File

@ -49,22 +49,18 @@ def set_render_engine(scene: bpy.types.Scene, engine='CYCLES'):
scene.render.engine = engine
def create_scene(scene_name: str) -> bpy.types.Scene:
def set_shot_scene(scene_name: str) -> bpy.types.Scene:
print(f"create scene with name {scene_name}")
scene = bpy.data.scenes.new(name=scene_name)
bpy.context.window.scene = scene
remove_other_scenes(scene_name)
return scene
def remove_other_scenes(keep_scene_name: str) -> None:
keep_scene = bpy.data.scenes.new(name=scene_name)
for scene in bpy.data.scenes:
if scene.name == keep_scene_name:
if scene.name == scene_name:
continue
print(f"remove scene {scene.name}")
bpy.data.scenes.remove(scene)
bpy.context.window.scene = keep_scene
return keep_scene
def set_resolution_and_fps(project: Project, scene: bpy.types.Scene):
scene.render.fps = project.fps # set fps

View File

@ -7,7 +7,7 @@ from .core import (
set_render_engine,
link_camera_rig,
task_type_anim_output_collection,
create_scene,
set_shot_scene,
set_resolution_and_fps,
)
@ -134,7 +134,7 @@ class KITSU_OT_build_new_shot(bpy.types.Operator):
# Set Up Scene + Naming
shot_task_name = shot.get_shot_task_name(task_type)
scene = create_scene(shot_task_name)
scene = set_shot_scene(shot_task_name)
set_resolution_and_fps(active_project, scene)
# File Path