Created
January 15, 2023 03:14
-
-
Save Lauloque/113b251748c4ce5c1da1a7f8bfb4bbbc to your computer and use it in GitHub Desktop.
True Fullscreen Viewport for Blender (not working)
This file contains hidden or 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 | |
| from bpy.props import (BoolProperty, | |
| PointerProperty, | |
| ) | |
| from bpy.types import (Panel, | |
| Operator, | |
| AddonPreferences, | |
| PropertyGroup, | |
| ) | |
| class tfv_settings(PropertyGroup): | |
| tfv_toggle: BoolProperty( | |
| default=False | |
| ) | |
| class view_OT_trueFullscreenViewport(bpy.types.Operator): | |
| """Sets the viewport to fullscreen with no overlays""" | |
| bl_idname = "view.true_fullscreen_viewport" | |
| bl_label = "True Fullscreen Viewport" | |
| def execute(self, context): | |
| scene = context.scene | |
| mytool = scene.my_tool | |
| context = bpy.context.copy() | |
| # HIDE AND FULLSCREEN | |
| # if mytool.tfv_toggle == True: | |
| for area in bpy.context.screen.areas: | |
| if area.type == 'VIEW_3D': | |
| context['area'] = area | |
| bpy.ops.screen.screen_full_area(context, use_hide_panels=True) | |
| bpy.context.space_data.show_gizmo = not bpy.context.space_data.show_gizmo | |
| bpy.context.space_data.overlay.show_overlays = bpy.context.space_data.overlay.show_overlays | |
| bpy.ops.wm.window_fullscreen_toggle() | |
| # mytool.tfv_toggle = False | |
| break | |
| # SHOW AND SMALLSCREEN | |
| # else: | |
| # context = bpy.context.copy() | |
| # for area in bpy.context.screen.areas: | |
| # if area.type == 'VIEW_3D': | |
| # context['area'] = area | |
| # bpy.ops.screen.screen_full_area(context, use_hide_panels=True) | |
| # bpy.context.space_data.show_gizmo = True | |
| # bpy.context.space_data.overlay.show_overlays = True | |
| # bpy.ops.wm.window_fullscreen_toggle() | |
| # mytool.tfv_toggle = True | |
| # break | |
| return {'FINISHED'} | |
| def draw_menu_func(self, context): | |
| layout = self.layout | |
| scene = context.scene | |
| layout.operator("view.true_fullscreen_viewport", text="Toggle True Fullscreen") | |
| classes = ( | |
| tfv_settings, | |
| view_OT_trueFullscreenViewport, | |
| ) | |
| def register(): | |
| from bpy.utils import register_class | |
| for cls in classes: | |
| register_class(cls) | |
| bpy.types.Scene.my_tool = PointerProperty(type=tfv_settings) | |
| bpy.types.VIEW3D_MT_view.append(draw_menu_func) | |
| def unregister(): | |
| from bpy.utils import unregister_class | |
| for cls in reversed(classes): | |
| unregister_class(cls) | |
| del bpy.types.Scene.my_tool | |
| bpy.types.VIEW3D_MT_view.remove(draw_menu_func) | |
| if __name__ == "__main__": | |
| register() | |
| # test call | |
| # bpy.ops.object.simple_operator() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment