From 2e7e07389f3ec9c0f74044e5d25950b20fb08e69 Mon Sep 17 00:00:00 2001
From: Maurice Raybaud <mauriceraybaud@hotmail.fr>
Date: Tue, 24 Dec 2019 08:07:33 +0100
Subject: [PATCH] POV: fix colored specular

pre 2.8 property was still used. Now in the .pov. wrapper.
---
 render_povray/__init__.py | 10 +++++++---
 render_povray/shading.py  |  6 +++---
 render_povray/ui.py       |  3 +++
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index 8f67892e5..99c854a4f 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -3682,10 +3682,12 @@ node_categories = [
 class RenderPovSettingsTexture(PropertyGroup):
     """Declare texture level properties controllable in UI and translated to POV."""
 
-    # former Space properties from  removed Blender Internal
+    # former Space properties from removed Blender Internal
     active_texture_index: IntProperty(
         name = "Index for texture_slots",
-        default = 0,
+        min=0,
+        max=17,
+        default=0,
     )
 
     use_limited_texture_context: BoolProperty(
@@ -3787,7 +3789,9 @@ class RenderPovSettingsTexture(PropertyGroup):
     magnet_type: IntProperty(
         name="Magnet_type",
         description="1 or 2",
-        min=1, max=2, default=2
+        min=1,
+        max=2,
+        default=2,
     )
 
     warp_types: EnumProperty(
diff --git a/render_povray/shading.py b/render_povray/shading.py
index 825cdd700..ac1f923f6 100644
--- a/render_povray/shading.py
+++ b/render_povray/shading.py
@@ -787,7 +787,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
         trans = 1.0 - mater.pov.alpha
     else:
         trans = 0.0
-    if ((mater.specular_color.s == 0.0) or (mater.pov.diffuse_shader == 'MINNAERT')):
+    if ((mater.pov.specular_color.s == 0.0) or (mater.pov.diffuse_shader == 'MINNAERT')):
     # No layered texture because of aoi pattern used for minnaert and pov can't layer patterned
         colored_specular_found = False
     else:
@@ -1192,7 +1192,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
     # Close first layer of POV "texture" (Blender material)
     tabWrite("}\n")
 
-    if ((mater.specular_color.s > 0.0) and (mater.pov.diffuse_shader != 'MINNAERT')):
+    if ((mater.pov.specular_color.s > 0.0) and (mater.pov.diffuse_shader != 'MINNAERT')):
 
         colored_specular_found = True
     else:
@@ -1222,7 +1222,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image,
 
         tabWrite("texture {\n")
         tabWrite("pigment {rgbft<%.3g, %.3g, %.3g, 0, 1>}\n" % \
-                         (mater.specular_color[0], mater.specular_color[1], mater.specular_color[2]))
+                         (mater.pov.specular_color[0], mater.pov.specular_color[1], mater.pov.specular_color[2]))
         tabWrite("finish {%s}\n" % (safety(material_finish, Level=2))) # Level 2 is translated spec
 
         texturesNorm = ""
diff --git a/render_povray/ui.py b/render_povray/ui.py
index 09f77cf20..49bcda3ac 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -2345,6 +2345,9 @@ class TEXTURE_PT_POV_context_texture(TextureButtonsPanel, Panel):
                 "pov_texture_slots",
                 mat.pov,
                 "active_texture_index",
+                rows=2,
+                maxrows=16,
+                type="DEFAULT"
             )
             col = row.column(align=True)
             col.operator("pov.textureslotadd", icon='ADD', text='')
-- 
GitLab