feat: initial inteface
This commit is contained in:
@ -993,6 +993,10 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
|
|||||||
default=10.0,
|
default=10.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
files: bpy.props.CollectionProperty(
|
||||||
|
name='File paths',
|
||||||
|
type=bpy.types.OperatorFileListElement)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -1018,6 +1022,14 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
|
|||||||
for node in nodes:
|
for node in nodes:
|
||||||
porcelain.apply(repo, node.uuid)
|
porcelain.apply(repo, node.uuid)
|
||||||
|
|
||||||
|
if len(self.files) > 1:
|
||||||
|
context.window_manager.session.replay_files.clear()
|
||||||
|
context.window_manager.session.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()
|
||||||
|
snap.name = str(Path(directory, f['name']))
|
||||||
|
|
||||||
if self.draw_users:
|
if self.draw_users:
|
||||||
f = gzip.open(self.filepath, "rb")
|
f = gzip.open(self.filepath, "rb")
|
||||||
db = pickle.load(f)
|
db = pickle.load(f)
|
||||||
@ -1036,7 +1048,7 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
class SessionImportUser(bpy.types.Panel):
|
class SESSION_PT_ImportUser(bpy.types.Panel):
|
||||||
bl_space_type = 'FILE_BROWSER'
|
bl_space_type = 'FILE_BROWSER'
|
||||||
bl_region_type = 'TOOL_PROPS'
|
bl_region_type = 'TOOL_PROPS'
|
||||||
bl_label = "Users"
|
bl_label = "Users"
|
||||||
@ -1300,7 +1312,7 @@ classes = (
|
|||||||
SessionNotifyOperator,
|
SessionNotifyOperator,
|
||||||
SessionSaveBackupOperator,
|
SessionSaveBackupOperator,
|
||||||
SessionLoadSaveOperator,
|
SessionLoadSaveOperator,
|
||||||
SessionImportUser,
|
SESSION_PT_ImportUser,
|
||||||
SessionStopAutoSaveOperator,
|
SessionStopAutoSaveOperator,
|
||||||
SessionPurgeOperator,
|
SessionPurgeOperator,
|
||||||
SessionPresetServerAdd,
|
SessionPresetServerAdd,
|
||||||
|
@ -99,6 +99,20 @@ def update_directory(self, context):
|
|||||||
def set_log_level(self, value):
|
def set_log_level(self, value):
|
||||||
logging.getLogger().setLevel(value)
|
logging.getLogger().setLevel(value)
|
||||||
|
|
||||||
|
def set_active_replay(self, value):
|
||||||
|
max_index = len(bpy.context.window_manager.session.replay_files)-1
|
||||||
|
if value > max_index:
|
||||||
|
value = max_index
|
||||||
|
|
||||||
|
if hasattr(self, 'active_replay_file'):
|
||||||
|
self["active_replay_file"] = value
|
||||||
|
else:
|
||||||
|
self.active_replay_file = value
|
||||||
|
|
||||||
|
print(bpy.context.window_manager.session.active_replay_file)
|
||||||
|
|
||||||
|
def get_active_replay(self):
|
||||||
|
return self.get('active_replay_file', 0)
|
||||||
|
|
||||||
def get_log_level(self):
|
def get_log_level(self):
|
||||||
return logging.getLogger().level
|
return logging.getLogger().level
|
||||||
@ -687,6 +701,19 @@ class SessionProps(bpy.types.PropertyGroup):
|
|||||||
is_host: bpy.props.BoolProperty(
|
is_host: bpy.props.BoolProperty(
|
||||||
default=False
|
default=False
|
||||||
)
|
)
|
||||||
|
replay_files: bpy.props.CollectionProperty(
|
||||||
|
name='File paths',
|
||||||
|
type=bpy.types.OperatorFileListElement
|
||||||
|
)
|
||||||
|
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,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
|
@ -564,6 +564,29 @@ class SESSION_PT_sync(bpy.types.Panel):
|
|||||||
row.prop(settings.sync_flags, "sync_active_camera", text="",icon_only=True, icon='VIEW_CAMERA')
|
row.prop(settings.sync_flags, "sync_active_camera", text="",icon_only=True, icon='VIEW_CAMERA')
|
||||||
|
|
||||||
|
|
||||||
|
class SESSION_PT_replay(bpy.types.Panel):
|
||||||
|
bl_idname = "MULTIUSER_REPLAY_PT_panel"
|
||||||
|
bl_label = "Replay"
|
||||||
|
bl_space_type = 'VIEW_3D'
|
||||||
|
bl_region_type = 'UI'
|
||||||
|
bl_parent_id = 'MULTIUSER_SETTINGS_PT_panel'
|
||||||
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
return context.window_manager.session.replay_files
|
||||||
|
|
||||||
|
def draw_header(self, context):
|
||||||
|
self.layout.label(text="", icon='RECOVER_LAST')
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
|
||||||
|
row= layout.row()
|
||||||
|
|
||||||
|
row.prop(bpy.context.window_manager.session, 'active_replay_file')
|
||||||
|
|
||||||
|
|
||||||
class SESSION_PT_repository(bpy.types.Panel):
|
class SESSION_PT_repository(bpy.types.Panel):
|
||||||
bl_idname = "MULTIUSER_PROPERTIES_PT_panel"
|
bl_idname = "MULTIUSER_PROPERTIES_PT_panel"
|
||||||
bl_label = "Repository"
|
bl_label = "Repository"
|
||||||
@ -709,6 +732,7 @@ classes = (
|
|||||||
SESSION_PT_sync,
|
SESSION_PT_sync,
|
||||||
SESSION_PT_repository,
|
SESSION_PT_repository,
|
||||||
VIEW3D_PT_overlay_session,
|
VIEW3D_PT_overlay_session,
|
||||||
|
SESSION_PT_replay,
|
||||||
)
|
)
|
||||||
|
|
||||||
register, unregister = bpy.utils.register_classes_factory(classes)
|
register, unregister = bpy.utils.register_classes_factory(classes)
|
||||||
|
Reference in New Issue
Block a user