feat(rcf): improve init scene

This commit is contained in:
Swann Martinez
2019-03-14 12:09:33 +01:00
parent 9856159e1c
commit c152ce2408
2 changed files with 39 additions and 30 deletions

View File

@ -164,7 +164,6 @@ def to_bpy(store_item):
value_casted = mathutils.Vector(
(store_value[0], store_value[1], store_value[2]))
return value_casted
@ -225,6 +224,7 @@ def init_scene():
except:
pass
def update_scene(msg):
global client
@ -261,6 +261,9 @@ def update_ui(msg):
recv_callbacks = [update_scene, update_ui]
post_init_callbacks = [refresh_window]
# Catch operator execution
#C.window_manager.operators['MESH_OT_primitive_plane_add'].bl_idname
class session_join(bpy.types.Operator):
bl_idname = "session.join"
@ -369,7 +372,7 @@ class session_create(bpy.types.Operator):
bpy.ops.session.join()
init_scene()
# init_scene()
bpy.app.timers.register(observer)
return {"FINISHED"}
@ -568,7 +571,6 @@ class session_draw_clients(bpy.types.Operator):
session = context.scene.session_settings
if client:
# Local view update
current_coords = get_client_view_rect()
if current_coords != self.coords:
@ -636,6 +638,8 @@ class session_snapview(bpy.types.Operator):
return {"CANCELLED"}
pass
# TODO: Rename to match official blender convention
classes = (
session_join,

View File

@ -34,9 +34,8 @@ class SessionSettingsPanel(bpy.types.Panel):
row.prop(net_settings, "update_frequency", text="")
row = layout.row()
row = layout.row()
row.operator("session.stop", text="exit session")
row.operator("session.stop", icon='QUIT', text="Exit")
else:
row = layout.row()
@ -48,6 +47,7 @@ class SessionSettingsPanel(bpy.types.Panel):
row = layout.row()
class SessionUsersPanel(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "NET users"
@ -79,10 +79,12 @@ class SessionUsersPanel(bpy.types.Panel):
if values.id == net_operators.client.id:
info = "(self)"
# detail_item_box = item_box.row()
detail_item_box.label(text="{} {}".format(values.id.decode(),info))
detail_item_box.label(
text="{} {}".format(values.id.decode(), info))
if net_operators.client.id.decode() not in key:
detail_item_box.operator("session.snapview",text="",icon='VIEW_CAMERA').target_client = values.id.decode()
detail_item_box.operator(
"session.snapview", text="", icon='VIEW_CAMERA').target_client = values.id.decode()
row = layout.row()
else:
row.label(text="Empty")
@ -90,7 +92,6 @@ class SessionUsersPanel(bpy.types.Panel):
row = layout.row()
class SessionPropertiesPanel(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor"""
bl_label = "NET properties"
@ -114,7 +115,8 @@ class SessionPropertiesPanel(bpy.types.Panel):
if net_operators.client:
row = layout.row(align=True)
row.prop(net_settings, "buffer", text="")
row.operator("session.add_prop", text="",icon="ADD").property_path = net_settings.buffer
row.operator("session.add_prop", text="",
icon="ADD").property_path = net_settings.buffer
row = layout.row()
# Property area
area_msg = row.box()
@ -123,11 +125,14 @@ class SessionPropertiesPanel(bpy.types.Panel):
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.mtype, values.id.decode()))
detail_item_box.operator("session.remove_prop",text="",icon="X").property_path = key
detail_item_box.label(text="{} ({}) {} ".format(
key, values.mtype, values.id.decode()))
detail_item_box.operator(
"session.remove_prop", text="", icon="X").property_path = key
else:
area_msg.label(text="Empty")
classes = (
SessionSettingsPanel,
SessionUsersPanel,