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 19 additions and 0 deletions
Showing only changes of commit dacae6e8a8 - Show all commits

View File

@ -45,8 +45,26 @@ def set_render_engine(scene: bpy.types.Scene, engine='CYCLES'):
scene.render.engine = engine scene.render.engine = engine
def remove_all_data():
for lib in bpy.data.libraries:
bpy.data.libraries.remove(lib)
for col in bpy.data.collections:
bpy.data.collections.remove(col)
for obj in bpy.data.objects:
bpy.data.objects.remove(obj)
bpy.ops.outliner.orphans_purge(
do_local_ids=True, do_linked_ids=True, do_recursive=True
)
def set_shot_scene(context: bpy.types.Context, scene_name: str) -> bpy.types.Scene: def set_shot_scene(context: bpy.types.Context, scene_name: str) -> bpy.types.Scene:
print(f"create scene with name {scene_name}") print(f"create scene with name {scene_name}")
for scene in bpy.data.scenes:
scene.name = 'REMOVE-' + scene.name
keep_scene = bpy.data.scenes.new(name=scene_name) keep_scene = bpy.data.scenes.new(name=scene_name)
for scene in bpy.data.scenes: for scene in bpy.data.scenes:
if scene.name == scene_name: if scene.name == scene_name:

View File

@ -148,6 +148,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 = set_shot_scene(context, shot_task_name) scene = set_shot_scene(context, shot_task_name)
remove_all_data()
set_resolution_and_fps(active_project, scene) set_resolution_and_fps(active_project, scene)
set_frame_range(shot, scene) set_frame_range(shot, scene)