def pref_header(boolean):
"""show/hide header on 'PREFERENCE' areas"""
for window in bpy.context.window_manager.windows:
for area in window.screen.areas:
if(area.type == 'PREFERENCES'):
for space in area.spaces:
if(space.type == 'PREFERENCES'):
space.show_region_header = boolean
def panel_replace():
"""register impostors"""
#show header just in case user hided it
pref_header(True)
#replace class by impostor
try: bpy.utils.register_class(USERPREF_PT_addons)
except: pass
#replace class by impostor
try: bpy.utils.register_class(USERPREF_PT_navigation_bar)
except: pass
#replace class by impostor
try: bpy.utils.register_class(USERPREF_HT_header)
except: pass
def panel_restore():
"""restore and find original drawing classes"""
import os, sys
scr = bpy.utils.system_resource('SCRIPTS')
pth = os.path.join(scr,'startup','bl_ui')
if pth not in sys.path:
sys.path.append(pth)
#restore addons drawing
from space_userpref import USERPREF_PT_addons
bpy.utils.register_class(USERPREF_PT_addons)
#restore navigation panel
from space_userpref import USERPREF_PT_navigation_bar
bpy.utils.register_class(USERPREF_PT_navigation_bar)
#restore header
from space_userpref import USERPREF_HT_header
bpy.utils.register_class(USERPREF_HT_header)
It’s a bit dirty, but creating an operator that register a new class that will overwrite native GUI code, then a restore operator that will register old GUI again is working fine in Scatter4
The only thing extremely important is keep having a loud escape button to restore old interface.