<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Willian Padovani Germano schreef:
<blockquote cite="mid:47DEE34E.9010407@gmail.com" type="cite">
  <pre wrap="">Hi Stani,

Stani wrote:
(...)
  </pre>
  <blockquote type="cite">
    <pre wrap="">I am working on some new features for SPE, which is an open-source,
cross-platform python IDE for Blender:
<a class="moz-txt-link-freetext" href="http://pythonide.stani.be">http://pythonide.stani.be</a>
    </pre>
  </blockquote>
  <pre wrap=""><!---->(...)
  </pre>
  <blockquote type="cite">
    <pre wrap="">However for normal Blender modeling (not Game Engine) I was wondering
which scriptlink I could use without blocking the user interface of
Blender. Is there some sort of timer event/scriptlink? Or is there a
better way to do this?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
Right now afaik there's no out of the box solution. No timer event 
scriptlink yet, neither one for communication between processes, Verse 
is not finished, etc. It shouldn't be hard to add a scriptlink for this 
(for one system, making it work for all platforms might take more help), 
only depends on finding a dev with interest and time to code it.
  </pre>
</blockquote>
Hi Willian,<br>
<br>
I managed to have a work-around through a creative detour:<br>
- link the socket server with a redraw scriptlink<br>
- let my python shell (which is floating partly on top of the blender
window) move one pixel back and forward for every command so that a
redraw of blender is forced<br>
(its a bit more complicated to prevent blocking)<br>
<br>
It is a hack and proper support would be better, but it really works
wonderfully. I can now simultaneously work in blender or in the python
shell (with all the wistles and bells of auto-completion and calltips)
on any drawing. It is a much better solution than how SPE was working
before with Blender of which the user interface got totally blocked.
This will be soon all available in a future version of SPE.<br>
<blockquote cite="mid:47DEE34E.9010407@gmail.com" type="cite">
  <pre wrap="">
Also, maybe threading can help. This occurred to me when I started 
making bpython "thread-safe" a few weeks ago: we could add a new 
function or make Blender.Run() support running the script in a separate 
thread and this script could for example keep checking if an external 
app has sent data to Blender. Didn't test it yet, though, will try to 
play with it this week.
  </pre>
</blockquote>
In which Blender version could this be available? Threading for sure
would help! If you are able to make threading work this will open tons
of possibilities (server sockets, pyODE, better integration with
ipython, ...). The nicest would be if the standard python threading
module would just work. If that is impossible other solutions are
welcome too, but please try to mimic the threading module api as that
is what everyone knows.<br>
<br>
One final note: it is really frustrating that it is impossible for
scripts embedded in blender drawings (not the ones which are imported)
that global variables don't work in the local scope. For example, this
doesn't work:<br>
import sys<br>
def foo(x):<br>
  print x, sys.platform<br>
<br>
Right now I have to rewrite all my functions like:<br>
import sys<br>
def foo(x,sys=sys):<br>
  print x, sys.platform<br>
<br>
When I did some research on this, it was mentioned on this mailing list
that a certain script which is loaded by blender, does all kind of
namespace manipulation which causes this bug. (If I remember correctly,
it was console.py) I think that such a script should be removed
immediately from Blender as it causes a major regression. I wonder how
people can code in Blender with such a hassle.<br>
<br>
Thanks for your answer,<br>
Stani<br>
<br>
</body>
</html>