Created
November 23, 2018 12:46
-
-
Save tin2tin/c4f8eb0dfefb7d5f36971d50dc63e1f5 to your computer and use it in GitHub Desktop.
Windowless Fullscreen Mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class SEQUENCE_MT_true_fullscreen(bpy.types.Operator): | |
"""True fullscreen preview""" | |
bl_label = "True Fullscreen" | |
bl_idname = "sequencer.true_fullscreen" | |
runs = 0 | |
original_area = None | |
def invoke(self, context, event): | |
self.original_area = context.area | |
bpy.ops.wm.window_fullscreen_toggle() | |
self.runs = 0 | |
context.window_manager.modal_handler_add(self) | |
return {'RUNNING_MODAL'} | |
def modal(self, context, event): | |
if self.runs == 0: | |
override = context.copy() | |
bpy.ops.screen.screen_full_area(override, use_hide_panels=True) #This has to be delayed because if it is run in the invoke function, it crashes blender... | |
if self.runs == 1: | |
bpy.ops.sequencer.view_all_preview() #This has to be delayed because if it is run right after the screen_full_area, it crashes blender... | |
self.runs = self.runs + 1 | |
if event.type in {'RIGHTMOUSE', 'ESC'}: | |
bpy.ops.wm.window_fullscreen_toggle() | |
bpy.ops.screen.header() | |
bpy.ops.screen.back_to_previous() | |
override = context.copy() | |
area = self.original_area | |
override['area'] = area | |
override['space_data'] = area.spaces.active | |
for region in area.regions: | |
if region.type == 'PREVIEW': | |
break | |
override['region'] = region | |
bpy.ops.sequencer.view_all_preview(override) | |
return {'FINISHED'} | |
return {'PASS_THROUGH'} | |
def true_fullscreen_menu(self, context): | |
if context.area.spaces[0].view_type == 'PREVIEW': | |
self.layout.operator(SEQUENCE_MT_true_fullscreen.bl_idname) | |
def register(): | |
bpy.utils.register_class(SEQUENCE_MT_true_fullscreen) | |
bpy.types.SEQUENCER_MT_view.append(true_fullscreen_menu) # add to "view" vse header menu | |
def unregister(): | |
bpy.utils.unregister_class(SEQUENCE_MT_true_fullscreen) | |
bpy.types.SEQUENCER_MT_view.remove(true_fullscreen_menu) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment