feat(rcf): expose all connexion parameters again

This commit is contained in:
Swann Martinez 2019-04-18 11:34:16 +02:00
parent 6583905c92
commit 2a9931dc0c
No known key found for this signature in database
GPG Key ID: 414CCAFD8DA720E1
3 changed files with 19 additions and 9 deletions

View File

@ -18,6 +18,7 @@ def get_selected_objects(scene):
selected_objects.append(obj.name)
return selected_objects
# LOAD HELPERS
def load(key, value):
target = resolve_bpy_path(key)
@ -369,12 +370,13 @@ def dump_datablock_attibute(datablock, attributes, depth=1):
def init_client(key=None):
client_dict = {}
client_dict['location'] = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]]
client_dict['color'] = [0,1,1,1]
C = bpy.context
Net = C.scene.session_settings
client_dict['location'] = [[0,0,0],[0,0,0],[0,0,0],[0,0,0]]
client_dict['color'] = [Net.client_color.r,Net.client_color.g,Net.client_color.b,1]
# for o in bpy.context.selected_objects:
# print("TOTO {}".format(o.name))
client_dict['active_objects'] = get_selected_objects(C.view_layer)
print(client_dict['active_objects'])
return client_dict

View File

@ -186,9 +186,11 @@ class session_join(bpy.types.Operator):
username = str(context.scene.session_settings.username)
if len(net_settings.ip)<1:
net_settings.ip = "127.0.0.1"
client_instance = client.RCFClient()
client_instance.connect(net_settings.username,"127.0.0.1",5555)
client_instance.connect(net_settings.username, net_settings.ip,net_settings.port)
# net_settings.is_running = True
@ -340,8 +342,8 @@ class session_stop(bpy.types.Operator):
class session_settings(bpy.types.PropertyGroup):
username = bpy.props.StringProperty(
name="Username", default="user_{}".format(randomStringDigits()))
ip = bpy.props.StringProperty(name="ip")
port = bpy.props.IntProperty(name="5555")
ip = bpy.props.StringProperty(name="ip", description='Distant host ip',default="127.0.0.1")
port = bpy.props.IntProperty(name="port", description='Distant host port',default=5555)
add_property_depth = bpy.props.IntProperty(
name="add_property_depth", default=1)

8
ui.py
View File

@ -27,6 +27,7 @@ class SessionSettingsPanel(bpy.types.Panel):
row.label(text="User infos")
row = box.row()
row.prop(scene.session_settings, "username", text="id")
row = box.row()
row.prop(scene.session_settings, "client_color", text="color")
@ -44,7 +45,10 @@ class SessionSettingsPanel(bpy.types.Panel):
else:
box = row.box()
row = box.row()
row.prop(net_settings, "ip", text="server ip")
row.prop(net_settings, "ip", text="ip")
row = box.row()
row.label(text="port:")
row.prop(scene.session_settings, "port", text="")
row = box.row()
row.label(text="load data:")
row.prop(net_settings, "load_data", text="")
@ -154,7 +158,9 @@ class SessionPropertiesPanel(bpy.types.Panel):
if operators.client_keys and len(operators.client_keys) > 0:
for item in operators.client_keys:
item_box = area_msg.box()
detail_item_box = item_box.row()
# detail_item_box = item_box.row()
detail_item_box.label(text="{}".format(item))