1
$\begingroup$

I'm trying to change the new Preset Menu UI to display the selected Preset name in the Properties Header like it appeared in the previous versions (2.79-). I know how to do it successfully, but I have to change the original Blender UI startup script, which I know we should not do. I only need to change 3 variable assignments in a Class method. If I change the original script, I will have to make the same changes every time I download a new version. How do I implement the changes so they are not overridden by new versions?

Here is the script that needs changing - its in /scripts/startup/bl_ui/utils.py

My changes are in the draw_panel_header method.

def draw_panel_header(cls, layout):
layout.emboss = 'NORMAL'
layout.popover(
    panel=cls.__name__,
    icon='NONE',
    text=cls.bl_label,
)
from bpy.types import Menu
# Panel mix-in class (don't register).
class PresetPanel:  
    bl_space_type = 'PROPERTIES'  
    bl_region_type = 'HEADER'  
    bl_label = "Presets"  
    path_menu = Menu.path_menu

    @classmethod
    def draw_panel_header(cls, layout):
        layout.emboss = 'NONE'
        layout.popover(
            panel=cls.__name__,
            icon='PRESET',
            text="",
        )

    @classmethod
    def draw_menu(cls, layout, text=None):
        if text is None:
            text = cls.bl_label

        layout.popover(
            panel=cls.__name__,
            icon='PRESET',
            text=text,
        )

    def draw(self, context):
        layout = self.layout
        layout.emboss = 'PULLDOWN_MENU'
        layout.operator_context = 'EXEC_DEFAULT'

        Menu.draw_preset(self, context)
$\endgroup$
  • $\begingroup$ Please fix the code markdown in question. Either select the code and ctrl-k or {} button, or indent all one right before pasting. It is not the job of others to do this for you every time. $\endgroup$ – batFINGER Jul 9 at 8:45
  • $\begingroup$ Sorry, but this thing has a mind of its own. I try editing the formatting but it just gets mangled by the web page. $\endgroup$ – zippy Jul 9 at 12:09
  • $\begingroup$ meta.stackexchange.com/questions/22186/… $\endgroup$ – batFINGER Jul 9 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.