In this experiment I tried to use the new
deapygui library, perhaps the most efficient and minimal imgui based project. This is not a good technique however, as considered “dangerous”, there are more proper ways to implement threading within Blender addons. I would get various crashes 1 out of 10 times this way.
def install_pygui(): import pip pip.main(['install', 'dearpygui']) # install_pygui() def run_callback(sender, data): print(sender, data) def run_pygui_demo(): import dearpygui.dearpygui as dpg dpg.create_context() dpg.create_viewport() dpg.setup_dearpygui() import bpy with dpg.window(label="Example Window"): # dpg.add_button(label="", callback=retrieve_object_names) dpg.add_text("Set Random Object Name") for i in bpy.context.scene.objects: # by looking at their github page, callback parameters not available (?) but planned to be added in next version dpg.add_button(label=i.name, callback=[run_callback, i.name]) #dpg.add_input_text(label="string") #dpg.add_slider_float(label="float") dpg.show_viewport() dpg.start_dearpygui() dpg.destroy_context() print('stopped dearpygui') try: import threading thr = threading.Thread(target=run_pygui_demo) thr.start() except e: print(e)
As for example, I have some specific use cases for Blender addons that would require more dynamic widges or visualization capabilities, such as graphs, curves, or 2D axis widgets etc.
I would be interested to hear your take on this, aspect. Whether or not to (a) to enhance Blender’s GUI with more widgets, (b) consider safe and standard interop techniques with imgui, (c) find some other better way for intercommunication between processes.
This is an open ended discussion, no strict outcome should be derived.