Blender Kitsu: Refactor Shot Builder #183
@ -49,22 +49,18 @@ def set_render_engine(scene: bpy.types.Scene, engine='CYCLES'):
|
|||||||
scene.render.engine = engine
|
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}")
|
print(f"create scene with name {scene_name}")
|
||||||
scene = bpy.data.scenes.new(name=scene_name)
|
keep_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:
|
for scene in bpy.data.scenes:
|
||||||
if scene.name == keep_scene_name:
|
if scene.name == scene_name:
|
||||||
continue
|
continue
|
||||||
print(f"remove scene {scene.name}")
|
print(f"remove scene {scene.name}")
|
||||||
bpy.data.scenes.remove(scene)
|
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):
|
def set_resolution_and_fps(project: Project, scene: bpy.types.Scene):
|
||||||
scene.render.fps = project.fps # set fps
|
scene.render.fps = project.fps # set fps
|
||||||
|
@ -7,7 +7,7 @@ from .core import (
|
|||||||
set_render_engine,
|
set_render_engine,
|
||||||
link_camera_rig,
|
link_camera_rig,
|
||||||
task_type_anim_output_collection,
|
task_type_anim_output_collection,
|
||||||
create_scene,
|
set_shot_scene,
|
||||||
set_resolution_and_fps,
|
set_resolution_and_fps,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ class KITSU_OT_build_new_shot(bpy.types.Operator):
|
|||||||
|
|
||||||
# Set Up Scene + Naming
|
# Set Up Scene + Naming
|
||||||
shot_task_name = shot.get_shot_task_name(task_type)
|
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)
|
set_resolution_and_fps(active_project, scene)
|
||||||
|
|
||||||
# File Path
|
# File Path
|
||||||
|
Loading…
Reference in New Issue
Block a user