<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hey Toni,<br>
<br>
I'm looking forward to read data from a VICON System, which records and
<br>
sends data over the network (another topic ^^)<br>
<br>
For early research I need to assure that I can run a function/script <br>
which reads data periodically from "somewhere else" and then redraws<br>
the 3D-Window<br>
<br>
IMPORTANT:<br>
<br>
I cannot use the GameEngine - because I need to relocate<br>
an "Empty" which is the target for an IK Chain. Changing<br>
the IK Chain / live / in the BGE isn't possible afaik. You can<br>
just rot/loc/size the whole Armature which isn't really usefull<br>
here. Correct me if I'm wrong.<br>
<br>
"if it's ok for the script to stay running all the time, then you're
fine."<br>
<br>
So, if the script is running in the script window, let's assume with<br>
some buttons, sliders and so on...Can I press a toggle button which<br>
set's a toggle value and automagically read some data, redraw the<br>
3D window until I press the toggle button again?<br>
<br>
Maybe I didn't mention that I am, in fact, QUITE new to Blender.<br>
I've learnt it from scratch  like two months ago...<br>
<br>
Thanks a million, Florian<br>
<br>
<br>
Toni Alatalo wrote:
<blockquote cite="mid:4e75457f375c82a2de507acbcaa1246d@kyperjokki.fi"
 type="cite">
  <pre wrap="">On Jun 17, 2009, at 10:30 AM, Florian Lier wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap=""> I need to know if its possible to poll a device constantly in a  
py-script like this
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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


  </pre>
  <blockquote type="cite">
    <pre wrap=""> 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
<a class="moz-txt-link-abbreviated" href="mailto:Bf-python@blender.org">Bf-python@blender.org</a>
<a class="moz-txt-link-freetext" href="http://lists.blender.org/mailman/listinfo/bf-python">http://lists.blender.org/mailman/listinfo/bf-python</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->
_______________________________________________
Bf-python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Bf-python@blender.org">Bf-python@blender.org</a>
<a class="moz-txt-link-freetext" href="http://lists.blender.org/mailman/listinfo/bf-python">http://lists.blender.org/mailman/listinfo/bf-python</a>

  </pre>
</blockquote>
<br>
</body>
</html>