Inside the Blender Cloud addon

In the first week of May we released the Blender Cloud addon. This addon provides an interface to browse the texture library of the Blender Cloud, download textures, and load them into the current scene. In this article we describe some of the more interesting technical aspects of the addon: the use of the asyncio module with the async/await syntax introduced in Python 3.5.

Blender Addon: textures

Before we go on to the details: subscribe to the cloud! Tell all your friends to subscribe! We need subscribers to be able to keep up development of the cloud and the addons.

Asynchronous communication

The addon communicates with Pillar, the back-end service of the Blender Cloud. It is a REST service that lives at https://cloudapi.blender.org/. Pillar is a Python service we built on top of Eve, and talks JSON with the Blender Cloud addon. Pillar provides all the project management and metadata, while Google Cloud Storage stores the actual texture files.

One of the core design principles of the addon was that it should not block the Blender user interface. We want communcation to be performed in the background, while we update the GUI as soon as new data is available. There are multiple approaches to this:

  1. Non-blocking socket I/O. This allows the code to download data that is available, and do other stuff (like drawing the GUI and responding to user events) instead of waiting. This often results in overly complex code, as you have to maintain a download queue yourself.
  2. Multi-threading. This allows threads to run in the background and use the simpler blocking I/O. The code becomes simpler, but you cannot call any Blender code from threads other than the main thread.
  3. Multi-processing. Processes take longer to create than threads, especially on platforms without fork() call (I look at you, Windows). You also cannot call any Blender code from other processes.

We chose a fourth, more modern option: asyncio. It allows co-routines to run concurrently, even on the same thread. These are the motivations to choose asyncio in favour of the above alternatives:

  1. Bundled with Python and supported by new syntax, most notably the await and async def statements.
  2. Allows for clear “handover points”, where one task can be suspended and another can be run in its place. This provides for a much more deterministic execution flow than possible with multi-threading.
  3. Support for calling callbacks in the same thread that runs the event loop. This allows for elegant parallel execution of tasks in different threads, while keeping the interface with Blender single-threaded.
  4. Support for wrapping non-asyncio, blocking functionality (that is, the asynchronous world supports the synchronous world).
  5. Support for calling async def methods in a synchronous way (that is, the synchronous world supports the asynchronous world).
  6. No tight integration with Blender, making it possible to test asynchronous Python modules without running Blender.

Blender Addon: folders

The asyncio event loop

The event loop is the central execution device provided by asyncio. By design it blocks the thread, either forever or until a given task is finished. It is intended to run on the main thread; running on a background thread would break the ability to call Blender code. For integration with Blender this default behaviour is unwanted, which is solved in the blender_cloud.async_loop module as follows:

  1. ensure_async_loop() starts AsyncLoopModalOperator.
  2. AsyncLoopModalOperator registers a timer, and performs a single iteration of the event loop on each timer tick. As only a single iteration is performed per timer tick, this only blocks for a very short time — sockets and file descriptors are inspected to see whether a reading task can continue without blocking.
  3. The modal operator stops automatically when all tasks are done.

Other addons will likely be able to use this functionality as well. However, as the addon is still under heavy development, the internals might change. Be sure to catch up with Sybren if you’re interested in following development.

More info can be found at the wiki.

The future of the GUI

The GUI of our Blender Cloud addon will change. The current GUI is based on Manu Järvinen’s Asset Flinger addon, which draws itself on top of Blender’s UI using OpenGL. As a proof of concept this is fine. A future version of the addon will integrate nicely with the Asset Engine that Bastien Montagne is working on.

The Future of Overrides
This Summer’s Sculpt Mode Refactor
Geometry Nodes Workshop: October 2024
New Brush Thumbnails

