Blender Kitsu: Refactor Shot Builder #183
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user