[Bf-python] Remote IPython & PyCrust Shell for Blender

Pablo Martin caedes at sindominio.net
Wed Mar 19 12:39:48 CET 2008


I do it in a way that is slightly cleaner (i'd say). Just use a scene
scriptlink, and QAdd own window for REDRAW after doing your stuff. This
ensures other events will be processed first, so interface will still be
responsive, but you have your own main loop so you can do pretty much do
anything (i can run crystalspace, and use its osc plugins for control
blender in real time for example).

Hope it helps, but anyways i agree we need some "native" solution.

 Pablo

Stani escribió:
> Willian Padovani Germano schreef:
>> Hi Stani,
>>
>> Stani wrote:
>> (...)
>>   
>>> I am working on some new features for SPE, which is an open-source,
>>> cross-platform python IDE for Blender:
>>> http://pythonide.stani.be
>>>     
>> (...)
>>   
>>> 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?
>>>     
>>
>> 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.
>>   
> Hi Willian,
>
> I managed to have a work-around through a creative detour:
> - link the socket server with a redraw scriptlink
> - 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
> (its a bit more complicated to prevent blocking)
>
> 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.
>> 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.
>>   
> 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.
>
> 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:
> import sys
> def foo(x):
>   print x, sys.platform
>
> Right now I have to rewrite all my functions like:
> import sys
> def foo(x,sys=sys):
>   print x, sys.platform
>
> 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.
>
> Thanks for your answer,
> Stani
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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