From e073c568036e211826e8d6ef6a80474e3a529094 Mon Sep 17 00:00:00 2001
From: Constantin Rahn <conz@vrchannel.de>
Date: Wed, 19 Jan 2011 23:56:07 +0000
Subject: [PATCH] AntiAlias Pannel UI und __init__

---
 render_povray/__init__.py | 35 +++++++++++++++++++++++++++++------
 render_povray/ui.py       | 36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 63 insertions(+), 8 deletions(-)

diff --git a/render_povray/__init__.py b/render_povray/__init__.py
index 1249cad0f..863d02133 100644
--- a/render_povray/__init__.py
+++ b/render_povray/__init__.py
@@ -56,9 +56,9 @@ def register():
             description="Show advanced options",
             default=False)
     Scene.pov_media_enable = BoolProperty(
-        name="Enable Media",
-        description="Enable POV-Rays atmospheric media",
-        default=False)
+            name="Enable Media",
+            description="Enable POV-Rays atmospheric media",
+            default=False)
     Scene.pov_media_samples = IntProperty(
             name="Samples", description="Number of samples taken from camera to first object encountered along ray path for media calculation",
             min=1, max=100, default=35)
@@ -90,6 +90,25 @@ def register():
     Scene.pov_command_line_switches = StringProperty(name="Command Line Switches",
             description="Command line switches consist of a + (plus) or - (minus) sign, followed by one or more alphabetic characters and possibly a numeric value.",
             default="", maxlen=500)
+            
+    Scene.pov_antialias_enable = BoolProperty(
+            name="Anti-Alias", description="Enable Anti-Aliasing",
+            default=True)
+            
+    Scene.pov_antialias_method = EnumProperty(
+            name="Method",
+            description="AA-sampling method. Type 1 is an adaptive, non-recursive, super-sampling method. Type 2 is an adaptive and recursive super-sampling method.",
+            items=(("0", "non-recursive AA", "Type 1 Sampling in POV-Ray"),
+               ("1", "recursive AA", "Type 2 Sampling in POV-Ray")),
+            default="1")
+            
+    Scene.pov_antialias_depth = IntProperty(
+            name="Antialias Depth", description="Depth of pixel for sampling",
+            min=1, max=9, default=3)
+    
+    Scene.pov_antialias_threshold = FloatProperty(
+            name="Antialias Threshold", description="Tolerance for sub-pixels",
+            min=0.0, max=1.0, soft_min=0.05, soft_max=0.5, default=0.1)
     
     Scene.pov_max_trace_level = IntProperty(
             name="Max Trace Level", description="Number of reflections/refractions allowed on ray path",
@@ -277,10 +296,14 @@ def unregister():
     del Scene.pov_media_color # MR
     del Scene.pov_baking_enable # MR
     del Scene.pov_max_trace_level # MR
-    del Scene.pov_command_line_switches #CR
+    del Scene.pov_antialias_enable # CR
+    del Scene.pov_antialias_method # CR 
+    del Scene.pov_antialias_depth # CR
+    del Scene.pov_antialias_threshold # CR
+    del Scene.pov_command_line_switches # CR
     del Scene.pov_indentation_character # CR
-    del Scene.pov_indentation_spaces #CR
-    del Scene.pov_comments_enable #CR
+    del Scene.pov_indentation_spaces # CR
+    del Scene.pov_comments_enable # CR
     del Mat.pov_irid_enable # MR
     del Mat.pov_mirror_use_IOR # MR
     del Mat.pov_mirror_metallic # MR    
diff --git a/render_povray/ui.py b/render_povray/ui.py
index 9b262dcd9..27444ab3a 100644
--- a/render_povray/ui.py
+++ b/render_povray/ui.py
@@ -22,7 +22,7 @@ import bpy
 import properties_render
 properties_render.RENDER_PT_render.COMPAT_ENGINES.add('POVRAY_RENDER')
 properties_render.RENDER_PT_dimensions.COMPAT_ENGINES.add('POVRAY_RENDER')
-properties_render.RENDER_PT_antialiasing.COMPAT_ENGINES.add('POVRAY_RENDER')
+# properties_render.RENDER_PT_antialiasing.COMPAT_ENGINES.add('POVRAY_RENDER')
 properties_render.RENDER_PT_shading.COMPAT_ENGINES.add('POVRAY_RENDER')
 properties_render.RENDER_PT_output.COMPAT_ENGINES.add('POVRAY_RENDER')
 del properties_render
@@ -261,7 +261,7 @@ class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel):
 ##            col.prop(mat, "pov_photons_reflection")
 ####TODO : MAKE THIS A real RADIO BUTTON (using EnumProperty?)
 ######################################EndMR#####################################
-class RENDER_PT_povray_max_trace_level(RenderButtonsPanel, bpy.types.Panel):
+class RENDER_PT_povray_global_settings(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Global Settings"
     COMPAT_ENGINES = {'POVRAY_RENDER'}
 
@@ -277,8 +277,40 @@ class RENDER_PT_povray_max_trace_level(RenderButtonsPanel, bpy.types.Panel):
         col = split.column()
         col.label(text="Command line switches:")
         col.prop(scene, "pov_command_line_switches", text="" )
+        split = layout.split()
+        col = split.column()
         col.prop(scene, "pov_max_trace_level", text="Ray Depth")
+        col = split.column()
+
+class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel):
+    bl_label = "Anti-Aliasing"
+    COMPAT_ENGINES = {'POVRAY_RENDER'}
+
+    def draw_header(self, context):
+        scene = context.scene
+
+        self.layout.prop(scene, "pov_antialias_enable", text="")
+
+    def draw(self, context):
+        layout = self.layout
 
+        scene = context.scene
+        rd = scene.render
+
+        layout.active = scene.pov_antialias_enable
+
+        split = layout.split()
+        col = split.column()
+        col.prop(scene, "pov_antialias_method", text="")
+        col = split.column()
+       
+        split = layout.split()
+        col = split.column()
+        col.prop(scene, "pov_antialias_depth", text="Depth")
+        col = split.column()
+        col.prop(scene, "pov_antialias_threshold", text="Threshold")
+        
+        
 class RENDER_PT_povray_radiosity(RenderButtonsPanel, bpy.types.Panel):
     bl_label = "Radiosity"
     COMPAT_ENGINES = {'POVRAY_RENDER'}
-- 
GitLab