feat: user sub panel is back
This commit is contained in:
@ -7,15 +7,20 @@ from ..libs.replication.data import ReplicatedDatablock
|
|||||||
|
|
||||||
class BlUser(ReplicatedDatablock):
|
class BlUser(ReplicatedDatablock):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__( *args, **kwargs)
|
||||||
|
|
||||||
self.icon = 'CON_ARMATURE'
|
self.icon = 'CON_ARMATURE'
|
||||||
|
|
||||||
super().__init__( *args, **kwargs)
|
#TODO: investigate on empty buffer...
|
||||||
|
if self.buffer:
|
||||||
|
self.load(self.buffer, self.pointer)
|
||||||
|
|
||||||
def load(self, data, target):
|
def load(self, data, target):
|
||||||
if target is None:
|
if target is None:
|
||||||
target = User()
|
target = User()
|
||||||
|
|
||||||
utils.dump_anything.load(target,data)
|
target.name = data['name']
|
||||||
|
|
||||||
|
|
||||||
def dump(self,pointer=None):
|
def dump(self,pointer=None):
|
||||||
return utils.dump_anything.dump(pointer)
|
return utils.dump_anything.dump(pointer)
|
||||||
|
@ -25,10 +25,6 @@ client = None
|
|||||||
|
|
||||||
context = None
|
context = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# def upload_client_instance_position():
|
# def upload_client_instance_position():
|
||||||
# username = bpy.context.window_manager.session.username
|
# username = bpy.context.window_manager.session.username
|
||||||
# if client:
|
# if client:
|
||||||
@ -79,8 +75,6 @@ def add_datablock(datablock):
|
|||||||
return new_uuid
|
return new_uuid
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: cleanup
|
# TODO: cleanup
|
||||||
def init_supported_datablocks(supported_types_id):
|
def init_supported_datablocks(supported_types_id):
|
||||||
global client
|
global client
|
||||||
@ -128,7 +122,7 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
global execution_queue, client
|
global client
|
||||||
settings = context.window_manager.session
|
settings = context.window_manager.session
|
||||||
# save config
|
# save config
|
||||||
settings.save(context)
|
settings.save(context)
|
||||||
@ -321,6 +315,7 @@ class SessionSnapUserOperator(bpy.types.Operator):
|
|||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SessionDumpDatabase(bpy.types.Operator, ExportHelper):
|
class SessionDumpDatabase(bpy.types.Operator, ExportHelper):
|
||||||
bl_idname = "session.dump"
|
bl_idname = "session.dump"
|
||||||
bl_label = "dump json data"
|
bl_label = "dump json data"
|
||||||
|
53
ui.py
53
ui.py
@ -24,7 +24,7 @@ class SESSION_PT_settings(bpy.types.Panel):
|
|||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
row = layout.row()
|
||||||
if hasattr(context.window_manager, 'session'):
|
if hasattr(context.window_manager, 'session'):
|
||||||
settings = context.window_manager.session
|
settings = context.window_manager.session
|
||||||
window_manager = context.window_manager
|
window_manager = context.window_manager
|
||||||
@ -154,36 +154,39 @@ class SESSION_PT_user(bpy.types.Panel):
|
|||||||
settings = context.window_manager.session
|
settings = context.window_manager.session
|
||||||
scene = context.window_manager
|
scene = context.window_manager
|
||||||
# Create a simple row.
|
# Create a simple row.
|
||||||
row = layout.row()
|
col = layout.column(align=True)
|
||||||
client_keys = operators.client.list()
|
|
||||||
|
client_keys = operators.client.list(filter='BlUser')
|
||||||
if client_keys and len(client_keys) > 0:
|
if client_keys and len(client_keys) > 0:
|
||||||
for key in client_keys:
|
for key in client_keys:
|
||||||
pass
|
area_msg = col.row(align = True)
|
||||||
# if 'Client' in key[0]:
|
item_box = area_msg.box()
|
||||||
# info = ""
|
client = operators.client.get(key).buffer
|
||||||
# item_box = row.box()
|
info = ""
|
||||||
# detail_item_box = item_box.row()
|
|
||||||
|
|
||||||
# username = key[0].split('/')[1]
|
detail_item_row = item_box.row(align = True)
|
||||||
# if username == settings.username:
|
|
||||||
# info = "(self)"
|
|
||||||
# # detail_item_box = item_box.row()
|
|
||||||
# detail_item_box.label(
|
|
||||||
# text="{} - {}".format(username, info))
|
|
||||||
|
|
||||||
# if settings.username not in key[0]:
|
username = client['name']
|
||||||
# detail_item_box.operator(
|
|
||||||
# "session.snapview", text="", icon='VIEW_CAMERA').target_client = username
|
|
||||||
# row = layout.row()
|
is_local_user = username == settings.username
|
||||||
|
|
||||||
|
if is_local_user:
|
||||||
|
info = "(self)"
|
||||||
|
|
||||||
|
detail_item_row.label(
|
||||||
|
text="{} {}".format(username, info))
|
||||||
|
|
||||||
|
if not is_local_user:
|
||||||
|
detail_item_row.operator(
|
||||||
|
"session.snapview", text="", icon='VIEW_CAMERA').target_client = key
|
||||||
|
row = layout.row()
|
||||||
else:
|
else:
|
||||||
row.label(text="Empty")
|
row.label(text="Empty")
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
|
|
||||||
def get_client_key(item):
|
|
||||||
return item.owner
|
|
||||||
|
|
||||||
class SESSION_PT_outliner(bpy.types.Panel):
|
class SESSION_PT_outliner(bpy.types.Panel):
|
||||||
bl_idname = "MULTIUSER_PROPERTIES_PT_panel"
|
bl_idname = "MULTIUSER_PROPERTIES_PT_panel"
|
||||||
bl_label = "Properties"
|
bl_label = "Properties"
|
||||||
@ -212,9 +215,15 @@ class SESSION_PT_outliner(bpy.types.Panel):
|
|||||||
# Property area
|
# Property area
|
||||||
# area_msg = row.box()
|
# area_msg = row.box()
|
||||||
client_keys = operators.client.list()
|
client_keys = operators.client.list()
|
||||||
|
|
||||||
if client_keys and len(client_keys) > 0:
|
if client_keys and len(client_keys) > 0:
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
for item in sorted(client_keys, key=get_client_key):
|
for key in client_keys:
|
||||||
|
item = operators.client.get(key)
|
||||||
|
|
||||||
|
if item.str_type == 'BlUser':
|
||||||
|
continue
|
||||||
|
|
||||||
area_msg = col.row(align = True)
|
area_msg = col.row(align = True)
|
||||||
item_box = area_msg.box()
|
item_box = area_msg.box()
|
||||||
name = "None"
|
name = "None"
|
||||||
|
Reference in New Issue
Block a user