akloster / blender-asyncio

Other
53 stars 6 forks source link

Interesting examples #3

Open bsavery opened 7 years ago

bsavery commented 7 years ago

Came across this from the blender-contribs list. Here's an example of something I've been looking at, if you could point me to the code here where I should start looking, that would be appreciated!

So imagine you have some network rendering solution, you hit render in blender, and it starts the rendering remotely or even in a separate process. As tiles/buckets of the render are done it would receive those over the network (asynchronously), and write to the renderresult. If you take a look at the RenderEngine plugin example this might make more sense : https://docs.blender.org/api/blender_python_api_current/bpy.types.RenderEngine.html

It seems like the correct thing would be to start the server which would receive rendered tiles in the render_scene method in the linked example. So I did that, just wasn't sure if there was some way we should be grabbing the correct event loop, it also seems like the blender ui freezes when end_result() is called.

Thoughts? Thanks for the example!

akloster commented 7 years ago

I think the idea is to spread out the begin_result/end_result across the task, so you would call begin_result with every chunk received, wait for the next chunk on the network, etc. Until all rectangles are finished and you call end_result.

I wouldn't know why end_result() freezes the UI. I Can't check this without further code and explanation.

bsavery commented 7 years ago

Well I'm assuming because blender draws the pixels to screen at the end_result

On Mon, Mar 27, 2017 at 11:14 PM Andreas Klostermann < notifications@github.com> wrote:

I think the idea is to spread out the begin_result/end_result across the task, so you would call begin_result with every chunk received, wait for the next chunk on the network, etc. Until all rectangles are finished and you call end_result.

I wouldn't know why end_result() freezes the UI. I Can't check this without further code and explanation.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akloster/blender-asyncio/issues/3#issuecomment-289673764, or mute the thread https://github.com/notifications/unsubscribe-auth/ABzffM-1fjYlfFy_wql858k41usVxf7Kks5rqKVRgaJpZM4Mq2MW .

-- brian.savery@gmail.com 508-274-8700

hedgehog-labs commented 7 years ago

Hey is this project dead? i just found it and really like the results....is there a way you can point me in the right direction to hear from a tcp server instead of a web server??? inside of blender... i tried to implement asyncio by myself...but the ui always freeze and crashes blender

akloster commented 7 years ago

hm, I think the code in the repository should work. It's not meant to be a full fledged extension/API/plugin yet, but rather a set of ideas and proof-of-concepts. But the loop implementation works. Unfortunately there is only very little interest from the Blender community in general. There is a plugin for blender-cloud which uses a similar asyncio hack, but in general, they don't seem to the benefits of asyncio in Blender in the first place. Additionally, I don't have the time or energy to pursue this further at this point.

In terms of TCP servers try this example from asyncio: http://asyncio.readthedocs.io/en/latest/tcp_echo.html