feat: user
fix: init datablock error refactor: property outliner paner
This commit is contained in:
parent
ea72ab36ce
commit
8b23d2bc09
@ -1,4 +1,5 @@
|
|||||||
__all__ = [
|
__all__ = [
|
||||||
|
'bl_user',
|
||||||
'bl_object',
|
'bl_object',
|
||||||
'bl_mesh',
|
'bl_mesh',
|
||||||
] # Order here defines execution order
|
] # 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
|
||||||
|
|
15
operators.py
15
operators.py
@ -69,9 +69,10 @@ def init_supported_datablocks(supported_types_id):
|
|||||||
global client
|
global client
|
||||||
|
|
||||||
for type_id in supported_types_id:
|
for type_id in supported_types_id:
|
||||||
for item in getattr(bpy.data,type_id):
|
if hasattr(bpy.data,type_id):
|
||||||
print(item)
|
for item in getattr(bpy.data,type_id):
|
||||||
client.add(item)
|
print(item)
|
||||||
|
client.add(item)
|
||||||
|
|
||||||
|
|
||||||
# def default_tick():
|
# def default_tick():
|
||||||
@ -146,7 +147,13 @@ class SessionStartOperator(bpy.types.Operator):
|
|||||||
address=settings.ip,
|
address=settings.ip,
|
||||||
port=settings.port
|
port=settings.port
|
||||||
)
|
)
|
||||||
|
|
||||||
|
usr = presence.User(
|
||||||
|
username=settings.username,
|
||||||
|
color=list(settings.client_color),
|
||||||
|
)
|
||||||
|
client.add(usr)
|
||||||
|
|
||||||
# settings.is_running = True
|
# settings.is_running = True
|
||||||
# bpy.ops.session.refresh()
|
# bpy.ops.session.refresh()
|
||||||
#register_ticks()
|
#register_ticks()
|
||||||
|
@ -81,6 +81,15 @@ def get_client_2d(coords):
|
|||||||
else:
|
else:
|
||||||
return (0, 0)
|
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):
|
class DrawFactory(object):
|
||||||
|
|
||||||
|
24
ui.py
24
ui.py
@ -188,27 +188,27 @@ class SESSION_PT_outliner(bpy.types.Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(net_settings, "buffer", text="")
|
# row.prop(net_settings, "buffer", text="")
|
||||||
row.prop(net_settings, "add_property_depth", text="")
|
# row.prop(net_settings, "add_property_depth", text="")
|
||||||
add = row.operator("session.add_prop", text="",
|
# add = row.operator("session.add_prop", text="",
|
||||||
icon="ADD")
|
# icon="ADD")
|
||||||
add.property_path = net_settings.buffer
|
# add.property_path = net_settings.buffer
|
||||||
add.depth = net_settings.add_property_depth
|
# add.depth = net_settings.add_property_depth
|
||||||
row = layout.row()
|
area_msg = layout.row()
|
||||||
|
|
||||||
# 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)
|
||||||
for item in sorted(client_keys, key=get_client_key):
|
for item in sorted(client_keys, key=get_client_key):
|
||||||
|
area_msg = col.row(align = True)
|
||||||
item_box = area_msg.box()
|
item_box = area_msg.box()
|
||||||
|
detail_item_box = item_box.row()
|
||||||
detail_item_box = item_box.row(align = True)
|
|
||||||
detail_item_box.label(text="",icon=item.icon)
|
detail_item_box.label(text="",icon=item.icon)
|
||||||
detail_item_box.label(text="{} ".format(item.uuid))
|
detail_item_box.label(text="{} ".format(item.uuid))
|
||||||
detail_item_box.label(text="{} ".format(item.owner))
|
detail_item_box.label(text="{} ".format(item.owner))
|
||||||
|
|
||||||
# right_icon = "DECORATE_UNLOCKED"
|
# right_icon = "DECORATE_UNLOCKED"
|
||||||
# if owner == net_settings.username:
|
# if owner == net_settings.username:
|
||||||
# right_icon="DECORATE_UNLOCKED"
|
# right_icon="DECORATE_UNLOCKED"
|
||||||
|
Loading…
Reference in New Issue
Block a user