feat: user
fix: init datablock error refactor: property outliner paner
This commit is contained in:
parent
ea72ab36ce
commit
8b23d2bc09
@ -1,4 +1,5 @@
|
||||
__all__ = [
|
||||
'bl_user',
|
||||
'bl_object',
|
||||
'bl_mesh',
|
||||
] # Order here defines execution order
|
||||
|
33
bl_types/bl_user.py
Normal file
33
bl_types/bl_user.py
Normal file
@ -0,0 +1,33 @@
|
||||
import bpy
|
||||
import mathutils
|
||||
|
||||
from .. import utils
|
||||
from ..presence import User
|
||||
from ..libs.replication.data import ReplicatedDatablock
|
||||
|
||||
class BlUser(ReplicatedDatablock):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.icon = 'CON_ARMATURE'
|
||||
|
||||
super().__init__( *args, **kwargs)
|
||||
|
||||
def load(self, data, target):
|
||||
if target is None:
|
||||
target = User()
|
||||
|
||||
utils.dump_anything.load(target,data)
|
||||
|
||||
def dump(self,pointer=None):
|
||||
return utils.dump_anything.dump(pointer)
|
||||
# def load(self, data, target):
|
||||
# pass
|
||||
|
||||
|
||||
# def dump(self, pointer=None):
|
||||
# pass
|
||||
|
||||
|
||||
bl_id = "user"
|
||||
bl_class = User
|
||||
bl_rep_class = BlUser
|
||||
|
13
operators.py
13
operators.py
@ -69,9 +69,10 @@ def init_supported_datablocks(supported_types_id):
|
||||
global client
|
||||
|
||||
for type_id in supported_types_id:
|
||||
for item in getattr(bpy.data,type_id):
|
||||
print(item)
|
||||
client.add(item)
|
||||
if hasattr(bpy.data,type_id):
|
||||
for item in getattr(bpy.data,type_id):
|
||||
print(item)
|
||||
client.add(item)
|
||||
|
||||
|
||||
# def default_tick():
|
||||
@ -147,6 +148,12 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
port=settings.port
|
||||
)
|
||||
|
||||
usr = presence.User(
|
||||
username=settings.username,
|
||||
color=list(settings.client_color),
|
||||
)
|
||||
client.add(usr)
|
||||
|
||||
# settings.is_running = True
|
||||
# bpy.ops.session.refresh()
|
||||
#register_ticks()
|
||||
|
@ -81,6 +81,15 @@ def get_client_2d(coords):
|
||||
else:
|
||||
return (0, 0)
|
||||
|
||||
class User():
|
||||
def __init__(self, username=None, color=(0,0,0,1)):
|
||||
self.name = username
|
||||
self.color = color
|
||||
self.location = (0,0,0)
|
||||
self.active_object = ""
|
||||
|
||||
|
||||
|
||||
|
||||
class DrawFactory(object):
|
||||
|
||||
|
22
ui.py
22
ui.py
@ -188,23 +188,23 @@ class SESSION_PT_outliner(bpy.types.Panel):
|
||||
row = layout.row()
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(net_settings, "buffer", text="")
|
||||
row.prop(net_settings, "add_property_depth", text="")
|
||||
add = row.operator("session.add_prop", text="",
|
||||
icon="ADD")
|
||||
add.property_path = net_settings.buffer
|
||||
add.depth = net_settings.add_property_depth
|
||||
row = layout.row()
|
||||
# row.prop(net_settings, "buffer", text="")
|
||||
# row.prop(net_settings, "add_property_depth", text="")
|
||||
# add = row.operator("session.add_prop", text="",
|
||||
# icon="ADD")
|
||||
# add.property_path = net_settings.buffer
|
||||
# add.depth = net_settings.add_property_depth
|
||||
area_msg = layout.row()
|
||||
|
||||
# Property area
|
||||
area_msg = row.box()
|
||||
# area_msg = row.box()
|
||||
client_keys = operators.client.list()
|
||||
if client_keys and len(client_keys) > 0:
|
||||
|
||||
col = layout.column(align=True)
|
||||
for item in sorted(client_keys, key=get_client_key):
|
||||
area_msg = col.row(align = True)
|
||||
item_box = area_msg.box()
|
||||
|
||||
detail_item_box = item_box.row(align = True)
|
||||
detail_item_box = item_box.row()
|
||||
detail_item_box.label(text="",icon=item.icon)
|
||||
detail_item_box.label(text="{} ".format(item.uuid))
|
||||
detail_item_box.label(text="{} ".format(item.owner))
|
||||
|
Loading…
Reference in New Issue
Block a user