Commit 373adb70 authored by Bruno Laurencich's avatar Bruno Laurencich

fix broadcast receive

parent d33b7692
No preview for this file type
......@@ -48,7 +48,7 @@ class Armature_Handler:
self.arm_repr[b.name]["diff_quat"] = False
self.arm_repr[b.name]["local_q"] = b.matrix_local.to_quaternion()
print(" [{}] {}".format(b.name, has_helper))
print(" [{:_<10}] {}".format(b.name, has_helper))
for m in self.meshes: m.hide = True
......
Subproject commit 27e6590c97f18d801afe7b4ac1f5271c426f6696
Subproject commit 3569e9cfbe8082eff05798f21aee295766171d73
......@@ -135,6 +135,7 @@ class Chord_Receive_OSC(bpy.types.Operator):
if self.chord_global.manage_notochord:
bpy.ops.chordata.close_notochord("EXEC_DEFAULT")
self.report({"WARNING"}, "Connection canceled")
print(" <-- Connection canceled --> ")
self.cancel(context)
return {'CANCELLED'}
......@@ -187,8 +188,10 @@ class Chord_Receive_OSC(bpy.types.Operator):
osc_startup()
method = self.chord_global.trans_method
server = u.transmition_methods(False)[method][2]
addr = u.get_transmition_addr(self.chord_global)
addr = "0.0.0.0"
if method == "multi":
addr = u.get_transmition_addr(self.chord_global)
port= self.chord_global.notochord_dest_port
try:
......
......@@ -107,8 +107,10 @@ class Chord_Play_Animation(bpy.types.Operator):
self.chord_global.playing = False
return {"FINISHED"}
INIT = False
def init_osc(options):
global INIT
method = options.trans_method
addr = u.get_transmition_addr(options)
port = options.dest_port
......@@ -119,27 +121,33 @@ def init_osc(options):
except:
print("OSC already initialized")
client = u.transmition_methods(False)[method][3]
# Make client channels to send packets.
client(addr, port, "chordata_client")
msg = "Transmiting to %s:%d (%s)" % \
(addr, port, u.transmition_methods(False)[method][0])
print(msg)
try:
u.write_blender_console(bpy.context, msg)
except Exception as e:
print("Couldn't write to internal console..")
client = u.transmition_methods(False)[method][3]
# Make client channels to send packets.
client(addr, port, "chordata_client")
INIT = True
msg = "Transmiting to %s:%d (%s)" % \
(addr, port, u.transmition_methods(False)[method][0])
print(msg)
try:
u.write_blender_console(bpy.context, msg)
except Exception as e:
print("Couldn't write to internal console..")
except KeyError as e:
print("Not trasmitting OSC")
def send_Armature(arm, options):
global INIT
if not INIT: return
msgs = []
for b in arm.pose.bones:
if options.send_rot:
q = b.matrix.to_quaternion()
msgs.append(oscbuildparse.OSCMessage("/Chordata/quaternion/"+b.name,
msgs.append(oscbuildparse.OSCMessage("/Chordata/"+b.name,
None, [q[0], q[1], q[2], q[3]]))
if options.send_pos:
......@@ -154,5 +162,8 @@ def send_Armature(arm, options):
def clean():
global INIT
if not INIT: return
osch.get_channel("chordata_client").terminate()
INIT = False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment