feat: initial kick
This commit is contained in:
@ -41,7 +41,6 @@ import bpy
|
||||
from bpy.app.handlers import persistent
|
||||
|
||||
from . import environment, utils
|
||||
from .libs.replication.replication.constants import RP_COMMON
|
||||
|
||||
|
||||
# TODO: remove dependency as soon as replication will be installed as a module
|
||||
|
Submodule multi_user/libs/replication updated: 83caa04e71...905d377bc2
@ -199,6 +199,36 @@ class SessionStopOperator(bpy.types.Operator):
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
class SessionKickOperator(bpy.types.Operator):
|
||||
bl_idname = "session.kick"
|
||||
bl_label = "Kick"
|
||||
bl_description = "Kick the user"
|
||||
bl_options = {"REGISTER"}
|
||||
|
||||
user: bpy.props.StringProperty()
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return True
|
||||
|
||||
def execute(self, context):
|
||||
global client, delayables, stop_modal_executor
|
||||
assert(client)
|
||||
|
||||
try:
|
||||
client.kick(self.user)
|
||||
except Exception as e:
|
||||
self.report({'ERROR'}, repr(e))
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
def invoke(self, context, event):
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
row = self.layout
|
||||
row.label(text=f" Do you really want to kick {self.user} ? " )
|
||||
|
||||
class SessionPropertyRemoveOperator(bpy.types.Operator):
|
||||
bl_idname = "session.remove_prop"
|
||||
@ -464,6 +494,7 @@ classes = (
|
||||
SessionApply,
|
||||
SessionCommit,
|
||||
ApplyArmatureOperator,
|
||||
SessionKickOperator,
|
||||
|
||||
)
|
||||
|
||||
|
@ -21,6 +21,7 @@ import bpy
|
||||
import string
|
||||
|
||||
from . import utils, bl_types, environment, addon_updater_ops, presence
|
||||
from .libs.replication.replication.constants import RP_COMMON
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -286,7 +286,7 @@ class SESSION_PT_user(bpy.types.Panel):
|
||||
selected_user = context.window_manager.user_index
|
||||
settings = utils.get_preferences()
|
||||
active_user = online_users[selected_user] if len(online_users)-1>=selected_user else 0
|
||||
|
||||
runtime_settings = context.window_manager.session
|
||||
|
||||
# Create a simple row.
|
||||
row = layout.row()
|
||||
@ -316,6 +316,12 @@ class SESSION_PT_user(bpy.types.Panel):
|
||||
text="",
|
||||
icon='TIME').target_client = active_user.username
|
||||
|
||||
if runtime_settings.session_mode == 'HOST':
|
||||
user_operations.operator(
|
||||
"session.kick",
|
||||
text="",
|
||||
icon='CANCEL').user = active_user.username
|
||||
|
||||
|
||||
class SESSION_UL_users(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag):
|
||||
|
Reference in New Issue
Block a user