Source code for pohlke.gui
# SPDX-FileCopyrightText: 2021-2026 Julien Rippinger, Ian Bertin <alicelab.be>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Defines the main UI panel and menu entries for the add-on
"""
import bpy
from .utils.ui_shared import draw_create_cam_content
from math import radians
# -------------------------------------------------------------------
# GUI FUNCTIONS
# -------------------------------------------------------------------
# -------------------------------------------------------------------
# GUI CLASSES
# -------------------------------------------------------------------
[docs]
class Pohlke_PT_projectionspanel(bpy.types.Panel):
"""
Main UI panel for creating parallel cameras in the 3D View sidebar.
This panel displays projection options and delegates
the UI drawing to shared functions.
"""
bl_idname = "POHLKE_PT_Camera_Panel"
bl_label = "Pohlke Cameras"
bl_category = "Pohlke"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
[docs]
def draw(self, context: bpy.types.Context) -> None:
"""
Draw the panel interface, thanks to :py:func:`pohlke.utils.ui_shared.draw_create_cam_content`.
Parameters
---------
context : bpy.types.Context
Blender context containing scene and UI state
"""
layout = self.layout
props = context.scene.pohlke_camera_props
draw_create_cam_content(layout, props, "property")
# -------------------------------------------------------------------
# REGISTRATION
# -------------------------------------------------------------------
_classes = (Pohlke_PT_projectionspanel,)
_register, _unregister = bpy.utils.register_classes_factory(_classes)
[docs]
def register() -> None:
"""
Register the panel and menu classes to Blender.
Also appends the custom menu entry to the VIEW3D camera add menu.
"""
_register()
bpy.types.VIEW3D_MT_camera_add.append(add_menu_func)
[docs]
def unregister() -> None:
"""
Unregister the panel and menu classes from Blender.
Also removes the custom menu entry from the VIEW3D camera add menu.
"""
_unregister()
bpy.types.VIEW3D_MT_camera_add.remove(add_menu_func)