Skip to content
Snippets Groups Projects
__init__.py 145 KiB
Newer Older
  • Learn to ignore specific revisions
  • # ##### BEGIN GPL LICENSE BLOCK #####
    
    Luca Bonavita's avatar
    Luca Bonavita committed
    #
    #  This program is free software; you can redistribute it and/or
    #  modify it under the terms of the GNU General Public License
    #  as published by the Free Software Foundation; either version 2
    #  of the License, or (at your option) any later version.
    #
    #  This program is distributed in the hope that it will be useful,
    #  but WITHOUT ANY WARRANTY; without even the implied warranty of
    #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    #  GNU General Public License for more details.
    #
    #  You should have received a copy of the GNU General Public License
    #  along with this program; if not, write to the Free Software Foundation,
    #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    #
    # ##### END GPL LICENSE BLOCK #####
    
    
        "name": "POV-3.7",
    
        "author": "Campbell Barton, Silvio Falcinelli, Maurice Raybaud, "
                  "Constantin Rahn, Bastien Montagne, Leonid Desyatkov",
    
        "version": (0, 1, 0),
    
        "blender": (2, 80, 0),
    
        "location": "Render > Engine > POV-Ray 3.7",
    
        "description": "Basic POV-Ray 3.7 integration for blender",
    
        "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
    
                    "Scripts/Render/POV-Ray",
    
    Luca Bonavita's avatar
    Luca Bonavita committed
    
    
    if "bpy" in locals():
    
        import importlib
        importlib.reload(ui)
        importlib.reload(render)
    
        importlib.reload(shading)
    
        importlib.reload(update_files)
    
    
    else:
        import bpy
    
        from bpy.utils import register_class
    
        #import addon_utils # To use some other addons
    
        import nodeitems_utils #for Nodes
        from nodeitems_utils import NodeCategory, NodeItem #for Nodes
    
        from bl_operators.presets import AddPresetBase
    
        from bpy.types import (
                AddonPreferences,
                PropertyGroup,
    
                )
        from bpy.props import (
                StringProperty,
                BoolProperty,
                IntProperty,
                FloatProperty,
                FloatVectorProperty,
                EnumProperty,
                PointerProperty,
    
                )
        from . import (
                ui,
                render,
                update_files,
                )
    
    def string_strip_hyphen(name):
        return name.replace("-", "")
    
    Luca Bonavita's avatar
    Luca Bonavita committed
    
    
    ###############################################################################
    # Scene POV properties.
    ###############################################################################
    
    class RenderPovSettingsScene(PropertyGroup):
    
        #Linux SDL-window enable
    
        sdl_window_enable: BoolProperty(
    
                name="Enable SDL window",
                description="Enable the SDL window in Linux OS",
                default=True)
    
        # File Options
    
        text_block: StringProperty(
    
                name="Text Scene Name",
                description="Name of POV-Ray scene to use. "
                            "Set when clicking Run to render current text only",
                maxlen=1024)
    
        tempfiles_enable: BoolProperty(
    
                name="Enable Tempfiles",
    
                description="Enable the OS-Tempfiles. Otherwise set the path where"
                            " to save the files",
    
                default=True)
    
        pov_editor: BoolProperty(
    
                name="POV-Ray editor",
    
                description="Don't Close POV-Ray editor after rendering (Overridden"
    
                            " by /EXIT command)",
    
        deletefiles_enable: BoolProperty(
    
                name="Delete files",
    
                description="Delete files after rendering. "
                            "Doesn't work with the image",
    
                default=True)
    
        scene_name: StringProperty(
    
                name="Scene Name",
    
                description="Name of POV-Ray scene to create. Empty name will use "
                            "the name of the blend file",
    
        scene_path: StringProperty(
    
                name="Export scene path",
    
                # Bug in POV-Ray RC3
                # description="Path to directory where the exported scene "
    
                            # "(POV and INI) is created",
    
                description="Path to directory where the files are created",
    
                maxlen=1024, subtype="DIR_PATH")
    
        renderimage_path: StringProperty(
    
                name="Rendered image path",
    
                description="Full path to directory where the rendered image is "
                            "saved",
    
                maxlen=1024, subtype="DIR_PATH")
    
        list_lf_enable: BoolProperty(
    
                name="LF in lists",
    
                description="Enable line breaks in lists (vectors and indices). "
                            "Disabled: lists are exported in one line",
    
                default=True)
    
        # Not a real pov option, just to know if we should write
    
        radio_enable: BoolProperty(
    
                name="Enable Radiosity",
    
                description="Enable POV-Rays radiosity calculation",
    
        radio_display_advanced: BoolProperty(
    
                name="Advanced Options",
                description="Show advanced options",
                default=False)
    
        media_enable: BoolProperty(
    
                name="Enable Media",
                description="Enable POV-Rays atmospheric media",
                default=False)
    
        media_samples: IntProperty(
    
                description="Number of samples taken from camera to first object "
    
                            "encountered along ray path for media calculation",
    
                min=1, max=100, default=35)
    
        media_scattering_type: EnumProperty(
    
                name="Scattering Type",
                description="Scattering model",
                items=(('1', "1 Isotropic", "The simplest form of scattering because"
                                          " it is independent of direction."),
                       ('2', "2 Mie haze ", "For relatively small particles such as "
                                          "minuscule water droplets of fog, cloud "
                                          "particles, and particles responsible "
                                          "for the polluted sky. In this model the"
                                          " scattering is extremely directional in"
                                          " the forward direction i.e. the amount "
                                          "of scattered light is largest when the "
                                          "incident light is anti-parallel to the "
                                          "viewing direction (the light goes "
                                          "directly to the viewer). It is smallest"
                                          " when the incident light is parallel to"
                                          " the viewing direction. "),
                       ('3', "3 Mie murky", "Like haze but much more directional"),
                       ('4', "4 Rayleigh", "For extremely small particles such as "
                                         "molecules of the air. The amount of "
                                         "scattered light depends on the incident"
                                         " light angle. It is largest when the "
                                         "incident light is parallel or "
                                         "anti-parallel to the viewing direction "
                                         "and smallest when the incident light is "
                                         "perpendicular to viewing direction."),
                       ('5', "5 Henyey-Greenstein", "The default eccentricity value "
                                                  "of zero defines isotropic "
                                                  "scattering while positive "
                                                  "values lead to scattering in "
                                                  "the direction of the light and "
                                                  "negative values lead to "
                                                  "scattering in the opposite "
                                                  "direction of the light. Larger "
                                                  "values of e (or smaller values "
                                                  "in the negative case) increase "
                                                  "the directional property of the"
    
                                                  " scattering.")),
    
        media_diffusion_scale: FloatProperty(
    
                name="Scale", description="Scale factor of Media Diffusion Color",
                precision=12, step=0.00000001, min=0.000000001, max=1.0,
                default=(1.0))
    
        media_diffusion_color: FloatVectorProperty(
    
                name="Media Diffusion Color", description="The atmospheric media color",
    
                precision=4, step=0.01, min=0, soft_max=1,
    
                default=(0.001, 0.001, 0.001),
    
                options={'ANIMATABLE'},
    
        media_absorption_scale: FloatProperty(
    
                name="Scale", description="Scale factor of Media Absorption Color. "
                                          "use 1/depth of media volume in meters",
                precision=12, step=0.000001, min=0.000000001, max=1.0,
                default=(0.00002))
    
        media_absorption_color: FloatVectorProperty(
    
                name="Media Absorption Color", description="The atmospheric media absorption color",
                precision=4, step=0.01, min=0, soft_max=1,
                default=(0.0, 0.0, 0.0),
                options={'ANIMATABLE'},
    
                subtype='COLOR')
    
        media_eccentricity: FloatProperty(
    
                name="Media Eccenticity Factor", description="Positive values lead"
                     " to scattering in the direction of the light and negative "
                     "values lead to scattering in the opposite direction of the "
                     "light. Larger values of e (or smaller values in the negative"
                     " case) increase the directional property of the scattering.",
                precision=2, step=0.01, min=-1.0, max=1.0,
                default=(0.0),
                options={'ANIMATABLE'})
    
        baking_enable: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Enable Baking",
    
                description="Enable POV-Rays texture baking",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                default=False)
    
        indentation_character: EnumProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Indentation",
                description="Select the indentation type",
    
                items=(('NONE', "None", "No indentation"),
                       ('TAB', "Tabs", "Indentation with tabs"),
                       ('SPACE', "Spaces", "Indentation with spaces")),
                default='SPACE')
    
        indentation_spaces: IntProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Quantity of spaces",
                description="The number of spaces for indentation",
    
                min=1, max=10, default=4)
    
        comments_enable: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Enable Comments",
    
                description="Add comments to pov file",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                default=True)
    
    
        # Real pov options
    
        command_line_switches: StringProperty(
    
                description="Command line switches consist of a + (plus) or - "
                            "(minus) sign, followed by one or more alphabetic "
                            "characters and possibly a numeric value",
    
        antialias_enable: BoolProperty(
    
                name="Anti-Alias", description="Enable Anti-Aliasing",
                default=True)
    
        antialias_method: EnumProperty(
    
                name="Method",
    
                description="AA-sampling method. Type 1 is an adaptive, "
                            "non-recursive, super-sampling method. Type 2 is an "
                            "adaptive and recursive super-sampling method. Type 3 "
                            "is a stochastic halton based super-sampling method",
    
                items=(("0", "non-recursive AA", "Type 1 Sampling in POV-Ray"),
    
                       ("1", "recursive AA", "Type 2 Sampling in POV-Ray"),
                       ("2", "stochastic AA", "Type 3 Sampling in UberPOV")),
    
                default="1")
    
        antialias_confidence: FloatProperty(
    
                name="Antialias Confidence",
                description="how surely the computed color "
                            "of a given pixel is indeed"
                            "within the threshold error margin",
    
                min=0.0001, max=1.0000, default=0.9900, precision=4)
    
        antialias_depth: IntProperty(
    
                name="Antialias Depth", description="Depth of pixel for sampling",
                min=1, max=9, default=3)
    
        antialias_threshold: FloatProperty(
    
                name="Antialias Threshold", description="Tolerance for sub-pixels",
    
                min=0.0, max=1.0, soft_min=0.05, soft_max=0.5, default=0.03)
    
        jitter_enable: BoolProperty(
    
                description="Enable Jittering. Adds noise into the sampling "
                            "process (it should be avoided to use jitter in "
                            "animation)",
    
        jitter_amount: FloatProperty(
    
                name="Jitter Amount", description="Amount of jittering",
    
                min=0.0, max=1.0, soft_min=0.01, soft_max=1.0, default=1.0)
    
        antialias_gamma: FloatProperty(
    
                description="POV-Ray compares gamma-adjusted values for super "
                            "sampling. Antialias Gamma sets the Gamma before "
                            "comparison",
    
                min=0.0, max=5.0, soft_min=0.01, soft_max=2.5, default=2.5)
    
        max_trace_level: IntProperty(
    
                description="Number of reflections/refractions allowed on ray "
                            "path",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                min=1, max=256, default=5)
    
    
    #######NEW from Lanuhum
    
        adc_bailout_enable: BoolProperty(
    
        adc_bailout: FloatProperty(
    
                name="ADC Bailout",
                description="",
                min=0.0, max=1000.0,default=0.00392156862745, precision=3)
    
    
        ambient_light_enable: BoolProperty(
    
        ambient_light: FloatVectorProperty(
    
                name="Ambient Light",
                description="Ambient light is used to simulate the effect of inter-diffuse reflection",
    
                precision=4, step=0.01, min=0, soft_max=1,
    
                default=(1, 1, 1), options={'ANIMATABLE'}, subtype='COLOR',
        )
    
        global_settings_advanced: BoolProperty(
    
        irid_wavelength_enable: BoolProperty(
    
        irid_wavelength: FloatVectorProperty(
    
                name="Irid Wavelength",
                description=(
                    "Iridescence calculations depend upon the dominant "
                    "wavelengths of the primary colors of red, green and blue light"
                ),
    
                precision=4, step=0.01, min=0, soft_max=1,
                default=(0.25,0.18,0.14), options={'ANIMATABLE'}, subtype='COLOR')
    
    
        charset: EnumProperty(
    
                description="This allows you to specify the assumed character set of all text strings",
    
                items=(("ascii", "ASCII", ""),
                       ("utf8", "UTF-8", ""),
                       ("sys", "SYS", "")),
                default="utf8")
    
    
        max_intersections_enable: BoolProperty(
    
        max_intersections: IntProperty(
    
                description="POV-Ray uses a set of internal stacks to collect ray/object intersection points",
    
        number_of_waves_enable: BoolProperty(
    
        number_of_waves: IntProperty(
    
                description=(
                    "The waves and ripples patterns are generated by summing a series of waves, "
                    "each with a slightly different center and size"
                ),
    
        noise_generator_enable: BoolProperty(
    
        noise_generator: IntProperty(
    
                description="There are three noise generators implemented",
    
        ########################### PHOTONS #######################################
    
        photon_enable: BoolProperty(
    
                name="Photons",
                description="Enable global photons",
                default=False)
    
    
        photon_enable_count: BoolProperty(
    
                name="Spacing / Count",
                description="Enable count photons",
                default=False)
    
    
        photon_count: IntProperty(
    
                name="Count",
                description="Photons count",
                min=1, max=100000000, default=20000)
    
        photon_spacing: FloatProperty(
    
                description="Average distance between photons on surfaces. half "
                            "this get four times as many surface photons",
                min=0.001, max=1.000, default=0.005,
                soft_min=0.001, soft_max=1.000, precision=3)
    
        photon_max_trace_level: IntProperty(
    
                description="Number of reflections/refractions allowed on ray "
                            "path",
    
                min=1, max=256, default=5)
    
    
        photon_adc_bailout: FloatProperty(
    
                description="The adc_bailout for photons. Use adc_bailout = "
    
                            "0.01 / brightest_ambient_object for good results",
    
                min=0.0, max=1000.0, default=0.1,
                soft_min=0.0, soft_max=1.0, precision=3)
    
        photon_gather_min: IntProperty(
    
                name="Gather Min", description="Minimum number of photons gathered"
                                               "for each point",
    
                min=1, max=256, default=20)
    
    
        photon_gather_max: IntProperty(
    
                name="Gather Max", description="Maximum number of photons gathered for each point",
                min=1, max=256, default=100)
    
        photon_map_file_save_load: EnumProperty(
    
                name="Operation",
                description="Load or Save photon map file",
                items=(("NONE", "None", ""),
                       ("save", "Save", ""),
                       ("load", "Load", "")),
                default="NONE")
    
    
        photon_map_filename: StringProperty(
    
                name="Filename",
                description="",
                maxlen=1024)
    
    
        photon_map_dir: StringProperty(
    
                name="Directory",
                description="",
                maxlen=1024, subtype="DIR_PATH")
    
    
        photon_map_file: StringProperty(
    
                name="File",
                description="",
                maxlen=1024, subtype="FILE_PATH")
    
        #########RADIOSITY########
    
        radio_adc_bailout: FloatProperty(
    
                description="The adc_bailout for radiosity rays. Use "
    
                            "adc_bailout = 0.01 / brightest_ambient_object for good results",
    
                min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default=0.0039, precision=4)
    
        radio_always_sample: BoolProperty(
    
                description="Only use the data from the pretrace step and not gather "
    
                            "any new samples during the final radiosity pass",
    
        radio_brightness: FloatProperty(
    
                description="Amount objects are brightened before being returned "
    
                min=0.0, max=1000.0, soft_min=0.0, soft_max=10.0, default=1.0)
    
    
        radio_count: IntProperty(
    
                description="Number of rays for each new radiosity value to be calculated "
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                min=1, max=10000, soft_max=1600, default=35)
    
        radio_error_bound: FloatProperty(
    
                description="One of the two main speed/quality tuning values, "
    
                min=0.0, max=1000.0, soft_min=0.1, soft_max=10.0, default=1.8)
    
    
        radio_gray_threshold: FloatProperty(
    
                description="One of the two main speed/quality tuning values, "
    
                min=0.0, max=1.0, soft_min=0, soft_max=1, default=0.0)
    
    
        radio_low_error_factor: FloatProperty(
    
                description="Just enough samples is slightly blotchy. Low error changes error "
    
                            "tolerance for less critical last refining pass",
    
                min=0.000001, max=1.0, soft_min=0.000001, soft_max=1.0, default=0.5)
    
        radio_media: BoolProperty(
    
                name="Media", description="Radiosity estimation can be affected by media",
    
        radio_subsurface: BoolProperty(
    
                name="Subsurface", description="Radiosity estimation can be affected by Subsurface Light Transport",
                default=False)
    
    
        radio_minimum_reuse: FloatProperty(
    
                description="Fraction of the screen width which sets the minimum radius of reuse "
    
                            "for each sample point (At values higher than 2% expect errors)",
    
                min=0.0, max=1.0, soft_min=0.1, soft_max=0.1, default=0.015, precision=3)
    
        radio_maximum_reuse: FloatProperty(
    
                name="Maximum Reuse",
                description="The maximum reuse parameter works in conjunction with, and is similar to that of minimum reuse, "
    
                            "the only difference being that it is an upper bound rather than a lower one",
    
        radio_nearest_count: IntProperty(
    
                description="Number of old ambient values blended together to "
    
                min=1, max=20, default=5)
    
    
        radio_normal: BoolProperty(
    
                name="Normals", description="Radiosity estimation can be affected by normals",
                default=False)
    
    
        radio_recursion_limit: IntProperty(
    
                description="how many recursion levels are used to calculate "
    
                min=1, max=20, default=1)
    
    Luca Bonavita's avatar
    Luca Bonavita committed
    
    
        radio_pretrace_start: FloatProperty(
    
                description="Fraction of the screen width which sets the size of the "
    
                            "blocks in the mosaic preview first pass",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                min=0.01, max=1.00, soft_min=0.02, soft_max=1.0, default=0.08)
    
    
        radio_pretrace_end: FloatProperty(
    
                description="Fraction of the screen width which sets the size of the blocks "
    
                min=0.000925, max=1.00, soft_min=0.01, soft_max=1.00, default=0.04, precision=3)
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
    
    ###############################################################################
    # Material POV properties.
    ###############################################################################
    
    class RenderPovSettingsMaterial(PropertyGroup):
    
    ######################Begin Old Blender Internal Props#########################
    
        use_transparency: BoolProperty(
                name="Transparency", description="Render material as transparent",
                default=False)
    
        alpha: FloatProperty(
                name="Alpha",
                description="Alpha transparency of the material",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=1.0, precision=3)
                
        ambient: FloatProperty(
                name="Ambient",
                description="Amount of global ambient color the material receives",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=1.0, precision=3)
    
        diffuse_color: FloatVectorProperty(
                name="Diffuse color",
                description=("Diffuse color of the material"),
                precision=4, step=0.01, min=0, #max=inf, soft_max=1,
                default=(0.6,0.6,0.6), options={'ANIMATABLE'}, subtype='COLOR')
    
        darkness: FloatProperty(
                name="Darkness",
                description="Minnaert darkness",
                min=0.0, max=2.0, soft_min=0.0, soft_max=2.0, default=1.0, precision=3)
                
        diffuse_fresnel: FloatProperty(
                name="Diffuse fresnel",
                description="Power of Fresnel",
                min=0.0, max=5.0, soft_min=0.0, soft_max=5.0, default=1.0, precision=3)
                
        diffuse_fresnel_factor: FloatProperty(
                name="Diffuse fresnel factor",
                description="Blending factor of Fresnel",
                min=0.0, max=5.0, soft_min=0.0, soft_max=5.0, default=0.5, precision=3)
    
        diffuse_intensity: FloatProperty(
                name="Diffuse intensity",
                description="Amount of diffuse reflection multiplying color",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.8, precision=3)
                
        diffuse_ramp_blend: EnumProperty(
                name="Diffuse ramp blend",
                description="Blending method of the ramp and the diffuse color",   
                items=(("MIX", "Mix", ""),
                       ("ADD", "Add", ""),
                       ("MULTIPLY", "Multiply", ""),
                       ("SUBTRACT", "Subtract", ""),
                       ("SCREEN", "Screen", ""),
                       ("DIVIDE", "Divide", ""),
                       ("DIFFERENCE", "Difference", ""),
                       ("DARKEN", "Darken", ""),
                       ("LIGHTEN", "Lighten", ""),
                       ("OVERLAY", "Overlay", ""),
                       ("DODGE", "Dodge", ""),
                       ("BURN", "Burn", ""),
                       ("HUE", "Hue", ""),
                       ("SATURATION", "Saturation", ""),
                       ("VALUE", "Value", ""),
                       ("COLOR", "Color", ""),
                       ("SOFT_LIGHT", "Soft light", ""),
                       ("LINEAR_LIGHT", "Linear light", "")),
                default="MIX")
    
        diffuse_ramp_factor: FloatProperty(
                name="Factor",
                description="Blending factor (also uses alpha in Colorband)",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=1.0, precision=3)
                
        diffuse_ramp_input: EnumProperty(
                name="Input",
                description="How the ramp maps on the surface",   
                items=(("SHADER", "Shader", ""),
                       ("ENERGY", "Energy", ""),
                       ("NORMAL", "Normal", ""),
                       ("RESULT", "Result", "")),
                default="SHADER")
                
        diffuse_shader: EnumProperty(
                name="Diffuse Shader Model",
                description="How the ramp maps on the surface",   
                items=(("LAMBERT", "Lambert", "Use a Lambertian shader"),
                       ("OREN_NAYAR", "Oren-Nayar", "Use an Oren-Nayar shader"),
                       ("MINNAERT", "Minnaert", "Use a Minnaert shader"),
                       ("FRESNEL", "Fresnel", "Use a Fresnel shader")),
                default="LAMBERT")
    
        diffuse_toon_size: FloatProperty(
                name="Size",
                description="Size of diffuse toon area",
                min=0.0, max=3.14, soft_min=0.0, soft_max=3.14, default=0.5, precision=3)
                
        diffuse_toon_smooth: FloatProperty(
                name="Smooth",
                description="Smoothness of diffuse toon area",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.1, precision=3)
    
        emit: FloatProperty(
                name="Emit",
                description="Amount of light to emit",
                min=0.0, soft_min=0.0, #max=inf, soft_max=inf,
                default=0.0, precision=3)
    
        mirror_color: FloatVectorProperty(
                name="Mirror color",
                description=("Mirror color of the material"),
                precision=4, step=0.01, min=0, #max=inf, soft_max=1,
                default=(0.6,0.6,0.6), options={'ANIMATABLE'}, subtype='COLOR')
                
        roughness: FloatProperty(
                name="Roughness",
                description="Oren-Nayar Roughness",
                min=0.0, max=3.14, soft_min=0.0, soft_max=3.14, default=0.5, precision=3)
    
        halo: BoolProperty(
                name="Halo", description=" Halo settings for the material",
                default=False)
                #(was readonly in Blender2.79, never None)
                
        line_color: FloatVectorProperty(
                name="Line color",
                description=("Line color used for Freestyle line rendering"),
                precision=4, step=0.01, min=0, #max=inf, soft_max=1,
                default=(0.0,0.0,0.0), options={'ANIMATABLE'}, subtype='COLOR')
    
        #diffuse_ramp:
        ##Color ramp used to affect diffuse shading
                ##Type:	ColorRamp, (readonly)    
        
                #cr_node = bpy.data.materials['Material'].node_tree.nodes['ColorRamp']
                #layout.template_color_ramp(cr_node, "color_ramp", expand=True)
                
                #ou
                
                #class bpy.types.ColorRamp(bpy_struct)            
    
        line_priority: IntProperty(
                name="Recursion Limit",
                description="The line color of a higher priority is used at material boundaries",
                min=0, max=32767, default=0)
                
        specular_color: FloatVectorProperty(
                name="Specular color",
                description=("Specular color of the material "),
                precision=4, step=0.01, min=0, #max=inf, soft_max=1,
                default=(1.0,1.0,1.0), options={'ANIMATABLE'}, subtype='COLOR')
    
        specular_hardness: IntProperty(
                name="Hardness",
                description="How hard (sharp) the specular reflection is",
                min=1, max=511, default=50)
                
        specular_intensity: FloatProperty(
                name="Intensity",
                description="How intense (bright) the specular reflection is",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.5, precision=3)
    
        # specular_ior: FloatProperty(
                # name="IOR",
                # description="Specular index of refraction",
                # min=-10.0, max=10.0, soft_min=0.0, soft_max=10.0, default=1.0, precision=3)
                
        # ior: FloatProperty(
                # name="IOR",
                # description="Index of refraction",
                # min=-10.0, max=10.0, soft_min=0.0, soft_max=10.0, default=1.0, precision=3)   
    
        specular_shader: EnumProperty(
                name="Specular Shader Model",
                description="How the ramp maps on the surface",   
                items=(("COOKTORR", "CookTorr", "Use a Cook-Torrance shader"),
                       ("PHONG", "Phong", "Use a Phong shader"),
                       ("BLINN", "Blinn", "Use a Blinn shader"),
                       ("TOON", "Toon", "Use a Toon shader"),
                       ("WARDISO", "WardIso", "Use a Ward anisotropic shader")),
                default="COOKTORR")           
    
        specular_slope: FloatProperty(
                name="Slope",
                description="The standard deviation of surface slope",
                min=0.0, max=0.4, soft_min=0.0, soft_max=0.4, default=0.1, precision=3)
    
        specular_toon_size: FloatProperty(
                name="Size",
                description="Size of specular toon area",
                min=0.0, max=0.53, soft_min=0.0, soft_max=0.53, default=0.5, precision=3)
    
        specular_toon_smooth: FloatProperty(
                name="Smooth",
                description="Smoothness of specular toon area",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.1, precision=3)
                
                
        translucency: FloatProperty(
                name="Translucency",
                description="Amount of diffuse shading on the back side",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.0, precision=3)
                
        transparency_method: EnumProperty(
                name="Specular Shader Model",
                description="Method to use for rendering transparency",   
                items=(("MASK", "Mask", "Mask the background"),
                       ("Z_TRANSPARENCY", "Z Transparency", "Use alpha buffer for transparent faces"),#TO DEPRECATE
                       ("RAYTRACE", "Raytrace", "Use raytracing for transparent refraction rendering")),
                default="MASK")
                
        type: EnumProperty(
                name="Type",
                description="Material type defining how the object is rendered",   
                items=(("SURFACE", "Surface", "Render object as a surface"),
                       ("WIRE", "Wire", "Render the edges of faces as wires (not supported in raytracing)"),#TO UPDATE > USE MACRO AND CHNGE DESCRIPTION
                       ("VOLUME", "Volume", "Render object as a volume"),
                       ("‘HALO’", "Halo", "Render object as halo particles")), #TO UPDATE > USE MACRO AND CHNGE DESCRIPTION
                default="SURFACE")
                
        use_cast_shadows: BoolProperty(
                name="Cast", description="Allow this material to cast shadows",
                default=True)
                
        use_cast_shadows_only: BoolProperty(
                name="Cast Only", description="Make objects with this material "
                                              "appear invisible (not rendered), only "
                                              "casting shadows",
                default=False)
                
        use_cubic: BoolProperty(
                name="Cubic Interpolation", description="Use cubic interpolation for diffuse "
                                                        "values, for smoother transitions",
                default=False)
    
        use_diffuse_ramp: BoolProperty(
                name="Ramp", description="Toggle diffuse ramp operations",
                default=False)
                
        use_light_group_exclusive: BoolProperty(
                name="Exclusive", description="Material uses the light group exclusively"
                                              "- these lamps are excluded from other "
                                              "scene lighting",
                default=False)
                
        use_light_group_local: BoolProperty(
                name="Local", description="When linked in, material uses local light"
                                          " group with the same name",
                default=False)
                
        use_mist: BoolProperty(
                name="Use Mist", description="Use mist with this material "
                                          "(in world settings)",
                default=True)
                
        use_nodes: BoolProperty(
                name="Nodes", description="Use shader nodes to render the material",#Add Icon in UI or here? icon='NODES'
                default=False)
                
        use_object_color: BoolProperty(
                name="Object Color", description="Modulate the result with a per-object color",
                default=False)
                
        use_only_shadow: BoolProperty(
                name="Shadows Only", description="Render shadows as the material’s alpha "
                                                 "value, making the material transparent "
                                                 "except for shadowed areas",
                default=False)
                
        use_shadeless: BoolProperty(
                name="Shadeless", description="Make this material insensitive to "
                                              "light or shadow",
                default=False)
                
        use_shadows: BoolProperty(
                name="Receive", description="Allow this material to receive shadows",
                default=True)
    
        use_sky: BoolProperty(
                name="Sky", description="Render this material with zero alpha, "
                                            "with sky background in place (scanline only)",
                default=False)
                
        use_specular_ramp: BoolProperty(
                name="Ramp", description="Toggle specular ramp operations",
                default=False)
                
        use_tangent_shading: BoolProperty(
                name="Tangent Shading", description="Use the material’s tangent vector instead"
                                         "of the normal for shading - for "
                                         "anisotropic shading effects",
                default=False)
                
        use_transparent_shadows: BoolProperty(
                name="Receive Transparent", description="Allow this object to receive transparent "
                                                        "shadows cast through other object",
                default=False) #linked to fake caustics
                
        use_vertex_color_light: BoolProperty(
                name="Vertex Color Light", description="Add vertex colors as additional lighting",
                default=False)
                
        use_vertex_color_paint: BoolProperty(
                name="Vertex Color Paint", description="Replace object base color with vertex "
                                                       "colors (multiply with ‘texture face’ "
                                                       "face assigned textures)",
                default=False)
    
        
        specular_ramp_blend: EnumProperty(
                name="Specular ramp blend",
                description="Blending method of the ramp and the specular color",   
                items=(("MIX", "Mix", ""),
                       ("ADD", "Add", ""),
                       ("MULTIPLY", "Multiply", ""),
                       ("SUBTRACT", "Subtract", ""),
                       ("SCREEN", "Screen", ""),
                       ("DIVIDE", "Divide", ""),
                       ("DIFFERENCE", "Difference", ""),
                       ("DARKEN", "Darken", ""),
                       ("LIGHTEN", "Lighten", ""),
                       ("OVERLAY", "Overlay", ""),
                       ("DODGE", "Dodge", ""),
                       ("BURN", "Burn", ""),
                       ("HUE", "Hue", ""),
                       ("SATURATION", "Saturation", ""),
                       ("VALUE", "Value", ""),
                       ("COLOR", "Color", ""),
                       ("SOFT_LIGHT", "Soft light", ""),
                       ("LINEAR_LIGHT", "Linear light", "")),
                default="MIX")
    
        specular_ramp_factor: FloatProperty(
                name="Factor",
                description="Blending factor (also uses alpha in Colorband)",
                min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=1.0, precision=3)
                
        specular_ramp_input: EnumProperty(
                name="Input",
                description="How the ramp maps on the surface",   
                items=(("SHADER", "Shader", ""),
                       ("ENERGY", "Energy", ""),
                       ("NORMAL", "Normal", ""),
                       ("RESULT", "Result", "")),
                default="SHADER")            
    
    
    
        irid_enable: BoolProperty(
    
                description="Newton's thin film interference (like an oil slick on a puddle of "
    
                            "water or the rainbow hues of a soap bubble.)",
    
        mirror_use_IOR: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Correct Reflection",
    
                description="Use same IOR as raytrace transparency to calculate mirror reflections. "
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                default=False)
    
    
        mirror_metallic: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Metallic Reflection",
                description="mirror reflections get colored as diffuse (for metallic materials)",
                default=False)
    
    
        conserve_energy: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Conserve Energy",
    
                description="Light transmitted is more correctly reduced by mirror reflections, "
    
                            "also the sum of diffuse and translucency gets reduced below one ",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                default=True)
    
    
        irid_amount: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="amount",
    
                description="Contribution of the iridescence effect to the overall surface color. "
                            "As a rule of thumb keep to around 0.25 (25% contribution) or less, "
                            "but experiment. If the surface is coming out too white, try lowering "
    
                            "the diffuse and possibly the ambient values of the surface",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                min=0.0, max=1.0, soft_min=0.01, soft_max=1.0, default=0.25)
    
    
        irid_thickness: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="thickness",
    
                description="A very thin film will have a high frequency of color changes while a "
    
                            "thick film will have large areas of color",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                min=0.0, max=1000.0, soft_min=0.1, soft_max=10.0, default=1)
    
    
        irid_turbulence: FloatProperty(
    
                name="turbulence", description="This parameter varies the thickness",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                min=0.0, max=10.0, soft_min=0.000, soft_max=1.0, default=0)
    
    
        interior_fade_color: FloatVectorProperty(
    
                name="Interior Fade Color", description="Color of filtered attenuation for transparent "
    
                precision=4, step=0.01, min=0.0, soft_max=1.0,
                default=(0, 0, 0), options={'ANIMATABLE'}, subtype='COLOR')
    
    
        caustics_enable: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Caustics",
    
                description="use only fake refractive caustics (default) or photon based "
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                default=True)
    
    
        fake_caustics: BoolProperty(
    
                name="Fake Caustics", description="use only (Fast) fake refractive caustics",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                default=True)
    
    
        fake_caustics_power: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Fake caustics power",
    
                description="Values typically range from 0.0 to 1.0 or higher. Zero is no caustics. "
                            "Low, non-zero values give broad hot-spots while higher values give "
    
                            "tighter, smaller simulated focal points",
    
                min=0.00, max=10.0, soft_min=0.00, soft_max=5.0, default=0.07)
    
        refraction_caustics: BoolProperty(
    
                name="Refractive Caustics", description="hotspots of light focused when going through the material",
                default=True)
    
        photons_dispersion: FloatProperty(
    
                description="Light passing through will be separated according to wavelength. "
                            "This ratio of refractive indices for violet to red controls how much "
    
                            "the colors are spread out 1 = no dispersion, good values are 1.01 to 1.1",
    
                min=1.0000, max=10.000, soft_min=1.0000, soft_max=1.1000, precision=4, default=1.0000)
    
        photons_dispersion_samples: IntProperty(
    
                name="Dispersion Samples", description="Number of color-steps for dispersion",
                min=2, max=128, default=7)
    
    
        photons_reflection: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                name="Reflective Photon Caustics",
                description="Use this to make your Sauron's ring ;-P",
                default=False)
    
    
        refraction_type: EnumProperty(
    
                       ("1", "Fake Caustics", "use fake caustics"),
    
                       ("2", "Photons Caustics", "use photons for refractive caustics")],
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                description="use fake caustics (fast) or true photons for refractive Caustics",
    
        ##################################CustomPOV Code############################
    
        replacement_text: StringProperty(
    
                description="Type the declared name in custom POV code or an external "
    
        def use_material_nodes_callback(self, context):
            if hasattr(context.space_data, "tree_type"):
                context.space_data.tree_type = 'ObjectNodeTree'
            mat=context.object.active_material
            if mat.pov.material_use_nodes: