Can I create a tree view/panel similar to the outliner?

Hi there.

That is the question, I would like to create a tree view, similar to the aspect of the outliner in Python, inside a Tab I will create for my addon.

Can this be done in Python?

I´m starting to learn Python inside Blender, I´m not new to programming in different languages and systems, both scripting or full programming, but I´m new to Blender context, so I´m still a bit lost looking for things in the API reference and such things.

Cheers and thanks in advance!

Yes you can create any GUI you want with BGL. But you will need to understand both Blender Python API and OpenGL to do so.

Great, thanks!

can you point me towards some related documentation or tutorials?

Thanks!

This is the docs for the BGL module

https://docs.blender.org/api/blender_python_api_2_76_0/bgl.html

Inside blender , text editor has a templated named “modal UI draw” which shows how to create custom guis using BGL. It uses the Viewport to draw the GUI but you can use whatever part of the Blender to draw your own GUI including the toolbar where the tabs for addons are drawn.

Bare in mind this WILL NOT be as easy as making usual GUIs for Blender, essentially BGL gives you access to the low level of GUI construction inside Blender. This is why rarely addons use BGL and extremely rarely to create complex GUIs. You will kiss goodbye to many of the conveniences of Blender guis, like layouts, rows, alignment, labels, buttons etc.

OpenGL is used to draw pretty much everything, GUIs, models, textures, materials and final or preview renders this means BGL gives you the ability to completely modify Blender down to a molecular level without touching a line of C code.

BUT… python is too slow for heavy graphic processing so its not advisable for very heavy eye candy GUIs , that use a lot of animation and changing features per frame.

No need for me to point you to OpenGL tutorials because there are like a ton out there and depends what version of OpenGL you want to use, the more recent the version the more diffirent the code will be. BGL support multiple versions of OpenGL as does Blender in general and more recent opengl version will give you faster code , more fancy features but also demand a more recent GPU.

Most addons use BGL with OpengGL version 1.1 or version 2.1. Last time I took a look BGL support at least OpenGL 4.3 .

Also be warned do not expect your questions to be answered here, because as I said people rarely use BGL. However because BGL is essentially OpenGL you will find ton of information and other forums online dedicated to OpenGL.

Thanks for all that info!

I’ll check if I con do it or I must change my mind for my addon.

Thanks!

you can do anything you want, its not a question of ability its a question of time and effort. It wont affect the general structure of your addon only the GUI part.