diff --git a/multi_user/icons/repository_merge.png b/multi_user/icons/repository_merge.png new file mode 100644 index 0000000..e6b02b7 Binary files /dev/null and b/multi_user/icons/repository_merge.png differ diff --git a/multi_user/icons/repository_push.png b/multi_user/icons/repository_push.png new file mode 100644 index 0000000..3eca381 Binary files /dev/null and b/multi_user/icons/repository_push.png differ diff --git a/multi_user/operators.py b/multi_user/operators.py index d7c1771..81fe2d7 100644 --- a/multi_user/operators.py +++ b/multi_user/operators.py @@ -110,7 +110,6 @@ def initialize_session(): for d in deleyables: d.register() - # Step 5: Clearing history utils.flush_history() @@ -144,7 +143,7 @@ def on_connection_end(reason="none"): if isinstance(handler, logging.FileHandler): logger.removeHandler(handler) if reason != "user": - bpy.ops.session.notify('INVOKE_DEFAULT', message=f"Disconnected from session. Reason: {reason}. ") + bpy.ops.session.notify('INVOKE_DEFAULT', message=f"Disconnected from session. Reason: {reason}. ") #TODO: change op session.notify to add ui + change reason (in replication->interface) # OPERATORS @@ -161,10 +160,11 @@ class SessionConnectOperator(bpy.types.Operator): global deleyables settings = utils.get_preferences() - runtime_settings = context.window_manager.session users = bpy.data.window_managers['WinMan'].online_users - admin_pass = settings.admin_password - server_pass = settings.server_password if settings.server_password else None + active_server_index = context.window_manager.server_index if context.window_manager.server_index<=len(settings.server_preset)-1 else 0 + active_server = settings.server_preset[active_server_index] + admin_pass = active_server.admin_password if active_server.use_admin_password else None + server_pass = active_server.server_password if active_server.use_server_password else None users.clear() deleyables.clear() @@ -213,18 +213,15 @@ class SessionConnectOperator(bpy.types.Operator): username=settings.username) # Join a session - if not runtime_settings.admin: + if not active_server.use_admin_password: utils.clean_scene() - # regular session, no admin_password needed nor server_password - admin_pass = None - server_pass = None try: porcelain.remote_add( repo, 'origin', - settings.ip, - settings.port, + active_server.ip, + active_server.port, server_password=server_pass, admin_password=admin_pass) session.connect( @@ -276,8 +273,8 @@ class SessionHostOperator(bpy.types.Operator): settings = utils.get_preferences() runtime_settings = context.window_manager.session users = bpy.data.window_managers['WinMan'].online_users - admin_pass = settings.admin_password - server_pass = settings.server_password if settings.server_password else None + admin_pass = settings.host_admin_password if settings.host_use_admin_password else None + server_pass = settings.host_server_password if settings.host_use_server_password else None users.clear() deleyables.clear() @@ -341,7 +338,7 @@ class SessionHostOperator(bpy.types.Operator): repo, 'origin', '127.0.0.1', - settings.port, + settings.host_port, server_password=server_pass, admin_password=admin_pass) session.host( @@ -929,12 +926,12 @@ class SessionPresetServerAdd(bpy.types.Operator): bl_options = {"REGISTER"} server_name: bpy.props.StringProperty(default="") - server_ip: bpy.props.StringProperty(default="127.0.0.1") - server_port: bpy.props.IntProperty(default=5555) + ip: bpy.props.StringProperty(default="127.0.0.1") + port: bpy.props.IntProperty(default=5555) use_server_password: bpy.props.BoolProperty(default=False) - server_server_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") + server_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") use_admin_password: bpy.props.BoolProperty(default=False) - server_admin_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") + admin_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") @classmethod def poll(cls, context): @@ -942,37 +939,36 @@ class SessionPresetServerAdd(bpy.types.Operator): def invoke(self, context, event): self.server_name = "" - self.server_ip = "127.0.0.1" - self.server_port = 5555 + self.ip = "127.0.0.1" + self.port = 5555 self.use_server_password = False - self.server_server_password = "" + self.server_password = "" self.use_admin_password = False - self.server_admin_password = "" + self.admin_password = "" assert(context) return context.window_manager.invoke_props_dialog(self) def draw(self, context): layout = self.layout - settings = utils.get_preferences() row = layout.row() row.prop(self, "server_name", text="Server name") row = layout.row(align = True) - row.prop(self, "server_ip", text="IP+port") - row.prop(self, "server_port", text="") + row.prop(self, "ip", text="IP+port") + row.prop(self, "port", text="") row = layout.row() col = row.column() col.prop(self, "use_server_password", text="Server password:") col = row.column() col.enabled = True if self.use_server_password else False - col.prop(self, "server_server_password", text="") + col.prop(self, "server_password", text="") row = layout.row() col = row.column() col.prop(self, "use_admin_password", text="Admin password:") col = row.column() col.enabled = True if self.use_admin_password else False - col.prop(self, "server_admin_password", text="") + col.prop(self, "admin_password", text="") def execute(self, context): assert(context) @@ -983,12 +979,12 @@ class SessionPresetServerAdd(bpy.types.Operator): new_server = existing_preset if existing_preset else settings.server_preset.add() new_server.name = str(uuid4()) new_server.server_name = self.server_name - new_server.server_ip = self.server_ip - new_server.server_port = self.server_port + new_server.ip = self.ip + new_server.port = self.port new_server.use_server_password = self.use_server_password - new_server.server_server_password = self.server_server_password + new_server.server_password = self.server_password new_server.use_admin_password = self.use_admin_password - new_server.server_admin_password = self.server_admin_password + new_server.admin_password = self.admin_password refresh_sidebar_view() @@ -1000,7 +996,7 @@ class SessionPresetServerAdd(bpy.types.Operator): return {'FINISHED'} -class SessionPresetServerEdit(bpy.types.Operator): +class SessionPresetServerEdit(bpy.types.Operator): # TODO : use preset, not settings """Edit a server to the server list preset""" bl_idname = "session.preset_server_edit" bl_label = "Edit server preset" @@ -1014,40 +1010,31 @@ class SessionPresetServerEdit(bpy.types.Operator): return True def invoke(self, context, event): - settings = utils.get_preferences() - settings_active_server = settings.server_preset.get(self.target_server_name) - - if settings_active_server : - settings.server_name = settings_active_server.server_name - settings.ip = settings_active_server.server_ip - settings.port = settings_active_server.server_port - settings.server_password = settings_active_server.server_server_password - settings.admin_password = settings_active_server.server_admin_password - assert(context) return context.window_manager.invoke_props_dialog(self) def draw(self, context): layout = self.layout settings = utils.get_preferences() + settings_active_server = settings.server_preset.get(self.target_server_name) row = layout.row() - row.prop(settings, "server_name", text="Server name") + row.prop(settings_active_server, "server_name", text="Server name") row = layout.row(align = True) - row.prop(settings, "ip", text="IP+port") - row.prop(settings, "port", text="") + row.prop(settings_active_server, "ip", text="IP+port") + row.prop(settings_active_server, "port", text="") row = layout.row() col = row.column() - col.prop(settings, "use_server_password", text="Server password:") + col.prop(settings_active_server, "use_server_password", text="Server password:") col = row.column() - col.enabled = True if settings.use_server_password else False - col.prop(settings, "server_password", text="") + col.enabled = True if settings_active_server.use_server_password else False + col.prop(settings_active_server, "server_password", text="") row = layout.row() col = row.column() - col.prop(settings, "use_admin_password", text="Admin password:") + col.prop(settings_active_server, "use_admin_password", text="Admin password:") col = row.column() - col.enabled = True if settings.use_admin_password else False - col.prop(settings, "admin_password", text="") + col.enabled = True if settings_active_server.use_admin_password else False + col.prop(settings_active_server, "admin_password", text="") def execute(self, context): assert(context) @@ -1055,20 +1042,12 @@ class SessionPresetServerEdit(bpy.types.Operator): settings = utils.get_preferences() settings_active_server = settings.server_preset.get(self.target_server_name) - server = settings_active_server if settings_active_server else settings.server_preset.add() - server.server_name = settings.server_name - server.server_ip = settings.ip - server.server_port = settings.port - server.server_server_password = settings.server_password - server.server_admin_password = settings.admin_password - refresh_sidebar_view() - self.report({'INFO'}, "Server '" + settings.server_name + "' override") + self.report({'INFO'}, "Server '" + settings_active_server.server_name + "' override") return {'FINISHED'} - class SessionPresetServerRemove(bpy.types.Operator): """Remove a server to the server list preset""" bl_idname = "session.preset_server_remove" @@ -1090,7 +1069,7 @@ class SessionPresetServerRemove(bpy.types.Operator): return {'FINISHED'} -class SessionGetInfo(bpy.types.Operator): +class RefreshServerStatus(bpy.types.Operator): bl_idname = "session.get_info" bl_label = "Get session info" bl_description = "Get session info" @@ -1102,8 +1081,15 @@ class SessionGetInfo(bpy.types.Operator): return (session.state != STATE_ACTIVE) def execute(self, context): - infos = porcelain.request_session_info(self.target_server, timeout=100) - logging.info(f"Session info: {infos}") + settings = utils.get_preferences() + + for server in settings.server_preset: + infos = porcelain.request_session_info(f"{server.ip}:{server.port}", timeout=1000) + server.is_online = True if infos else False + if server.is_online: + server.is_private = infos.get("private") + + logging.info(f"{server.server_name} status: {infos}") return {'FINISHED'} @@ -1137,6 +1123,10 @@ class FirstLaunch(bpy.types.Operator): assert(context) settings = utils.get_preferences() settings.is_first_launch = False + for i in range(len(settings.server_preset)): # TODO: Try to empty the server list preset in a cleaner way + settings.server_preset.remove(i) + prefs = bpy.context.preferences.addons[__package__].preferences + prefs.generate_default_presets() return {'FINISHED'} def menu_func_import(self, context): @@ -1167,7 +1157,7 @@ classes = ( SessionPresetServerAdd, SessionPresetServerEdit, SessionPresetServerRemove, - SessionGetInfo, + RefreshServerStatus, GetDoc, FirstLaunch, ) diff --git a/multi_user/preferences.py b/multi_user/preferences.py index 215774f..7023205 100644 --- a/multi_user/preferences.py +++ b/multi_user/preferences.py @@ -34,18 +34,20 @@ from replication.interface import session IP_REGEX = re.compile("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$") HOSTNAME_REGEX = re.compile("^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$") +#SERVER PRESETS AT LAUNCH DEFAULT_PRESETS = { "localhost" : { "server_name": "localhost", - "server_ip": "localhost", - "server_port": 5555, + "ip": "localhost", + "port": 5555, + "use_admin_password": True, "admin_password": "admin", "server_password": "" }, "public session" : { "server_name": "public session", - "server_ip": "51.75.71.183", - "server_port": 5555, + "ip": "51.75.71.183", + "port": 5555, "admin_password": "", "server_password": "" }, @@ -83,12 +85,6 @@ def update_ip(self, context): logging.error("Wrong IP format") self['ip'] = "127.0.0.1" -def update_server_preset_interface(self, context): - self.server_name = self.server_preset.get(self.server_preset_interface).name - self.ip = self.server_preset.get(self.server_preset_interface).server_ip - self.port = self.server_preset.get(self.server_preset_interface).server_port - self.server_password = self.server_preset.get(self.server_preset_interface).server_server_password - self.admin_password = self.server_preset.get(self.server_preset_interface).server_admin_password def update_directory(self, context): new_dir = Path(self.cache_directory) @@ -117,12 +113,14 @@ class ReplicatedDatablock(bpy.types.PropertyGroup): class ServerPreset(bpy.types.PropertyGroup): server_name: bpy.props.StringProperty(default="") - server_ip: bpy.props.StringProperty(default="127.0.0.1") - server_port: bpy.props.IntProperty(default=5555) + ip: bpy.props.StringProperty(default="127.0.0.1") + port: bpy.props.IntProperty(default=5555) use_server_password: bpy.props.BoolProperty(default=False) - server_server_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") + server_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") use_admin_password: bpy.props.BoolProperty(default=False) - server_admin_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") + admin_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") + is_online: bpy.props.BoolProperty(default=False) + is_private: bpy.props.BoolProperty(default=False) def set_sync_render_settings(self, value): self['sync_render_settings'] = value @@ -172,11 +170,7 @@ class ReplicationFlags(bpy.types.PropertyGroup): class SessionPrefs(bpy.types.AddonPreferences): bl_idname = __package__ - ip: bpy.props.StringProperty( - name="ip", - description='Distant host ip', - default="localhost", - update=update_ip) + # User settings username: bpy.props.StringProperty( name="Username", default=f"user_{random_string_digits()}" @@ -185,12 +179,9 @@ class SessionPrefs(bpy.types.AddonPreferences): name="client_instance_color", description='User color', subtype='COLOR', - default=randomColor()) - port: bpy.props.IntProperty( - name="port", - description='Distant host port', - default=5555 + default=randomColor() ) + # Current server settings server_name: bpy.props.StringProperty( name="server_name", description="Custom name of the server", @@ -200,26 +191,33 @@ class SessionPrefs(bpy.types.AddonPreferences): name="server_index", description="index of the server", ) - use_server_password: bpy.props.BoolProperty( + host_port: bpy.props.IntProperty( + name="host_port", + description='Distant host port', + default=5555 + ) + # User host session settings + host_use_server_password: bpy.props.BoolProperty( name="use_server_password", description='Use session password', default=False ) - server_password: bpy.props.StringProperty( + host_server_password: bpy.props.StringProperty( name="server_password", description='Session password', subtype='PASSWORD' ) - use_admin_password: bpy.props.BoolProperty( + host_use_admin_password: bpy.props.BoolProperty( name="use_admin_password", description='Use admin password', default=False ) - admin_password: bpy.props.StringProperty( + host_admin_password: bpy.props.StringProperty( name="admin_password", description='Admin password', subtype='PASSWORD' ) + # Other is_first_launch: bpy.props.BoolProperty( name="is_first_launch", description="First time lauching the addon", @@ -259,7 +257,7 @@ class SessionPrefs(bpy.types.AddonPreferences): description="Remove filecache from memory", default=False ) - # for UI + # For UI category: bpy.props.EnumProperty( name="Category", description="Preferences Category", @@ -431,12 +429,6 @@ class SessionPrefs(bpy.types.AddonPreferences): name="server preset", type=ServerPreset, ) - server_preset_interface: bpy.props.EnumProperty( - name="servers", - description="servers enum", - items=server_list_callback, - update=update_server_preset_interface, - ) # Custom panel panel_category: bpy.props.StringProperty( @@ -475,21 +467,23 @@ class SessionPrefs(bpy.types.AddonPreferences): icon=get_expanded_icon(self.conf_session_hosting_expanded), emboss=False) if self.conf_session_hosting_expanded: + row = box.row() + row.prop(self, "host_port", text="Port: ") row = box.row() row.label(text="Init the session from:") row.prop(self, "init_method", text="") row = box.row() col = row.column() - col.prop(self, "use_server_password", text="Server password:") + col.prop(self, "host_use_server_password", text="Server password:") col = row.column() - col.enabled = True if self.use_server_password else False - col.prop(self, "server_password", text="") + col.enabled = True if self.host_use_server_password else False + col.prop(self, "host_server_password", text="") row = box.row() col = row.column() - col.prop(self, "use_admin_password", text="Admin password:") + col.prop(self, "host_use_admin_password", text="Admin password:") col = row.column() - col.enabled = True if self.use_admin_password else False - col.prop(self, "admin_password", text="") + col.enabled = True if self.host_use_admin_password else False + col.prop(self, "host_admin_password", text="") # NETWORKING box = grid.box() @@ -563,6 +557,7 @@ class SessionPrefs(bpy.types.AddonPreferences): new_db.icon = impl.bl_icon new_db.bl_name = impl.bl_id + # Get a server preset through its name def get_server_preset(self, name): existing_preset = None @@ -572,7 +567,7 @@ class SessionPrefs(bpy.types.AddonPreferences): return existing_preset - # custom at launch server preset + # Custom at launch server preset def generate_default_presets(self): for preset_name, preset_data in DEFAULT_PRESETS.items(): existing_preset = self.get_server_preset(preset_name) @@ -581,10 +576,12 @@ class SessionPrefs(bpy.types.AddonPreferences): new_server = self.server_preset.add() new_server.name = str(uuid4()) new_server.server_name = preset_data.get('server_name') - new_server.server_index = preset_data.get('server_index') - new_server.server_ip = preset_data.get('server_ip') - new_server.server_port = preset_data.get('server_port') + new_server.ip = preset_data.get('ip') + new_server.port = preset_data.get('port') + new_server.use_server_password = preset_data.get('use_server_password',False) new_server.server_password = preset_data.get('server_password',None) + new_server.use_admin_password = preset_data.get('use_admin_password',False) + new_server.admin_password = preset_data.get('admin_password',None) def client_list_callback(scene, context): diff --git a/multi_user/temp.py b/multi_user/temp.py deleted file mode 100644 index fd8c431..0000000 --- a/multi_user/temp.py +++ /dev/null @@ -1,117 +0,0 @@ -class SESSION_PT_network(bpy.types.Panel): - bl_idname = "MULTIUSER_SETTINGS_PT_network" - bl_label = "Network" - bl_space_type = 'VIEW_3D' - bl_region_type = 'UI' - bl_parent_id = 'MULTIUSER_SETTINGS_PT_network' - - @classmethod - def poll(cls, context): - return not session \ - or (session and session.state == 0) - - def draw_header(self, context): - self.layout.label(text="", icon='LINKED') - - def draw(self, context): - layout = self.layout - - runtime_settings = context.window_manager.session - settings = get_preferences() - - # Create a simple row. - row = layout.row() - box = row.box() - split = box.split(factor=0.35) - split.label(text="Server") - split = split.split(factor=0.3) - split.label(text="Online") - - row = layout.row() - layout.template_list("SESSION_UL_network", "", settings, - "server_preset_interface", context.window_manager, "user_index") - - -class SESSION_UL_network(bpy.types.UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): - settings = get_preferences() - server_name = '-' - server_status = 'BLANK1' - server_private = 'BLANK1' - - if not session: - server_name = settings.server_name - - # Session with/without password - if settings.server_password != None: - server_private = 'LOCKED' - split = layout.split(factor=0.35) - split.label(text=server_name, icon=server_private) - else: - split = layout.split(factor=0.35) - split.label(text=server_name) - - # Session status - # if session online : vert else rouge - from multi_user import icons - server_status = icons.icons_col["session_status_offline"] - split.label(icon=server_status) - -class SESSION_UL_users(bpy.types.UIList): - def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): - settings = get_preferences() - is_local_user = item.username == settings.username - ping = '-' - frame_current = '-' - scene_current = '-' - mode_current = '-' - mode_icon = 'BLANK1' - status_icon = 'BLANK1' - if session: - user = session.online_users.get(item.username) - if user: - ping = str(user['latency']) - metadata = user.get('metadata') - if metadata and 'frame_current' in metadata: - frame_current = str(metadata.get('frame_current','-')) - scene_current = metadata.get('scene_current','-') - mode_current = metadata.get('mode_current','-') - if mode_current == "OBJECT" : - mode_icon = "OBJECT_DATAMODE" - elif mode_current == "EDIT_MESH" : - mode_icon = "EDITMODE_HLT" - elif mode_current == 'EDIT_CURVE': - mode_icon = "CURVE_DATA" - elif mode_current == 'EDIT_SURFACE': - mode_icon = "SURFACE_DATA" - elif mode_current == 'EDIT_TEXT': - mode_icon = "FILE_FONT" - elif mode_current == 'EDIT_ARMATURE': - mode_icon = "ARMATURE_DATA" - elif mode_current == 'EDIT_METABALL': - mode_icon = "META_BALL" - elif mode_current == 'EDIT_LATTICE': - mode_icon = "LATTICE_DATA" - elif mode_current == 'POSE': - mode_icon = "POSE_HLT" - elif mode_current == 'SCULPT': - mode_icon = "SCULPTMODE_HLT" - elif mode_current == 'PAINT_WEIGHT': - mode_icon = "WPAINT_HLT" - elif mode_current == 'PAINT_VERTEX': - mode_icon = "VPAINT_HLT" - elif mode_current == 'PAINT_TEXTURE': - mode_icon = "TPAINT_HLT" - elif mode_current == 'PARTICLE': - mode_icon = "PARTICLES" - elif mode_current == 'PAINT_GPENCIL' or mode_current =='EDIT_GPENCIL' or mode_current =='SCULPT_GPENCIL' or mode_current =='WEIGHT_GPENCIL' or mode_current =='VERTEX_GPENCIL': - mode_icon = "GREASEPENCIL" - if user['admin']: - status_icon = 'FAKE_USER_ON' - split = layout.split(factor=0.35) - split.label(text=item.username, icon=status_icon) - split = split.split(factor=0.3) - split.label(icon=mode_icon) - split.label(text=frame_current) - split.label(text=scene_current) - split.label(text=ping) \ No newline at end of file diff --git a/multi_user/ui.py b/multi_user/ui.py index e3844ee..5a6a496 100644 --- a/multi_user/ui.py +++ b/multi_user/ui.py @@ -150,34 +150,19 @@ class SESSION_PT_settings(bpy.types.Panel): col.template_list("SESSION_UL_network", "", settings, "server_preset", context.window_manager, "server_index") col.separator() connectOp = col.row() - connectOp.operator("session.host", text="Host") # TODO : add a pop-up for admin and server password ? + connectOp.operator("session.host", text="Host") # TODO : add a pop-up for admin and server password ? add port 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="") + col.operator("session.preset_server_add", icon="ADD", text="") # TODO : add conditions (need a name, etc..) + add a checkbox for password without creating preferences 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: exitbutton = layout.row() @@ -208,7 +193,6 @@ class SESSION_PT_settings(bpy.types.Panel): length=16 )) - class SESSION_PT_advanced_settings(bpy.types.Panel): bl_idname = "MULTIUSER_SETTINGS_REPLICATION_PT_panel" @@ -240,21 +224,23 @@ class SESSION_PT_advanced_settings(bpy.types.Panel): icon=get_expanded_icon(settings.sidebar_advanced_hosting_expanded), emboss=False) if settings.sidebar_advanced_hosting_expanded: + host_selection_row = host_selection.row() + host_selection_row.prop(settings, "host_port", text="Port:") host_selection_row = host_selection.row() host_selection_row.label(text="Init the session from:") host_selection_row.prop(settings, "init_method", text="") host_selection_row = host_selection.row() host_selection_col = host_selection_row.column() - host_selection_col.prop(settings, "use_server_password", text="Server password:") + host_selection_col.prop(settings, "host_use_server_password", text="Server password:") host_selection_col = host_selection_row.column() - host_selection_col.enabled = True if settings.use_server_password else False - host_selection_col.prop(settings, "server_password", text="") + host_selection_col.enabled = True if settings.host_use_server_password else False + host_selection_col.prop(settings, "host_server_password", text="") host_selection_row = host_selection.row() host_selection_col = host_selection_row.column() - host_selection_col.prop(settings, "use_admin_password", text="Admin password:") + host_selection_col.prop(settings, "host_use_admin_password", text="Admin password:") host_selection_col = host_selection_row.column() - host_selection_col.enabled = True if settings.use_admin_password else False - host_selection_col.prop(settings, "admin_password", text="") + host_selection_col.enabled = True if settings.host_use_admin_password else False + host_selection_col.prop(settings, "host_admin_password", text="") #ADVANCED NET net_section = layout.row().box() @@ -466,15 +452,18 @@ def draw_property(context, parent, property_uuid, level=0): detail_item_box.label(text=f"{name}") # Operations - have_right_to_modify = (item.owner == settings.username or \ item.owner == RP_COMMON) and item.state != ERROR + from multi_user import icons + sync_status = icons.icons_col["repository_push"] #TODO: Link all icons to the right sync (push/merge/issue). For issue use "UNLINKED" for icon + # sync_status = icons.icons_col["repository_merge"] + if have_right_to_modify: detail_item_box.operator( "session.commit", text="", - icon='TRIA_UP').target = item.uuid + icon_value=sync_status.icon_id).target = item.uuid detail_item_box.separator() if item.state in [FETCHED, UP]: @@ -579,7 +568,7 @@ class SESSION_PT_repository(bpy.types.Panel): box = layout.box() row = box.row() - row.prop(runtime_settings, "filter_owned", text="Show only owned data blocks", icon_only=True, icon="DECORATE_UNLOCKED") + row.prop(runtime_settings, "filter_owned", text="Only show owned data blocks", icon_only=True, icon="DECORATE_UNLOCKED") row = box.row() row.prop(runtime_settings, "filter_name", text="Filter") row = box.row() @@ -600,8 +589,10 @@ class SESSION_PT_repository(bpy.types.Panel): layout.row().label(text="Empty") elif session.state == STATE_LOBBY and usr and usr['admin']: + row = layout.row() row.operator("session.init", icon='TOOL_SETTINGS', text="Init") else: + row = layout.row() row.label(text="Waiting to start") class VIEW3D_PT_overlay_session(bpy.types.Panel): @@ -658,21 +649,16 @@ class SESSION_UL_network(bpy.types.UIList): server_name = item.server_name split = layout.split(factor=0.7) - # Session with/without password - # TODO : ping lock server - if settings.server_password != None: + if item.is_private: server_private = 'LOCKED' split.label(text=server_name, icon=server_private) else: split.label(text=server_name) - # Session status - # TODO : if session online : vert else rouge - # TODO : ping - - from multi_user import icons server_status = icons.icons_col["server_offline"] + if item.is_online: + server_status = icons.icons_col["server_online"] split.label(icon_value=server_status.icon_id) classes = (