[Bf-python] Polling a device in Bpy?

Dietrich Bollmann diresu at web.de
Wed Jun 17 15:30:16 CEST 2009


Hi Florian,

maybe the command port branch of blender could help?  It is not part of
the official blender though and probably will never be...

Here is a page with some informations: 

  - command port home page: http://formgames.org/blender/command-port/
  - command port code on launchpad :
https://code.launchpad.net/~diresu/blender/blender-command-port

It was inspired by the Maya command port used for motion capturing with
Maya...

http://download.autodesk.com/us/maya/2009help/Commands/commandPort.html

Good luck, Dietrich


On Wed, 2009-06-17 at 09:59 +0200, Florian Lier wrote:
> Hey Toni,
> 
> I'm looking forward to read data from a VICON System, which records
> and 
> sends data over the network (another topic ^^)
> 
> For early research I need to assure that I can run a function/script 
> which reads data periodically from "somewhere else" and then redraws
> the 3D-Window
> 
> IMPORTANT:
> 
> I cannot use the GameEngine - because I need to relocate
> an "Empty" which is the target for an IK Chain. Changing
> the IK Chain / live / in the BGE isn't possible afaik. You can
> just rot/loc/size the whole Armature which isn't really usefull
> here. Correct me if I'm wrong.
> 
> "if it's ok for the script to stay running all the time, then you're
> fine."
> 
> So, if the script is running in the script window, let's assume with
> some buttons, sliders and so on...Can I press a toggle button which
> set's a toggle value and automagically read some data, redraw the
> 3D window until I press the toggle button again?
> 
> Maybe I didn't mention that I am, in fact, QUITE new to Blender.
> I've learnt it from scratch  like two months ago...
> 
> Thanks a million, Florian
> 
> 
> Toni Alatalo wrote: 
> > On Jun 17, 2009, at 10:30 AM, Florian Lier wrote:
> > 
> >   
> > > I need to know if its possible to poll a device constantly in a  
> > > py-script like this
> > >     
> > 
> > yes, polling works like it normally does. so you can e.g. use select()  
> > to read from a socket in a non-blocking manner, or use some python  
> > module that gives polling access to your device.
> > 
> > the question is how you need to execute the code. if it's ok for the  
> > script to stay running all the time, then you're fine. if you'd like it  
> > to have it like a scriptlink, i.e. just in the scene and not running  
> > otherwise, there is currently no 'always' scriptlink that would run  
> > periodically. 2.5 should solve this too with the new event internals.
> > 
> > ~Toni
> > 
> > 
> >   
> > > pseudo code
> > >  ----------------------------------------------
> > >  if button1 state = "down":
> > >       
> > > poll.mydevice(cube.setLocation(mydevice.valA,mydevice.valB,mydevice.val 
> > > C))
> > >      Blender.Redraw()
> > >  else
> > >      print "No data avail"
> > >  ----------------------------------------------
> > > 
> > >  Is there another apporach? Like looping parts of the script?
> > >  The problem is, functions like while(true) or for x in  
> > > range(10000000): sleep(0.5)
> > >  freezing the script, thus Blender too.
> > > 
> > >  Thank you, cheers Florian
> > > 
> > > 
> > > 
> > > 
> > >  _______________________________________________
> > > Bf-python mailing list
> > > Bf-python at blender.org
> > > http://lists.blender.org/mailman/listinfo/bf-python
> > >     
> > 
> > _______________________________________________
> > Bf-python mailing list
> > Bf-python at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-python
> > 
> >   
> 
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python




More information about the Bf-python mailing list