Results 1 to 3 of 3
  1. #1

    Rendering from Python Script Freezes UI

    Hello,

    I am working on an external add-on that allows a user to select a .blend file and send it to multiple computers on a LAN. It is slightly similar to Distriblend, but more tailored to the needs of my studio.

    The issue that I am having is coming from two directions. One) Whenever I execute the "bpy.ops.render.render(animation=True)" command from a script, the command successfully begins to render out my animation, however the UI freezes in the meantime. I can see the render going from the console, but the UV/Image Editor, where my render should be previewing in the gui, freezes up.

    I tried running a render command "blender -anim" from the command line, and again, it opens blender but the UI freezes so that I cannot actually see what is going on. I can see from console that blender is rendering correctly, but I'd like to be able to see the actual render as well.

    Does anyone have any suggestions on how to run the render command from inside a python script (or even a console command) that allows for a file to render with the GUI fully intact (as if you had pressed render or ctrl+f12 from inside blender).

    Thanks for all your help,

    Joe



  2. #2
    Hey everyone. I found a solution digging in the forums.

    bpy.ops.render.render({'dict': "override"},'INVOKE_DEFAULT',animation=True)
    This works great. Now my issue is that I need a python script that can send a message to my database upon a render's completion. Is there anyway, from python, to be able to print a message upon a render's completion? Thanks in advance.



  3. #3
    You are looking for "Application handlers" (bpy.app.handlers).

    There is no good general solution to communicate with other processes (like a database) from within blender:
    • You can invoke an external command, hoping your user has the appropriate binaries in the right place.
    • If you use urllib2 to send data to a webserver, the UI will block during that time
    • If you use urllib2 from threads, you can expect problems with the Blender API
    • If you use my asyncio bridge, there is no blocking and no threading, but it is non-standard and difficult to setup/install



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •