Skip to content
Snippets Groups Projects
__init__.py 183 KiB
Newer Older
  • Learn to ignore specific revisions
  • 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333
    
    
    
    
                col.prop(mat, "specular_color", text="")
                col.prop(mat, "specular_intensity", text="Intensity")
    
                col.prop(mat, "specular_shader", text="")
                col.prop(mat, "use_specular_ramp", text="Ramp")
    
                if mat.specular_shader in {'COOKTORR', 'PHONG'}:
                    col.prop(mat, "specular_hardness", text="Hardness")
                elif mat.specular_shader == 'BLINN':
    
                    row.prop(mat, "specular_hardness", text="Hardness")
                    row.prop(mat, "specular_ior", text="IOR")
                elif mat.specular_shader == 'WARDISO':
                    col.prop(mat, "specular_slope", text="Slope")
                elif mat.specular_shader == 'TOON':
    
                    row.prop(mat, "specular_toon_size", text="Size")
                    row.prop(mat, "specular_toon_smooth", text="Smooth")
    
                if mat.use_specular_ramp:
                    layout.separator()
                    layout.template_color_ramp(mat, "specular_ramp", expand=True)
                    layout.separator()
    
                    row = layout.row()
                    row.prop(mat, "specular_ramp_input", text="Input")
                    row.prop(mat, "specular_ramp_blend", text="Blend")
    
                    layout.prop(mat, "specular_ramp_factor", text="Factor")
    
    
        class MATERIAL_PT_shading(MaterialButtonsPanel, Panel):
            bl_label = "Shading"
            COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
    
            @classmethod
            def poll(cls, context):
                mat = context.material
                engine = context.scene.render.engine
                return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
    
            def draw(self, context):
                layout = self.layout
    
                mat = active_node_mat(context.material)
    
                if mat.type in {'SURFACE', 'WIRE'}:
                    split = layout.split()
    
                    col = split.column()
                    sub = col.column()
                    sub.active = not mat.use_shadeless
                    sub.prop(mat, "emit")
                    sub.prop(mat, "ambient")
                    sub = col.column()
                    sub.prop(mat, "translucency")
    
                    col = split.column()
                    col.prop(mat, "use_shadeless")
                    sub = col.column()
                    sub.active = not mat.use_shadeless
                    sub.prop(mat, "use_tangent_shading")
                    sub.prop(mat, "use_cubic")
    
    
        class MATERIAL_PT_transp(MaterialButtonsPanel, Panel):
            bl_label = "Transparency"
            COMPAT_ENGINES = {'BLENDER_RENDER'}
    
            @classmethod
            def poll(cls, context):
                mat = context.material
                engine = context.scene.render.engine
                return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
    
            def draw_header(self, context):
                mat = context.material
    
                if simple_material(mat):
                    self.layout.prop(mat, "use_transparency", text="")
    
            def draw(self, context):
                layout = self.layout
    
                base_mat = context.material
                mat = active_node_mat(context.material)
                rayt = mat.raytrace_transparency
    
                if simple_material(base_mat):
                    row = layout.row()
                    row.active = mat.use_transparency
                    row.prop(mat, "transparency_method", expand=True)
    
                split = layout.split()
                split.active = base_mat.use_transparency
    
                col = split.column()
                col.prop(mat, "alpha")
                row = col.row()
                row.active = (base_mat.transparency_method != 'MASK') and (not mat.use_shadeless)
                row.prop(mat, "specular_alpha", text="Specular")
    
                col = split.column()
                col.active = (not mat.use_shadeless)
                col.prop(rayt, "fresnel")
                sub = col.column()
                sub.active = (rayt.fresnel > 0.0)
                sub.prop(rayt, "fresnel_factor", text="Blend")
    
                if base_mat.transparency_method == 'RAYTRACE':
                    layout.separator()
                    split = layout.split()
                    split.active = base_mat.use_transparency
    
                    col = split.column()
                    col.prop(rayt, "ior")
                    col.prop(rayt, "filter")
                    col.prop(rayt, "falloff")
                    col.prop(rayt, "depth_max")
                    col.prop(rayt, "depth")
    
                    col = split.column()
                    col.label(text="Gloss:")
                    col.prop(rayt, "gloss_factor", text="Amount")
                    sub = col.column()
                    sub.active = rayt.gloss_factor < 1.0
                    sub.prop(rayt, "gloss_threshold", text="Threshold")
                    sub.prop(rayt, "gloss_samples", text="Samples")
    
    
        class MATERIAL_PT_mirror(MaterialButtonsPanel, Panel):
            bl_label = "Mirror"
            bl_options = {'DEFAULT_CLOSED'}
            COMPAT_ENGINES = {'BLENDER_RENDER'}
    
            @classmethod
            def poll(cls, context):
                mat = context.material
                engine = context.scene.render.engine
                return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
    
            def draw_header(self, context):
                raym = active_node_mat(context.material).raytrace_mirror
    
                self.layout.prop(raym, "use", text="")
    
            def draw(self, context):
                layout = self.layout
    
                mat = active_node_mat(context.material)
                raym = mat.raytrace_mirror
    
                layout.active = raym.use
    
                split = layout.split()
    
                col = split.column()
                col.prop(raym, "reflect_factor")
                col.prop(mat, "mirror_color", text="")
    
                col = split.column()
                col.prop(raym, "fresnel")
                sub = col.column()
                sub.active = (raym.fresnel > 0.0)
                sub.prop(raym, "fresnel_factor", text="Blend")
    
                split = layout.split()
    
                col = split.column()
                col.separator()
                col.prop(raym, "depth")
                col.prop(raym, "distance", text="Max Dist")
                col.separator()
                sub = col.split(percentage=0.4)
                sub.active = (raym.distance > 0.0)
                sub.label(text="Fade To:")
                sub.prop(raym, "fade_to", text="")
    
                col = split.column()
                col.label(text="Gloss:")
                col.prop(raym, "gloss_factor", text="Amount")
                sub = col.column()
                sub.active = (raym.gloss_factor < 1.0)
                sub.prop(raym, "gloss_threshold", text="Threshold")
                sub.prop(raym, "gloss_samples", text="Samples")
                sub.prop(raym, "gloss_anisotropic", text="Anisotropic")
    
    
        class MATERIAL_PT_sss(MaterialButtonsPanel, Panel):
            bl_label = "Subsurface Scattering"
            bl_options = {'DEFAULT_CLOSED'}
            COMPAT_ENGINES = {'BLENDER_RENDER'}
    
            @classmethod
            def poll(cls, context):
                mat = context.material
                engine = context.scene.render.engine
                return check_material(mat) and (mat.type in {'SURFACE', 'WIRE'}) and (engine in cls.COMPAT_ENGINES)
    
            def draw_header(self, context):
                mat = active_node_mat(context.material)
                sss = mat.subsurface_scattering
    
                self.layout.active = (not mat.use_shadeless)
                self.layout.prop(sss, "use", text="")
    
            def draw(self, context):
                layout = self.layout
    
                mat = active_node_mat(context.material)
                sss = mat.subsurface_scattering
    
                layout.active = (sss.use) and (not mat.use_shadeless)
    
                row = layout.row().split()
                sub = row.row(align=True).split(align=True, percentage=0.75)
                sub.menu("MATERIAL_MT_sss_presets", text=bpy.types.MATERIAL_MT_sss_presets.bl_label)
                sub.operator("material.sss_preset_add", text="", icon='ZOOMIN')
                sub.operator("material.sss_preset_add", text="", icon='ZOOMOUT').remove_active = True
    
                split = layout.split()
    
                col = split.column()
                col.prop(sss, "ior")
                col.prop(sss, "scale")
                col.prop(sss, "color", text="")
                col.prop(sss, "radius", text="RGB Radius", expand=True)
    
                col = split.column()
                sub = col.column(align=True)
                sub.label(text="Blend:")
                sub.prop(sss, "color_factor", text="Color")
                sub.prop(sss, "texture_factor", text="Texture")
                sub.label(text="Scattering Weight:")
                sub.prop(sss, "front")
                sub.prop(sss, "back")
                col.separator()
                col.prop(sss, "error_threshold", text="Error")
    
    
        class MATERIAL_PT_halo(MaterialButtonsPanel, Panel):
            bl_label = "Halo"
            COMPAT_ENGINES = {'BLENDER_RENDER'}
    
            @classmethod
            def poll(cls, context):
                mat = context.material
                engine = context.scene.render.engine
                return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
    
            def draw(self, context):
                layout = self.layout
    
                mat = context.material  # don't use node material
                halo = mat.halo
    
                def number_but(layout, toggle, number, name, color):
                    row = layout.row(align=True)
                    row.prop(halo, toggle, text="")
                    sub = row.column(align=True)
                    sub.active = getattr(halo, toggle)
                    sub.prop(halo, number, text=name, translate=False)
                    if not color == "":
                        sub.prop(mat, color, text="")
    
                split = layout.split()
    
                col = split.column()
                col.prop(mat, "alpha")
                col.prop(mat, "diffuse_color", text="")
                col.prop(halo, "seed")
    
                col = split.column()
                col.prop(halo, "size")
                col.prop(halo, "hardness")
                col.prop(halo, "add")
    
                layout.label(text="Options:")
    
                split = layout.split()
                col = split.column()
                col.prop(halo, "use_texture")
                col.prop(halo, "use_vertex_normal")
                col.prop(halo, "use_extreme_alpha")
                col.prop(halo, "use_shaded")
                col.prop(halo, "use_soft")
    
                col = split.column()
                number_but(col, "use_ring", "ring_count", iface_("Rings"), "mirror_color")
                number_but(col, "use_lines", "line_count", iface_("Lines"), "specular_color")
                number_but(col, "use_star", "star_tip_count", iface_("Star Tips"), "")
    
    
        class MATERIAL_PT_flare(MaterialButtonsPanel, Panel):
            bl_label = "Flare"
            COMPAT_ENGINES = {'BLENDER_RENDER'}
    
            @classmethod
            def poll(cls, context):
                mat = context.material
                engine = context.scene.render.engine
                return mat and (mat.type == 'HALO') and (engine in cls.COMPAT_ENGINES)
    
            def draw_header(self, context):
                halo = context.material.halo
    
                self.layout.prop(halo, "use_flare_mode", text="")
    
            def draw(self, context):
                layout = self.layout
    
                mat = context.material  # don't use node material
                halo = mat.halo
    
                layout.active = halo.use_flare_mode
    
                split = layout.split()
    
                col = split.column()
                col.prop(halo, "flare_size", text="Size")
                col.prop(halo, "flare_boost", text="Boost")
                col.prop(halo, "flare_seed", text="Seed")
    
                col = split.column()
                col.prop(halo, "flare_subflare_count", text="Subflares")
                col.prop(halo, "flare_subflare_size", text="Subsize")
    
        '''
    #######################End Old Blender Internal Props##########################
    
    ###############################################################################
    # Povray Nodes
    
    ###############################################################################
    
    class PovraySocketUniversal(NodeSocket):
    
        bl_idname = 'PovraySocketUniversal'
        bl_label = 'Povray Socket'
    
        value_unlimited: bpy.props.FloatProperty(default=0.0)
        value_0_1: bpy.props.FloatProperty(min=0.0,max=1.0,default=0.0)
        value_0_10: bpy.props.FloatProperty(min=0.0,max=10.0,default=0.0)
        value_000001_10: bpy.props.FloatProperty(min=0.000001,max=10.0,default=0.0)
        value_1_9: bpy.props.IntProperty(min=1,max=9,default=1)
        value_0_255: bpy.props.IntProperty(min=0,max=255,default=0)
        percent: bpy.props.FloatProperty(min=0.0,max=100.0,default=0.0)
    
        def draw(self, context, layout, node, text):
            space = context.space_data
            tree = space.edit_tree
            links=tree.links
            if self.is_linked:
                value=[]
                for link in links:
                    if link.from_node==node:
                        inps=link.to_node.inputs
    
                        for inp in inps:
    
                            if inp.bl_idname=="PovraySocketFloat_0_1" and inp.is_linked:
                                prop="value_0_1"
                                if prop not in value:
                                    value.append(prop)
                            if inp.bl_idname=="PovraySocketFloat_000001_10" and inp.is_linked:
                                prop="value_000001_10"
                                if prop not in value:
                                    value.append(prop)
                            if inp.bl_idname=="PovraySocketFloat_0_10" and inp.is_linked:
                                prop="value_0_10"
                                if prop not in value:
                                    value.append(prop)
                            if inp.bl_idname=="PovraySocketInt_1_9" and inp.is_linked:
                                prop="value_1_9"
                                if prop not in value:
                                    value.append(prop)
                            if inp.bl_idname=="PovraySocketInt_0_255" and inp.is_linked:
                                prop="value_0_255"
                                if prop not in value:
                                    value.append(prop)
                            if inp.bl_idname=="PovraySocketFloatUnlimited" and inp.is_linked:
                                prop="value_unlimited"
                                if prop not in value:
                                    value.append(prop)
                if len(value)==1:
                    layout.prop(self, "%s"%value[0], text=text)
                else:
                    layout.prop(self, "percent", text="Percent")
            else:
                layout.prop(self, "percent", text=text)
        def draw_color(self, context, node):
            return (1, 0, 0, 1)
    
    
    class PovraySocketFloat_0_1(NodeSocket):
    
        bl_idname = 'PovraySocketFloat_0_1'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.FloatProperty(description="Input node Value_0_1",min=0,max=1,default=0)
    
        def draw(self, context, layout, node, text):
            if self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text, slider=True)
    
        def draw_color(self, context, node):
            return (0.5, 0.7, 0.7, 1)
    
    
    class PovraySocketFloat_0_10(NodeSocket):
    
        bl_idname = 'PovraySocketFloat_0_10'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.FloatProperty(description="Input node Value_0_10",min=0,max=10,default=0)
    
        def draw(self, context, layout, node, text):
            if node.bl_idname == 'ShaderNormalMapNode' and node.inputs[2].is_linked:
    
                layout.label(text='')
    
                self.hide_value=True
            if self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text, slider=True)
        def draw_color(self, context, node):
            return (0.65, 0.65, 0.65, 1)
    
    
    class PovraySocketFloat_10(NodeSocket):
    
        bl_idname = 'PovraySocketFloat_10'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.FloatProperty(description="Input node Value_10",min=-10,max=10,default=0)
    
        def draw(self, context, layout, node, text):
            if node.bl_idname == 'ShaderNormalMapNode' and node.inputs[2].is_linked:
    
                layout.label(text='')
    
                self.hide_value=True
            if self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text, slider=True)
        def draw_color(self, context, node):
            return (0.65, 0.65, 0.65, 1)
    
    
    class PovraySocketFloatPositive(NodeSocket):
    
        bl_idname = 'PovraySocketFloatPositive'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.FloatProperty(description="Input Node Value Positive", min=0.0, default=0)
    
        def draw(self, context, layout, node, text):
            if self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text, slider=True)
        def draw_color(self, context, node):
            return (0.045, 0.005, 0.136, 1)
    
    
    class PovraySocketFloat_000001_10(NodeSocket):
    
        bl_idname = 'PovraySocketFloat_000001_10'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.FloatProperty(min=0.000001,max=10,default=0.000001)
    
        def draw(self, context, layout, node, text):
            if self.is_output or self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text, slider=True)
        def draw_color(self, context, node):
            return (1, 0, 0, 1)
    
    
    class PovraySocketFloatUnlimited(NodeSocket):
    
        bl_idname = 'PovraySocketFloatUnlimited'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.FloatProperty(default = 0.0)
    
        def draw(self, context, layout, node, text):
            if self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text, slider=True)
        def draw_color(self, context, node):
            return (0.7, 0.7, 1, 1)
    
    
    class PovraySocketInt_1_9(NodeSocket):
    
        bl_idname = 'PovraySocketInt_1_9'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.IntProperty(description="Input node Value_1_9",min=1,max=9,default=6)
    
        def draw(self, context, layout, node, text):
            if self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text)
        def draw_color(self, context, node):
            return (1, 0.7, 0.7, 1)
    
    
    class PovraySocketInt_0_256(NodeSocket):
    
        bl_idname = 'PovraySocketInt_0_256'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.IntProperty(min=0,max=255,default=0)
    
        def draw(self, context, layout, node, text):
            if self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text)
        def draw_color(self, context, node):
            return (0.5, 0.5, 0.5, 1)
    
    
    
    class PovraySocketPattern(NodeSocket):
    
        bl_idname = 'PovraySocketPattern'
        bl_label = 'Povray Socket'
    
    
        default_value: bpy.props.EnumProperty(
    
                name="Pattern",
                description="Select the pattern",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
                items=(
                    ('boxed', "Boxed", ""),
                    ('brick', "Brick", ""),
                    ('cells', "Cells", ""),
                    ('checker', "Checker", ""),
                    ('granite', "Granite", ""),
                    ('leopard', "Leopard", ""),
                    ('marble', "Marble", ""),
                    ('onion', "Onion", ""),
                    ('planar', "Planar", ""),
                    ('quilted', "Quilted", ""),
                    ('ripples', "Ripples", ""),
                    ('radial', "Radial", ""),
                    ('spherical', "Spherical", ""),
                    ('spotted', "Spotted", ""),
                    ('waves', "Waves", ""),
                    ('wood', "Wood", ""),
                    ('wrinkles', "Wrinkles", "")
                ),
    
                default='granite')
    
        def draw(self, context, layout, node, text):
            if self.is_output or self.is_linked:
    
                layout.label(text="Pattern")
    
            else:
                layout.prop(self, "default_value", text=text)
    
        def draw_color(self, context, node):
            return (1, 1, 1, 1)
    
    
    class PovraySocketColor(NodeSocket):
    
        bl_idname = 'PovraySocketColor'
        bl_label = 'Povray Socket'
    
    
        default_value: bpy.props.FloatVectorProperty(
    
                precision=4, step=0.01, min=0, soft_max=1,
                default=(0.0, 0.0, 0.0), options={'ANIMATABLE'}, subtype='COLOR')
    
        def draw(self, context, layout, node, text):
            if self.is_output or self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text)
    
        def draw_color(self, context, node):
            return (1, 1, 0, 1)
    
    
    class PovraySocketColorRGBFT(NodeSocket):
    
        bl_idname = 'PovraySocketColorRGBFT'
        bl_label = 'Povray Socket'
    
    
        default_value: bpy.props.FloatVectorProperty(
    
                precision=4, step=0.01, min=0, soft_max=1,
                default=(0.0, 0.0, 0.0), options={'ANIMATABLE'}, subtype='COLOR')
    
        f: bpy.props.FloatProperty(default = 0.0,min=0.0,max=1.0)
        t: bpy.props.FloatProperty(default = 0.0,min=0.0,max=1.0)
    
        def draw(self, context, layout, node, text):
            if self.is_output or self.is_linked:
                layout.label(text)
            else:
                layout.prop(self, "default_value", text=text)
    
        def draw_color(self, context, node):
            return (1, 1, 0, 1)
    
    
    class PovraySocketTexture(NodeSocket):
    
        bl_idname = 'PovraySocketTexture'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.IntProperty()
    
        def draw(self, context, layout, node, text):
            layout.label(text)
    
        def draw_color(self, context, node):
            return (0, 1, 0, 1)
    
    
    
    
    class PovraySocketTransform(NodeSocket):
    
        bl_idname = 'PovraySocketTransform'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.IntProperty(min=0,max=255,default=0)
    
        def draw(self, context, layout, node, text):
            layout.label(text)
    
        def draw_color(self, context, node):
            return (99/255, 99/255, 199/255, 1)
    
    
    class PovraySocketNormal(NodeSocket):
    
        bl_idname = 'PovraySocketNormal'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.IntProperty(min=0,max=255,default=0)
    
        def draw(self, context, layout, node, text):
            layout.label(text)
    
        def draw_color(self, context, node):
            return (0.65, 0.65, 0.65, 1)
    
    
    class PovraySocketSlope(NodeSocket):
    
        bl_idname = 'PovraySocketSlope'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.FloatProperty(min = 0.0, max = 1.0)
        height: bpy.props.FloatProperty(min = 0.0, max = 10.0)
        slope: bpy.props.FloatProperty(min = -10.0, max = 10.0)
    
        def draw(self, context, layout, node, text):
            if self.is_output or self.is_linked:
                layout.label(text)
            else:
                layout.prop(self,'default_value',text='')
                layout.prop(self,'height',text='')
                layout.prop(self,'slope',text='')
        def draw_color(self, context, node):
            return (0, 0, 0, 1)
    
    
    class PovraySocketMap(NodeSocket):
    
        bl_idname = 'PovraySocketMap'
        bl_label = 'Povray Socket'
    
        default_value: bpy.props.StringProperty()
    
        def draw(self, context, layout, node, text):
            layout.label(text)
        def draw_color(self, context, node):
            return (0.2, 0, 0.2, 1)
    
    class PovrayShaderNodeCategory(NodeCategory):
        @classmethod
        def poll(cls, context):
            return context.space_data.tree_type == 'ObjectNodeTree'
    
    class PovrayTextureNodeCategory(NodeCategory):
        @classmethod
        def poll(cls, context):
            return context.space_data.tree_type == 'TextureNodeTree'
    
    class PovraySceneNodeCategory(NodeCategory):
        @classmethod
        def poll(cls, context):
            return context.space_data.tree_type == 'CompositorNodeTree'
    
    node_categories = [
    
        PovrayShaderNodeCategory("SHADEROUTPUT", "Output", items=[
            NodeItem("PovrayOutputNode"),
            ]),
    
        PovrayShaderNodeCategory("SIMPLE", "Simple texture", items=[
            NodeItem("PovrayTextureNode"),
            ]),
    
        PovrayShaderNodeCategory("MAPS", "Maps", items=[
            NodeItem("PovrayBumpMapNode"),
            NodeItem("PovrayColorImageNode"),
            NodeItem("ShaderNormalMapNode"),
            NodeItem("PovraySlopeNode"),
            NodeItem("ShaderTextureMapNode"),
            NodeItem("ShaderNodeValToRGB"),
            ]),
    
        PovrayShaderNodeCategory("OTHER", "Other patterns", items=[
            NodeItem("PovrayImagePatternNode"),
            NodeItem("ShaderPatternNode"),
            ]),
    
        PovrayShaderNodeCategory("COLOR", "Color", items=[
            NodeItem("PovrayPigmentNode"),
            ]),
    
        PovrayShaderNodeCategory("TRANSFORM", "Transform", items=[
            NodeItem("PovrayMappingNode"),
            NodeItem("PovrayMultiplyNode"),
            NodeItem("PovrayModifierNode"),
            NodeItem("PovrayTransformNode"),
            NodeItem("PovrayValueNode"),
            ]),
    
        PovrayShaderNodeCategory("FINISH", "Finish", items=[
            NodeItem("PovrayFinishNode"),
            NodeItem("PovrayDiffuseNode"),
            NodeItem("PovraySpecularNode"),
            NodeItem("PovrayPhongNode"),
            NodeItem("PovrayAmbientNode"),
            NodeItem("PovrayMirrorNode"),
            NodeItem("PovrayIridescenceNode"),
            NodeItem("PovraySubsurfaceNode"),
    
    
        PovrayShaderNodeCategory("CYCLES", "Cycles", items=[
            NodeItem("ShaderNodeAddShader"),
            NodeItem("ShaderNodeAmbientOcclusion"),
            NodeItem("ShaderNodeAttribute"),
            NodeItem("ShaderNodeBackground"),
            NodeItem("ShaderNodeBlackbody"),
            NodeItem("ShaderNodeBrightContrast"),
            NodeItem("ShaderNodeBsdfAnisotropic"),
            NodeItem("ShaderNodeBsdfDiffuse"),
            NodeItem("ShaderNodeBsdfGlass"),
            NodeItem("ShaderNodeBsdfGlossy"),
            NodeItem("ShaderNodeBsdfHair"),
            NodeItem("ShaderNodeBsdfRefraction"),
            NodeItem("ShaderNodeBsdfToon"),
            NodeItem("ShaderNodeBsdfTranslucent"),
            NodeItem("ShaderNodeBsdfTransparent"),
            NodeItem("ShaderNodeBsdfVelvet"),
            NodeItem("ShaderNodeBump"),
            NodeItem("ShaderNodeCameraData"),
            NodeItem("ShaderNodeCombineHSV"),
            NodeItem("ShaderNodeCombineRGB"),
            NodeItem("ShaderNodeCombineXYZ"),
            NodeItem("ShaderNodeEmission"),
            NodeItem("ShaderNodeExtendedMaterial"),
            NodeItem("ShaderNodeFresnel"),
            NodeItem("ShaderNodeGamma"),
            NodeItem("ShaderNodeGeometry"),
            NodeItem("ShaderNodeGroup"),
            NodeItem("ShaderNodeHairInfo"),
            NodeItem("ShaderNodeHoldout"),
            NodeItem("ShaderNodeHueSaturation"),
            NodeItem("ShaderNodeInvert"),
            NodeItem("ShaderNodeLampData"),
            NodeItem("ShaderNodeLayerWeight"),
            NodeItem("ShaderNodeLightFalloff"),
            NodeItem("ShaderNodeLightPath"),
            NodeItem("ShaderNodeMapping"),
            NodeItem("ShaderNodeMaterial"),
            NodeItem("ShaderNodeMath"),
            NodeItem("ShaderNodeMixRGB"),
            NodeItem("ShaderNodeMixShader"),
            NodeItem("ShaderNodeNewGeometry"),
            NodeItem("ShaderNodeNormal"),
            NodeItem("ShaderNodeNormalMap"),
            NodeItem("ShaderNodeObjectInfo"),
            NodeItem("ShaderNodeOutput"),
            NodeItem("ShaderNodeOutputLamp"),
            NodeItem("ShaderNodeOutputLineStyle"),
            NodeItem("ShaderNodeOutputMaterial"),
            NodeItem("ShaderNodeOutputWorld"),
            NodeItem("ShaderNodeParticleInfo"),
            NodeItem("ShaderNodeRGB"),
            NodeItem("ShaderNodeRGBCurve"),
            NodeItem("ShaderNodeRGBToBW"),
            NodeItem("ShaderNodeScript"),
            NodeItem("ShaderNodeSeparateHSV"),
            NodeItem("ShaderNodeSeparateRGB"),
            NodeItem("ShaderNodeSeparateXYZ"),
            NodeItem("ShaderNodeSqueeze"),
            NodeItem("ShaderNodeSubsurfaceScattering"),
            NodeItem("ShaderNodeTangent"),
            NodeItem("ShaderNodeTexBrick"),
            NodeItem("ShaderNodeTexChecker"),
            NodeItem("ShaderNodeTexCoord"),
            NodeItem("ShaderNodeTexEnvironment"),
            NodeItem("ShaderNodeTexGradient"),
            NodeItem("ShaderNodeTexImage"),
            NodeItem("ShaderNodeTexMagic"),
            NodeItem("ShaderNodeTexMusgrave"),
            NodeItem("ShaderNodeTexNoise"),
            NodeItem("ShaderNodeTexPointDensity"),
            NodeItem("ShaderNodeTexSky"),
            NodeItem("ShaderNodeTexVoronoi"),
            NodeItem("ShaderNodeTexWave"),
            NodeItem("ShaderNodeTexture"),
            NodeItem("ShaderNodeUVAlongStroke"),
            NodeItem("ShaderNodeUVMap"),
            NodeItem("ShaderNodeValToRGB"),
            NodeItem("ShaderNodeValue"),
            NodeItem("ShaderNodeVectorCurve"),
            NodeItem("ShaderNodeVectorMath"),
            NodeItem("ShaderNodeVectorTransform"),
            NodeItem("ShaderNodeVolumeAbsorption"),
            NodeItem("ShaderNodeVolumeScatter"),
            NodeItem("ShaderNodeWavelength"),
            NodeItem("ShaderNodeWireframe"),
            ]),
    
        PovrayTextureNodeCategory("TEXTUREOUTPUT", "Output", items=[
            NodeItem("TextureNodeValToRGB"),
            NodeItem("TextureOutputNode"),
            ]),
    
        PovraySceneNodeCategory("ISOSURFACE", "Isosurface", items=[
            NodeItem("IsoPropsNode"),
            ]),
    
        PovraySceneNodeCategory("FOG", "Fog", items=[
            NodeItem("PovrayFogNode"),
    
            ]),
        ]
    ############### end nodes
    
    ###############################################################################
    # Texture POV properties.
    ###############################################################################
    
    class RenderPovSettingsTexture(PropertyGroup):
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        """Declare texture level properties controllable in UI and translated to POV."""
    
        # former Space properties from removed Blender Internal
    
        active_texture_index: IntProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name = "Index for texture_slots",
    
            min=0,
            max=17,
            default=0,
    
        use_limited_texture_context: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="",
            description="Use the limited version of texture user (for ‘old shading’ mode)",
            default=True,
        )
    
    
        texture_context: EnumProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Texture context",
            description="Type of texture data to display and edit",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            items=(
                ('MATERIAL', "", "Show material textures", "MATERIAL",0), # "Show material textures"
                ('WORLD', "", "Show world textures", "WORLD",1), # "Show world textures"
                ('LAMP', "", "Show lamp textures", "LIGHT",2), # "Show lamp textures"
                ('PARTICLES', "", "Show particles textures", "PARTICLES",3), # "Show particles textures"
                ('LINESTYLE', "", "Show linestyle textures", "LINE_DATA",4), # "Show linestyle textures"
                ('OTHER', "", "Show other data textures", "TEXTURE_DATA",5), # "Show other data textures"
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            default = 'MATERIAL',
        )
    
        # Custom texture gamma
    
        tex_gamma_enable: BoolProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Enable custom texture gamma",
            description="Notify some custom gamma for which texture has been precorrected "
            "without the file format carrying it and only if it differs from your "
            "OS expected standard (see pov doc)",
            default=False,
        )
    
        tex_gamma_value: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Custom texture gamma",
            description="value for which the file was issued e.g. a Raw photo is gamma 1.0",
            min=0.45, max=5.00, soft_min=1.00, soft_max=2.50, default=1.00
        )
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
    
    
        ##################################CustomPOV Code############################
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
        # commented out below if we wanted custom pov code in texture only, inside exported material:
        # replacement_text = StringProperty(
    
        #        name="Declared name:",
        #        description="Type the declared name in custom POV code or an external .inc "
        #                    "it points at. pigment {} expected",
        #        default="")
    
        tex_pattern_type: EnumProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Texture_Type",
            description="Choose between Blender or POV parameters to specify texture",
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            items= (
                ('agate', 'Agate', '','PLUGIN', 0),
                ('aoi', 'Aoi', '', 'PLUGIN', 1),
                ('average', 'Average', '', 'PLUGIN', 2),
                ('boxed', 'Boxed', '', 'PLUGIN', 3),
                ('bozo', 'Bozo', '', 'PLUGIN', 4),
                ('bumps', 'Bumps', '', 'PLUGIN', 5),
                ('cells', 'Cells', '', 'PLUGIN', 6),
                ('crackle', 'Crackle', '', 'PLUGIN', 7),
                ('cubic', 'Cubic', '', 'PLUGIN', 8),
                ('cylindrical', 'Cylindrical', '', 'PLUGIN', 9),
                ('density_file', 'Density', '(.df3)', 'PLUGIN', 10),
                ('dents', 'Dents', '', 'PLUGIN', 11),
                ('fractal', 'Fractal', '', 'PLUGIN', 12),
                ('function', 'Function', '', 'PLUGIN', 13),
                ('gradient', 'Gradient', '', 'PLUGIN', 14),
                ('granite', 'Granite', '', 'PLUGIN', 15),
                ('image_pattern', 'Image pattern', '', 'PLUGIN', 16),
                ('leopard', 'Leopard', '', 'PLUGIN', 17),
                ('marble', 'Marble', '', 'PLUGIN', 18),
                ('onion', 'Onion', '', 'PLUGIN', 19),
                ('pigment_pattern', 'pigment pattern', '', 'PLUGIN', 20),
                ('planar', 'Planar', '', 'PLUGIN', 21),
                ('quilted', 'Quilted', '', 'PLUGIN', 22),
                ('radial', 'Radial', '', 'PLUGIN', 23),
                ('ripples', 'Ripples', '', 'PLUGIN', 24),
                ('slope', 'Slope', '', 'PLUGIN', 25),
                ('spherical', 'Spherical', '', 'PLUGIN', 26),
                ('spiral1', 'Spiral1', '', 'PLUGIN', 27),
                ('spiral2', 'Spiral2', '', 'PLUGIN', 28),
                ('spotted', 'Spotted', '', 'PLUGIN', 29),
                ('waves', 'Waves', '', 'PLUGIN', 30),
                ('wood', 'Wood', '', 'PLUGIN', 31),
                ('wrinkles', 'Wrinkles', '', 'PLUGIN', 32),
                ('brick', "Brick", "", 'PLUGIN', 33),
                ('checker', "Checker", "", 'PLUGIN', 34),
                ('hexagon', "Hexagon", "", 'PLUGIN', 35),
                ('object', "Mesh", "", 'PLUGIN', 36),
    
                ('emulator', "Blender Type Emulator", "", 'SCRIPTPLUGINS', 37)
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            default='emulator',
        )
    
        magnet_style: EnumProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Magnet style",
            description="magnet or julia",
            items=(('mandel', "Mandelbrot", ""),('julia', "Julia", "")),
            default='julia',
        )
    
        magnet_type: IntProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Magnet_type",
            description="1 or 2",
    
            min=1,
            max=2,
            default=2,
    
        warp_types: EnumProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Warp Types",
            description="Select the type of warp",
            items=(('PLANAR', "Planar", ""), ('CUBIC', "Cubic", ""),
                   ('SPHERICAL', "Spherical", ""), ('TOROIDAL', "Toroidal", ""),
                   ('CYLINDRICAL', "Cylindrical", ""), ('NONE', "None", "No indentation")),
            default='NONE'
        )
    
        warp_orientation: EnumProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Warp Orientation",
            description="Select the orientation of warp",
            items=(('x', "X", ""), ('y', "Y", ""), ('z', "Z", "")),
            default='y',
        )
    
        wave_type: EnumProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Waves type",
            description="Select the type of waves",
            items=(('ramp', "Ramp", ""), ('sine', "Sine", ""), ('scallop', "Scallop", ""),
                   ('cubic', "Cubic", ""), ('poly', "Poly", ""), ('triangle', 'Triangle', "")),
            default='ramp',
        )
    
        gen_noise: IntProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Noise Generators",
            description="Noise Generators",
            min=1, max=3, default=1,
        )
    
        warp_dist_exp: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Distance exponent",
            description="Distance exponent",
            min=0.0, max=100.0, default=1.0,
        )
    
        warp_tor_major_radius: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Major radius",
            description="Torus is distance from major radius",
            min=0.0, max=5.0, default=1.0,
        )
    
        warp_turbulence_x: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Turbulence X",
            description="Turbulence X",
            min=0.0, max=5.0, default=0.0,
        )
    
        warp_turbulence_y: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Turbulence Y",
            description="Turbulence Y",
            min=0.0, max=5.0, default=0.0
        )
    
        warp_turbulence_z: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Turbulence Z",
            description="Turbulence Z",
            min=0.0, max=5.0, default=0.0
        )
    
        modifier_octaves: IntProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Turbulence octaves",
            description="Turbulence octaves",
            min=1, max=10, default=1
        )
    
        modifier_lambda: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Turbulence lambda",
            description="Turbulence lambda",
            min=0.0, max=5.0, default=1.00
        )
    
        modifier_omega: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Turbulence omega",
            description="Turbulence omega",
            min=0.0, max=10.0, default=1.00
        )
    
        modifier_phase: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Phase",
            description="The phase value causes the map entries to be shifted so that the map "
            "starts and ends at a different place",
            min=0.0, max=2.0, default=0.0
        )
    
        modifier_frequency: FloatProperty(
    
    Maurice Raybaud's avatar
    Maurice Raybaud committed
            name="Frequency",
            description="The frequency keyword adjusts the number of times that a color map "
            "repeats over one cycle of a pattern",
            min=0.0, max=25.0, default=2.0
        )