feat: clear scene sequence on connection

This commit is contained in:
Swann 2020-11-11 18:36:00 +01:00
parent f7e98abb59
commit 30b2f5d32e
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
3 changed files with 28 additions and 2 deletions

View File

@ -384,6 +384,12 @@ class BlScene(BlDatablock):
]
data['view_settings']['curve_mapping']['curves'] = scene_dumper.dump(
instance.view_settings.curve_mapping.curves)
if instance.sequence_editor:
data['has_sequence'] = True
else:
data['has_sequence'] = False
return data
def _resolve_deps_implementation(self):

View File

@ -26,6 +26,12 @@ from .dump_anything import Loader, Dumper
from .bl_datablock import BlDatablock, get_datablock_from_uuid
def dump_sequence(sequence: bpy.types.Sequence) -> dict:
""" Dump a sequence to a dict
:arg sequence: sequence to dump
:type sequence: bpy.types.Sequence
:return dict:
"""
dumper = Dumper()
dumper.exclude_filter = [
'lock',
@ -36,18 +42,30 @@ def dump_sequence(sequence: bpy.types.Sequence) -> dict:
]
dumper.depth = 1
data = dumper.dump(sequence)
input_count = getattr(sequence, 'input_count', None)
# TODO: Support multiple images
if sequence.type == 'IMAGE':
data['filename'] = sequence.elements[0].filename
# Effect strip inputs
input_count = getattr(sequence, 'input_count', None)
if input_count:
for n in range(input_count):
input_name = f"input_{n+1}"
data[input_name] = getattr(sequence, input_name).name
return data
def load_sequence(sequence_data: dict, sequence_editor: bpy.types.SequenceEditor):
""" Load sequence from dumped data
:arg sequence_data: sequence to dump
:type sequence_data:dict
:arg sequence_editor: root sequence editor
:type sequence_editor: bpy.types.SequenceEditor
"""
strip_type = sequence_data.get('type')
strip_name = sequence_data.get('name')
strip_channel = sequence_data.get('channel')

View File

@ -99,7 +99,9 @@ def clean_scene():
type_collection.remove(item)
except:
continue
# Clear sequencer
bpy.context.scene.sequence_editor_clear()
def get_selected_objects(scene, active_view_layer):
return [obj.uuid for obj in scene.objects if obj.select_get(view_layer=active_view_layer)]