feat: user

fix: init datablock error
refactor: property outliner paner
This commit is contained in:
Swann Martinez 2019-08-08 17:17:58 +02:00
parent ea72ab36ce
commit 8b23d2bc09
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
5 changed files with 66 additions and 16 deletions

View File

@ -1,4 +1,5 @@
__all__ = [
'bl_user',
'bl_object',
'bl_mesh',
] # Order here defines execution order

33
bl_types/bl_user.py Normal file
View 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

View File

@ -69,6 +69,7 @@ def init_supported_datablocks(supported_types_id):
global client
for type_id in supported_types_id:
if hasattr(bpy.data,type_id):
for item in getattr(bpy.data,type_id):
print(item)
client.add(item)
@ -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()

View File

@ -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
View File

@ -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))