I’m trying to implement a new editor for Blender 2.8. However, I’m having a few problems, especially because the documentation is not really updated. I’m trying to learn from what I can find in the documentation and the code.
The space I create doesn’t have the drop menu to change the space again. I couldn’t find a way to add it. Actually, I couldn’t find a way to add anything to the header or the main region.
Following this page Reference/FAQ - Blender Developer Wiki at the section “Where is the UI code?” I have created the python code for my new editor (and also added it to the __init__.py file) in release/scripts/modules/bl_ui/ . But I’m not sure of how I should “connect” the python code with the C code I wrote to create the editor! I’ve tried to mess around with the python files of other editors, and I can see that it has influence (making disappear menus or buttons), so I really believe that the python code I wrote is not working because I need to connect it with the C code I previously wrote.
I also compared what I wrote with other editors’ code (in particular INFO and CONSOLE, which I believe are the simplest), and they are pretty similar to mine. Am I missing something?
Any help would be really appreciated thank you in advance!
if its in Python , then BGL modules is the way to go, if its C++ you will have to do what I do now, read through the implementation of regions and how they draw their elements, including GUIs and work areas.
It’s also a good idea to always link your code and an image with the error or problem you get so the devs can help you more accurately
I actually thought I need to use them both! I’ve created a new editor in source/blender/editors (in C++) and a Python script in release/scripts/startup/bl_ui/ .
You are right I don’t really get an error. The new editor window is created, but it is empty, and I really do not understand how to add new elements in the header and in the main region! Not even the toggle to change editor again! Here’s the result:
Following opinion should be taken with a mountain of salt because of how new I am to Blender C++ coding
Yes if you followed the tutorial to the letter not having menus, buttons or any gui elements seems normal to me. Those things will have to be added to the C++ code. Generally speaking you got the regions that do the drawing and you have to make sure you have the right region for the UI stuff.
How you do this in C++ is beyond me , I have not touched that part yet. My advice is find the editor you like the most and is closer to what you trying to achieve, launch the debug build with the debugger of your choice, add the breakpoint to the areas you want to examine and step over the code you see exactly how it executes the drawing and see the data that it expects.
If you really want to use Quad View for example , then examine the 3DVIEW.
You also could also try to modify the existing editor , in this example 3DView , to see how it behaves.
The layout indeed is done by Python but you have to make sure first that what Python requires is there and that is where C++ code comes in.
I know its not much but thats how I learned how to contribute my first patch today , took me a couple of hours because I had to battle both C++ and Python (my patch also deals with both suspects) so it can be tricky.
Starting next week I will be studying the same code myself to make my own GUI API, or rather an extension to the existing for some custom GUI elements I have in mind.
I am curious, what kind of editor are you developing? If it is a code editor, are you looking to incorporate more of the “modern” features from popular ones like Sublime, Atom or VS Code, such as multi-select, etc.?
Are there still plans to implement custom editors for the final 2.8 release? Without it and without the ability to use the T-Shelf for Addons GUI (which admittedly was a mess), I fear Addon developers will have a hard time finding a place for their GUI and will instead clutter the N-Menu, which will result in a mess too.
Maybe in the meantime, a simple new tabbed Editor Type could be introduced that appers in the Editors-List as soon as at least one Addon that uses it is installed. It probably just use the code from the old T-Shelf, but without the vanilla Blender stuff and only Addons.
I don’t think there will be custom editor support in 2.80, it would be for a later release. The support for tabs in the N-key sidebar is new in 2.8, and I think the result then will be quite similar to the T-key toolbar in 2.7.
I don’t see how custom editors provide much of a solution to that problem though. For most of the add-ons it would not be convenient to have to open an editor rather than access them from the side of the 3D viewport. There are only a few add-ons where a new editor helps.
Some add-ons can be converted to active tools, which can help clean up the UI by only showing the relevant settings and tools in the topbar when the tool is active.
I will not only have to agree with Brecht , I will take it one step further by saying that Blender has too many editors already.
On the matters of space limitation that’s easily handled by moving settings to properties panel which now has a special tab for addons if I understand it correctly. If you need more flexibility bgl and gpu modules can provide you with means to make your own custom gui anywhere you want. Most complex addons heavily rely on those modules already anyway.
For me the only justification for the introduction of a new editor would be if the addon offered at least 100 (a random big number used as example) new features. If not then an existing editor should be used. However even if it did I still will not find it a good option to introduce a new editor.
What if it is a new editor for a rig picker ? A bit like AnimSchool Picker, where you can create and save your own pickers, I think that could be really useful It doesn’t really fit in the sidebar
YESSS PLEASE, to add selection, sets, scripts that you can easily run, and buttons that you can rearrange however you feel like, that would be amazing.
Yes, it really depends on the type of addon,
for example, I want to implement a node-based procedural texture generator for Blender 2.8,
so having its own editor is a must to be able to work with a node graph comfortably.