feat(rcf): start update refactoring

This commit is contained in:
Swann Martinez
2019-04-01 15:39:05 +02:00
parent 8316356d42
commit df5f89a2a3
2 changed files with 46 additions and 8 deletions

View File

@ -983,20 +983,23 @@ classes = (
def depsgraph_update(scene):
global client
# for c in (bpy.context.depsgraph.updates.items()):
# print("UPDATE {}".format(c[1].id))
if client:
update_selected_object(bpy.context)
for c in bpy.context.depsgraph.updates.items():
if client.status == net_components.RCFStatus.CONNECTED:
if scene.session_settings.active_object:
if c[1].is_updated_geometry:
print('geometry')
if c[1].id.name == scene.session_settings.active_object.name:
add_update(c[1].id.bl_rna.name, c[1].id.name)
elif c[1].is_updated_transform:
print('transform')
if c[1].id.name == scene.session_settings.active_object.name:
add_update(c[1].id.bl_rna.name, c[1].id.name)
else:
print('other')
# if c[1].id.bl_rna.name == 'Material' or c[1].id.bl_rna.name== 'Shader Nodetree':
data_name = c[1].id.name
if c[1].id.bl_rna.name == "Object":
@ -1008,11 +1011,10 @@ def depsgraph_update(scene):
break
if not found:
client.property_map["Object/{}".format(data_name)] = net_components.RCFMessage(
"Object/{}".format(data_name), "Object", None)
upload_mesh(bpy.data.objects[data_name].data)
dump_datablock(bpy.data.objects[data_name], 1)
dump_datablock(bpy.data.scenes[0], 4)
pass
# upload_mesh(bpy.data.objects[data_name].data)
# dump_datablock(bpy.data.objects[data_name], 1)
# dump_datablock(bpy.data.scenes[0], 4)
# dump_datablock(bpy.data.scenes[0],4)

View File

@ -160,11 +160,47 @@ class SessionPropertiesPanel(bpy.types.Panel):
else:
area_msg.label(text="Empty")
class SessionTaskPanel(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "NET tasks"
bl_idname = "SCENE_PT_layout"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
@classmethod
def poll(cls, context):
if net_operators.client:
return net_operators.client.status == net_components.RCFStatus.CONNECTED
return False
def draw(self, context):
layout = self.layout
scene = context.scene
# Create a simple row.
row = layout.row()
if net_operators.update_list:
# Property area
area_msg = row.box()
if len(net_operators.update_list) > 0:
for key, values in net_operators.update_list.items():
item_box = area_msg.box()
detail_item_box = item_box.row()
# detail_item_box = item_box.row()
detail_item_box.label(text="{} - {} ".format(
key, values))
else:
area_msg.label(text="Empty")
classes = (
SessionSettingsPanel,
SessionUsersPanel,
SessionPropertiesPanel,
SessionTaskPanel,
)