Skip to content
Snippets Groups Projects
__init__.py 172 KiB
Newer Older
  • Learn to ignore specific revisions
  • 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569
                # texture_slots
    
                    # Texture slots defining the mapping and influence of textures
                    # Type:	MaterialTextureSlots bpy_prop_collection of MaterialTextureSlot, (readonly)
    
                # translucency
    
                    # Amount of diffuse shading on the back side
                    # Type:	float in [0, 1], default 0.0
    
                # transparency_method
    
                    # Method to use for rendering transparency
    
                        # MASK Mask, Mask the background.
                        # Z_TRANSPARENCY Z Transparency, Use alpha buffer for transparent faces.
                        # RAYTRACE Raytrace, Use raytracing for transparent refraction rendering.
    
                    # Type:	enum in [‘MASK’, ‘Z_TRANSPARENCY’, ‘RAYTRACE’], default ‘MASK’
    
                # type
    
                    # Material type defining how the object is rendered
    
                        # SURFACE Surface, Render object as a surface.
                        # WIRE Wire, Render the edges of faces as wires (not supported in raytracing).
                        # VOLUME Volume, Render object as a volume.
                        # HALO Halo, Render object as halo particles.
    
                    # Type:	enum in [‘SURFACE’, ‘WIRE’, ‘VOLUME’, ‘HALO’], default ‘SURFACE’
    
                # use_cast_approximate
    
                    # Allow this material to cast shadows when using approximate ambient occlusion
                    # Type:	boolean, default False
    
                # use_cast_buffer_shadows
    
                    # Allow this material to cast shadows from shadow buffer lamps
                    # Type:	boolean, default False
    
                # use_cast_shadows
    
                    # Allow this material to cast shadows
                    # Type:	boolean, default False
    
                # use_cast_shadows_only
    
                    # Make objects with this material appear invisible (not rendered), only casting shadows
                    # Type:	boolean, default False
    
                # use_cubic
    
                    # Use cubic interpolation for diffuse values, for smoother transitions
                    # Type:	boolean, default False
    
                # use_diffuse_ramp
    
                    # Toggle diffuse ramp operations
                    # Type:	boolean, default False
    
                # use_face_texture
    
                    # Replace the object’s base color with color from UV map image textures
                    # Type:	boolean, default False
    
                # use_face_texture_alpha
    
                    # Replace the object’s base alpha value with alpha from UV map image textures
                    # Type:	boolean, default False
    
                # use_full_oversampling
    
                    # Force this material to render full shading/textures for all anti-aliasing samples
                    # Type:	boolean, default False
    
                # use_light_group_exclusive
    
                    # Material uses the light group exclusively - these lamps are excluded from other scene lighting
                    # Type:	boolean, default False
    
                # use_light_group_local
    
                    # When linked in, material uses local light group with the same name
                    # Type:	boolean, default False
    
                # use_mist
    
                    # Use mist with this material (in world settings)
                    # Type:	boolean, default False
    
                # use_nodes
    
                    # Use shader nodes to render the material
                    # Type:	boolean, default False
    
                # use_object_color
    
                    # Modulate the result with a per-object color
                    # Type:	boolean, default False
    
                # use_only_shadow
    
                    # Render shadows as the material’s alpha value, making the material transparent except for shadowed areas
                    # Type:	boolean, default False
    
                # use_ray_shadow_bias
    
                    # Prevent raytraced shadow errors on surfaces with smooth shaded normals (terminator problem)
                    # Type:	boolean, default False
    
                # use_raytrace
    
                    # Include this material and geometry that uses it in raytracing calculations
                    # Type:	boolean, default False
    
                # use_shadeless
    
                    # Make this material insensitive to light or shadow
                    # Type:	boolean, default False
    
                # use_shadows
    
                    # Allow this material to receive shadows
                    # Type:	boolean, default False
    
                # use_sky
    
                    # Render this material with zero alpha, with sky background in place (scanline only)
                    # Type:	boolean, default False
    
                # use_specular_ramp
    
                    # Toggle specular ramp operations
                    # Type:	boolean, default False
    
                # use_tangent_shading
    
                    # Use the material’s tangent vector instead of the normal for shading - for anisotropic shading effects
                    # Type:	boolean, default False
    
                # use_textures
    
                    # Enable/Disable each texture
                    # Type:	boolean array of 18 items, default (False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
    
                # use_transparency
    
                    # Render material as transparent
                    # Type:	boolean, default False
    
                # use_transparent_shadows
    
                    # Allow this object to receive transparent shadows cast through other objects
                    # Type:	boolean, default False
    
                # use_uv_project
    
                    # Use to ensure UV interpolation is correct for camera projections (use with UV project modifier)
                    # Type:	boolean, default False
    
                # use_vertex_color_light
    
                    # Add vertex colors as additional lighting
                    # Type:	boolean, default False
    
                # use_vertex_color_paint
    
                    # Replace object base color with vertex colors (multiply with ‘texture face’ face assigned textures)
                    # Type:	boolean, default False
    
                # volume
    
                    # Volume settings for the material
                    # Type:	MaterialVolume, (readonly, never None)
        '''    
        (mat.type in {'SURFACE', 'WIRE', 'VOLUME'}) 
         "use_transparency")
    
    
    
        mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
    
    
    
    
                col.prop(mat, "use_raytrace")
                col.prop(mat, "use_full_oversampling")
    
                sub.prop(mat, "use_sky")
    
    
                col.prop(mat, "use_cast_shadows", text="Cast")
                col.prop(mat, "use_cast_shadows_only", text="Cast Only")
                col.prop(mat, "use_cast_buffer_shadows")
    
                sub.active = mat.use_cast_buffer_shadows
                sub.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
                col.prop(mat, "use_cast_approximate")
    
    
    
                col.prop(mat, "diffuse_color", text="")
    
                sub.active = (not mat.use_shadeless)
                
                sub.prop(mat, "diffuse_intensity", text="Intensity")
    
    
                col.prop(mat, "diffuse_shader", text="")
                col.prop(mat, "use_diffuse_ramp", text="Ramp")
    
    
                if mat.diffuse_shader == 'OREN_NAYAR':
                    col.prop(mat, "roughness")
                elif mat.diffuse_shader == 'MINNAERT':
                    col.prop(mat, "darkness")
                elif mat.diffuse_shader == 'TOON':
    
                    row.prop(mat, "diffuse_toon_size", text="Size")
                    row.prop(mat, "diffuse_toon_smooth", text="Smooth")
                elif mat.diffuse_shader == 'FRESNEL':
    
                    row.prop(mat, "diffuse_fresnel", text="Fresnel")
                    row.prop(mat, "diffuse_fresnel_factor", text="Factor")
    
                if mat.use_diffuse_ramp:
           
                    col.template_color_ramp(mat, "diffuse_ramp", expand=True)
            
    
    
                    row.prop(mat, "diffuse_ramp_input", text="Input")
                    row.prop(mat, "diffuse_ramp_blend", text="Blend")
    
                    col.prop(mat, "diffuse_ramp_factor", text="Factor")
    
    
    
    
                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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.NodeSocket):
        bl_idname = 'PovraySocketPattern'
        bl_label = 'Povray Socket'
    
    
        default_value: bpy.props.EnumProperty(
    
                name="Pattern",
                description="Select the pattern",
                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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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(bpy.types.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"),
            ]),