Skip to content

Update to support latest Blender + Vulkan backend#5

Open
DanLaneyDLL wants to merge 1 commit into
eliemichel:mainfrom
DanLaneyDLL:main
Open

Update to support latest Blender + Vulkan backend#5
DanLaneyDLL wants to merge 1 commit into
eliemichel:mainfrom
DanLaneyDLL:main

Conversation

@DanLaneyDLL

@DanLaneyDLL DanLaneyDLL commented Jun 20, 2025

Copy link
Copy Markdown

This update migrates the implementation from using opengl directly--through blender's now-deprecated bgl module--to blender's gpu module, allowing it to work on both the latest versions of Blender and the new Vulkan backend available in the 4.5 alpha (at time of writing).

Some caveats:

  • The GPU module seems to manage state decently better than using OpenGL directly, so some memory management that was necessary in the past no longer is. I didn't notice any significant memory leaks in my testing, but if you catch an error on my part please do let me know and I'll correct it.
  • This commit does not adjust the "blender_imgui.py" file found in the root of the repo yet, only the one found in examples\blender_imgui.py. It seems the one in examples is older, before the framerate limit PR, but for some reason I was running into errors I didn't have the time to track down on top of migrating the implementation. I'll get around to updating the root file later, and will commit those changes to the file in examples as it seems like that was intended to get updated.
  • The class name for the Blender Imgui implementation is still erroneously called BaseOpenGLRenderer. Just didn't get around to renaming it yet, oop! I'll let you choose a different name if you want :p

Also, an adjustment was made to the following code to prevent a crash when unloading the plugin:

     def shutdown_imgui(self):
        for SpaceType, draw_handler in self.draw_handlers.items():
            SpaceType.draw_handler_remove(draw_handler, 'WINDOW') # originally "self.draw_handler," which was throwing an error.

This PR has been tested on both the latest LTS of Blender (4.4) and the 4.5 alpha, both in OpenGL and Vulkan backends. It has only been tested on Windows, but it may work fine on Linux as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant