feat: fonctional UI, no server pswd/ping
This commit is contained in:
parent
ac615cd134
commit
07252d62df
@ -87,6 +87,7 @@ def register():
|
|||||||
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
|
bpy.types.WindowManager.user_index = bpy.props.IntProperty()
|
||||||
bpy.types.WindowManager.server_index = bpy.props.IntProperty()
|
bpy.types.WindowManager.server_index = bpy.props.IntProperty()
|
||||||
bpy.types.TOPBAR_MT_file_import.append(operators.menu_func_import)
|
bpy.types.TOPBAR_MT_file_import.append(operators.menu_func_import)
|
||||||
|
bpy.types.TOPBAR_MT_file_export.append(operators.menu_func_export)
|
||||||
|
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
@ -99,6 +100,7 @@ def unregister():
|
|||||||
from . import addon_updater_ops
|
from . import addon_updater_ops
|
||||||
|
|
||||||
bpy.types.TOPBAR_MT_file_import.remove(operators.menu_func_import)
|
bpy.types.TOPBAR_MT_file_import.remove(operators.menu_func_import)
|
||||||
|
bpy.types.TOPBAR_MT_file_export.remove(operators.menu_func_export)
|
||||||
|
|
||||||
presence.unregister()
|
presence.unregister()
|
||||||
addon_updater_ops.unregister()
|
addon_updater_ops.unregister()
|
||||||
|
@ -1127,6 +1127,9 @@ class FirstLaunch(bpy.types.Operator):
|
|||||||
def menu_func_import(self, context):
|
def menu_func_import(self, context):
|
||||||
self.layout.operator(SessionLoadSaveOperator.bl_idname, text='Multi-user session snapshot (.db)')
|
self.layout.operator(SessionLoadSaveOperator.bl_idname, text='Multi-user session snapshot (.db)')
|
||||||
|
|
||||||
|
def menu_func_export(self, context):
|
||||||
|
self.layout.operator(SessionSaveBackupOperator.bl_idname, text='Multi-user session snapshot (.db)')
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
SessionConnectOperator,
|
SessionConnectOperator,
|
||||||
|
@ -672,7 +672,7 @@ class SessionProps(bpy.types.PropertyGroup):
|
|||||||
description='Connect as admin',
|
description='Connect as admin',
|
||||||
default=False
|
default=False
|
||||||
)
|
)
|
||||||
internet_ip: bpy.props.StringProperty(
|
internet_ip: bpy.props.StringProperty( # TODO: to remove
|
||||||
name="internet ip",
|
name="internet ip",
|
||||||
default="no found",
|
default="no found",
|
||||||
description='Internet interface ip',
|
description='Internet interface ip',
|
||||||
|
115
multi_user/ui.py
115
multi_user/ui.py
@ -137,47 +137,59 @@ class SESSION_PT_settings(bpy.types.Panel):
|
|||||||
# SERVER LIST
|
# SERVER LIST
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
box = row.box()
|
box = row.box()
|
||||||
|
box.scale_y = 0.7
|
||||||
split = box.split(factor=0.7)
|
split = box.split(factor=0.7)
|
||||||
split.label(text="Server")
|
split.label(text="Server")
|
||||||
split.label(text="Online")
|
split.label(text="Online")
|
||||||
|
|
||||||
row = layout.row()
|
col = row.column(align=True)
|
||||||
layout.template_list("SESSION_UL_network", "", settings, "server_preset", context.window_manager, "server_index")
|
col.operator("session.preset_server_add", icon="FILE_REFRESH", text="") # TODO : Replace add by refresh operator
|
||||||
|
|
||||||
row = layout.row() # TODO : active server in template
|
|
||||||
row.operator("session.preset_server_add", text="Add") # TODO : add conditions (need a name, etc..) + add a checkbox for password without creating preferences
|
|
||||||
col = row.column()
|
|
||||||
col.enabled = is_server_selected
|
|
||||||
col.operator("session.preset_server_edit", text="Edit").target_server_name = active_server_name
|
|
||||||
col = row.column()
|
|
||||||
col.enabled = is_server_selected
|
|
||||||
col.operator("session.preset_server_remove", text="Remove").target_server_name = active_server_name
|
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.operator("session.host", text="Host") # TODO : add a pop-up for admin and server password ?
|
col = row.column(align=True)
|
||||||
col = row.column()
|
col.template_list("SESSION_UL_network", "", settings, "server_preset", context.window_manager, "server_index")
|
||||||
col.enabled =is_server_selected
|
col.separator()
|
||||||
col.operator("session.connect", text="Connect")
|
connectOp = col.row()
|
||||||
|
connectOp.operator("session.host", text="Host") # TODO : add a pop-up for admin and server password ?
|
||||||
|
connectopcol = connectOp.column()
|
||||||
|
connectopcol.enabled =is_server_selected
|
||||||
|
connectopcol.operator("session.connect", text="Connect")
|
||||||
|
|
||||||
|
col = row.column(align=True)
|
||||||
|
col.operator("session.preset_server_add", icon="ADD", text="") # TODO : Replace add by refresh operator
|
||||||
|
row_visible = col.row(align=True)
|
||||||
|
col_visible = row_visible.column(align=True)
|
||||||
|
col_visible.enabled = is_server_selected
|
||||||
|
col_visible.operator("session.preset_server_remove", icon="REMOVE", text="").target_server_name = active_server_name
|
||||||
|
col_visible.separator()
|
||||||
|
col_visible.operator("session.preset_server_edit", icon="GREASEPENCIL", text="").target_server_name = active_server_name
|
||||||
|
|
||||||
|
# row = layout.row() # TODO : active server in template
|
||||||
|
# row.operator("session.preset_server_add", text="Add") # TODO : add conditions (need a name, etc..) + add a checkbox for password without creating preferences
|
||||||
|
# col = row.column()
|
||||||
|
# col.enabled = is_server_selected
|
||||||
|
# col.operator("session.preset_server_edit", text="Edit").target_server_name = active_server_name
|
||||||
|
# col = row.column()
|
||||||
|
# col.enabled = is_server_selected
|
||||||
|
# col.operator("session.preset_server_remove", text="Remove").target_server_name = active_server_name
|
||||||
|
|
||||||
|
# row = layout.row()
|
||||||
|
# row.operator("session.host", text="Host") # TODO : add a pop-up for admin and server password ?
|
||||||
|
# col = row.column()
|
||||||
|
# col.enabled =is_server_selected
|
||||||
|
# col.operator("session.connect", text="Connect")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
progress = session.state_progress
|
exitbutton = layout.row()
|
||||||
row = layout.row()
|
exitbutton.scale_y = 1.5
|
||||||
|
exitbutton.operator("session.stop", icon='QUIT', text="Disconnect")
|
||||||
|
|
||||||
|
progress = session.state_progress
|
||||||
current_state = session.state
|
current_state = session.state
|
||||||
info_msg = None
|
info_msg = None
|
||||||
|
|
||||||
# STATE IN SESSION
|
|
||||||
if current_state in [STATE_ACTIVE]:
|
|
||||||
row = row.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
|
|
||||||
row.prop(settings.sync_flags, "sync_render_settings",text="",icon_only=True, icon='SCENE')
|
|
||||||
row.prop(settings.sync_flags, "sync_during_editmode", text="",icon_only=True, icon='EDITMODE_HLT')
|
|
||||||
row.prop(settings.sync_flags, "sync_active_camera", text="",icon_only=True, icon='VIEW_CAMERA')
|
|
||||||
|
|
||||||
row= layout.row()
|
|
||||||
|
|
||||||
if current_state in [STATE_ACTIVE] and runtime_settings.is_host:
|
|
||||||
info_msg = f"LAN: {runtime_settings.internet_ip}"
|
|
||||||
if current_state == STATE_LOBBY:
|
if current_state == STATE_LOBBY:
|
||||||
|
row= layout.row()
|
||||||
info_msg = "Waiting for the session to start."
|
info_msg = "Waiting for the session to start."
|
||||||
|
|
||||||
if info_msg:
|
if info_msg:
|
||||||
@ -186,14 +198,17 @@ class SESSION_PT_settings(bpy.types.Panel):
|
|||||||
|
|
||||||
# PROGRESS BAR
|
# PROGRESS BAR
|
||||||
if current_state in [STATE_SYNCING, STATE_SRV_SYNC, STATE_WAITING]:
|
if current_state in [STATE_SYNCING, STATE_SRV_SYNC, STATE_WAITING]:
|
||||||
|
row= layout.row()
|
||||||
|
row.label(text=f"Status: {get_state_str(current_state)}")
|
||||||
|
row= layout.row()
|
||||||
info_box = row.box()
|
info_box = row.box()
|
||||||
info_box.row().label(text=printProgressBar(
|
info_box.label(text=printProgressBar(
|
||||||
progress['current'],
|
progress['current'],
|
||||||
progress['total'],
|
progress['total'],
|
||||||
length=16
|
length=16
|
||||||
))
|
))
|
||||||
|
|
||||||
layout.row().operator("session.stop", icon='QUIT', text="Exit")
|
|
||||||
|
|
||||||
class SESSION_PT_advanced_settings(bpy.types.Panel):
|
class SESSION_PT_advanced_settings(bpy.types.Panel):
|
||||||
bl_idname = "MULTIUSER_SETTINGS_REPLICATION_PT_panel"
|
bl_idname = "MULTIUSER_SETTINGS_REPLICATION_PT_panel"
|
||||||
@ -491,12 +506,40 @@ def draw_property(context, parent, property_uuid, level=0):
|
|||||||
else:
|
else:
|
||||||
detail_item_box.label(text="", icon="DECORATE_LOCKED")
|
detail_item_box.label(text="", icon="DECORATE_LOCKED")
|
||||||
|
|
||||||
|
class SESSION_PT_sync(bpy.types.Panel):
|
||||||
|
bl_idname = "MULTIUSER_SYNC_PT_panel"
|
||||||
|
bl_label = "Synchronize"
|
||||||
|
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 session \
|
||||||
|
and session.state in [STATE_ACTIVE]
|
||||||
|
|
||||||
|
def draw_header(self, context):
|
||||||
|
self.layout.label(text="", icon='UV_SYNC_SELECT')
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
settings = get_preferences()
|
||||||
|
|
||||||
|
row= layout.row()
|
||||||
|
row = row.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=True)
|
||||||
|
row.prop(settings.sync_flags, "sync_render_settings",text="",icon_only=True, icon='SCENE')
|
||||||
|
row.prop(settings.sync_flags, "sync_during_editmode", text="",icon_only=True, icon='EDITMODE_HLT')
|
||||||
|
row.prop(settings.sync_flags, "sync_active_camera", text="",icon_only=True, icon='VIEW_CAMERA')
|
||||||
|
|
||||||
|
|
||||||
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"
|
||||||
bl_space_type = 'VIEW_3D'
|
bl_space_type = 'VIEW_3D'
|
||||||
bl_region_type = 'UI'
|
bl_region_type = 'UI'
|
||||||
bl_parent_id = 'MULTIUSER_SETTINGS_PT_panel'
|
bl_parent_id = 'MULTIUSER_SETTINGS_PT_panel'
|
||||||
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
@ -525,19 +568,18 @@ class SESSION_PT_repository(bpy.types.Panel):
|
|||||||
|
|
||||||
usr = session.online_users.get(settings.username)
|
usr = session.online_users.get(settings.username)
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
|
|
||||||
if session.state == STATE_ACTIVE:
|
if session.state == STATE_ACTIVE:
|
||||||
if 'SessionBackupTimer' in registry:
|
if 'SessionBackupTimer' in registry:
|
||||||
|
row = layout.row()
|
||||||
row.alert = True
|
row.alert = True
|
||||||
row.operator('session.cancel_autosave', icon="CANCEL")
|
row.operator('session.cancel_autosave', icon="CANCEL")
|
||||||
row.alert = False
|
row.alert = False
|
||||||
else:
|
# else:
|
||||||
row.operator('session.save', icon="FILE_TICK")
|
# row.operator('session.save', icon="FILE_TICK")
|
||||||
|
|
||||||
box = layout.box()
|
box = layout.box()
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(runtime_settings, "filter_owned", text="Show only owned Nodes", icon_only=True, icon="DECORATE_UNLOCKED")
|
row.prop(runtime_settings, "filter_owned", text="Show only owned data blocks", icon_only=True, icon="DECORATE_UNLOCKED")
|
||||||
row = box.row()
|
row = box.row()
|
||||||
row.prop(runtime_settings, "filter_name", text="Filter")
|
row.prop(runtime_settings, "filter_name", text="Filter")
|
||||||
row = box.row()
|
row = box.row()
|
||||||
@ -637,6 +679,7 @@ classes = (
|
|||||||
SESSION_PT_settings,
|
SESSION_PT_settings,
|
||||||
SESSION_PT_advanced_settings,
|
SESSION_PT_advanced_settings,
|
||||||
SESSION_PT_user,
|
SESSION_PT_user,
|
||||||
|
SESSION_PT_sync,
|
||||||
SESSION_PT_repository,
|
SESSION_PT_repository,
|
||||||
VIEW3D_PT_overlay_session,
|
VIEW3D_PT_overlay_session,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user