Commit f3e7c2f0 authored by Bruno Laurencich's avatar Bruno Laurencich

add license and readme

parent 17cfae9d
*.sublime*
*.blend[0-9]
*.blend*
__pycache__
\ No newline at end of file
This diff is collapsed.
# Chordata client [Blender Addon]
_Motion capture manager for the Chordata Open Source motion capture system_
This software allows you to receive, record, and retransmit physical motion capture data coming from a [Chordata open source motion capture system](http://chordata.cc)
![Chordata addon in Blender](http://web.chordata.cc/wp-content/themes/chordata_adonis/assets/Chordata_capturing_blender.gif)
## Installation
- Download the addon as a zip file.
- Inside Blender go to _User preferences > Add-ons. Click on the [Install Add-on from file]_ button, and point to the location of the zip file.
- Search for the word _Chordata_ and activate the add-on by clicking on the checkbox
## Capturing
_The next steps assume that you have a [Chordata motion capture suit](http://chordata.cc) ready to be used, and your computer is connected to the **Chordata-net** wifi network_
- Click on the [Connect] button and wait for the state indicator to become green.
- Tell the person wearing the suit to adopt a T-pose, correct the pose to better match the theretical one.
- Tick the _manage notochord_ option and then click the [Receive] button. You will enter on _Calibration mode_ in which you can only see the virtual representation of the sensors.
- After some seconds click the Enter key, it will take to _capturing mode_ where you can see, record or retransmit the capture using the advanced menus.
-Press the Esc key on your keyboard, or the [Stop] button in order to finish the capture.
### LICENSE
This program is free software and is distributed under the GNU General Public License, version 3.
You are free to run, study, share and modify this software.
Derivative work can only be distributed under the same license terms, and replicating this program copyright notice.
More info about the terms of the license [here](https://www.gnu.org/licenses/gpl-faq.en.html).
\ No newline at end of file
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
bl_info = {
"name": "Chordata mocap",
"category": "Rigging",
"name": "Chordata motion capture client",
"author": "Bruno Laurencich",
"blender": (2, 79, 0),
"version": (0, 1, 0),
"location": "View 3D > Tools shelf > Chordata tab",
"description": "A client to manage the physical motion capture performed with the Chordata system",
"warning": "",
"wiki_url": "http://chordata.cc",
"tracker_url": "https://gitlab.com/chordata/Blender-addon/issues",
"support": "COMMUNITY",
"category": "Rigging",
}
# To support reload properly, try to access a package var,
......
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
import bpy
import threading
# from pythonosc import dispatcher
# from pythonosc import osc_server
import time, threading
from re import search as regex
from mathutils import *
......@@ -94,59 +124,3 @@ class Armature_Handler:
b["diff_quat"] = self.object.pose.bones[key].rotation_quaternion.rotation_difference(q0)
self.message = " Chordata operator | Posing... Press ESC to end "
# def start_server(self, IP = "", PORT = 6565):
# """
# Start the OSC server on different thread and attach a handler to the OSC address "/quats"
# """
# #create the dispatcher
# self.dispatcher = dispatcher.Dispatcher()
# #register a handler to get the recived values on the address /Chordata
# self.dispatcher.map("/Chordata/.*", receive, self)
# #Start evetything
# self.server = osc_server.BlockingOSCUDPServer((IP, PORT), self.dispatcher)
# self.st = threading.Thread( target = self.server.serve_forever,)
# print("Serving on {}".format(self.server.server_address))
# self.st.start()
# def close_server(self):
# print ("\nClosing OSCServer.")
# self.server.shutdown()
# print ("Waiting for Server-thread to finish")
# self.st.join()
# print ("Done")
# def receive(addr, objs, *osc_vals):
# sensor = regex("^/Chordata/(\w.*)", addr)
# if not sensor or sensor.lastindex < 1:
# print("Invalid address")
# return
# # print(osc_vals)
# try:
# for x in range(len(osc_vals)):
# objs[0].temp[sensor.group(1)]["chord_quat"][x] = float(osc_vals[x])
# except IndexError as e:
# print("An OSC lecture came with too much values")
# return
# except Exception as e:
# print("There was an error while reading 0SC data")
# print(e)
# return
# if __name__ == '__main__':
# c = Chordata()
# try:
# c.start_server()
# except KeyboardInterrupt as e:
# del c
\ No newline at end of file
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
import bpy
import threading
......
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
from sys import path
from os.path import join, abspath, dirname
path.append(join(dirname(abspath(__file__)), "dnspython"))
......
import bpy
from bpy.props import IntProperty, FloatProperty
from mathutils import *
from math import *
# import pdb
from os import system
from os import path
from sys import path as syspath
# from pythonosc import dispatcher
# from pythonosc import osc_server
syspath.append(path.dirname(bpy.data.filepath))
import Chordata_Armature as chordata
import send_arm_osc as send
from importlib import reload
reload(chordata)
reload(send)
system("clear")
D = bpy.data
C = bpy.context
do_send_osc = True
def check_sc_fr_end(context):
sc = context.scene
if sc.frame_current > sc.frame_end:
sc.frame_current = sc.frame_start
class Send_Anim_Osc(bpy.types.Operator):
"""Send Chordata armature animation trough OSC"""
bl_idname = "object.send_anim_osc"
bl_label = "Send Chordata Animation OSC"
def invoke(self, context, event):
return self.execute(context);
def execute(self, context):
for o in D.objects:
if o.type == "ARMATURE":
self.object = o
if self.object is None:
raise Error("There's no Armature in the scene.")
sc = context.scene
if sc.frame_current < sc.frame_start:
sc.frame_current = sc.frame_start
check_sc_fr_end(context)
wm = context.window_manager
self._timer = wm.event_timer_add( 1 / context.scene.render.fps , context.window)
wm.modal_handler_add(self)
return {'RUNNING_MODAL'}
def modal(self, context, event):
if event.type == 'TIMER':
send.send_Armature(self.object)
context.scene.frame_current += 1
check_sc_fr_end(context)
elif event.type in {'RIGHTMOUSE', 'ESC'}:
print("ESQUING")
self.cancel(context)
return {'CANCELLED'}
return {'RUNNING_MODAL'}
def cancel(self, context):
wm = context.window_manager
wm.event_timer_remove(self._timer)
class ReceiveOperator(bpy.types.Operator):
"""Receive quaternions from OSC and move an armature"""
bl_idname = "object.receive_operator"
bl_label = "Receive Chordata Armature"
views_3d = [area for area in bpy.context.screen.areas if area.type == 'VIEW_3D' ]
def __init__(self):
self.chord = chordata.Chordata()
self.last_event = ""
def invoke(self, context, event):
"""Start the timer"""
if context.scene.layers[10]:
do_send_osc = True
print ("^"*10, "SENDING OSC TO:", send.IP, send.PORT)
else:
do_send_osc = False
print("^"*10, "NOT SENDING OSC!")
wm = context.window_manager
self._timer = wm.event_timer_add( 1 / context.scene.render.fps , context.window)
wm.modal_handler_add(self)
self.chord.start_server()
self.text(self.chord.message)
D.scenes['Scene'].layers[0] = True
D.scenes['Scene'].layers[1] = True
D.scenes['Scene'].layers[2] = True
if do_send_osc:
send.send_init_msg(self.chord.object)
self.do_set_keyframes = False
context.scene.frame_current = 0
context.scene.frame_start = 0
send.init_osc()
self.chord.reset_pose()
return {'RUNNING_MODAL'}
def text(self, text):
for a in self.views_3d:
a.header_text_set(text)
def modal(self, context, event):
if context.scene.layers[10]:
do_send_osc = True
else:
do_send_osc = False
if event.type == 'TIMER':
self.chord.put_quad_on_bones()
if do_send_osc:
send.send_Armature(self.chord.object)
if self.do_set_keyframes:
self.chord.set_key(context)
context.scene.frame_current += 1
elif event.type == 'A':
self.chord.get_rot_diff()
self.text(self.chord.message)
elif event.type == "Q":
D.scenes['Scene'].layers[0] = False
elif event.type == "K":
self.chord.object.animation_data_clear()
self.do_set_keyframes = True
self.report({"INFO"}, "Registering animation!")
elif event.type == "W":
D.scenes['Scene'].layers[1] = False
elif event.type == "E":
D.scenes['Scene'].layers[2] = False
elif event.type == "R":
D.scenes['Scene'].layers[0] = True
D.scenes['Scene'].layers[1] = True
D.scenes['Scene'].layers[2] = True
# elif event.type == 'LEFTMOUSE':
# self.cancel(context)
# return {'FINISHED'}
elif event.type in {'RIGHTMOUSE', 'ESC'}:
print("ESQUING")
if self.chord.object.animation_data:
context.scene.frame_end = self.chord.object.animation_data.action.frame_range[1]
wm = context.window_manager
wm.event_timer_remove(self._timer)
self.chord.server.shutdown()
self.chord.server.socket.close()
self.chord.st.join()
send.osc_terminate()
for a in self.views_3d:
a.header_text_set()
# pdb.set_trace()
# self.cancel(context)
return {'CANCELLED'}
self.last_event = event.type
return {'RUNNING_MODAL'}
def cancel(self, context):
"""
cancel() get's called when the operator is about to exit
Here we remove the timer and stop the server
"""
print("CANCELLING")
wm = context.window_manager
wm.event_timer_remove(self._timer)
self.text("Closing server..")
# self.chord.close_server()
self.chord.server.shutdown()
self.chord.st.join()
for a in self.views_3d:
a.header_text_set()
# ###########################################
# ### DEFINING CUSTOM METHODS ###
# ###########################################
def register():
# send.register()
bpy.utils.register_class(ReceiveOperator)
bpy.utils.register_class(Send_Anim_Osc)
def unregister():
bpy.utils.unregister_class(ReceiveOperator)
bpy.utils.unregister_class(Send_Anim_Osc)
# send.unregister()
if __name__ == "__main__":
register()
# test call
# bpy.ops.object.receive_operator('INVOKE_DEFAULT')
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
import bpy
from time import time
from sys import path
......
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
import bpy
from mathutils import Quaternion
......
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
import bpy
from time import time
from sys import path
......
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
import bpy
from mathutils import Vector
D=bpy.data
C=bpy.context
# cam = D.objects['the_cam']
# from pythonosc import osc_message_builder
# from pythonosc import osc_bundle_builder
# from pythonosc import udp_client
# from mathutils import Matrix, Euler
# from time import sleep
# from math import pi
# from os import system
# from os import path
# from sys import path as syspath
# Import needed modules from osc4py3
from sys import path
......
# Chordata client (Blender addon)
# -- Motion capture manager for the Chordata Open Source motion capture system
#
# http://chordata.cc
# contact@chordata.cc
#
#
# Copyright 2018 Bruno Laurencich
#
# This file is part of Chordata client (Blender addon).
#
# Chordata client is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Chordata client is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Chordata client. If not, see <https://www.gnu.org/licenses/>.
#
#
# This program uses code from various sources, the default license is GNU GPLv3
# for all code, the dependencies where originally distributed as follows:
# -dnspython library: Copyright 2003-2007, 2009, 2011 Nominum, Inc. Under ISC License
# -osc4py3 library: Copyright 2013-2018 CNRS. Under CeCILL-2.1 license
# -request library: Copyright: 2017 Kenneth Reitz. Under Apache 2.0 License
#
import bpy
from sys import path
from os.path import join, abspath, dirname
......
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