import pymel.core as pm
from mtoa.ui.ae.shaderTemplate import ShaderAETemplate


class AEapCurSampleTemplate(ShaderAETemplate):
    def setup(self):
        self.addSwatch()

        self.beginLayout("Sample", collapse=False)
        self.addControl('sample_data_type', label='Sample Type',
                        annotation='Sample Type')
        self.addControl('ray_offset', label='Ray Offset',
                        annotation='Ray Offset')
        self.addControl('ray_max_sample', label='Ray Max Sample',
                        annotation='Ray Max Sample')
        self.addControl('ray_max_depth', label='Ray Max Depth',
                        annotation='Ray Max Depth')
        self.endLayout()

        self.beginLayout("Occlusion", collapse=False)
        self.addControl('occ_min_dist', label='Occlusion Min Dist',
                        annotation='Occlusion Minimum Ray Distance')
        self.addControl('occ_max_dist', label='Occlusion Max Dist',
                        annotation='Occlusion Maximum Ray Distance')
        self.addControl('occ_spread', label='Occlusion Spread',
                        annotation='Angular spread around the normal vector')
        self.addControl('occ_falloff', label='Occlusion Falloff',
                        annotation='Exponential falloff rate for the occlusion along the ray distance')
        self.endLayout()

        self.beginLayout("Output", collapse=False)
        self.addControl('sample_data_type', label='Sample Data Type',
                        annotation='Sample Data Type')
        self.beginNoOptimize()
        self.addControl('space', label='Space',
                        annotation='Normalize Output Vector')
        self.addControl('normalize', label='Normalize',
                        annotation='Normalize Output Vector')
        self.addControl('invert', label='Invert',
                        annotation='Invert Output Vector')
        self.endNoOptimize()
        self.endLayout()

        self.beginLayout("Render", collapse=False)
        self.addControl('error_color', label='Error Color',
                        annotation='Error Color')
        self.addControl('trace_sets', label='Trace Sets',
                        annotation='Trace Sets')
        self.endLayout()

        pm.mel.AEdependNodeTemplate(self.nodeName)
        self.addExtraControls()
        self.endScrollLayout()
