feat: basic file sequence loading

This commit is contained in:
Swann 2021-11-24 18:56:17 +01:00
parent b96f600f15
commit 8000ce9931
3 changed files with 20 additions and 3 deletions

View File

@ -1024,7 +1024,7 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
if len(self.files) > 1:
context.window_manager.session.replay_files.clear()
context.window_manager.session.active_replay_file = len(self.files)-1
context.scene.active_replay_file = len(self.files)-1
directory = Path(self.filepath).parent
for f in self.files:
snap = context.window_manager.session.replay_files.add()

View File

@ -109,7 +109,11 @@ def set_active_replay(self, value):
else:
self.active_replay_file = value
print(bpy.context.window_manager.session.active_replay_file)
# bpy.ops.session.load( )
bpy.ops.session.load(
filepath=bpy.context.window_manager.session.replay_files[value].name,
draw_users=True)
def get_active_replay(self):
return self.get('active_replay_file', 0)
@ -712,6 +716,7 @@ class SessionProps(bpy.types.PropertyGroup):
description='Active snapshot',
set=set_active_replay,
get=get_active_replay,
options={'ANIMATABLE'}
)
@ -739,6 +744,16 @@ def register():
# at launch server presets
prefs.generate_default_presets()
bpy.types.Scene.active_replay_file = bpy.props.IntProperty(
name="active_replay_file",
default=0,
min=0,
description='Active snapshot',
set=set_active_replay,
get=get_active_replay,
options={'ANIMATABLE'}
)
@ -747,3 +762,5 @@ def unregister():
for cls in reversed(classes):
unregister_class(cls)
del bpy.types.Scene.active_replay_file

View File

@ -584,7 +584,7 @@ class SESSION_PT_replay(bpy.types.Panel):
row= layout.row()
row.prop(bpy.context.window_manager.session, 'active_replay_file')
row.prop(bpy.context.scene, 'active_replay_file')
class SESSION_PT_repository(bpy.types.Panel):