Skip to content
Snippets Groups Projects
scripting_properties.py 1.11 KiB
Newer Older
  • Learn to ignore specific revisions
  • # SPDX-License-Identifier: GPL-2.0-or-later
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
    """Declare pov native file syntax properties controllable in UI hooks and text blocks"""
    
    
    import bpy
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    from bpy.utils import register_class, unregister_class
    from bpy.types import PropertyGroup
    from bpy.props import EnumProperty, PointerProperty
    
    
    # ---------------------------------------------------------------- #
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    # Text POV properties.
    
    # ---------------------------------------------------------------- #
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
    
    class RenderPovSettingsText(PropertyGroup):
    
        """Declare text properties to use UI as an IDE or render text snippets to POV."""
    
        custom_code: EnumProperty(
            name="Custom Code",
            description="rendered source: Both adds text at the " "top of the exported POV file",
            items=(("3dview", "View", ""), ("text", "Text", ""), ("both", "Both", "")),
    
    classes = (RenderPovSettingsText,)
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
    
    def register():
        for cls in classes:
            register_class(cls)
        bpy.types.Text.pov = PointerProperty(type=RenderPovSettingsText)
    
    
    def unregister():
        del bpy.types.Text.pov
        for cls in reversed(classes):
            unregister_class(cls)