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 20 additions and 2 deletions
Showing only changes of commit 9b3e7ca3eb - Show all commits

View File

@ -47,6 +47,23 @@ def set_render_engine(scene: bpy.types.Scene, engine='CYCLES'):
scene.render.engine = engine
def create_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:
for scene in bpy.data.scenes:
if scene.name == keep_scene_name:
continue
print(f"remove scene {scene.name}")
bpy.data.scenes.remove(scene)
def link_and_override_collection(
file_path: str, collection_name: str, scene: bpy.types.Scene
) -> bpy.types.Collection:

View File

@ -7,6 +7,7 @@ from .core import (
set_render_engine,
link_camera_rig,
task_type_anim_output_collection,
create_scene,
)
active_project = None
@ -130,9 +131,9 @@ class KITSU_OT_build_new_shot(bpy.types.Operator):
shot = active_project.get_shot(self.shot_id)
task_type = self._get_task_type_for_shot(context, shot)
# Scene Naming
# Set Up Scene + Naming
shot_task_name = shot.get_shot_task_name(task_type)
context.scene.name = shot_task_name
create_scene(shot_task_name)
# File Path
# TODO Only run if saving file