feat: object watchdog test

This commit is contained in:
Swann Martinez
2019-08-12 18:21:07 +02:00
parent 70c596756c
commit 38c5e9352d
5 changed files with 16 additions and 10 deletions

View File

@ -65,6 +65,10 @@ class BlObject(ReplicatedDatablock):
object_name = self.buffer['name']
self.pointer = bpy.data.objects.get(object_name)
def diff(self):
return self.pointer.location != self.buffer['location']
bl_id = "objects"
bl_class = bpy.types.Object
bl_rep_class = BlObject

View File

@ -24,13 +24,9 @@ class BlUser(ReplicatedDatablock):
def dump(self,pointer=None):
return utils.dump_anything.dump(pointer)
# def load(self, data, target):
# pass
# def dump(self, pointer=None):
# pass
def diff(self):
pass
bl_id = "user"
bl_class = User

View File

@ -147,7 +147,11 @@ class SessionStartOperator(bpy.types.Operator):
for type in bl_types.types_to_register():
_type = getattr(bl_types, type)
supported_bl_types.append(_type.bl_id)
bpy_factory.register_type(_type.bl_class, _type.bl_rep_class)
if _type.bl_id == 'objects':#For testing
bpy_factory.register_type(_type.bl_class, _type.bl_rep_class, timer=2,automatic=False)
else:
bpy_factory.register_type(_type.bl_class, _type.bl_rep_class)
client = Client(factory=bpy_factory)

6
ui.py
View File

@ -1,6 +1,7 @@
import bpy
from . import operators
from .libs.replication.constants import *
from .bl_types.bl_user import BlUser
ICONS = {'Image': 'IMAGE_DATA', 'Curve':'CURVE_DATA', 'Client':'SOLO_ON','Collection': 'FILE_FOLDER', 'Mesh': 'MESH_DATA', 'Object': 'OBJECT_DATA', 'Material': 'MATERIAL_DATA',
@ -10,7 +11,8 @@ PROP_STATES = [ 'ADDED',
'COMMITED',
'PUSHED',
'FETCHED',
'UP']
'UP',
'CHANGED']
class SESSION_PT_settings(bpy.types.Panel):
"""Settings panel"""
bl_idname = "MULTIUSER_SETTINGS_PT_panel"
@ -155,7 +157,7 @@ class SESSION_PT_user(bpy.types.Panel):
# Create a simple row.
col = layout.column(align=True)
client_keys = operators.client.list(filter='BlUser')
client_keys = operators.client.list(filter=BlUser)
if client_keys and len(client_keys) > 0:
for key in client_keys:
area_msg = col.row(align = True)