33 comments
  1. The Blender Cloud addon provides an interface to synchronise settings, as well as to browse the texture library of the Blender Cloud, download textures, and load time. The mobile app design cost services may vary greatly based on the country to which you decide to outsource mobile app design. While some regions may seem more attractive due to lower rates, it might be a better idea to look for the best quality-to-price ratio. This is why you need to ask how much it costs to design an app in a particular country rather than in general.

  2. I have thought so many times of entering the blogging world as I love reading them. I think I finally have the courage to give it a try. Thank you so much for all of the ideas!

  3. It’s a very informative article like it.
    Keep it up :)

  4. Very cool stuff, Shane! Thanks for sharing. Definitely trying this for my next blog post!

  5. ZAZZ is a leading cross platform mobile application development company offering cross platform / multi platform mobile apps development services. Our cross platform app development teams are well versed with the different multiplatform mobile app development tools like, Flutter, React Native, etc. visit: Cross Platform Mobile Application Development

  6. AppStudio is one of the best mobile game development company in Canada with multiple offices worldwide. Our mobile game app development services are world class, as we combine our skills and knowledge to offer the best.

  7. Very interesting & informative article indeed
    following the thread to gain more knowledge over it
    If anyone of you is in need of Best Maritime Accident Lawyer can consult Van Cleave Law

  8. Good Articles with in-depth knowledge! Thanks for updating in 2021.

  9. Nice pieces of advices.

  10. Very informative article.

  11. I truly appreciate this post. I’ve been looking all over for this! Thank goodness

  12. these file is helpful so you want to grow your business online then you need a website if you have that’s good if no then check web design company.

  13. Wouldn’t it be great if you could access some Blender Cloud content directly from within Blender? Now you can! In the following video, Sybren demonstrates how to use the new Blender Cloud Texture Library add-on!

  14. nice post.
    Ekhane kichu likhte hobe. Jemon Nice post, helpful post. You can checkout our Web Design service.

  15. Do you want to pull off a striking outfit? Invest in great quality leather jackets. To your surprise, we have a huge collection of different style jackets. More importantly, these jackets are available in stunning and eye-pleasing colors that make you stand out in the crowd. And what if we tell you that our jacket collection is crafted according to the needs of current fashion trends? So, don’t wait for the winter season to pair jackets with your look. You can achieve the chic and trendy vibes wearing our jackets during any season.

  16. Thanks, DR. Sybren such a great article you shared

  17. Thanks a lot for sharing

  18. I really like the information given by you. Thanks a lot

  19. Thank you so much for sharing such a great information with us about blender cloud.

  20. Thank you so much for sharing all this wonderful info, It is so appreciated!!!

  21. Just commenting about that, thank you so much dear, truly countless solutions and advice…

  22. Digital marketing is the advertising of products or services using virtual technologies, which include the Internet, mobile telephones, digital billboards, television, radio, and any other digital media.

  23. Are you positive the difference between social media advertising and virtual advertising and marketing? If no longer, right here’s a quick manual to can help you know what both these advertising terms certainly mean.

  24. Appreciated you have a well blender cloud addon it is useful and get the best chance for the developer add on this keep more posting.

  25. Yes, I was just commenting about that, thank you so much dear, truly countless solutions and advice…

  26. Hi, it would be very valuable if Blender Cloud supported and allowed to download and share Cycles Renderer materials (as implemented in Substance Source) – with descriptions and characteristics, respectively.
    PS Thank you very much for your work, guys) !!!!!!

  27. Just subscribed. How do I increase the size of the text and thumbnails in the interface of Blender Cloud Addon? It’s WAY too small for me.

  28. Nice work!

    Will the server side also be open source and self-hostable?

  29. Thanks Manuel! It’s a good idea, we’ll jot it down :)

  30. I’d recommend all blender users to subscribe to the cloud. The Blender Cloud addon is a useful tool and a much appreciated feature. It’s easy to install, easy to work with. The GUI is a bit odd still but as it is mentioned in the article above, the GUI of the addon will change and integrate with the Asset Engine. Looking forward to it.

    I’d love to ask for a little feature though. It’d be really nice to have image statistics displayed, especially the resolution of the map before downloading.

    Thank you.

In order to prevent spam, comments are closed 7 days after the post is published.
Feel free to continue the conversation on the forums.