import bpy
from .fn import scene_aa

def update_scene_aa(context, scene):
    scene_aa(toggle=bpy.context.scene.gp_render_settings.use_aa)

class GPRENDER_PGT_settings(bpy.types.PropertyGroup) :

    show_scene_setup :bpy.props.BoolProperty(
        name='Show scene setup',
        default=False,
        description='Show scene setup, options to tweak render scene and compo scene')

    render_scene : bpy.props.StringProperty(
        name="Render Scene", description="Link object and create viewlayers in render scene, create if necessary",
        default="", maxlen=0, options={'HIDDEN'})

    node_scene : bpy.props.StringProperty(
        name="Compo Scene", description="Add nodes in compositing scene, if empty, add in Render scene nodeTree",
        default="", maxlen=0, options={'HIDDEN'})

    use_aa : bpy.props.BoolProperty(
        name='Use Native Anti Aliasing',
        default=True,
        description='\
Should be Off only if tree contains a merge_NG or alpha-over-combined renderlayers.\n\
Auto-set to Off when using node merge button\n\
Toggle: AA settings of and muting AA nested-nodegroup',
        update=update_scene_aa)

classes=(
GPRENDER_PGT_settings,
)

def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.gp_render_settings = bpy.props.PointerProperty(type=GPRENDER_PGT_settings)

def unregister():
    for cls in reversed(classes):
        bpy.utils.unregister_class(cls)

    del bpy.types.Scene.gp_render_settings
