-= PIRVI =-

BlenderTUIO

Update 03/03/2010 17pm: A new version of blenderTUIO has been compiled using the latest 2.5 version of the official blender. Please use it has it fix a lot of bugs: | Download. I also updated the tutorials to make them compatible with the 2.5 branch (that use python 3 and a new game engine API): | Download tutorials. Please report any problem you may have with this version.

Update 02/01/2010 14pm: Update version of BlenderTUIO. One bug when using on_cursor_over has been fixed (thanks to Sven for the report). This version also has been resynched with the official blender trunk at revision r26512. You can download this new version there: | Download.

Update 31/12/2009 16pm: I promised myself to make a release based on blender 2.5 before the end of 2009. So here is an alpha version of it| Download. In addition to support Multitouch/TUIO this version also features a raw OSC sensor to connect your BGE script to any weird devices you may want. Use the "stard.bat" script to launch the application.

Update 04/11/2009 10am: You can find some news on the blog part of this site: http://forge.lifl.fr/PIRVI/blog

Update 20/09/2009 9am: Thank to the help of Sven Widderich a Linux version of blenderTUIO is now on its way.

Update 23/03/2009 17pm: a better example is available: Display-fingers

Videos: Navigation 3DManipulation


This is an unofficial version of blender that supports TUIO in the gamemode. We use it for quick prototyping of 3d multi-touch applications. My employer (the CNRS) allowed me to release the source code in opensource so I made this page. The code is still considered as an alpha state but we are using it internally since two months and are quite happy with it. You can see a little demo in the following movie: Movie-Navigation Movie-3DManipulation Any help is welcome to improve it (please contact us).


How to use it

The multi-touch device is exposed as a blender sensor (see tutorial-tuio-1.blend tutorial-tuio-2.blend)). To run this example don't forget to type the P into blender to start the game mode. This multi-touch sensor triggers a controller when a touch event is received. Several Blender objects can have a muti-touch sensor and thus can receive the same events.

The current version supports the following modes for touch events:

  • on_cursor_move: trigger an event if a touch is either: moving, touching-down and touching-up;
  • on_over: trigger an event if the cusor is over the object owning this sensor;
  • on_over_any: trigger an event if the cursor is over an object.

The Blender sensors need to be connected to a controller. In our case this is most of the time a python controller so that we can process the event and modify blender states using the given API.

When the controller is triggered by an on_cursor_move event you can use the following python code to get the table info:

#### Version for blenderTUIO based on blender 2.5
import GameLogic
ctrl  = GameLogic.getCurrentController()
table = ctrl.sensors["yoursensorname"

cursors={}
for i in range(0,table.cursorCount()):
   cursor = table.getCursorInfo(i)
   cursors[cursor[0]] = cursor



#### Version for blenderTUIO based on blender 2.48
import GameLogic
ctrl  = GameLogic.getCurrentController()
table = ctrl.getSensor("yoursensorname")

cursors={}
for i in range(0,table.cursorCount()):
   cursor = table.getCursorInfo(i)
   cursors[cursor[0]] = cursor

The getCursorInfo returns an array with the following content: [cursorid, xpos, ypos, …, …, cursor_width, cursor_height]

When the controller is triggered by an on_over(_any) events extra python function are available to get the info:

#### This version is  for blenderTUIO based one 2.5
import GameLogic
ctrl  = GameLogic.getCurrentController()
table = ctrl.sensors["yoursensorname"]

cursors={}
for i in range(0,table.cursorCount()):
   cursor = table.getCursorInfo(i)
   cursors[cursor[0]] = cursor

for i in range(0, table.getHitCount()):
   print("Cursor is over object :"+table.getHitObject(i).name)
   print("          hit position:"+str(table.getHitPosition(i)))  
   print("           cursor info:"+str(cursors[table.getHitCursor(i)]))

#### This version is  for blenderTUIO based one 2.49
import GameLogic
ctrl  = GameLogic.getCurrentController()
table = ctrl.getSensor("yoursensorname")

cursors={}
for i in range(0,table.cursorCount()):
   cursor = table.getCursorInfo(i)
   cursors[cursor[0]] = cursor

for i in range(0, table.getHitCount()):
   print "Cursor is over object :"+table.getHitObject(i).getName()
   print "          hit position:"+`table.getHitPosition(i)`  
   print "           cursor info:"+`cursors[table.getHitCursor(i)]` 

Next to come

  • fixing tutorial for the new version.
  • more more more demos of usage;
  • better python stubs;
  • unified and more clean Python interface;
  • Improved performance for the on_over and on_over_any;
  • supporting multiple IP/port multi-touch sensing.

Known bugs

  • the modes: on_enter, on_leave are not working;
  • blender crash when stating game mode and that the port 3333 is not available;
  • on_over and on_over_any are not working if the camera mode is "orthographics".

Download

This is an unofficial version of Blender. Please do not complain if anything bad happen to you. | Download

Contact

Please contact us if you use or want to use this software this will help in motivating us to improve it :). Damien Marchal: damien[d.o.t]marchal[a.t].lifl.fr

Last modified 5 years ago Last modified on 03/03/10 17:10:03

Attachments (15)