2019-02-08 15:44:02 +01:00
|
|
|
import bpy
|
|
|
|
from . import net_components
|
|
|
|
from . import net_operators
|
|
|
|
|
|
|
|
class SessionPanel(bpy.types.Panel):
|
|
|
|
"""Creates a Panel in the scene context of the properties editor"""
|
2019-02-13 14:17:22 +01:00
|
|
|
bl_label = "RFC Session"
|
2019-02-08 15:44:02 +01:00
|
|
|
bl_idname = "SCENE_PT_layout"
|
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
bl_context = "scene"
|
|
|
|
|
|
|
|
# def draw_header(self, context):
|
2019-02-11 18:10:56 +01:00
|
|
|
# self.layout.prop(context.scene.session_settings, "username", text="")
|
2019-02-08 15:44:02 +01:00
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
2019-02-08 18:34:10 +01:00
|
|
|
|
2019-02-08 15:44:02 +01:00
|
|
|
scene = context.scene
|
|
|
|
# Create a simple row.
|
|
|
|
row = layout.row()
|
|
|
|
|
2019-02-11 17:31:03 +01:00
|
|
|
if net_operators.client:
|
|
|
|
row.operator("session.stop")
|
2019-02-08 18:34:10 +01:00
|
|
|
row = layout.row()
|
|
|
|
|
|
|
|
row = layout.row(align=True)
|
2019-02-13 18:53:22 +01:00
|
|
|
|
2019-02-14 13:13:28 +01:00
|
|
|
row.prop(scene.session_settings,"buffer", text="")
|
|
|
|
row.operator("session.send").property_path = scene.session_settings.buffer
|
2019-02-08 18:34:10 +01:00
|
|
|
row = layout.row()
|
|
|
|
# Debug area
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
area_msg = row.box()
|
2019-02-13 18:53:22 +01:00
|
|
|
if len(net_operators.client.property_map) > 0:
|
|
|
|
for key,value in net_operators.client.property_map.items():
|
2019-02-14 13:13:28 +01:00
|
|
|
area_msg.label(text="{}".format(key))
|
2019-02-08 18:34:10 +01:00
|
|
|
else:
|
|
|
|
area_msg.label(text="Empty")
|
2019-02-12 10:18:39 +01:00
|
|
|
|
2019-02-08 18:34:10 +01:00
|
|
|
else:
|
2019-02-11 18:10:56 +01:00
|
|
|
row = layout.row()
|
|
|
|
row.prop(scene.session_settings,"username",text="")
|
|
|
|
row = layout.row()
|
2019-02-08 18:34:10 +01:00
|
|
|
row.operator("session.join")
|
|
|
|
row.operator("session.create")
|
2019-02-08 15:44:02 +01:00
|
|
|
|
2019-02-08 18:34:10 +01:00
|
|
|
|
2019-02-12 10:18:39 +01:00
|
|
|
|
2019-02-11 18:10:56 +01:00
|
|
|
|
2019-02-08 15:44:02 +01:00
|
|
|
|
|
|
|
classes = (
|
2019-02-11 17:31:03 +01:00
|
|
|
SessionPanel,
|
2019-02-08 15:44:02 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
register, unregister = bpy.utils.register_classes_factory(classes)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
register()
|