I’m working on an add-on that manages a custom work flow. I would like to be able to hide panels in the properties window that are not relevant to that workflow. I thought this would be fairly straight forward but I can find nothing that addresses it. Maybe I’m going about this the wrong way.
In my recent scripts I just have a special case for the panel that displays a simple message. Like “This panel is not relevant for this object”. Or display nothing in the draw routine.
I think registering and unregistering class on-the-fly would certainly stress-test the API and the event system.
In playing with this today, the unregister_class method gives the results I’m looking for. The panels I don’t want are completely hidden. I unregister a list of classes in my register method and register them again in my unregister method. So far this seems to be working.
Hi everybody! This is what I was looking for as well, but I cannot seem to find the bpy_types for the Graph Editor to remove it’s menus… can anybody help?
Ps. It would be even better if it was possible to add a poll function to the panels in order to make it appear only in certain cases… Could anybody help me setting it up?
My target is to hide selected panels from the graph editor when the screen name is “Data Anaysis” … !
I might be wrong but I don’t think it’s actually necessary to import bpy_types… I used to and I don’t remember why. I just import the class through the bpy module directly.
from the (shift-f4) console you can type bpy.types. and then ctrl-space to see the list of types. bpy.types.GR completes to a few graph editor things and there is a GRAPH_MT_editor_menus. Is that what you wanted to hack on?
Thank you very much dustractor for your kind answer.
No, although very interesting and probably something I will need in the future, unfortunately it isn’t what I was looking for… something similato to what you wrote (see below) would remove the menus in the header, while what I wanted to remove is the element in the panels you activate with the ‘N’ key. These should be some ‘GRAPH_PT_***’ clas_s (at least PT is what is used in other area types) but they don’t seem to exist for the graph editor…
I tried with ‘GRAPH_MT_editor_menus’ anyway but unregistering it seems to have no effect.
Trying with ‘GRAPH_MT_view’ partly works as it is possible to unregister it (View menu disappears) but not to bind it to a poll call.
In order to be sure the idea was right, I tested it with VIEW3D_PT_view3d_cursor and it perfectly works.
Messing with blender ui is about the only kind of programming I would call as one of my specialty. I haven’t in a long time though… currently messing around learning kotlin and yuck java