From c958b22acb74b142dc1ea6115da371ccca368acb Mon Sep 17 00:00:00 2001 From: Campbell Barton <ideasman42@gmail.com> Date: Fri, 10 Sep 2010 02:32:56 +0000 Subject: [PATCH] update for changes in blender. --- mesh_surface_sketch.py | 16 +++---- render_povray/__init__.py | 89 ++++++++++++++++++++++++++++++++++++--- render_povray/ui.py | 83 ------------------------------------ 3 files changed, 91 insertions(+), 97 deletions(-) diff --git a/mesh_surface_sketch.py b/mesh_surface_sketch.py index 5aa7eadf0..41bc79c76 100644 --- a/mesh_surface_sketch.py +++ b/mesh_surface_sketch.py @@ -788,20 +788,20 @@ class GPENCIL_OT_SURFSK_strokes_to_curves(bpy.types.Operator): def register(): - bpy.types.Scene.IntProperty(attr = "SURFSK_edges_U", name = "Cross", description = "Number of edge rings crossing the strokes (perpendicular to strokes direction)", default = 10, min = 0, max = 100000) - bpy.types.Scene.IntProperty(attr = "SURFSK_edges_V", name = "Follow", description = "Number of edge rings following the strokes (parallel to strokes direction)", default = 10, min = 0, max = 100000) - bpy.types.Scene.IntProperty(attr = "SURFSK_precision", name = "Precision", description = "Precision level of the surface calculation", default = 4, min = 0, max = 100000) - bpy.types.Scene.BoolProperty(attr = "SURFSK_keep_strokes", name = "Keep strokes", description = "Keeps the sketched strokes after adding the surface", default = False) + bpy.types.Scene.SURFSK_edges_U = bpy.props.IntProperty(name="Cross", description="Number of edge rings crossing the strokes (perpendicular to strokes direction)", default=10, min=0, max=100000) + bpy.types.Scene.SURFSK_edges_V = bpy.props.IntProperty(name="Follow", description="Number of edge rings following the strokes (parallel to strokes direction)", default=10, min=0, max=100000) + bpy.types.Scene.SURFSK_precision = bpy.props.IntProperty(name="Precision", description="Precision level of the surface calculation", default=4, min=0, max=100000) + bpy.types.Scene.SURFSK_keep_strokes = bpy.props.BoolProperty(name="Keep strokes", description="Keeps the sketched strokes after adding the surface", default=False) keymap_item_add_surf = bpy.data.window_managers[0].keyconfigs.active.keymaps["3D View"].items.new("GPENCIL_OT_SURFSK_add_surface","E","PRESS", key_modifier="D") keymap_item_stroke_to_curve = bpy.data.window_managers[0].keyconfigs.active.keymaps["3D View"].items.new("GPENCIL_OT_SURFSK_strokes_to_curves","C","PRESS", key_modifier="D") def unregister(): - bpy.types.Scene.RemoveProperty("SURFSK_edges_U") - bpy.types.Scene.RemoveProperty("SURFSK_edges_V") - bpy.types.Scene.RemoveProperty("SURFSK_precision") - bpy.types.Scene.RemoveProperty("SURFSK_keep_strokes") + del bpy.types.Scene.SURFSK_edges_U + del bpy.types.Scene.SURFSK_edges_V + del bpy.types.Scene.SURFSK_precision + del bpy.types.Scene.SURFSK_keep_strokes km = bpy.data.window_managers[0].keyconfigs.active.keymaps["3D View"] for kmi in km.items: diff --git a/render_povray/__init__.py b/render_povray/__init__.py index 983f2eb0c..4adcbf07e 100644 --- a/render_povray/__init__.py +++ b/render_povray/__init__.py @@ -31,23 +31,100 @@ bl_addon_info = { "func=detail&aid=23145&group_id=153&atid=469", "category": "Render"} -try: - init_data +if "bpy" in locals(): reload(render) reload(ui) -except: + +else: + import bpy + from bpy.props import * from render_povray import render from render_povray import ui -init_data = True def register(): - pass + Scene = bpy.types.Scene + + # Not a real pov option, just to know if we should write + Scene.pov_radio_enable = BoolProperty( + name="Enable Radiosity", + description="Enable povrays radiosity calculation", + default=False) + Scene.pov_radio_display_advanced = BoolProperty( + name="Advanced Options", + description="Show advanced options", + default=False) + + # Real pov options + Scene.pov_radio_adc_bailout = FloatProperty( + name="ADC Bailout", description="The adc_bailout for radiosity rays. Use adc_bailout = 0.01 / brightest_ambient_object for good results", + min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default=0.01) + + Scene.pov_radio_always_sample = BoolProperty( + name="Always Sample", description="Only use the data from the pretrace step and not gather any new samples during the final radiosity pass", + default=True) + + Scene.pov_radio_brightness = FloatProperty( + name="Brightness", description="Amount objects are brightened before being returned upwards to the rest of the system", + min=0.0, max=1000.0, soft_min=0.0, soft_max=10.0, default=1.0) + + Scene.pov_radio_count = IntProperty( + name="Ray Count", description="Number of rays that are sent out whenever a new radiosity value has to be calculated", + min=1, max=1600, default=35) + + Scene.pov_radio_error_bound = FloatProperty( + name="Error Bound", description="One of the two main speed/quality tuning values, lower values are more accurate", + min=0.0, max=1000.0, soft_min=0.1, soft_max=10.0, default=1.8) + + Scene.pov_radio_gray_threshold = FloatProperty( + name="Gray Threshold", description="One of the two main speed/quality tuning values, lower values are more accurate", + min=0.0, max=1.0, soft_min=0, soft_max=1, default=0.0) + + Scene.pov_radio_low_error_factor = FloatProperty( + name="Low Error Factor", description="If you calculate just enough samples, but no more, you will get an image which has slightly blotchy lighting", + min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.5) + + # max_sample - not available yet + Scene.pov_radio_media = BoolProperty( + name="Media", description="Radiosity estimation can be affected by media", + default=False) + + Scene.pov_radio_minimum_reuse = FloatProperty( + name="Minimum Reuse", description="Fraction of the screen width which sets the minimum radius of reuse for each sample point (At values higher than 2% expect errors)", + min=0.0, max=1.0, soft_min=0.1, soft_max=0.1, default=0.015) + + Scene.pov_radio_nearest_count = IntProperty( + name="Nearest Count", description="Number of old ambient values blended together to create a new interpolated value", + min=1, max=20, default=5) + + Scene.pov_radio_normal = BoolProperty( + name="Normals", description="Radiosity estimation can be affected by normals", + default=False) + + Scene.pov_radio_recursion_limit = IntProperty( + name="Recursion Limit", description="how many recursion levels are used to calculate the diffuse inter-reflection", + min=1, max=20, default=3) def unregister(): - pass + import bpy + Scene = bpy.types.Scene + + del Scene.pov_radio_enable + del Scene.pov_radio_display_advanced + del Scene.pov_radio_adc_bailout + del Scene.pov_radio_always_sample + del Scene.pov_radio_brightness + del Scene.pov_radio_count + del Scene.pov_radio_error_bound + del Scene.pov_radio_gray_threshold + del Scene.pov_radio_low_error_factor + del Scene.pov_radio_media + del Scene.pov_radio_minimum_reuse + del Scene.pov_radio_nearest_count + del Scene.pov_radio_normal + del Scene.pov_radio_recursion_limit if __name__ == "__main__": diff --git a/render_povray/ui.py b/render_povray/ui.py index 027d9102d..2d2a6d627 100644 --- a/render_povray/ui.py +++ b/render_povray/ui.py @@ -18,86 +18,6 @@ import bpy - -# Radiosity panel, use in the scene for now. -FloatProperty = bpy.types.Scene.FloatProperty -IntProperty = bpy.types.Scene.IntProperty -BoolProperty = bpy.types.Scene.BoolProperty - -# Not a real pov option, just to know if we should write -BoolProperty(attr="pov_radio_enable", - name="Enable Radiosity", - description="Enable povrays radiosity calculation", - default=False) -BoolProperty(attr="pov_radio_display_advanced", - name="Advanced Options", - description="Show advanced options", - default=False) - -# Real pov options -FloatProperty(attr="pov_radio_adc_bailout", - name="ADC Bailout", - description="The adc_bailout for radiosity rays. Use adc_bailout = 0.01 / brightest_ambient_object for good results", - min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default=0.01) - -BoolProperty(attr="pov_radio_always_sample", - name="Always Sample", - description="Only use the data from the pretrace step and not gather any new samples during the final radiosity pass", - default=True) - -FloatProperty(attr="pov_radio_brightness", - name="Brightness", - description="Amount objects are brightened before being returned upwards to the rest of the system", - min=0.0, max=1000.0, soft_min=0.0, soft_max=10.0, default=1.0) - -IntProperty(attr="pov_radio_count", - name="Ray Count", - description="Number of rays that are sent out whenever a new radiosity value has to be calculated", - min=1, max=1600, default=35) - -FloatProperty(attr="pov_radio_error_bound", - name="Error Bound", - description="One of the two main speed/quality tuning values, lower values are more accurate", - min=0.0, max=1000.0, soft_min=0.1, soft_max=10.0, default=1.8) - -FloatProperty(attr="pov_radio_gray_threshold", - name="Gray Threshold", - description="One of the two main speed/quality tuning values, lower values are more accurate", - min=0.0, max=1.0, soft_min=0, soft_max=1, default=0.0) - -FloatProperty(attr="pov_radio_low_error_factor", - name="Low Error Factor", - description="If you calculate just enough samples, but no more, you will get an image which has slightly blotchy lighting", - min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, default=0.5) - -# max_sample - not available yet -BoolProperty(attr="pov_radio_media", - name="Media", - description="Radiosity estimation can be affected by media", - default=False) - -FloatProperty(attr="pov_radio_minimum_reuse", - name="Minimum Reuse", - description="Fraction of the screen width which sets the minimum radius of reuse for each sample point (At values higher than 2% expect errors)", - min=0.0, max=1.0, soft_min=0.1, soft_max=0.1, default=0.015) - -IntProperty(attr="pov_radio_nearest_count", - name="Nearest Count", - description="Number of old ambient values blended together to create a new interpolated value", - min=1, max=20, default=5) - -BoolProperty(attr="pov_radio_normal", - name="Normals", - description="Radiosity estimation can be affected by normals", - default=False) - -IntProperty(attr="pov_radio_recursion_limit", - name="Recursion Limit", - description="how many recursion levels are used to calculate the diffuse inter-reflection", - min=1, max=20, default=3) - - - # Use some of the existing buttons. import properties_render properties_render.RENDER_PT_render.COMPAT_ENGINES.add('POVRAY_RENDER') @@ -214,6 +134,3 @@ class RENDER_PT_povray_radiosity(RenderButtonsPanel, bpy.types.Panel): col = split.column() col.prop(scene, "pov_radio_always_sample") - - - -- GitLab