diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-19 04:49:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-19 04:49:18 +0300 |
commit | 57f376e9465c6b79ebd4409bc30e0b5930dd4140 (patch) | |
tree | 8dc6d5940bc8c39d7979d3b35c19d91f4bb83bf0 /render_povray | |
parent | 1338695613af08ae912e6507f0fc89d54577e11a (diff) |
Cleanup: trailing space
Diffstat (limited to 'render_povray')
-rw-r--r-- | render_povray/__init__.py | 240 | ||||
-rw-r--r-- | render_povray/nodes.py | 39 | ||||
-rw-r--r-- | render_povray/primitives.py | 289 | ||||
-rw-r--r-- | render_povray/render.py | 272 | ||||
-rw-r--r-- | render_povray/shading.py | 268 | ||||
-rw-r--r-- | render_povray/ui.py | 334 |
6 files changed, 720 insertions, 722 deletions
diff --git a/render_povray/__init__.py b/render_povray/__init__.py index bd7142f7..12f291a5 100644 --- a/render_povray/__init__.py +++ b/render_povray/__init__.py @@ -97,7 +97,7 @@ class RenderPovSettingsScene(PropertyGroup): name="Export scene path", # Bug in POV-Ray RC3 # description="Path to directory where the exported scene " - # "(POV and INI) is created", + # "(POV and INI) is created", description="Path to directory where the files are created", maxlen=1024, subtype="DIR_PATH") renderimage_path = StringProperty( @@ -116,12 +116,12 @@ class RenderPovSettingsScene(PropertyGroup): name="Enable Radiosity", description="Enable POV-Rays radiosity calculation", default=False) - + radio_display_advanced = BoolProperty( name="Advanced Options", description="Show advanced options", default=False) - + media_enable = BoolProperty( name="Enable Media", description="Enable POV-Rays atmospheric media", @@ -136,7 +136,7 @@ class RenderPovSettingsScene(PropertyGroup): name="Media Color", description="The atmospheric media color", precision=4, step=0.01, min=0, soft_max=1, default=(0.001, 0.001, 0.001), - options={'ANIMATABLE'}, + options={'ANIMATABLE'}, subtype='COLOR') baking_enable = BoolProperty( @@ -182,7 +182,7 @@ class RenderPovSettingsScene(PropertyGroup): ("1", "recursive AA", "Type 2 Sampling in POV-Ray"), ("2", "stochastic AA", "Type 3 Sampling in UberPOV")), default="1") - + antialias_confidence = FloatProperty( name="Antialias Confidence", description="how surely the computed color " @@ -220,8 +220,8 @@ class RenderPovSettingsScene(PropertyGroup): description="Number of reflections/refractions allowed on ray " "path", min=1, max=256, default=5) - -#######NEW from Lanuhum + +#######NEW from Lanuhum adc_bailout_enable = BoolProperty( name="Enable", description="", @@ -310,7 +310,7 @@ class RenderPovSettingsScene(PropertyGroup): name="Count", description="Photons count", min=1, max=100000000, default=20000) - + photon_spacing = FloatProperty( name="Spacing", description="Average distance between photons on surfaces. half " @@ -339,7 +339,7 @@ class RenderPovSettingsScene(PropertyGroup): photon_gather_max = IntProperty( name="Gather Max", description="Maximum number of photons gathered for each point", min=1, max=256, default=100) - + photon_map_file_save_load = EnumProperty( name="Operation", description="Load or Save photon map file", @@ -362,7 +362,7 @@ class RenderPovSettingsScene(PropertyGroup): name="File", description="", maxlen=1024, subtype="FILE_PATH") - + radio_adc_bailout = FloatProperty( name="ADC Bailout", @@ -561,7 +561,7 @@ class RenderPovSettingsMaterial(PropertyGroup): # NODES - + def use_material_nodes_callback(self, context): if hasattr(context.space_data, "tree_type"): context.space_data.tree_type = 'ObjectNodeTree' @@ -597,7 +597,7 @@ class RenderPovSettingsMaterial(PropertyGroup): tmap.location = 0,200 links.new(tmap.outputs[0],output.inputs[0]) tmap.select = True - tree.nodes.active = tmap + tree.nodes.active = tmap else: mat.use_nodes=False @@ -656,12 +656,12 @@ class RenderPovSettingsMaterial(PropertyGroup): object_preview_transform = BoolProperty(name="Transform object", description="",default=False) object_preview_scale = FloatProperty(name="XYZ", min=0.5, max=2.0, default=1.0) object_preview_rotate = FloatVectorProperty(name="Rotate", description="", min=-180.0, max=180.0,default=(0.0,0.0,0.0), subtype='XYZ') - object_preview_bgcontrast = FloatProperty(name="Contrast", min=0.0, max=1.0, default=0.5) - - + object_preview_bgcontrast = FloatProperty(name="Contrast", min=0.0, max=1.0, default=0.5) + + +############################################################################### +# Povray Nodes ############################################################################### -# Povray Nodes -############################################################################### class PovraySocketUniversal(bpy.types.NodeSocket): bl_idname = 'PovraySocketUniversal' bl_label = 'Povray Socket' @@ -681,7 +681,7 @@ class PovraySocketUniversal(bpy.types.NodeSocket): for link in links: if link.from_node==node: inps=link.to_node.inputs - for inp in inps: + for inp in inps: if inp.bl_idname=="PovraySocketFloat_0_1" and inp.is_linked: prop="value_0_1" if prop not in value: @@ -995,7 +995,7 @@ node_categories = [ NodeItem("PovrayMirrorNode"), NodeItem("PovrayIridescenceNode"), NodeItem("PovraySubsurfaceNode"), - ]), + ]), PovrayShaderNodeCategory("CYCLES", "Cycles", items=[ NodeItem("ShaderNodeAddShader"), @@ -1100,7 +1100,7 @@ node_categories = [ ]), ] ############### end nodes - + ############################################################################### # Texture POV properties. ############################################################################### @@ -1126,7 +1126,7 @@ class RenderPovSettingsTexture(PropertyGroup): # "it points at. pigment {} expected", # default="") - + tex_pattern_type = EnumProperty( name="Texture_Type", @@ -1140,7 +1140,7 @@ class RenderPovSettingsTexture(PropertyGroup): ('cells', 'Cells', '', 'PLUGIN', 6), ('crackle', 'Crackle', '', 'PLUGIN', 7), ('cubic', 'Cubic', '', 'PLUGIN', 8), - ('cylindrical', 'Cylindrical', '', 'PLUGIN', 9), + ('cylindrical', 'Cylindrical', '', 'PLUGIN', 9), ('density_file', 'Density', '(.df3)', 'PLUGIN', 10), ('dents', 'Dents', '', 'PLUGIN', 11), ('fractal', 'Fractal', '', 'PLUGIN', 12), @@ -1175,7 +1175,7 @@ class RenderPovSettingsTexture(PropertyGroup): magnet_style = EnumProperty( name="Magnet style", description="magnet or julia", - items=(('mandel', "Mandelbrot", ""),('julia', "Julia", "")), + items=(('mandel', "Mandelbrot", ""),('julia', "Julia", "")), default='julia') magnet_type = IntProperty( @@ -1196,87 +1196,87 @@ class RenderPovSettingsTexture(PropertyGroup): description="Select the orientation of warp", items=(('x', "X", ""), ('y', "Y", ""), ('z', "Z", "")), default='y') - + wave_type = EnumProperty( name="Waves type", description="Select the type of waves", items=(('ramp', "Ramp", ""), ('sine', "Sine", ""), ('scallop', "Scallop", ""), ('cubic', "Cubic", ""), ('poly', "Poly", ""), ('triangle', 'Triangle', "")), - default='ramp') + default='ramp') gen_noise = IntProperty( name="Noise Generators", description="Noise Generators", - min=1, max=3, default=1) + min=1, max=3, default=1) warp_dist_exp = FloatProperty( name="Distance exponent", description="Distance exponent", min=0.0, max=100.0, default=1.0) - + warp_tor_major_radius = FloatProperty( name="Major radius", description="Torus is distance from major radius", - min=0.0, max=5.0, default=1.0) + min=0.0, max=5.0, default=1.0) warp_turbulence_x = FloatProperty( name="Turbulence X", description="Turbulence X", min=0.0, max=5.0, default=0.0) - + warp_turbulence_y = FloatProperty( name="Turbulence Y", description="Turbulence Y", - min=0.0, max=5.0, default=0.0) + min=0.0, max=5.0, default=0.0) warp_turbulence_z = FloatProperty( name="Turbulence Z", description="Turbulence Z", min=0.0, max=5.0, default=0.0) - + modifier_octaves = IntProperty( name="Turbulence octaves", description="Turbulence octaves", - min=1, max=10, default=1) + min=1, max=10, default=1) modifier_lambda = FloatProperty( name="Turbulence lambda", description="Turbulence lambda", min=0.0, max=5.0, default=1.00) - + modifier_omega = FloatProperty( name="Turbulence omega", description="Turbulence omega", - min=0.0, max=10.0, default=1.00) + min=0.0, max=10.0, default=1.00) modifier_phase = FloatProperty( 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( 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) + min=0.0, max=25.0, default=2.0) modifier_turbulence = FloatProperty( name="Turbulence", description="Turbulence", - min=0.0, max=5.0, default=2.0) - + min=0.0, max=5.0, default=2.0) + modifier_numbers = IntProperty( name="Numbers", description="Numbers", - min=1, max=27, default=2) + min=1, max=27, default=2) modifier_control0 = IntProperty( name="Control0", description="Control0", min=0, max=100, default=1) - + modifier_control1 = IntProperty( name="Control1", description="Control1", @@ -1285,17 +1285,17 @@ class RenderPovSettingsTexture(PropertyGroup): brick_size_x = FloatProperty( name="Brick size x", description="", - min=0.0000, max=1.0000, default=0.2500) + min=0.0000, max=1.0000, default=0.2500) brick_size_y = FloatProperty( name="Brick size y", description="", min=0.0000, max=1.0000, default=0.0525) - + brick_size_z = FloatProperty( name="Brick size z", description="", - min=0.0000, max=1.0000, default=0.1250) + min=0.0000, max=1.0000, default=0.1250) brick_mortar = FloatProperty( name="Mortar", @@ -1402,7 +1402,7 @@ class RenderPovSettingsTexture(PropertyGroup): name="Pavement pattern 35", description="maximum: 35", min=1, max=35, default=35) - + pave_tiles= IntProperty( name="Pavement tiles", description="If sides = 6, maximum tiles 5!!!", @@ -1411,11 +1411,11 @@ class RenderPovSettingsTexture(PropertyGroup): pave_form= IntProperty( name="Pavement form", description="", - min=0, max=4, default=0) - + min=0, max=4, default=0) + #########FUNCTIONS############################################################################# #########FUNCTIONS############################################################################# - + func_list = EnumProperty( name="Functions", description="Select the function for create pattern", @@ -1425,20 +1425,20 @@ class RenderPovSettingsTexture(PropertyGroup): ("f_bicorn","Bicorn",""), ("f_bifolia","Bifolia",""), ("f_blob","Blob",""), ("f_blob2","Blob2",""), ("f_boy_surface","Boy surface",""), ("f_comma","Comma",""), - ("f_cross_ellipsoids","Cross ellipsoids",""), + ("f_cross_ellipsoids","Cross ellipsoids",""), ("f_crossed_trough","Crossed trough",""), ("f_cubic_saddle","Cubic saddle",""), ("f_cushion","Cushion",""), ("f_devils_curve","Devils curve",""), ("f_devils_curve_2d","Devils curve 2d",""), ("f_dupin_cyclid","Dupin cyclid",""), ("f_ellipsoid","Ellipsoid",""), ("f_enneper","Enneper",""), ("f_flange_cover","Flange cover",""), - ("f_folium_surface","Folium surface",""), + ("f_folium_surface","Folium surface",""), ("f_folium_surface_2d","Folium surface 2d",""), ("f_glob","Glob",""), ("f_heart","Heart",""), ("f_helical_torus","Helical torus",""), ("f_helix1","Helix1",""), ("f_helix2","Helix2",""), ("f_hex_x","Hex x",""), ("f_hex_y","Hex y",""), ("f_hetero_mf","Hetero mf",""), ("f_hunt_surface","Hunt surface",""), ("f_hyperbolic_torus","Hyperbolic torus",""), - ("f_isect_ellipsoids","Isect ellipsoids",""), + ("f_isect_ellipsoids","Isect ellipsoids",""), ("f_kampyle_of_eudoxus","Kampyle of eudoxus",""), ("f_kampyle_of_eudoxus_2d","Kampyle of eudoxus 2d",""), ("f_klein_bottle","Klein bottle",""), @@ -1467,7 +1467,7 @@ class RenderPovSettingsTexture(PropertyGroup): ("f_torus_gumdrop","Torus gumdrop",""), ("f_umbrella","Umbrella",""), ("f_witch_of_agnesi","Witch of agnesi",""), ("f_witch_of_agnesi_2d","Witch of agnesi 2d","")), - + default='NONE') func_x = FloatProperty( @@ -1551,48 +1551,48 @@ class RenderPovSettingsTexture(PropertyGroup): func_P9 = FloatProperty( name="P9", description="", - min=0.0, max=25.0, default=1.0) + min=0.0, max=25.0, default=1.0) ######################################### tex_rot_x = FloatProperty( name="Rotate X", description="", - min=-180.0, max=180.0, default=0.0) + min=-180.0, max=180.0, default=0.0) tex_rot_y = FloatProperty( name="Rotate Y", description="", - min=-180.0, max=180.0, default=0.0) + min=-180.0, max=180.0, default=0.0) tex_rot_z = FloatProperty( name="Rotate Z", description="", - min=-180.0, max=180.0, default=0.0) - + min=-180.0, max=180.0, default=0.0) + tex_mov_x = FloatProperty( name="Move X", description="", - min=-100000.0, max=100000.0, default=0.0) + min=-100000.0, max=100000.0, default=0.0) tex_mov_y = FloatProperty( name="Move Y", description="", - min=-100000.0, max=100000.0, default=0.0) + min=-100000.0, max=100000.0, default=0.0) tex_mov_z = FloatProperty( name="Move Z", description="", - min=-100000.0, max=100000.0, default=0.0) + min=-100000.0, max=100000.0, default=0.0) tex_scale_x = FloatProperty( name="Scale X", description="", - min=0.0, max=10000.0, default=1.0) + min=0.0, max=10000.0, default=1.0) tex_scale_y = FloatProperty( name="Scale Y", description="", - min=0.0, max=10000.0, default=1.0) + min=0.0, max=10000.0, default=1.0) tex_scale_z = FloatProperty( name="Scale Z", @@ -1639,19 +1639,19 @@ class RenderPovSettingsObject(PropertyGroup): #############POV-Ray specific object properties.############################ object_as = StringProperty(maxlen=1024) - + imported_loc = FloatVectorProperty( name="Imported Pov location", - precision=6, + precision=6, default=(0.0, 0.0, 0.0)) - + imported_loc_cap = FloatVectorProperty( name="Imported Pov location", - precision=6, + precision=6, default=(0.0, 0.0, 2.0)) unlock_parameters = BoolProperty(name="Lock",default = False) - + curveshape = EnumProperty( name="Povray Shape Type", items=(("birail", "Birail", ""), @@ -1661,7 +1661,7 @@ class RenderPovSettingsObject(PropertyGroup): ("prism", "Prism", ""), ("sphere_sweep", "Sphere Sweep", "")), default="sphere_sweep") - + mesh_write_as = EnumProperty( name="Mesh Write As", items=(("blobgrid", "Blob Grid", ""), @@ -1672,7 +1672,7 @@ class RenderPovSettingsObject(PropertyGroup): object_ior = FloatProperty( name="IOR", description="IOR", min=1.0, max=10.0,default=1.0) - + # shape_as_light = StringProperty(name="Light",maxlen=1024) # fake_caustics_power = FloatProperty( # name="Power", description="Fake caustics power", @@ -1690,23 +1690,23 @@ class RenderPovSettingsObject(PropertyGroup): # reflection = BoolProperty(name="Reflection",description="",default=False) # pass_through = BoolProperty(name="Pass through",description="",default=False) no_shadow = BoolProperty(name="No Shadow",default=False) - + no_image = BoolProperty(name="No Image",default=False) - + no_reflection = BoolProperty(name="No Reflection",default=False) - + no_radiosity = BoolProperty(name="No Radiosity",default=False) - + inverse = BoolProperty(name="Inverse",default=False) - + sturm = BoolProperty(name="Sturm",default=False) - + double_illuminate = BoolProperty(name="Double Illuminate",default=False) - + hierarchy = BoolProperty(name="Hierarchy",default=False) - + hollow = BoolProperty(name="Hollow",default=False) - + boundorclip = EnumProperty( name="Boundorclip", items=(("none", "None", ""), @@ -1714,33 +1714,33 @@ class RenderPovSettingsObject(PropertyGroup): ("clipped_by", "Clipped_by", "")), default="none") boundorclipob = StringProperty(maxlen=1024) - + addboundorclip = BoolProperty(description="",default=False) - + blob_threshold = FloatProperty(name="Threshold",min=0.00, max=10.0, default=0.6) blob_strength = FloatProperty(name="Strength",min=-10.00, max=10.0, default=1.00) - + res_u = IntProperty(name="U",min=100, max=1000, default=500) - + res_v = IntProperty(name="V",min=100, max=1000, default=500) - + contained_by = EnumProperty( name="Contained by", items=(("box", "Box", ""), ("sphere", "Sphere", "")), default="box") - + container_scale = FloatProperty(name="Container Scale",min=0.0, max=10.0, default=1.00) - + threshold = FloatProperty(name="Threshold",min=0.0, max=10.0, default=0.00) - + accuracy = FloatProperty(name="Accuracy",min=0.0001, max=0.1, default=0.001) - + max_gradient = FloatProperty(name="Max Gradient",min=0.0, max=100.0, default=5.0) - + all_intersections = BoolProperty(name="All Intersections",default=False) - + max_trace = IntProperty(name="Max Trace",min=1, max=100,default=1) @@ -1756,12 +1756,12 @@ class RenderPovSettingsObject(PropertyGroup): imported_cyl_loc = FloatVectorProperty( name="Imported Pov location", - precision=6, + precision=6, default=(0.0, 0.0, 0.0)) - + imported_cyl_loc_cap = FloatVectorProperty( name="Imported Pov location", - precision=6, + precision=6, default=(0.0, 0.0, 2.0)) def prop_update_sphere(self, context): @@ -1778,7 +1778,7 @@ class RenderPovSettingsObject(PropertyGroup): cone_cap_radius = FloatProperty( name = "Cap radius", description = "The second radius of the cone", default = 0.3, min = 0.0, max = 100.0, update=prop_update_cone) - + cone_segments = IntProperty( name = "Segments", description = "Radial segmentation of proxy mesh", default = 16, min = 3, max = 265, update=prop_update_cone) @@ -1788,12 +1788,12 @@ class RenderPovSettingsObject(PropertyGroup): default = 2.0, min = 0.01, max = 100.0, update=prop_update_cone) cone_base_z = FloatProperty() - cone_cap_z = FloatProperty() + cone_cap_z = FloatProperty() ###########Parametric def prop_update_parametric(self, context): bpy.ops.pov.parametric_update() - + u_min = FloatProperty(name = "U Min", description = "", default = 0.0, update=prop_update_parametric) @@ -1817,7 +1817,7 @@ class RenderPovSettingsObject(PropertyGroup): def prop_update_torus(self, context): bpy.ops.pov.torus_update() - + torus_major_segments = IntProperty( name = "Segments", description = "Radial segmentation of proxy mesh", default = 48, min = 3, max = 720, update=prop_update_torus) @@ -1842,14 +1842,14 @@ class RenderPovSettingsObject(PropertyGroup): description = "The angle after which rainbow dissolves into background", default = 360, min = 0.0, max = 360) -###########HeightFields +###########HeightFields quality = IntProperty(name = "Quality", description = "", default = 100, min = 1, max = 100) - + hf_filename = StringProperty(maxlen = 1024) - + hf_gamma = FloatProperty( name="Gamma", description="Gamma", @@ -1874,7 +1874,7 @@ class RenderPovSettingsObject(PropertyGroup): name="Hierarchy", description="Height field hierarchy", default=True) - + ##############Superellipsoid def prop_update_superellipsoid(self, context): bpy.ops.pov.superellipsoid_update() @@ -1888,7 +1888,7 @@ class RenderPovSettingsObject(PropertyGroup): name="Parameter 2", description="", min=0.00, max=10.0, default=0.04) - + se_u = IntProperty(name = "U-segments", description = "radial segmentation", default = 20, min = 4, max = 265, @@ -1923,11 +1923,11 @@ class RenderPovSettingsObject(PropertyGroup): ("sphere_sweep", "Sphere Sweep", ""), ("sor", "Surface of Revolution", "")), default="sphere_sweep") - + #############Supertorus def prop_update_supertorus(self, context): bpy.ops.pov.supertorus_update() - + st_major_radius = FloatProperty( name="Major radius", description="Major radius", @@ -1962,7 +1962,7 @@ class RenderPovSettingsObject(PropertyGroup): description="Max gradient", min=0.0001, max=100.00, default=10.00, update=prop_update_supertorus) - + st_R = FloatProperty(name = "big radius", description = "The radius inside the tube", default = 1.0, min = 0.01, max = 100.0, @@ -2015,9 +2015,9 @@ class RenderPovSettingsObject(PropertyGroup): default = 1, min = 0.01, max = 10) loft_height = FloatProperty(name = "Height", description = "Manipulates the shape of the Ring", - default = 2, min = 0.01, max = 10.0) + default = 2, min = 0.01, max = 10.0) -###################Prism +###################Prism prism_n = IntProperty(name = "Sides", description = "Number of sides", default = 5, min = 3, max = 720) @@ -2027,7 +2027,7 @@ class RenderPovSettingsObject(PropertyGroup): ##################Isosurface iso_function_text = StringProperty(name="Function Text",maxlen=1024)#,update=iso_props_update_callback) - + ##################PolygonToCircle polytocircle_resolution = IntProperty(name = "Resolution", description = "", @@ -2044,12 +2044,12 @@ class RenderPovSettingsObject(PropertyGroup): #################Avogadro # filename_ext = ".png" - + # filter_glob = StringProperty( # default="*.exr;*.gif;*.hdr;*.iff;*.jpeg;*.jpg;*.pgm;*.png;*.pot;*.ppm;*.sys;*.tga;*.tiff;*.EXR;*.GIF;*.HDR;*.IFF;*.JPEG;*.JPG;*.PGM;*.PNG;*.POT;*.PPM;*.SYS;*.TGA;*.TIFF", # options={'HIDDEN'}, # ) - + ############################################################################### # Camera POV properties. ############################################################################### @@ -2094,19 +2094,19 @@ class RenderPovSettingsCamera(PropertyGroup): normal_patterns = EnumProperty( name="Pattern", description="", - items=(('agate', "Agate", ""), ('boxed', "Boxed", ""), ('bumps', "Bumps", ""), ('cells', "Cells", ""), + items=(('agate', "Agate", ""), ('boxed', "Boxed", ""), ('bumps', "Bumps", ""), ('cells', "Cells", ""), ('crackle', "Crackle", ""),('dents', "Dents", ""), ('granite', "Granite", ""), ('leopard', "Leopard", ""), - ('marble', "Marble", ""), ('onion', "Onion", ""), ('pavement', "Pavement", ""), ('planar', "Planar", ""), + ('marble', "Marble", ""), ('onion', "Onion", ""), ('pavement', "Pavement", ""), ('planar', "Planar", ""), ('quilted', "Quilted", ""), ('ripples', "Ripples", ""), ('radial', "Radial", ""), - ('spherical', "Spherical", ""),('spiral1', "Spiral1", ""), ('spiral2', "Spiral2", ""), ('spotted', "Spotted", ""), + ('spherical', "Spherical", ""),('spiral1', "Spiral1", ""), ('spiral2', "Spiral2", ""), ('spotted', "Spotted", ""), ('square', "Square", ""),('tiling', "Tiling", ""), ('waves', "Waves", ""), ('wood', "Wood", ""),('wrinkles', "Wrinkles", "")), default='agate') turbulence = FloatProperty(name="Turbulence", min=0.0, max=100.0, default=0.1) scale = FloatProperty(name="Scale", min=0.0,default=1.0) - + ##################################CustomPOV Code############################ # Only DUMMIES below for now: replacement_text = StringProperty( @@ -2116,7 +2116,7 @@ class RenderPovSettingsCamera(PropertyGroup): default="") - + ############################################################################### # Text POV properties. ############################################################################### @@ -2141,7 +2141,7 @@ class PovrayPreferences(AddonPreferences): ('uberpov', 'Unofficial UberPOV', '', 'PLUGIN', 1)), default='povray' ) - + filepath_povray = StringProperty( name="Binary Location", description="Path to renderer executable", @@ -2161,7 +2161,7 @@ class PovrayPreferences(AddonPreferences): - + def register(): bpy.utils.register_module(__name__) @@ -2169,18 +2169,18 @@ def register(): bpy.types.INFO_MT_file_import.append(ui.menu_func_import) #used for parametric objects: addon_utils.enable("add_mesh_extra_objects", default_set=False, persistent=True) - + #bpy.types.TEXTURE_PT_context_texture.prepend(TEXTURE_PT_povray_type) - + bpy.types.NODE_HT_header.append(ui.menu_func_nodes) - nodeitems_utils.register_node_categories("POVRAYNODES", node_categories) + nodeitems_utils.register_node_categories("POVRAYNODES", node_categories) bpy.types.Scene.pov = PointerProperty(type=RenderPovSettingsScene) bpy.types.Material.pov = PointerProperty(type=RenderPovSettingsMaterial) bpy.types.Texture.pov = PointerProperty(type=RenderPovSettingsTexture) bpy.types.Object.pov = PointerProperty(type=RenderPovSettingsObject) bpy.types.Camera.pov = PointerProperty(type=RenderPovSettingsCamera) bpy.types.Text.pov = PointerProperty(type=RenderPovSettingsText) - + def unregister(): @@ -2192,7 +2192,7 @@ def unregister(): del bpy.types.Text.pov nodeitems_utils.unregister_node_categories("POVRAYNODES") bpy.types.NODE_HT_header.remove(ui.menu_func_nodes) - + #bpy.types.TEXTURE_PT_context_texture.remove(TEXTURE_PT_povray_type) addon_utils.disable("add_mesh_extra_objects", default_set=False) bpy.types.INFO_MT_file_import.remove(ui.menu_func_import) diff --git a/render_povray/nodes.py b/render_povray/nodes.py index 41b0caf1..bf6df14a 100644 --- a/render_povray/nodes.py +++ b/render_povray/nodes.py @@ -36,8 +36,8 @@ from bpy.props import ( -############### object - +############### object + class ObjectNodeTree(bpy.types.NodeTree): '''Povray Material Nodes''' @@ -305,7 +305,7 @@ class PovrayMappingNode(Node, ObjectNodeTree): name="Distance exponent", description="Distance exponent", min=0.0, max=100.0, default=1.0) - + warp_tor_major_radius = FloatProperty( name="Major radius", description="Torus is distance from major radius", @@ -357,7 +357,7 @@ class PovrayMultiplyNode(Node, ObjectNodeTree): name="Z", description="Number of repeats", min=1.0, max=10000.0, default=1.0) - + def init(self, context): self.outputs.new('NodeSocketVector', "Amount") @@ -737,12 +737,12 @@ class ShaderPatternNode(Node, ObjectNodeTree): spiral_arms = FloatProperty( name="Number", description="", - min=0.0, max=256.0, default=2.0) + min=0.0, max=256.0, default=2.0) tiling_number = IntProperty( name="Number", description="", - min=1, max=27, default=1) + min=1, max=27, default=1) gradient_orient = EnumProperty( name="Orient", @@ -750,7 +750,7 @@ class ShaderPatternNode(Node, ObjectNodeTree): items=(('x', "X", ""), ('y', "Y", ""), ('z', "Z", "")), - default='x') + default='x') def init(self, context): @@ -788,17 +788,17 @@ class ShaderTextureMapNode(Node, ObjectNodeTree): brick_size_x = FloatProperty( name="X", description="", - min=0.0000, max=1.0000, default=0.2500) + min=0.0000, max=1.0000, default=0.2500) brick_size_y = FloatProperty( name="Y", description="", min=0.0000, max=1.0000, default=0.0525) - + brick_size_z = FloatProperty( name="Z", description="", - min=0.0000, max=1.0000, default=0.1250) + min=0.0000, max=1.0000, default=0.1250) brick_mortar = FloatProperty( name="Mortar", @@ -850,17 +850,17 @@ class ShaderNormalMapNode(Node, ObjectNodeTree): brick_size_x = FloatProperty( name="X", description="", - min=0.0000, max=1.0000, default=0.2500) + min=0.0000, max=1.0000, default=0.2500) brick_size_y = FloatProperty( name="Y", description="", min=0.0000, max=1.0000, default=0.0525) - + brick_size_z = FloatProperty( name="Z", description="", - min=0.0000, max=1.0000, default=0.1250) + min=0.0000, max=1.0000, default=0.1250) brick_mortar = FloatProperty( name="Mortar", @@ -878,7 +878,7 @@ class ShaderNormalMapNode(Node, ObjectNodeTree): def draw_buttons(self, context, layout): #for i, inp in enumerate(self.inputs): - + if self.inputs[0].default_value =='brick': layout.prop(self, "brick_mortar") layout.label("Brick size:") @@ -1015,7 +1015,7 @@ class TextureOutputNode(Node, TextureNodeTree): #################################Operators######################################## ################################################################################## - + class NODE_OT_iso_add(bpy.types.Operator): bl_idname = "pov.nodeisoadd" bl_label = "Create iso props" @@ -1088,7 +1088,7 @@ class NODE_OT_povray_node_output_add(bpy.types.Operator): def execute(self, context): tree=bpy.context.object.active_material.node_tree - tmap = tree.nodes.new('ShaderNodeOutputMaterial') + tmap = tree.nodes.new('ShaderNodeOutputMaterial') bpy.context.object.active_material.node_tree.nodes.active=tmap for inp in tmap.inputs: tmap.inputs.remove(inp) @@ -1249,7 +1249,7 @@ class PovrayPatternNode(bpy.types.Operator): def invoke(self, context, event): context.window_manager.modal_handler_add(self) return {'RUNNING_MODAL'} - + class UpdatePreviewMaterial(bpy.types.Operator): '''Operator update preview material''' bl_idname = "node.updatepreview" @@ -1294,6 +1294,5 @@ class UpdatePreviewKey(bpy.types.Operator): mapstr = "Node Editor" map = conf.keymaps[mapstr] map.keymap_items.new("node.updatepreview",type='RIGHTMOUSE',value="PRESS") - return {'FINISHED'} - -
\ No newline at end of file + return {'FINISHED'} + diff --git a/render_povray/primitives.py b/render_povray/primitives.py index 1a9eea8a..f76a41ee 100644 --- a/render_povray/primitives.py +++ b/render_povray/primitives.py @@ -41,7 +41,7 @@ from bpy.props import ( from mathutils import ( Vector, ) - + #import collections def pov_define_mesh(mesh, verts, edges, faces, name, hide_geometry=True): @@ -71,7 +71,7 @@ class POVRAY_OT_lathe_add(bpy.types.Operator): rotation=(0, 0, 0), layers=layers) ob=context.scene.objects.active ob.name = ob.data.name = "PovLathe" - ob.pov.object_as='LATHE' + ob.pov.object_as='LATHE' bpy.ops.object.mode_set(mode='EDIT') self.report({'INFO'}, "This native POV-Ray primitive " "won't have any vertex to show in edit mode") @@ -84,7 +84,7 @@ class POVRAY_OT_lathe_add(bpy.types.Operator): return {'FINISHED'} - + def pov_superellipsoid_define(context, op, ob): if op: @@ -97,7 +97,7 @@ def pov_superellipsoid_define(context, op, ob): edit = op.se_edit se_param1 = n2 # op.se_param1 se_param2 = n1 # op.se_param2 - + else: assert(ob) mesh = ob.data @@ -109,10 +109,10 @@ def pov_superellipsoid_define(context, op, ob): edit = ob.pov.se_edit se_param1 = ob.pov.se_param1 se_param2 = ob.pov.se_param2 - + verts = [] r=1 - + stepSegment=360/v*pi/180 stepRing=pi/u angSegment=0 @@ -142,9 +142,9 @@ def pov_superellipsoid_define(context, op, ob): if edit == 'TRIANGLES': verts.append((0,0,1)) verts.append((0,0,-1)) - + faces = [] - + for i in range(0,u-2): m=i*v for p in range(0,v): @@ -192,17 +192,17 @@ def pov_superellipsoid_define(context, op, ob): ob.pov.object_as = 'SUPERELLIPSOID' ob.pov.se_param1 = n2 ob.pov.se_param2 = n1 - + ob.pov.se_u = u ob.pov.se_v = v - ob.pov.se_n1 = n1 + ob.pov.se_n1 = n1 ob.pov.se_n2 = n2 - ob.pov.se_edit = edit + ob.pov.se_edit = edit bpy.ops.object.mode_set(mode="EDIT") bpy.ops.mesh.hide(unselected=False) bpy.ops.object.mode_set(mode="OBJECT") - + class POVRAY_OT_superellipsoid_add(bpy.types.Operator): bl_idname = "pov.addsuperellipsoid" bl_label = "Add SuperEllipsoid" @@ -221,7 +221,7 @@ class POVRAY_OT_superellipsoid_add(bpy.types.Operator): name="Parameter 2", description="", min=0.00, max=10.0, default=0.04) - + se_u = IntProperty(name = "U-segments", description = "radial segmentation", default = 20, min = 4, max = 265) @@ -245,11 +245,11 @@ class POVRAY_OT_superellipsoid_add(bpy.types.Operator): def poll(cls, context): engine = context.scene.render.engine return (engine in cls.COMPAT_ENGINES) - + def execute(self,context): pov_superellipsoid_define(context, self, None) - self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode") + self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode") return {'FINISHED'} @@ -328,7 +328,7 @@ def power(a,b): if a < 0: return -((-a)**b) return a**b - + def supertoroid(R,r,u,v,n1,n2): a = 2*pi/u b = 2*pi/v @@ -348,7 +348,7 @@ def supertoroid(R,r,u,v,n1,n2): faces.extend(f) return verts, faces -def pov_supertorus_define(context, op, ob): +def pov_supertorus_define(context, op, ob): if op: mesh = None st_R = op.st_R @@ -371,7 +371,7 @@ def pov_supertorus_define(context, op, ob): st_n2 = ob.pov.st_cross st_ie = ob.pov.st_ie st_edit = ob.pov.st_edit - + if st_ie: rad1 = (st_R+st_r)/2 rad2 = (st_R-st_r)/2 @@ -402,14 +402,14 @@ def pov_supertorus_define(context, op, ob): ob.pov.st_cross = st_n2 ob.pov.st_ie = st_ie ob.pov.st_edit = st_edit - + class POVRAY_OT_supertorus_add(bpy.types.Operator): bl_idname = "pov.addsupertorus" bl_label = "Add Supertorus" bl_description = "Create a SuperTorus" bl_options = {'REGISTER', 'UNDO'} - COMPAT_ENGINES = {'POVRAY_RENDER'} - + COMPAT_ENGINES = {'POVRAY_RENDER'} + st_R = FloatProperty(name = "big radius", description = "The radius inside the tube", default = 1.0, min = 0.01, max = 100.0) @@ -434,7 +434,7 @@ class POVRAY_OT_supertorus_add(bpy.types.Operator): st_edit = BoolProperty(name="", description="", default=False, - options={'HIDDEN'}) + options={'HIDDEN'}) @classmethod def poll(cls, context): @@ -444,8 +444,8 @@ class POVRAY_OT_supertorus_add(bpy.types.Operator): def execute(self, context): pov_supertorus_define(context, self, None) - self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode") - return {'FINISHED'} + self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode") + return {'FINISHED'} class POVRAY_OT_supertorus_update(bpy.types.Operator): bl_idname = "pov.supertorus_update" @@ -477,7 +477,7 @@ class POVRAY_OT_loft_add(bpy.types.Operator): bl_description = "Create a Curve data for Meshmaker" bl_options = {'REGISTER', 'UNDO'} COMPAT_ENGINES = {'POVRAY_RENDER'} - + loft_n = IntProperty(name = "Segments", description = "Vertical segments", default = 16, min = 3, max = 720) @@ -498,7 +498,7 @@ class POVRAY_OT_loft_add(bpy.types.Operator): default = 2, min = 0.01, max = 10.0) def execute(self,context): - + props = self.properties loftData = bpy.data.curves.new('Loft', type='CURVE') loftData.dimensions = '3D' @@ -605,7 +605,7 @@ class POVRAY_OT_plane_add(bpy.types.Operator): bpy.ops.object.shade_smooth() ob.pov.object_as = "PLANE" return {'FINISHED'} - + class POVRAY_OT_box_add(bpy.types.Operator): bl_idname = "pov.addbox" bl_label = "Box" @@ -668,22 +668,22 @@ class POVRAY_OT_cylinder_add(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} # XXX Keep it in sync with __init__'s cylinder Primitive - R = FloatProperty(name="Cylinder radius", min=0.00, max=10.0, default=1.0) + R = FloatProperty(name="Cylinder radius", min=0.00, max=10.0, default=1.0) imported_cyl_loc = FloatVectorProperty( name="Imported Pov base location", - precision=6, - default=(0.0, 0.0, 0.0)) + precision=6, + default=(0.0, 0.0, 0.0)) imported_cyl_loc_cap = FloatVectorProperty( name="Imported Pov cap location", - precision=6, + precision=6, default=(0.0, 0.0, 2.0)) def execute(self,context): props = self.properties R = props.R - ob = context.object + ob = context.object layers = 20*[False] layers[0] = True if ob: @@ -699,7 +699,7 @@ class POVRAY_OT_cylinder_add(bpy.types.Operator): LOC = props.imported_cyl_loc LOC_CAP = props.imported_cyl_loc_cap self.report({'INFO'}, "This native POV-Ray primitive " - "won't have any vertex to show in edit mode") + "won't have any vertex to show in edit mode") pov_cylinder_define(context, self, None, self.R, LOC, LOC_CAP) @@ -743,7 +743,7 @@ def pov_sphere_define(context, op, ob, loc): obrot = ob.rotation_euler #obloc = ob.location obscale = ob.scale - + bpy.ops.object.mode_set(mode="EDIT") bpy.ops.mesh.reveal() bpy.ops.mesh.select_all(action='SELECT') @@ -752,8 +752,8 @@ def pov_sphere_define(context, op, ob, loc): #bpy.ops.transform.rotate(axis=obrot,constraint_orientation='GLOBAL') bpy.ops.transform.resize(value=obscale) #bpy.ops.transform.rotate(axis=obrot, proportional_size=1) - - + + bpy.ops.mesh.hide(unselected=False) bpy.ops.object.mode_set(mode="OBJECT") bpy.ops.object.shade_smooth() @@ -776,35 +776,35 @@ class POVRAY_OT_sphere_add(bpy.types.Operator): bl_options = {'REGISTER', 'UNDO'} # XXX Keep it in sync with __init__'s torus Primitive - R = FloatProperty(name="Sphere radius",min=0.00, max=10.0, default=0.5) - + R = FloatProperty(name="Sphere radius",min=0.00, max=10.0, default=0.5) + imported_loc = FloatVectorProperty( name="Imported Pov location", - precision=6, + precision=6, default=(0.0, 0.0, 0.0)) - + def execute(self,context): props = self.properties R = props.R ob = context.object - - - + + + if ob: if ob.pov.imported_loc: LOC = ob.pov.imported_loc else: if not props.imported_loc: LOC = bpy.context.scene.cursor_location - + else: - LOC = props.imported_loc + LOC = props.imported_loc self.report({'INFO'}, "This native POV-Ray primitive " - "won't have any vertex to show in edit mode") + "won't have any vertex to show in edit mode") pov_sphere_define(context, self, None, LOC) return {'FINISHED'} - + # def execute(self,context): # layers = 20*[False] # layers[0] = True @@ -837,9 +837,9 @@ class POVRAY_OT_sphere_update(bpy.types.Operator): pov_sphere_define(context, None, context.object,context.object.location) - return {'FINISHED'} + return {'FINISHED'} + - ####################################CONE####################################### def pov_cone_define(context, op, ob): verts = [] @@ -856,7 +856,7 @@ def pov_cone_define(context, op, ob): base = ob.pov.cone_base_radius cap = ob.pov.cone_cap_radius seg = ob.pov.cone_segments - height = ob.pov.cone_height + height = ob.pov.cone_height zc = height / 2 zb = -zc @@ -931,7 +931,7 @@ class POVRAY_OT_cone_add(bpy.types.Operator): def execute(self, context): pov_cone_define(context, self, None) - self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode") + self.report({'INFO'}, "This native POV-Ray primitive won't have any vertex to show in edit mode") return {'FINISHED'} @@ -1038,27 +1038,27 @@ class POVRAY_OT_blob_add(bpy.types.Operator): ob = context.object ob.name = "Blob" return {'FINISHED'} - -class POVRAY_OT_rainbow_add(bpy.types.Operator): + +class POVRAY_OT_rainbow_add(bpy.types.Operator): bl_idname = "pov.addrainbow" bl_label = "Rainbow" bl_description = "Add Rainbow" bl_options = {'REGISTER', 'UNDO'} - + def execute(self,context): cam = context.scene.camera - bpy.ops.object.lamp_add(type='SPOT', radius=1) + bpy.ops.object.lamp_add(type='SPOT', radius=1) ob = context.object ob.data.show_cone = False ob.data.spot_blend = 0.5 - ob.data.shadow_buffer_clip_end = 0 + ob.data.shadow_buffer_clip_end = 0 ob.data.shadow_buffer_clip_start = 4*cam.location.length ob.data.distance = cam.location.length - ob.data.energy = 0 + ob.data.energy = 0 ob.name = ob.data.name = "PovRainbow" ob.pov.object_as = "RAINBOW" - + #obj = context.object bpy.ops.object.constraint_add(type='DAMPED_TRACK') @@ -1071,7 +1071,7 @@ class POVRAY_OT_rainbow_add(bpy.types.Operator): #refocus on the actual rainbow bpy.context.scene.objects.active = ob ob.select=True - + return {'FINISHED'} class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper): @@ -1079,10 +1079,10 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper): bl_label = "Height Field" bl_description = "Add Height Field " bl_options = {'REGISTER', 'UNDO'} - + # XXX Keep it in sync with __init__'s hf Primitive # filename_ext = ".png" - + # filter_glob = StringProperty( # default="*.exr;*.gif;*.hdr;*.iff;*.jpeg;*.jpg;*.pgm;*.png;*.pot;*.ppm;*.sys;*.tga;*.tiff;*.EXR;*.GIF;*.HDR;*.IFF;*.JPEG;*.JPG;*.PGM;*.PNG;*.POT;*.PPM;*.SYS;*.TGA;*.TIFF", # options={'HIDDEN'}, @@ -1091,7 +1091,7 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper): description = "", default = 100, min = 1, max = 100) hf_filename = StringProperty(maxlen = 1024) - + hf_gamma = FloatProperty( name="Gamma", description="Gamma", @@ -1141,12 +1141,12 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper): bpy.ops.object.mode_set(mode="EDIT") bpy.ops.mesh.noise(factor=1) bpy.ops.object.mode_set(mode="OBJECT") - - #needs a loop to select by index? + + #needs a loop to select by index? #bpy.ops.object.material_slot_remove() #material just left there for now - - + + mat.texture_slots.clear(-1) bpy.ops.object.mode_set(mode="EDIT") bpy.ops.mesh.hide(unselected=False) @@ -1154,8 +1154,8 @@ class POVRAY_OT_height_field_add(bpy.types.Operator, ImportHelper): ob.pov.object_as = 'HEIGHT_FIELD' ob.pov.hf_filename = impath return {'FINISHED'} - - + + ############################TORUS############################################ def pov_torus_define(context, op, ob): if op: @@ -1169,21 +1169,21 @@ def pov_torus_define(context, op, ob): mis = ob.pov.torus_minor_segments mar = ob.pov.torus_major_radius mir = ob.pov.torus_minor_radius - + #keep object rotation and location for the add object operator obrot = ob.rotation_euler obloc = ob.location - + bpy.ops.object.mode_set(mode="EDIT") bpy.ops.mesh.reveal() bpy.ops.mesh.select_all(action='SELECT') bpy.ops.mesh.delete(type='VERT') bpy.ops.mesh.primitive_torus_add(rotation = obrot, location = obloc, major_segments=mas, minor_segments=mis,major_radius=mar, minor_radius=mir) - + bpy.ops.mesh.hide(unselected=False) bpy.ops.object.mode_set(mode="OBJECT") - + if not ob: bpy.ops.mesh.primitive_torus_add(major_segments=mas, minor_segments=mis,major_radius=mar, minor_radius=mir) @@ -1197,13 +1197,13 @@ def pov_torus_define(context, op, ob): bpy.ops.object.mode_set(mode="EDIT") bpy.ops.mesh.hide(unselected=False) bpy.ops.object.mode_set(mode="OBJECT") - + class POVRAY_OT_torus_add(bpy.types.Operator): bl_idname = "pov.addtorus" bl_label = "Torus" bl_description = "Add Torus" bl_options = {'REGISTER', 'UNDO'} - + # XXX Keep it in sync with __init__'s torus Primitive mas = IntProperty(name = "Major Segments", description = "", @@ -1246,8 +1246,8 @@ class POVRAY_OT_torus_update(bpy.types.Operator): pov_torus_define(context, None, context.object) - return {'FINISHED'} - + return {'FINISHED'} + ################################################################################### @@ -1256,7 +1256,7 @@ class POVRAY_OT_prism_add(bpy.types.Operator): bl_label = "Prism" bl_description = "Create Prism" bl_options = {'REGISTER', 'UNDO'} - + prism_n = IntProperty(name = "Sides", description = "Number of sides", default = 5, min = 3, max = 720) @@ -1264,7 +1264,7 @@ class POVRAY_OT_prism_add(bpy.types.Operator): description = "Radius", default = 1.0) def execute(self,context): - + props = self.properties loftData = bpy.data.curves.new('Prism', type='CURVE') loftData.dimensions = '2D' @@ -1296,9 +1296,9 @@ class POVRAY_OT_prism_add(bpy.types.Operator): ob.pov.curveshape = "prism" ob.name = ob.data.name = "Prism" return {'FINISHED'} - + ##############################PARAMETRIC###################################### -def pov_parametric_define(context, op, ob): +def pov_parametric_define(context, op, ob): if op: u_min = op.u_min u_max = op.u_max @@ -1317,7 +1317,7 @@ def pov_parametric_define(context, op, ob): x_eq = ob.pov.x_eq y_eq = ob.pov.y_eq z_eq = ob.pov.z_eq - + #keep object rotation and location for the updated object obloc = ob.location obrot = ob.rotation_euler # In radians @@ -1325,7 +1325,7 @@ def pov_parametric_define(context, op, ob): #in case cursor has moved curloc = bpy.context.scene.cursor_location - + bpy.ops.object.mode_set(mode="EDIT") bpy.ops.mesh.reveal() bpy.ops.mesh.select_all(action='SELECT') @@ -1335,7 +1335,7 @@ def pov_parametric_define(context, op, ob): #extra work: bpy.ops.transform.translate(value=(obloc-curloc), proportional_size=1) bpy.ops.transform.rotate(axis=obrot, proportional_size=1) - + bpy.ops.mesh.hide(unselected=False) bpy.ops.object.mode_set(mode="OBJECT") @@ -1345,7 +1345,7 @@ def pov_parametric_define(context, op, ob): ob = context.object ob.name = ob.data.name = "PovParametric" ob.pov.object_as = "PARAMETRIC" - + ob.pov.u_min = u_min ob.pov.u_max = u_max ob.pov.v_min = v_min @@ -1382,7 +1382,7 @@ class POVRAY_OT_parametric_add(bpy.types.Operator): maxlen=1024, default = "sin(u)*sin(v/8)+cos(v/8)*1.5") z_eq = StringProperty( maxlen=1024, default = "sin(v)*(1+cos(u))*sin(v/8)") - + def execute(self,context): props = self.properties u_min = props.u_min @@ -1392,7 +1392,7 @@ class POVRAY_OT_parametric_add(bpy.types.Operator): x_eq = props.x_eq y_eq = props.y_eq z_eq = props.z_eq - + pov_parametric_define(context, self, None) self.report({'INFO'}, "This native POV-Ray primitive " "won't have any vertex to show in edit mode") @@ -1423,7 +1423,7 @@ class POVRAY_OT_shape_polygon_to_circle_add(bpy.types.Operator): bl_description = "Add Polygon To Circle Blending Surface" bl_options = {'REGISTER', 'UNDO'} COMPAT_ENGINES = {'POVRAY_RENDER'} - + # XXX Keep it in sync with __init__'s polytocircle properties polytocircle_resolution = IntProperty(name = "Resolution", description = "", @@ -1471,9 +1471,9 @@ class POVRAY_OT_shape_polygon_to_circle_add(bpy.types.Operator): bpy.ops.mesh.hide(unselected=False) bpy.ops.object.mode_set(mode="OBJECT") return {'FINISHED'} - + #############################IMPORT - + class ImportPOV(bpy.types.Operator, ImportHelper): """Load Povray files""" bl_idname = "import_scene.pov" @@ -1485,17 +1485,17 @@ class ImportPOV(bpy.types.Operator, ImportHelper): # File props. files = CollectionProperty(type=bpy.types.OperatorFileListElement, options={'HIDDEN', 'SKIP_SAVE'}) directory = StringProperty(maxlen=1024, subtype='FILE_PATH', options={'HIDDEN', 'SKIP_SAVE'}) - + filename_ext = {".pov",".inc"} filter_glob = StringProperty( default="*.pov;*.inc", options={'HIDDEN'}, ) - + import_at_cur = BoolProperty(name="Import at Cursor Location", description = "Ignore Object Matrix", default=False) - + def execute(self, context): from mathutils import Matrix verts = [] @@ -1517,7 +1517,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper): cylinder_search = False sphere_search = False cone_search = False - tex_search = False ################## + tex_search = False ################## cache = [] matrixes = {} writematrix = False @@ -1529,30 +1529,30 @@ class ImportPOV(bpy.types.Operator, ImportHelper): r = g = b = 0.5 f = t = 0 color = None - + for item, value in enumerate(cache): - + if value == 'texture': pass - + if value == 'pigment': - + if cache[item+2] in {'rgb','srgb'}: pass - + elif cache[item+2] in {'rgbf','srgbf'}: pass - + elif cache[item+2] in {'rgbt','srgbt'}: try: r,g,b,t = float(cache[item+3]),float(cache[item+4]),float(cache[item+5]),float(cache[item+6]) except: r = g = b = t = float(cache[item+2]) color = (r,g,b,t) - + elif cache[item+2] in {'rgbft','srgbft'}: pass - + else: pass @@ -1627,11 +1627,11 @@ class ImportPOV(bpy.types.Operator, ImportHelper): ob = context.object ob.location = (x0,y0,z0) #ob.scale = (r,r,r) - mat_search(cache) + mat_search(cache) except (ValueError): pass cache = [] - cone_search = False + cone_search = False if word == 'plane': plane_search = True name_search = False @@ -1641,11 +1641,11 @@ class ImportPOV(bpy.types.Operator, ImportHelper): try: bpy.ops.pov.addplane() ob = context.object - mat_search(cache) + mat_search(cache) except (ValueError): pass cache = [] - plane_search = False + plane_search = False if word == 'box': box_search = True name_search = False @@ -1665,12 +1665,12 @@ class ImportPOV(bpy.types.Operator, ImportHelper): bpy.ops.pov.addbox() ob = context.object ob.location = center - mat_search(cache) + mat_search(cache) except (ValueError): pass cache = [] - box_search = False + box_search = False if word == 'cylinder': cylinder_search = True name_search = False @@ -1689,28 +1689,28 @@ class ImportPOV(bpy.types.Operator, ImportHelper): r = float(cache[8]) - + vec = Vector(imported_cyl_loc_cap ) - Vector(imported_cyl_loc) depth = vec.length rot = Vector((0, 0, 1)).rotation_difference(vec) # Rotation from Z axis. - trans = rot * Vector((0, 0, depth / 2)) # Such that origin is at center of the base of the cylinder. + trans = rot * Vector((0, 0, depth / 2)) # Such that origin is at center of the base of the cylinder. #center = ((x0 + x1)/2,(y0 + y1)/2,(z0 + z1)/2) scaleZ = sqrt((x1-x0)**2+(y1-y0)**2+(z1-z0)**2)/2 bpy.ops.pov.addcylinder(R=r, imported_cyl_loc=imported_cyl_loc, imported_cyl_loc_cap=imported_cyl_loc_cap) ob = context.object ob.location = (x0, y0, z0) ob.rotation_euler = rot.to_euler() - ob.scale = (1,1,scaleZ) - + ob.scale = (1,1,scaleZ) + #scale data rather than obj? # bpy.ops.object.mode_set(mode='EDIT') # bpy.ops.mesh.reveal() # bpy.ops.mesh.select_all(action='SELECT') # bpy.ops.transform.resize(value=(1,1,scaleZ), constraint_orientation='LOCAL') # bpy.ops.mesh.hide(unselected=False) - # bpy.ops.object.mode_set(mode='OBJECT') - - mat_search(cache) + # bpy.ops.object.mode_set(mode='OBJECT') + + mat_search(cache) except (ValueError): pass @@ -1741,7 +1741,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper): mat_search(cache) cache = [] sphere_search = False -##################End Primitives Import################## +##################End Primitives Import################## if word == '#declare': name_search = True if name_search: @@ -1757,9 +1757,9 @@ class ImportPOV(bpy.types.Operator, ImportHelper): name_search = False cache = [] if word == 'vertex_vectors': - verts_search = True + verts_search = True if verts_search: - cache.append(word) + cache.append(word) if word == '}': verts_search = False lenverts=cache[2] @@ -1772,7 +1772,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper): y=(i*3)+1 z=(i*3)+2 verts.append((float(cache[x]),float(cache[y]),float(cache[z]))) - cache = [] + cache = [] #if word == 'face_indices': #faces_search = True if word == 'texture_list': ######## @@ -1784,7 +1784,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper): tex_search = False ################ faces_search = True if faces_search: - cache.append(word) + cache.append(word) if word == '}': faces_search = False lenfaces = cache[2] @@ -1816,7 +1816,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper): m2=i*6+5 materials.append((int(cache[m0]),int(cache[m1]),int(cache[m2]))) faces.append((int(cache[v0]),int(cache[v1]),int(cache[v2]))) - #mesh = pov_define_mesh(None, verts, [], faces, name, hide_geometry=False) + #mesh = pov_define_mesh(None, verts, [], faces, name, hide_geometry=False) #ob_base = object_utils.object_data_add(context, mesh, operator=None) #ob = ob_base.object @@ -1830,7 +1830,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper): for mName in povMats: ##################### if mName not in blendMats: ########### povMat = bpy.data.materials.new(mName) ################# - mat_search(cache) + mat_search(cache) ob.data.materials.append(bpy.data.materials[mName]) ################### if materials: ################## for i,val in enumerate(materials): #################### @@ -1849,43 +1849,43 @@ class ImportPOV(bpy.types.Operator, ImportHelper): ob = bpy.context.object matrix=ob.matrix_world v=matrixes[name] - matrix[0][0] = v[0] - matrix[1][0] = v[1] - matrix[2][0] = v[2] - matrix[0][1] = v[3] - matrix[1][1] = v[4] - matrix[2][1] = v[5] - matrix[0][2] = v[6] - matrix[1][2] = v[7] - matrix[2][2] = v[8] - matrix[0][3] = v[9] - matrix[1][3] = v[10] - matrix[2][3] = v[11] + matrix[0][0] = v[0] + matrix[1][0] = v[1] + matrix[2][0] = v[2] + matrix[0][1] = v[3] + matrix[1][1] = v[4] + matrix[2][1] = v[5] + matrix[0][2] = v[6] + matrix[1][2] = v[7] + matrix[2][2] = v[8] + matrix[0][3] = v[9] + matrix[1][3] = v[10] + matrix[2][3] = v[11] matrix = global_matrix*ob.matrix_world ob.matrix_world = matrix verts = [] faces = [] - + # if word == 'pigment': # try: # #all indices have been incremented once to fit a bad test file # r,g,b,t = float(S[2]),float(S[3]),float(S[4]),float(S[5]) - # color = (r,g,b,t) + # color = (r,g,b,t) # except (IndexError): # #all indices have been incremented once to fit alternate test file # r,g,b,t = float(S[3]),float(S[4]),float(S[5]),float(S[6]) - # color = (r,g,b,t) + # color = (r,g,b,t) # except UnboundLocalError: # # In case no transmit is specified ? put it to 0 # r,g,b,t = float(S[2]),float(S[3]),float(S[4],0) # color = (r,g,b,t) - + # except (ValueError): # color = (0.8,0.8,0.8,0) # pass - + # if colors == [] or (colors != [] and color not in colors): # colors.append(color) # name = ob.name+"_mat" @@ -1900,16 +1900,15 @@ class ImportPOV(bpy.types.Operator, ImportHelper): # else: # for i in range(len(colors)): # if color == colors[i]: - # ob.data.materials.append(bpy.data.materials[matNames[i]]) - - ##To keep Avogadro Camera angle: + # ob.data.materials.append(bpy.data.materials[matNames[i]]) + + ##To keep Avogadro Camera angle: # for obj in bpy.context.scene.objects: # if obj.type == "CAMERA": # track = obj.constraints.new(type = "TRACK_TO") # track.target = ob # track.track_axis ="TRACK_NEGATIVE_Z" # track.up_axis = "UP_Y" - # obj.location = (0,0,0) - return {'FINISHED'} - -
\ No newline at end of file + # obj.location = (0,0,0) + return {'FINISHED'} + diff --git a/render_povray/render.py b/render_povray/render.py index 1a98bdc5..384ed73f 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -54,9 +54,9 @@ def imageFormat(imgF): }.get(os.path.splitext(imgF)[-1].upper(), "") if not ext: - #maybe add a check for if path exists here? + #maybe add a check for if path exists here? print(" WARNING: texture image has no extension") #too verbose - + ext = what(imgF) #imghdr is a python lib to identify image file types return ext @@ -66,7 +66,7 @@ def imgMap(ts): if ts.mapping == 'FLAT': image_map = "map_type 0 " elif ts.mapping == 'SPHERE': - image_map = "map_type 1 " + image_map = "map_type 1 " elif ts.mapping == 'TUBE': image_map = "map_type 2 " @@ -106,7 +106,7 @@ def imgMapTransforms(ts): 1.0 / ts.scale.z, 0.5-(0.5/ts.scale.x) - (ts.offset.x), 0.5-(0.5/ts.scale.y) - (ts.offset.y), - ts.offset.z)) + ts.offset.z)) # image_map_transforms = (" translate <-0.5,-0.5,0.0> scale <%.4g,%.4g,%.4g> translate <%.4g,%.4g,%.4g>" % \ # ( 1.0 / ts.scale.x, # 1.0 / ts.scale.y, @@ -115,7 +115,7 @@ def imgMapTransforms(ts): # (0.5 / ts.scale.y) + ts.offset.y, # ts.offset.z)) # image_map_transforms = ("translate <-0.5,-0.5,0> scale <-1,-1,1> * <%.4g,%.4g,%.4g> translate <0.5,0.5,0> + <%.4g,%.4g,%.4g>" % \ - # (1.0 / ts.scale.x, + # (1.0 / ts.scale.x, # 1.0 / ts.scale.y, # 1.0 / ts.scale.z, # ts.offset.x, @@ -145,11 +145,11 @@ def imgMapBG(wts): #if image_mapBG == "": # print(" No background texture image found ") return image_mapBG - - + + def path_image(image): return bpy.path.abspath(image.filepath, library=image.library).replace("\\","/") - # .replace("\\","/") to get only forward slashes as it's what POV prefers, + # .replace("\\","/") to get only forward slashes as it's what POV prefers, # even on windows # end find image texture # ----------------------------------------------------------------------------- @@ -211,16 +211,16 @@ def write_global_setting(scene,file): file.write(" ambient_light <%.6f,%.6f,%.6f>\n"%scene.pov.ambient_light[:]) file.write(" irid_wavelength <%.6f,%.6f,%.6f>\n"%scene.pov.irid_wavelength[:]) file.write(" charset %s\n"%scene.pov.charset) - file.write(" max_trace_level %s\n"%scene.pov.max_trace_level) + file.write(" max_trace_level %s\n"%scene.pov.max_trace_level) file.write(" max_intersections %s\n"%scene.pov.max_intersections) file.write(" number_of_waves %s\n"%scene.pov.number_of_waves) - file.write(" noise_generator %s\n"%scene.pov.noise_generator) + file.write(" noise_generator %s\n"%scene.pov.noise_generator) - # below properties not added to __init__ yet to avoid conflicts with material sss scale + # below properties not added to __init__ yet to avoid conflicts with material sss scale # unless it would override then should be interfaced also in scene units property tab # if scene.pov.sslt_enable: - # file.write(" mm_per_unit %s\n"%scene.pov.mm_per_unit) + # file.write(" mm_per_unit %s\n"%scene.pov.mm_per_unit) # file.write(" subsurface {\n") # file.write(" samples %s, %s\n"%(scene.pov.sslt_samples_max,scene.pov.sslt_samples_min)) # if scene.pov.sslt_radiosity: @@ -229,24 +229,24 @@ def write_global_setting(scene,file): if scene.pov.radio_enable: file.write(" radiosity {\n") - file.write(" pretrace_start %.6f\n"%scene.pov.radio_pretrace_start) - file.write(" pretrace_end %.6f\n"%scene.pov.radio_pretrace_end) - file.write(" count %s\n"%scene.pov.radio_count) - file.write(" nearest_count %s\n"%scene.pov.radio_nearest_count) - file.write(" error_bound %.6f\n"%scene.pov.radio_error_bound) - file.write(" recursion_limit %s\n"%scene.pov.radio_recursion_limit) - file.write(" low_error_factor %.6f\n"%scene.pov.radio_low_error_factor) - file.write(" gray_threshold %.6f\n"%scene.pov.radio_gray_threshold) - file.write(" maximum_reuse %.6f\n"%scene.pov.radio_maximum_reuse) - file.write(" minimum_reuse %.6f\n"%scene.pov.radio_minimum_reuse) - file.write(" brightness %.6f\n"%scene.pov.radio_brightness) + file.write(" pretrace_start %.6f\n"%scene.pov.radio_pretrace_start) + file.write(" pretrace_end %.6f\n"%scene.pov.radio_pretrace_end) + file.write(" count %s\n"%scene.pov.radio_count) + file.write(" nearest_count %s\n"%scene.pov.radio_nearest_count) + file.write(" error_bound %.6f\n"%scene.pov.radio_error_bound) + file.write(" recursion_limit %s\n"%scene.pov.radio_recursion_limit) + file.write(" low_error_factor %.6f\n"%scene.pov.radio_low_error_factor) + file.write(" gray_threshold %.6f\n"%scene.pov.radio_gray_threshold) + file.write(" maximum_reuse %.6f\n"%scene.pov.radio_maximum_reuse) + file.write(" minimum_reuse %.6f\n"%scene.pov.radio_minimum_reuse) + file.write(" brightness %.6f\n"%scene.pov.radio_brightness) file.write(" adc_bailout %.6f\n"%scene.pov.radio_adc_bailout) if scene.pov.radio_normal: - file.write(" normal on\n") + file.write(" normal on\n") if scene.pov.radio_always_sample: - file.write(" always_sample on\n") + file.write(" always_sample on\n") if scene.pov.radio_media: - file.write(" media on\n") + file.write(" media on\n") if scene.pov.radio_subsurface: file.write(" subsurface on\n") file.write(" }\n") @@ -321,10 +321,10 @@ def write_object_modifiers(scene,ob,File): # File.write("ior %.4g\n"%ob.pov.object_ior) # if scene.pov.photon_enable and ob.pov.target and ob.pov.refraction and ob.pov.dispersion: # File.write("ior %.4g\n"%ob.pov.dispersion_value) - # File.write("ior %s\n"%ob.pov.dispersion_samples) + # File.write("ior %s\n"%ob.pov.dispersion_samples) # if scene.pov.photon_enable == False: # File.write("caustics %.4g\n"%ob.pov.fake_caustics_power) - + def write_pov(filename, scene=None, info_callback=None): @@ -349,7 +349,7 @@ def write_pov(filename, scene=None, info_callback=None): print("Unofficial UberPOV feature set chosen in preferences") else: print("Official POV-Ray 3.7 feature set chosen in preferences") - if 'uber' in pov_binary: + if 'uber' in pov_binary: print("The name of the binary suggests you are probably rendering with Uber POV engine") else: print("The name of the binary suggests you are probably rendering with standard POV engine") @@ -488,7 +488,7 @@ def write_pov(filename, scene=None, info_callback=None): materialNames = {} DEF_MAT_NAME = "" #or "Default"? - + def exportCamera(): camera = scene.camera @@ -541,9 +541,9 @@ def write_pov(filename, scene=None, info_callback=None): camera.data.pov.turbulence, camera.data.pov.scale)) tabWrite("}\n") - - + + def exportLamps(lamps): # Incremented after each lamp export to declare its target # currently used for Fresnel diffuse shader as their slope vector: @@ -666,35 +666,35 @@ def write_pov(filename, scene=None, info_callback=None): povdataname = ob.data.name #enough? angle = degrees(ob.data.spot_size/2.5) #radians in blender (2 width = ob.data.spot_blend *10 - distance = ob.data.shadow_buffer_clip_start + distance = ob.data.shadow_buffer_clip_start #eps=0.0000001 #angle = br/(cr+eps) * 10 #eps is small epsilon variable to avoid dividing by zero #width = ob.dimensions[2] #now let's say width of rainbow is the actual proxy height # formerly: #cz-bz # let's say width of the rainbow is height of the cone (interfacing choice - + # v(A,B) rotates vector A about origin by vector B. # and avoid a 0 length vector by adding 1 - + # file.write("#declare %s_Target= vrotate(<%.6g,%.6g,%.6g>,<%.4g,%.4g,%.4g>);\n" % \ # (povdataname, -(ob.location.x+0.1), -(ob.location.y+0.1), -(ob.location.z+0.1), - # ob.rotation_euler.x, ob.rotation_euler.y, ob.rotation_euler.z)) - + # ob.rotation_euler.x, ob.rotation_euler.y, ob.rotation_euler.z)) + direction = (ob.location.x,ob.location.y,ob.location.z) # not taking matrix into account rmatrix = global_matrix * ob.matrix_world - + #ob.rotation_euler.to_matrix().to_4x4() * mathutils.Vector((0,0,1)) # XXX Is result of the below offset by 90 degrees? - up =ob.matrix_world.to_3x3()[1].xyz #* global_matrix + up =ob.matrix_world.to_3x3()[1].xyz #* global_matrix - # XXX TO CHANGE: + # XXX TO CHANGE: #formerly: - #tabWrite("#declare %s = rainbow {\n"%povdataname) - + #tabWrite("#declare %s = rainbow {\n"%povdataname) + # clumsy for now but remove the rainbow from instancing # system because not an object. use lamps later instead of meshes - + #del data_ref[dataname] tabWrite("rainbow {\n") @@ -716,8 +716,8 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("[0.900 color rgbt<1.0, 0.2, 0.2, 0.7>]\n") tabWrite("[1.000 color rgbt<1.0, 0.2, 0.2, 1.0>]\n") tabWrite("}\n") - - + + povMatName = "Default_texture" #tabWrite("texture {%s}\n"%povMatName) write_object_modifiers(scene,ob,file) @@ -726,7 +726,7 @@ def write_pov(filename, scene=None, info_callback=None): #writeMatrix(matrix) tabWrite("}\n") #continue #Don't render proxy mesh, skip to next object - + ################################XXX LOFT, ETC. def exportCurves(scene, ob): name_orig = "OB" + ob.name @@ -1092,7 +1092,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write(' #break\n') file.write(' #end\n') file.write(' }\n') - + file.write(' #debug concat(" - uv_vectors\\n") \n') file.write(' #local NumVertices=dimension_size(UVArr,1);\n') file.write(' #switch(Write)\n') @@ -1264,7 +1264,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write(' #end\n') file.write(' }\n') file.write('#end\n') - + file.write('#macro MSM(SplineArray, SplRes, Interp_type, InterpRes, FileName)\n') file.write(' #declare Build=CheckFileName(FileName);\n') file.write(' #if(Build=0)\n') @@ -1425,7 +1425,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write(' BuildWriteMesh2(VecArr, NormArr, UVArr, Iter_U, Iter_V, FileName)\n') file.write(' #end\n') file.write('#end\n\n') - + if bezier_sweep == False: tabWrite("#declare %s =\n"%dataname) if ob.pov.curveshape == 'sphere_sweep' and bezier_sweep == False: @@ -1454,7 +1454,7 @@ def write_pov(filename, scene=None, info_callback=None): wpt = endPt.co tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt[0], wpt[1], wpt[2], endPt.radius*ob.data.bevel_depth)) - + tabWrite("}\n") if ob.pov.curveshape == 'sor': @@ -1543,7 +1543,7 @@ def write_pov(filename, scene=None, info_callback=None): r0 = points[i].radius * depth r1 = 2/3*r0 + 1/3*r3 r2 = 1/3*r0 + 2/3*r3 - br.append((r0,r1,r2,r3)) + br.append((r0,r1,r2,r3)) line="<%.4g,%.4g,%.4f>"%(p1[0],p1[1],p1[2]) line+="<%.4g,%.4g,%.4f>"%(pR[0],pR[1],pR[2]) line+="<%.4g,%.4g,%.4f>"%(pL[0],pL[1],pL[2]) @@ -1556,11 +1556,11 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("}\n") if len(ob.data.splines)== 1: tabWrite('#declare %s = object{\n'%dataname) - tabWrite(' Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s) \n'%(ob.data.resolution_u,dataname,p,dataname,p)) + tabWrite(' Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s) \n'%(ob.data.resolution_u,dataname,p,dataname,p)) else: tabWrite('#declare %s = union{\n'%dataname) for p in range(len(ob.data.splines)): - tabWrite(' object{Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s)} \n'%(ob.data.resolution_u,dataname,p,dataname,p)) + tabWrite(' object{Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_points_%s, %s_radii_%s)} \n'%(ob.data.resolution_u,dataname,p,dataname,p)) #tabWrite('#include "bezier_spheresweep.inc"\n') #now inlined # tabWrite('#declare %s = object{Shape_Bezierpoints_Sphere_Sweep(yes,%s, %s_bezier_points, %.4f) \n'%(dataname,ob.data.resolution_u,dataname,ob.data.bevel_depth)) if ob.pov.curveshape in {'loft'}: @@ -1581,10 +1581,10 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("rotate <90,0,0>\n") tabWrite("scale y*-1\n" ) tabWrite("}\n") - -################################################################# - - + +################################################################# + + def exportMeta(metas): # TODO - blenders 'motherball' naming is not supported. @@ -1746,8 +1746,8 @@ def write_pov(filename, scene=None, info_callback=None): # Data not yet processed, create a new entry in data_ref. data_ref[dataname] = [(name, MatrixAsPovString(matrix))] return dataname - - + + def exportSmoke(smoke_obj_name): #if LuxManager.CurrentScene.name == 'preview': #return 1, 1, 1, 1.0 @@ -1927,12 +1927,12 @@ def write_pov(filename, scene=None, info_callback=None): file.write("}\n") - + #file.write(" interpolate 1\n") #file.write(" frequency 0\n") #file.write(" }\n") - #file.write("}\n") - + #file.write("}\n") + ob_num = 0 for ob in sel: ob_num += 1 @@ -1949,7 +1949,7 @@ def write_pov(filename, scene=None, info_callback=None): if (mod.smoke_type == 'DOMAIN'): exportSmoke(ob.name) break # don't render domain mesh or flow emitter mesh, skip to next object. - if not smokeFlag: + if not smokeFlag: # Export Hair renderEmitter = True if hasattr(ob, 'particle_systems'): @@ -1971,7 +1971,7 @@ def write_pov(filename, scene=None, info_callback=None): if pmaterial.strand.use_blender_units: strandStart = pmaterial.strand.root_size strandEnd = pmaterial.strand.tip_size - strandShape = pmaterial.strand.shape + strandShape = pmaterial.strand.shape else: # Blender unit conversion strandStart = pmaterial.strand.root_size / 200.0 strandEnd = pmaterial.strand.tip_size / 200.0 @@ -1981,11 +1981,11 @@ def write_pov(filename, scene=None, info_callback=None): strandStart = 0.01 strandEnd = 0.01 strandShape = 0.0 - # Set the number of particles to render count rather than 3d view display - pSys.set_resolution(scene, ob, 'RENDER') + # Set the number of particles to render count rather than 3d view display + pSys.set_resolution(scene, ob, 'RENDER') steps = pSys.settings.draw_step steps = 3 ** steps # or (power of 2 rather than 3) + 1 # Formerly : len(particle.hair_keys) - + totalNumberOfHairs = ( len(pSys.particles) + len(pSys.child_particles) ) #hairCounter = 0 file.write('#declare HairArray = array[%i] {\n' % totalNumberOfHairs) @@ -1995,7 +1995,7 @@ def write_pov(filename, scene=None, info_callback=None): #hairCounter += 1 #controlPointCounter = 0 # Each hair is represented as a separate sphere_sweep in POV-Ray. - + file.write('sphere_sweep{') if pSys.settings.use_hair_bspline: file.write('b_spline ') @@ -2003,7 +2003,7 @@ def write_pov(filename, scene=None, info_callback=None): else: file.write('linear_spline ') file.write('%i,\n' % (steps)) - #changing world coordinates to object local coordinates by multiplying with inverted matrix + #changing world coordinates to object local coordinates by multiplying with inverted matrix initCo = ob.matrix_world.inverted()*(pSys.co_hair(ob, pindex, 0)) if ob.material_slots[pSys.settings.material - 1].material and ob.active_material is not None: pmaterial = ob.material_slots[pSys.settings.material-1].material @@ -2023,7 +2023,7 @@ def write_pov(filename, scene=None, info_callback=None): g = image_pixels[pixelnumber*4+1] b = image_pixels[pixelnumber*4+2] a = image_pixels[pixelnumber*4+3] - initColor=(r,g,b,a) + initColor=(r,g,b,a) else: #only overwrite variable for each competing texture for now initColor=th.texture.evaluate((initCo[0],initCo[1],initCo[2])) @@ -2039,12 +2039,12 @@ def write_pov(filename, scene=None, info_callback=None): if step == 0 and pSys.settings.use_hair_bspline: # Write three times the first point to compensate pov Bezier handling file.write('<%.6g,%.6g,%.6g>,%.7g,\n' % (co[0], co[1], co[2], abs(hDiameter))) - file.write('<%.6g,%.6g,%.6g>,%.7g,\n' % (co[0], co[1], co[2], abs(hDiameter))) + file.write('<%.6g,%.6g,%.6g>,%.7g,\n' % (co[0], co[1], co[2], abs(hDiameter))) #file.write('<%.6g,%.6g,%.6g>,%.7g' % (particle.location[0], particle.location[1], particle.location[2], abs(hDiameter))) # Useless because particle location is the tip, not the root. #file.write(',\n') #controlPointCounter += 1 #totalNumberOfHairs += len(pSys.particles)# len(particle.hair_keys) - + # Each control point is written out, along with the radius of the # hair at that point. file.write('<%.6g,%.6g,%.6g>,%.7g' % (co[0], co[1], co[2], abs(hDiameter))) @@ -2059,7 +2059,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write('\npigment{ color rgbf < %.3g, %.3g, %.3g, %.3g> }\n' %(initColor[0], initColor[1], initColor[2], 1.0-initColor[3])) # End the sphere_sweep declaration for this hair file.write('}\n') - + # All but the final sphere_sweep (each array element) needs a terminating comma. if pindex != totalNumberOfHairs: file.write(',\n') @@ -2070,7 +2070,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write('}\n') file.write('\n') - + if not texturedHair: # Pick up the hair material diffuse color and create a default POV-Ray hair texture. @@ -2113,20 +2113,20 @@ def write_pov(filename, scene=None, info_callback=None): file.write(' }\n') file.write(' }\n') file.write(' }\n') - + file.write(' #local I = I + HairStep;\n') file.write(' #end\n') - + writeMatrix(global_matrix * ob.matrix_world) - + file.write('}') print('Totals hairstrands written: %i' % totalNumberOfHairs) print('Number of tufts (particle systems)', len(ob.particle_systems)) - + # Set back the displayed number of particles to preview count pSys.set_resolution(scene, ob, 'PREVIEW') - + if renderEmitter == False: continue #don't render mesh, skip to next object. @@ -2147,7 +2147,7 @@ def write_pov(filename, scene=None, info_callback=None): ob.dupli_list_create(scene) for eachduplicate in ob.dupli_list: dataname_orig = "DATA" + eachduplicate.object.name - ob.dupli_list_clear() + ob.dupli_list_clear() elif ob.type == 'EMPTY': name_orig = "OB" + ob.name dataname_orig = "DATA" + ob.name @@ -2176,13 +2176,13 @@ def write_pov(filename, scene=None, info_callback=None): continue print("Writing Down First Occurence of " + name) - + ############################################Povray Primitives # special exportCurves() function takes care of writing # lathe, sphere_sweep, birail, and loft except with modifiers # converted to mesh if not ob.is_modified(scene, 'RENDER'): - if ob.type == 'CURVE' and (ob.pov.curveshape in + if ob.type == 'CURVE' and (ob.pov.curveshape in {'lathe', 'sphere_sweep', 'loft'}): continue #Don't render proxy mesh, skip to next object @@ -2286,7 +2286,7 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("rotate x*90\n") tabWrite("}\n") continue #Don't render proxy mesh, skip to next object - + if ob.pov.object_as == 'PLANE': tabWrite("#declare %s = plane{ <0,0,1>,1\n"%povdataname) @@ -2297,7 +2297,7 @@ def write_pov(filename, scene=None, info_callback=None): material = ob.active_material writeObjectMaterial(material, ob) except IndexError: - print(me) + print(me) #tabWrite("texture {%s}\n"%povMatName) write_object_modifiers(scene,ob,file) #tabWrite("rotate x*90\n") @@ -2433,7 +2433,7 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("}\n") continue #Don't render proxy mesh, skip to next object - + if ob.pov.object_as == 'PARAMETRIC': tabWrite("#declare %s = parametric {\n"%povdataname) tabWrite("function { %s }\n"%ob.pov.x_eq) @@ -2449,7 +2449,7 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("precompute 10 x,y,z\n") tabWrite("}\n") continue #Don't render proxy mesh, skip to next object - + if ob.pov.object_as == 'POLYCIRCLE': #TODO write below macro Once: #if write_polytocircle_macro_once == 0: @@ -2541,23 +2541,23 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("}\n") continue #Don't render proxy mesh, skip to next object - + ############################################else try to export mesh elif ob.is_duplicator == False: #except duplis which should be instances groups for now but all duplis later if ob.type == 'EMPTY': tabWrite("\n//dummy sphere to represent Empty location\n") tabWrite("#declare %s =sphere {<0, 0, 0>,0 pigment{rgbt 1} no_image no_reflection no_radiosity photons{pass_through collect off} hollow}\n" % povdataname) - + try: me = ob.to_mesh(scene, True, 'RENDER') - + #XXX Here? identify the specific exception for mesh object with no data #XXX So that we can write something for the dataname ! except: # also happens when curves cant be made into meshes because of no-data continue - + importance = ob.pov.importance_value if me: me_materials = me.materials @@ -2565,8 +2565,8 @@ def write_pov(filename, scene=None, info_callback=None): if len(me_faces)==0: tabWrite("\n//dummy sphere to represent empty mesh location\n") tabWrite("#declare %s =sphere {<0, 0, 0>,0 pigment{rgbt 1} no_image no_reflection no_radiosity photons{pass_through collect off} hollow}\n" % povdataname) - - + + if not me or not me_faces: continue @@ -2693,7 +2693,7 @@ def write_pov(filename, scene=None, info_callback=None): except: material = None if material: #and material.use_vertex_color_paint: #Always use vertex color when there is some for now - + col = vcol_layer[fi] if len(faces_verts[fi]) == 4: @@ -2724,7 +2724,7 @@ def write_pov(filename, scene=None, info_callback=None): material_index vertCols[key] = [-1] - tabWrite("\n}\n") + tabWrite("\n}\n") # Face indices tabWrite("\nface_indices {\n") tabWrite("%d" % (len(me_faces) + quadCount)) # faces count @@ -2780,7 +2780,7 @@ def write_pov(filename, scene=None, info_callback=None): if linebreaksinlists: file.write(",\n") file.write(tabStr + "<%d,%d,%d>, %d,%d,%d" % \ - (fv[i1], fv[i2], fv[i3], ci1-1, ci2-1, ci3-1)) # vert count + (fv[i1], fv[i2], fv[i3], ci1-1, ci2-1, ci3-1)) # vert count else: file.write(", ") file.write("<%d,%d,%d>, %d,%d,%d" % \ @@ -2894,7 +2894,7 @@ def write_pov(filename, scene=None, info_callback=None): vertCols[key] = [-1] idx = 0 - LocalMaterialNames = [] + LocalMaterialNames = [] for col, index in vertCols.items(): #if me_materials: mater = me_materials[col[3]] @@ -2903,7 +2903,7 @@ def write_pov(filename, scene=None, info_callback=None): trans = 0.0 else: - shading.writeTextureInfluence(mater, materialNames, + shading.writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, lampCount, imageFormat, imgMap, @@ -2913,13 +2913,13 @@ def write_pov(filename, scene=None, info_callback=None): safety, col, os, preview_dir, unpacked_images) ################################################################### index[0] = idx - idx += 1 + idx += 1 + - # Vert Colors tabWrite("texture_list {\n") - # In case there's is no material slot, give at least one texture + # In case there's is no material slot, give at least one texture #(an empty one so it uses pov default) if len(vertCols)==0: file.write(tabStr + "1") @@ -2928,13 +2928,13 @@ def write_pov(filename, scene=None, info_callback=None): - - # below "material" alias, added check ob.active_material - # to avoid variable referenced before assignment error + + # below "material" alias, added check ob.active_material + # to avoid variable referenced before assignment error try: material = ob.active_material except IndexError: - #when no material slot exists, + #when no material slot exists, material=None # WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -2948,7 +2948,7 @@ def write_pov(filename, scene=None, info_callback=None): for cMN in LocalMaterialNames: if material != "Default": file.write("\n texture{MAT_%s}\n" % cMN) - #use string_strip_hyphen(materialNames[material])) + #use string_strip_hyphen(materialNames[material])) #or Something like that to clean up the above? elif material and material.pov.material_use_nodes: for index in facesMaterials: @@ -2956,7 +2956,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write("\n texture{%s}\n" % faceMaterial) # END!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! else: - file.write(" texture{}\n") + file.write(" texture{}\n") tabWrite("}\n") # Face indices @@ -3113,8 +3113,8 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("}\n") # End of mesh block - - + + bpy.data.meshes.remove(me) duplidata_ref = [] @@ -3126,7 +3126,7 @@ def write_pov(filename, scene=None, info_callback=None): dup = "" if ob.is_modified(scene, 'RENDER'): #modified object always unique so using object name rather than data name - dup = "#declare OB%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name))) + dup = "#declare OB%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name))) else: dup = "#declare DATA%s = union{\n" %(string_strip_hyphen(bpy.path.clean_name(ob.name))) for eachduplicate in ob.dupli_list: @@ -3212,14 +3212,14 @@ def write_pov(filename, scene=None, info_callback=None): # inverse, a standard scale factor. # 0.5 Offset is needed relatively to scale because center of the # UV scale is 0.5,0.5 in blender and 0,0 in POV - # Further Scale by 2 and translate by -1 are + # Further Scale by 2 and translate by -1 are # required for the sky_sphere not to repeat - + mappingBlend = "scale 2 scale <%.4g,%.4g,%.4g> translate -1 " \ "translate <%.4g,%.4g,%.4g> rotate<0,0,0> " % \ - ((1.0 / t_blend.scale.x), + ((1.0 / t_blend.scale.x), (1.0 / t_blend.scale.y), - (1.0 / t_blend.scale.z), + (1.0 / t_blend.scale.z), 0.5-(0.5/t_blend.scale.x)- t_blend.offset.x, 0.5-(0.5/t_blend.scale.y)- t_blend.offset.y, t_blend.offset.z) @@ -3319,7 +3319,7 @@ def write_pov(filename, scene=None, info_callback=None): if scene.pov.number_of_waves_enable: file.write(" number_of_waves %s\n"%scene.pov.number_of_waves) if scene.pov.noise_generator_enable: - file.write(" noise_generator %s\n"%scene.pov.noise_generator) + file.write(" noise_generator %s\n"%scene.pov.noise_generator) if scene.pov.radio_enable: tabWrite("radiosity {\n") tabWrite("adc_bailout %.4g\n" % scene.pov.radio_adc_bailout) @@ -3328,7 +3328,7 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite("error_bound %.4g\n" % scene.pov.radio_error_bound) tabWrite("gray_threshold %.4g\n" % scene.pov.radio_gray_threshold) tabWrite("low_error_factor %.4g\n" % scene.pov.radio_low_error_factor) - tabWrite("maximum_reuse %.4g\n" % scene.pov.radio_maximum_reuse) + tabWrite("maximum_reuse %.4g\n" % scene.pov.radio_maximum_reuse) tabWrite("minimum_reuse %.4g\n" % scene.pov.radio_minimum_reuse) tabWrite("nearest_count %d\n" % scene.pov.radio_nearest_count) tabWrite("pretrace_start %.3g\n" % scene.pov.radio_pretrace_start) @@ -3351,9 +3351,9 @@ def write_pov(filename, scene=None, info_callback=None): # 1000 rather than scale * (-100.0) + 15.0)) # In POV-Ray, the scale factor for all subsurface shaders needs to be the same - + # formerly sslt_samples were multiplied by 100 instead of 10 - sslt_samples = (11 - material.subsurface_scattering.error_threshold) * 10 + sslt_samples = (11 - material.subsurface_scattering.error_threshold) * 10 tabWrite("subsurface { samples %d, %d }\n" % (sslt_samples, sslt_samples / 10)) onceSss = 0 @@ -3401,7 +3401,7 @@ def write_pov(filename, scene=None, info_callback=None): exportGlobalSettings(scene) - + if comments: file.write("\n//--Custom Code--\n\n") exportCustomCode() @@ -3410,15 +3410,15 @@ def write_pov(filename, scene=None, info_callback=None): file.write("\n//--Patterns Definitions--\n\n") LocalPatternNames = [] for texture in bpy.data.textures: #ok? - if texture.users > 0: - currentPatName = string_strip_hyphen(bpy.path.clean_name(texture.name)) + if texture.users > 0: + currentPatName = string_strip_hyphen(bpy.path.clean_name(texture.name)) #string_strip_hyphen(patternNames[texture.name]) #maybe instead of the above - LocalPatternNames.append(currentPatName) + LocalPatternNames.append(currentPatName) #use above list to prevent writing texture instances several times and assign in mats? if (texture.type not in {'NONE', 'IMAGE'} and texture.pov.tex_pattern_type == 'emulator')or(texture.type in {'NONE', 'IMAGE'} and texture.pov.tex_pattern_type != 'emulator'): file.write("\n#declare PAT_%s = \n" % currentPatName) file.write(shading.exportPattern(texture, string_strip_hyphen)) - file.write("\n") + file.write("\n") if comments: file.write("\n//--Background--\n\n") @@ -3433,7 +3433,7 @@ def write_pov(filename, scene=None, info_callback=None): file.write("\n//--Lamps--\n\n") exportLamps([L for L in sel if (L.type == 'LAMP' and L.pov.object_as != 'RAINBOW')]) - + if comments: file.write("\n//--Rainbows--\n\n") exportRainbows([L for L in sel if (L.type == 'LAMP' and L.pov.object_as == 'RAINBOW')]) @@ -3445,9 +3445,9 @@ def write_pov(filename, scene=None, info_callback=None): if c.is_modified(scene, 'RENDER'): continue #don't export as pov curves objects with modifiers, but as mesh elif c.type == 'CURVE' and (c.pov.curveshape in {'lathe','sphere_sweep','loft','birail'}): - exportCurves(scene,c) + exportCurves(scene,c) + - if comments: file.write("\n//--Material Definitions--\n\n") # write a default pigment for objects with no material (comment out to show black) @@ -3515,7 +3515,7 @@ def write_pov_ini(scene, filename_ini, filename_log, filename_pov, filename_imag #file.write("All_File='%s'\n" % filename_log) # DEBUG.OUT log if none specified: file.write("All_File=1\n") - + file.write("Input_File_Name='%s'\n" % filename_pov) file.write("Output_File_Name='%s'\n" % filename_image) @@ -3602,7 +3602,7 @@ class PovrayRender(bpy.types.RenderEngine): pov_binary = os.path.join(win_home, "bin", "uberpov64.exe") if os.path.exists(pov_binary): return pov_binary - + # Then try 64bits POV pov_binary = os.path.join(win_home, "bin", "pvengine64.exe") if os.path.exists(pov_binary): @@ -3611,8 +3611,8 @@ class PovrayRender(bpy.types.RenderEngine): # Then try 32bits UberPOV pov_binary = os.path.join(win_home, "bin", "uberpov32.exe") if os.path.exists(pov_binary): - return pov_binary - + return pov_binary + # Then try 32bits POV pov_binary = os.path.join(win_home, "bin", "pvengine.exe") if os.path.exists(pov_binary): @@ -3997,8 +3997,8 @@ class PovrayRender(bpy.types.RenderEngine): #print(filename_log) #bring the pov log to blender console with proper path? with open(self._temp_file_log) as f: # The with keyword automatically closes the file when you are done - print(f.read()) - + print(f.read()) + self.update_stats("", "") if scene.pov.tempfiles_enable or scene.pov.deletefiles_enable: @@ -4070,7 +4070,7 @@ class RenderPovTexturePreview(Operator): ##################### end write ########################################## pov_binary = PovrayRender._locate_binary() - + if sys.platform[:3] == "win": p1=subprocess.Popen(["%s"%pov_binary,"/EXIT","%s"%iniPrevFile], stdout=subprocess.PIPE,stderr=subprocess.STDOUT) @@ -4084,19 +4084,19 @@ class RenderPovTexturePreview(Operator): links = tree.links for n in tree.nodes: tree.nodes.remove(n) - im = tree.nodes.new("TextureNodeImage") + im = tree.nodes.new("TextureNodeImage") pathPrev="%s.png"%outputPrevFile im.image = bpy.data.images.load(pathPrev) name=pathPrev name=name.split("/") name=name[len(name)-1] - im.name = name + im.name = name im.location = 200,200 - previewer = tree.nodes.new('TextureNodeOutput') + previewer = tree.nodes.new('TextureNodeOutput') previewer.label = "Preview" previewer.location = 400,400 links.new(im.outputs[0],previewer.inputs[0]) #tex.type="IMAGE" # makes clip extend possible #tex.extension="CLIP" return {'FINISHED'} - + diff --git a/render_povray/shading.py b/render_povray/shading.py index 81fd2376..42dd2636 100644 --- a/render_povray/shading.py +++ b/render_povray/shading.py @@ -28,7 +28,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments else: tabWrite("\n") tabWrite("#declare %s = finish {\n" % safety(name, Level=1)) - + elif Level == 2: if comments: tabWrite("//--translation of spec and mir levels for when no map " \ @@ -150,7 +150,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments tabWrite("conserve_energy\n") if colored_specular_found == True: - tabWrite("metallic\n") + tabWrite("metallic\n") # 'phong 70.0 ' if Level != 1: @@ -158,7 +158,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments raytrace_mirror = material.raytrace_mirror if raytrace_mirror.reflect_factor: tabWrite("reflection {\n") - tabWrite("rgb <%.3g, %.3g, %.3g>\n" % material.mirror_color[:]) + tabWrite("rgb <%.3g, %.3g, %.3g>\n" % material.mirror_color[:]) if material.pov.mirror_metallic: tabWrite("metallic %.3g\n" % (raytrace_mirror.reflect_factor)) # Blurry reflections for UberPOV @@ -173,7 +173,7 @@ def writeMaterial(using_uberpov, DEF_MAT_NAME, scene, tabWrite, safety, comments tabWrite("fresnel 1 ") tabWrite("falloff %.3g exponent %.3g} " % \ (raytrace_mirror.fresnel, raytrace_mirror.fresnel_factor)) - + if material.subsurface_scattering.use: subsurface_scattering = material.subsurface_scattering tabWrite("subsurface { translucency <%.3g, %.3g, %.3g> }\n" % ( @@ -241,7 +241,7 @@ def exportPattern(texture, string_strip_hyphen): texStrg="" def exportColorRamp(texture): tex=texture - pat = tex.pov + pat = tex.pov colRampStrg="color_map {\n" numColor=0 for el in tex.color_ramp.elements: @@ -259,7 +259,7 @@ def exportPattern(texture, string_strip_hyphen): colRampStrg+="color rgbf<%.4g,%.4g,%.4g,%.4g> \n"%(colR,colG,colB,colA) if pat.tex_pattern_type == 'triangular' and numColor < 7 : colRampStrg+="color rgbf<%.4g,%.4g,%.4g,%.4g> \n"%(colR,colG,colB,colA) - + colRampStrg+="} \n" #end color map return colRampStrg @@ -268,50 +268,50 @@ def exportPattern(texture, string_strip_hyphen): if tex.type not in {'NONE', 'IMAGE'} and pat.tex_pattern_type == 'emulator': texStrg+="pigment {\n" ####################### EMULATE BLENDER VORONOI TEXTURE #################### - if tex.type == 'VORONOI': + if tex.type == 'VORONOI': texStrg+="crackle\n" texStrg+=" offset %.4g\n"%tex.nabla texStrg+=" form <%.4g,%.4g,%.4g>\n"%(tex.weight_1, tex.weight_2, tex.weight_3) if tex.distance_metric == 'DISTANCE': - texStrg+=" metric 2.5\n" + texStrg+=" metric 2.5\n" if tex.distance_metric == 'DISTANCE_SQUARED': texStrg+=" metric 2.5\n" - texStrg+=" poly_wave 2\n" - if tex.distance_metric == 'MINKOVSKY': - texStrg+=" metric %s\n"%tex.minkovsky_exponent - if tex.distance_metric == 'MINKOVSKY_FOUR': + texStrg+=" poly_wave 2\n" + if tex.distance_metric == 'MINKOVSKY': + texStrg+=" metric %s\n"%tex.minkovsky_exponent + if tex.distance_metric == 'MINKOVSKY_FOUR': texStrg+=" metric 4\n" - if tex.distance_metric == 'MINKOVSKY_HALF': + if tex.distance_metric == 'MINKOVSKY_HALF': texStrg+=" metric 0.5\n" - if tex.distance_metric == 'CHEBYCHEV': + if tex.distance_metric == 'CHEBYCHEV': texStrg+=" metric 10\n" - if tex.distance_metric == 'MANHATTAN': + if tex.distance_metric == 'MANHATTAN': texStrg+=" metric 1\n" if tex.color_mode == 'POSITION': texStrg+="solid\n" - texStrg+="scale 0.25\n" + texStrg+="scale 0.25\n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<0,0,0,1>]\n" - texStrg+="[1 color rgbt<1,1,1,0>]\n" - texStrg+="}\n" + texStrg+="[1 color rgbt<1,1,1,0>]\n" + texStrg+="}\n" ####################### EMULATE BLENDER CLOUDS TEXTURE #################### - if tex.type == 'CLOUDS': + if tex.type == 'CLOUDS': if tex.noise_type == 'SOFT_NOISE': texStrg+="wrinkles\n" texStrg+="scale 0.25\n" else: - texStrg+="granite\n" + texStrg+="granite\n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<0,0,0,1>]\n" - texStrg+="[1 color rgbt<1,1,1,0>]\n" + texStrg+="[1 color rgbt<1,1,1,0>]\n" texStrg+="}\n" ####################### EMULATE BLENDER WOOD TEXTURE #################### @@ -332,7 +332,7 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="scale 0.25\n" texStrg+="rotate <45,-45,45>\n" texStrg+="turbulence %.4g\n"%(tex.turbulence/10) - + if tex.noise_basis_2 == 'SIN': texStrg+="sine_wave\n" if tex.noise_basis_2 == 'TRI': @@ -344,11 +344,11 @@ def exportPattern(texture, string_strip_hyphen): else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<0,0,0,0>]\n" - texStrg+="[1 color rgbt<1,1,1,0>]\n" + texStrg+="[1 color rgbt<1,1,1,0>]\n" texStrg+="}\n" - + ####################### EMULATE BLENDER STUCCI TEXTURE #################### - if tex.type == 'STUCCI': + if tex.type == 'STUCCI': texStrg+="bozo\n" texStrg+="scale 0.25\n" if tex.noise_type == 'HARD_NOISE': @@ -368,9 +368,9 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="[0 color rgbf<0,0,0,1>]\n" texStrg+="[1 color rgbt<1,1,1,0>]\n" texStrg+="}\n" - + ####################### EMULATE BLENDER MAGIC TEXTURE #################### - if tex.type == 'MAGIC': + if tex.type == 'MAGIC': texStrg+="leopard\n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) @@ -382,10 +382,10 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="[0.75 color rgbf<1,0,1,0.75>]\n" texStrg+="[1 color rgbf<0,1,0,0.75>]\n" texStrg+="}\n" - texStrg+="scale 0.1\n" - + texStrg+="scale 0.1\n" + ####################### EMULATE BLENDER MARBLE TEXTURE #################### - if tex.type == 'MARBLE': + if tex.type == 'MARBLE': texStrg+="marble\n" texStrg+="turbulence 0.5\n" texStrg+="noise_generator 3\n" @@ -408,7 +408,7 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="}\n" else: texStrg+="[0 color rgbt<0,0,0,0>]\n" - texStrg+="[1 color rgbt<1,1,1,0>]\n" + texStrg+="[1 color rgbt<1,1,1,0>]\n" texStrg+="}\n" if tex.noise_basis_2 == 'SIN': texStrg+="sine_wave\n" @@ -416,7 +416,7 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="triangle_wave\n" if tex.noise_basis_2 == 'SAW': texStrg+="ramp_wave\n" - + ####################### EMULATE BLENDER BLEND TEXTURE #################### if tex.type == 'BLEND': if tex.progression=='RADIAL': @@ -437,7 +437,7 @@ def exportPattern(texture, string_strip_hyphen): elif tex.progression=='DIAGONAL': texStrg+="gradient <1,1,0>\n" texStrg+="scale 3\n" - elif tex.use_flip_axis=='HORIZONTAL': + elif tex.use_flip_axis=='HORIZONTAL': texStrg+="gradient x\n" texStrg+="scale 2.01\n" elif tex.use_flip_axis=='VERTICAL': @@ -453,16 +453,16 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="[0 color rgbt<1,1,1,0>]\n" texStrg+="[1 color rgbf<0,0,0,1>]\n" texStrg+="}\n" - if tex.progression == 'LINEAR': + if tex.progression == 'LINEAR': texStrg+=" poly_wave 1\n" - if tex.progression == 'QUADRATIC': + if tex.progression == 'QUADRATIC': texStrg+=" poly_wave 2\n" if tex.progression == 'EASING': texStrg+=" poly_wave 1.5\n" - + ####################### EMULATE BLENDER MUSGRAVE TEXTURE #################### - # if tex.type == 'MUSGRAVE': + # if tex.type == 'MUSGRAVE': # texStrg+="function{ f_ridged_mf( x, y, 0, 1, 2, 9, -0.5, 3,3 )*0.5}\n" # texStrg+="color_map {\n" # texStrg+="[0 color rgbf<0,0,0,1>]\n" @@ -474,17 +474,17 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="bozo scale 0.25 \n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) - else: + else: texStrg+="color_map {[0.5 color rgbf<0,0,0,1>][1 color rgbt<1,1,1,0>]}ramp_wave \n" - + ####################### EMULATE BLENDER DISTORTED NOISE TEXTURE #################### - if tex.type == 'DISTORTED_NOISE': + if tex.type == 'DISTORTED_NOISE': texStrg+="average\n" texStrg+=" pigment_map {\n" texStrg+=" [1 bozo scale 0.25 turbulence %.4g\n" %tex.distortion if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) - else: + else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<1,1,1,0>]\n" texStrg+="[1 color rgbf<0,0,0,1>]\n" @@ -495,37 +495,37 @@ def exportPattern(texture, string_strip_hyphen): texStrg+=" [1 cells scale 0.1\n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) - else: + else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<1,1,1,0>]\n" texStrg+="[1 color rgbf<0,0,0,1>]\n" texStrg+="}\n" - texStrg+="]\n" + texStrg+="]\n" if tex.noise_distortion=='VORONOI_CRACKLE': texStrg+=" [1 crackle scale 0.25\n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) - else: + else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<1,1,1,0>]\n" texStrg+="[1 color rgbf<0,0,0,1>]\n" texStrg+="}\n" - texStrg+="]\n" + texStrg+="]\n" if tex.noise_distortion in ['VORONOI_F1','VORONOI_F2','VORONOI_F3','VORONOI_F4','VORONOI_F2_F1']: texStrg+=" [1 crackle metric 2.5 scale 0.25 turbulence %.4g\n" %(tex.distortion/2) if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) - else: + else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<1,1,1,0>]\n" texStrg+="[1 color rgbf<0,0,0,1>]\n" texStrg+="}\n" - texStrg+="]\n" + texStrg+="]\n" else: - texStrg+=" [1 wrinkles scale 0.25\n" + texStrg+=" [1 wrinkles scale 0.25\n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) - else: + else: texStrg+="color_map {\n" texStrg+="[0 color rgbt<1,1,1,0>]\n" texStrg+="[1 color rgbf<0,0,0,1>]\n" @@ -534,13 +534,13 @@ def exportPattern(texture, string_strip_hyphen): texStrg+=" }\n" ####################### EMULATE BLENDER NOISE TEXTURE #################### - if tex.type == 'NOISE': + if tex.type == 'NOISE': texStrg+="cells\n" texStrg+="turbulence 3\n" texStrg+="omega 3\n" if tex.use_color_ramp == True: texStrg+=exportColorRamp(tex) - else: + else: texStrg+="color_map {\n" texStrg+="[0.75 color rgb<0,0,0,>]\n" texStrg+="[1 color rgb<1,1,1,>]\n" @@ -549,81 +549,81 @@ def exportPattern(texture, string_strip_hyphen): ####################### IGNORE OTHER BLENDER TEXTURE #################### else: #non translated textures pass - texStrg+="}\n\n" + texStrg+="}\n\n" texStrg+="#declare f%s=\n"%PATname - texStrg+="function{pigment{%s}}\n"%PATname + texStrg+="function{pigment{%s}}\n"%PATname texStrg+="\n" - + elif pat.tex_pattern_type != 'emulator': texStrg+="pigment {\n" texStrg+="%s\n"%pat.tex_pattern_type - if pat.tex_pattern_type == 'agate': - texStrg+="agate_turb %.4g\n"%pat.modifier_turbulence - if pat.tex_pattern_type in {'spiral1', 'spiral2', 'tiling'}: + if pat.tex_pattern_type == 'agate': + texStrg+="agate_turb %.4g\n"%pat.modifier_turbulence + if pat.tex_pattern_type in {'spiral1', 'spiral2', 'tiling'}: texStrg+="%s\n"%pat.modifier_numbers - if pat.tex_pattern_type == 'quilted': - texStrg+="control0 %s control1 %s\n"%(pat.modifier_control0, pat.modifier_control1) - if pat.tex_pattern_type == 'mandel': - texStrg+="%s exponent %s \n"%(pat.f_iter, pat.f_exponent) - if pat.tex_pattern_type == 'julia': - texStrg+="<%.4g, %.4g> %s exponent %s \n"%(pat.julia_complex_1, pat.julia_complex_2, pat.f_iter, pat.f_exponent) - if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'mandel': + if pat.tex_pattern_type == 'quilted': + texStrg+="control0 %s control1 %s\n"%(pat.modifier_control0, pat.modifier_control1) + if pat.tex_pattern_type == 'mandel': + texStrg+="%s exponent %s \n"%(pat.f_iter, pat.f_exponent) + if pat.tex_pattern_type == 'julia': + texStrg+="<%.4g, %.4g> %s exponent %s \n"%(pat.julia_complex_1, pat.julia_complex_2, pat.f_iter, pat.f_exponent) + if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'mandel': texStrg+="%s mandel %s \n"%(pat.magnet_type, pat.f_iter) - if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'julia': - texStrg+="%s julia <%.4g, %.4g> %s\n"%(pat.magnet_type, pat.julia_complex_1, pat.julia_complex_2, pat.f_iter) + if pat.tex_pattern_type == 'magnet' and pat.magnet_style == 'julia': + texStrg+="%s julia <%.4g, %.4g> %s\n"%(pat.magnet_type, pat.julia_complex_1, pat.julia_complex_2, pat.f_iter) if pat.tex_pattern_type in {'mandel', 'julia', 'magnet'}: - texStrg+="interior %s, %.4g\n"%(pat.f_ior, pat.f_ior_fac) + texStrg+="interior %s, %.4g\n"%(pat.f_ior, pat.f_ior_fac) texStrg+="exterior %s, %.4g\n"%(pat.f_eor, pat.f_eor_fac) - if pat.tex_pattern_type == 'gradient': + if pat.tex_pattern_type == 'gradient': texStrg+="<%s, %s, %s> \n"%(pat.grad_orient_x, pat.grad_orient_y, pat.grad_orient_z) if pat.tex_pattern_type == 'pavement': numTiles=pat.pave_tiles numPattern=1 - if pat.pave_sides == '4' and pat.pave_tiles == 3: + if pat.pave_sides == '4' and pat.pave_tiles == 3: numPattern = pat.pave_pat_2 - if pat.pave_sides == '6' and pat.pave_tiles == 3: + if pat.pave_sides == '6' and pat.pave_tiles == 3: numPattern = pat.pave_pat_3 - if pat.pave_sides == '3' and pat.pave_tiles == 4: + if pat.pave_sides == '3' and pat.pave_tiles == 4: numPattern = pat.pave_pat_3 - if pat.pave_sides == '3' and pat.pave_tiles == 5: + if pat.pave_sides == '3' and pat.pave_tiles == 5: numPattern = pat.pave_pat_4 - if pat.pave_sides == '4' and pat.pave_tiles == 4: + if pat.pave_sides == '4' and pat.pave_tiles == 4: numPattern = pat.pave_pat_5 - if pat.pave_sides == '6' and pat.pave_tiles == 4: + if pat.pave_sides == '6' and pat.pave_tiles == 4: numPattern = pat.pave_pat_7 - if pat.pave_sides == '4' and pat.pave_tiles == 5: + if pat.pave_sides == '4' and pat.pave_tiles == 5: numPattern = pat.pave_pat_12 - if pat.pave_sides == '3' and pat.pave_tiles == 6: + if pat.pave_sides == '3' and pat.pave_tiles == 6: numPattern = pat.pave_pat_12 - if pat.pave_sides == '6' and pat.pave_tiles == 5: + if pat.pave_sides == '6' and pat.pave_tiles == 5: numPattern = pat.pave_pat_22 - if pat.pave_sides == '4' and pat.pave_tiles == 6: + if pat.pave_sides == '4' and pat.pave_tiles == 6: numPattern = pat.pave_pat_35 - if pat.pave_sides == '6' and pat.pave_tiles == 6: - numTiles = 5 + if pat.pave_sides == '6' and pat.pave_tiles == 6: + numTiles = 5 texStrg+="number_of_sides %s number_of_tiles %s pattern %s form %s \n"%(pat.pave_sides, numTiles, numPattern, pat.pave_form) ################ functions ##################################################################################################### - if pat.tex_pattern_type == 'function': + if pat.tex_pattern_type == 'function': texStrg+="{ %s"%pat.func_list texStrg+="(x" if pat.func_plus_x != "NONE": if pat.func_plus_x =='increase': - texStrg+="*" + texStrg+="*" if pat.func_plus_x =='plus': texStrg+="+" texStrg+="%.4g"%pat.func_x texStrg+=",y" if pat.func_plus_y != "NONE": if pat.func_plus_y =='increase': - texStrg+="*" + texStrg+="*" if pat.func_plus_y =='plus': texStrg+="+" texStrg+="%.4g"%pat.func_y texStrg+=",z" if pat.func_plus_z != "NONE": if pat.func_plus_z =='increase': - texStrg+="*" + texStrg+="*" if pat.func_plus_z =='plus': texStrg+="+" texStrg+="%.4g"%pat.func_z @@ -672,7 +672,7 @@ def exportPattern(texture, string_strip_hyphen): texStrg+=",%.4g"%pat.func_P9 texStrg+=")}\n" ############## end functions ############################################################### - if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'}: + if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'}: texStrg+="color_map {\n" numColor=0 if tex.use_color_ramp == True: @@ -694,9 +694,9 @@ def exportPattern(texture, string_strip_hyphen): else: texStrg+="[0 color rgbf<0,0,0,1>]\n" texStrg+="[1 color rgbf<1,1,1,0>]\n" - if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'} : - texStrg+="} \n" - if pat.tex_pattern_type == 'brick': + if pat.tex_pattern_type not in {'checker', 'hexagon', 'square', 'triangular', 'brick'} : + texStrg+="} \n" + if pat.tex_pattern_type == 'brick': texStrg+="brick_size <%.4g, %.4g, %.4g> mortar %.4g \n"%(pat.brick_size_x, pat.brick_size_y, pat.brick_size_z, pat.brick_mortar) texStrg+="%s \n"%mappingDif texStrg+="rotate <%.4g,%.4g,%.4g> \n"%(pat.tex_rot_x, pat.tex_rot_y, pat.tex_rot_z) @@ -705,22 +705,22 @@ def exportPattern(texture, string_strip_hyphen): texStrg+="lambda %.4g \n"%pat.modifier_lambda texStrg+="omega %.4g \n"%pat.modifier_omega texStrg+="frequency %.4g \n"%pat.modifier_frequency - texStrg+="phase %.4g \n"%pat.modifier_phase + texStrg+="phase %.4g \n"%pat.modifier_phase texStrg+="}\n\n" texStrg+="#declare f%s=\n"%PATname - texStrg+="function{pigment{%s}}\n"%PATname + texStrg+="function{pigment{%s}}\n"%PATname texStrg+="\n" return(texStrg) - - + + def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, lampCount, imageFormat, imgMap, imgMapTransforms, tabWrite, comments, string_strip_hyphen, safety, col, os, preview_dir, unpacked_images): - material_finish = materialNames[mater.name] + material_finish = materialNames[mater.name] if mater.use_transparency: trans = 1.0 - mater.alpha else: - trans = 0.0 + trans = 0.0 if ((mater.specular_color.s == 0.0) or (mater.diffuse_shader == 'MINNAERT')): # No layered texture because of aoi pattern used for minnaert and pov can't layer patterned colored_specular_found = False @@ -732,7 +732,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, trans = (1.0 - mater.alpha) - povFilter else: povFilter = 0.0 - + ##############SF texturesDif = "" texturesSpec = "" @@ -772,7 +772,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, #was the above used? --MR t_alpha = t - # RASTER IMAGE + # RASTER IMAGE elif (t.texture.type == 'IMAGE' and t.texture.image and t.texture.pov.tex_pattern_type == 'emulator'): proceduralFlag=False #PACKED @@ -782,11 +782,11 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, if not os.path.exists(unpackedfilename): # record which images that were newly copied and can be safely # cleaned up - unpacked_images.append(unpackedfilename) + unpacked_images.append(unpackedfilename) t.texture.image.filepath_raw=unpackedfilename t.texture.image.save() image_filename = unpackedfilename.replace("\\","/") - # .replace("\\","/") to get only forward slashes as it's what POV prefers, + # .replace("\\","/") to get only forward slashes as it's what POV prefers, # even on windows t.texture.image.filepath_raw=orig_image_filename #FILE @@ -824,7 +824,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, #textDispName=t.texture.image.name + ".displ" #was the above used? --MR t_alpha = t - + #################################################################################### @@ -835,7 +835,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, LocalMaterialNames.append(currentMatName) tabWrite("\n#declare MAT_%s = \ntexture{\n" % currentMatName) ################################################################################ - + if mater.pov.replacement_text != "": tabWrite("%s\n" % mater.pov.replacement_text) ################################################################################# @@ -873,11 +873,11 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, if texturesSpec != "": # tabWrite("\n") tabWrite("pigment_pattern {\n") - + mappingSpec =imgMapTransforms(t_spec) if texturesSpec and texturesSpec.startswith("PAT_"): - tabWrite("function{f%s(x,y,z).grey}\n" %texturesSpec) - tabWrite("%s\n" % mappingSpec) + tabWrite("function{f%s(x,y,z).grey}\n" %texturesSpec) + tabWrite("%s\n" % mappingSpec) else: tabWrite("uv_mapping image_map{%s \"%s\" %s}\n" % \ @@ -894,9 +894,9 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, mappingAlpha = imgMapTransforms(t_alpha) if texturesAlpha and texturesAlpha.startswith("PAT_"): - tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha)) + tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha)) else: - + tabWrite("pigment {pigment_pattern {uv_mapping image_map" \ "{%s \"%s\" %s}%s" % \ (imageFormat(texturesAlpha), texturesAlpha, @@ -931,7 +931,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, tabWrite("pigment {\n") tabWrite("pigment_pattern {\n") if texturesAlpha and texturesAlpha.startswith("PAT_"): - tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha)) + tabWrite("function{f%s(x,y,z).transmit}%s\n" %(texturesAlpha, mappingAlpha)) else: tabWrite("uv_mapping image_map{%s \"%s\" %s}%s}\n" % \ (imageFormat(texturesAlpha), texturesAlpha, @@ -939,13 +939,13 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, tabWrite("pigment_map {\n") tabWrite("[0 color rgbft<0,0,0,1,1>]\n") #if texturesAlpha and texturesAlpha.startswith("PAT_"): - #tabWrite("[1 pigment{%s}]\n" %texturesDif) + #tabWrite("[1 pigment{%s}]\n" %texturesDif) if texturesDif and not texturesDif.startswith("PAT_"): tabWrite("[1 uv_mapping image_map {%s \"%s\" %s} %s]\n" % \ (imageFormat(texturesDif), texturesDif, (imgGamma + imgMap(t_dif)), mappingDif)) elif texturesDif and texturesDif.startswith("PAT_"): - tabWrite("[1 %s]\n" %texturesDif) + tabWrite("[1 %s]\n" %texturesDif) tabWrite("}\n") tabWrite("}\n") if texturesAlpha and texturesAlpha.startswith("PAT_"): @@ -953,7 +953,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, else: if texturesDif and texturesDif.startswith("PAT_"): - tabWrite("pigment{%s}\n" %texturesDif) + tabWrite("pigment{%s}\n" %texturesDif) else: tabWrite("pigment {uv_mapping image_map {%s \"%s\" %s}%s}\n" % \ (imageFormat(texturesDif), texturesDif, @@ -982,7 +982,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, mappingNor =imgMapTransforms(t_nor) if texturesNorm and texturesNorm.startswith("PAT_"): - tabWrite("normal{function{f%s(x,y,z).grey} bump_size %.4g %s}\n" %(texturesNorm, t_nor.normal_factor/10, mappingNor)) + tabWrite("normal{function{f%s(x,y,z).grey} bump_size %.4g %s}\n" %(texturesNorm, t_nor.normal_factor/10, mappingNor)) else: tabWrite("normal {uv_mapping bump_map " \ "{%s \"%s\" %s bump_size %.4g }%s}\n" % \ @@ -998,7 +998,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, mappingAlpha = imgMapTransforms(t_alpha) if texturesAlpha and texturesAlpha.startswith("PAT_"): - tabWrite("function{f%s(x,y,z).transmit %s}\n" %(texturesAlpha, mappingAlpha)) + tabWrite("function{f%s(x,y,z).transmit %s}\n" %(texturesAlpha, mappingAlpha)) else: tabWrite("pigment {pigment_pattern {uv_mapping image_map" \ "{%s \"%s\" %s}%s}\n" % \ @@ -1014,12 +1014,12 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, else: tabWrite("pigment {rgbft<%.3g, %.3g, %.3g, %.3g, %.3g>}\n" % \ (col[0], col[1], col[2], povFilter, trans)) - - + + if texturesSpec != "": # Level 3 is full specular tabWrite("finish {%s}\n" % (safety(material_finish, Level=3))) - + elif colored_specular_found: # Level 1 is no specular tabWrite("finish {%s}\n" % (safety(material_finish, Level=1))) @@ -1045,8 +1045,8 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, tabWrite("pigment_map {\n") tabWrite("[0 color rgbft<0,0,0,1,1>]\n") if texturesAlpha and texturesAlpha.startswith("PAT_"): - tabWrite("[1 function{f%s(x,y,z).transmit}%s]\n" %(texturesAlpha, mappingAlpha)) - elif texturesDif and not texturesDif.startswith("PAT_"): + tabWrite("[1 function{f%s(x,y,z).transmit}%s]\n" %(texturesAlpha, mappingAlpha)) + elif texturesDif and not texturesDif.startswith("PAT_"): tabWrite("[1 uv_mapping image_map {%s \"%s\" %s} %s]\n" % \ (imageFormat(texturesDif), texturesDif, (imgMap(t_dif) + imgGamma), mappingDif)) @@ -1057,9 +1057,9 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, else: if texturesDif and texturesDif.startswith("PAT_"): - tabWrite("pigment{%s %s}\n" %(texturesDif, mappingDif)) + tabWrite("pigment{%s %s}\n" %(texturesDif, mappingDif)) print('XXXMEEEERDE!') - else: + else: tabWrite("pigment {\n") tabWrite("uv_mapping image_map {\n") #tabWrite("%s \"%s\" %s}%s\n" % \ @@ -1070,10 +1070,10 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, tabWrite("}\n") tabWrite("%s\n" % mappingDif) tabWrite("}\n") - + if texturesSpec != "": # Level 3 is full specular - tabWrite("finish {%s}\n" % (safety(material_finish, Level=3))) + tabWrite("finish {%s}\n" % (safety(material_finish, Level=3))) else: # Level 2 is translated specular tabWrite("finish {%s}\n" % (safety(material_finish, Level=2))) @@ -1094,7 +1094,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, if texturesNorm and texturesNorm.startswith("PAT_"): tabWrite("normal{function{f%s(x,y,z).grey} bump_size %.4g %s}\n" %(texturesNorm, t_nor.normal_factor/10, mappingNor)) - else: + else: tabWrite("normal {uv_mapping bump_map {%s \"%s\" %s bump_size %.4g }%s}\n" % \ (imageFormat(texturesNorm), texturesNorm, imgMap(t_nor), t_nor.normal_factor/10, mappingNor)) @@ -1114,18 +1114,18 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, tabWrite("}\n") c += 1 - - + + # Close first layer of POV "texture" (Blender material) tabWrite("}\n") - + if ((mater.specular_color.s > 0.0) and (mater.diffuse_shader != 'MINNAERT')): - + colored_specular_found = True else: colored_specular_found = False - - # Write another layered texture using invisible diffuse and metallic trick + + # Write another layered texture using invisible diffuse and metallic trick # to emulate colored specular highlights special_texture_found = False for t in mater.texture_slots: @@ -1134,13 +1134,13 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, # Specular mapped textures would conflict with colored specular # because POV can't layer over or under pigment patterned textures special_texture_found = True - + if colored_specular_found and not special_texture_found: if comments: tabWrite(" // colored highlights with a stransparent metallic layer\n") else: tabWrite("\n") - + tabWrite("texture {\n") tabWrite("pigment {rgbft<%.3g, %.3g, %.3g, 0, 1>}\n" % \ (mater.specular_color[0], mater.specular_color[1], mater.specular_color[2])) @@ -1155,7 +1155,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, if (t and t.texture.type == 'IMAGE' and t.use and t.texture.image and t.texture.pov.tex_pattern_type == 'emulator'): - proceduralFlag=False + proceduralFlag=False image_filename = path_image(t.texture.image) imgGamma = "" if image_filename: @@ -1177,7 +1177,7 @@ def writeTextureInfluence(mater, materialNames, LocalMaterialNames, path_image, texturesNorm, imgMap(t_nor), t_nor.normal_factor/10, mappingNor)) - + tabWrite("}\n") # THEN IT CAN CLOSE LAST LAYER OF TEXTURE def string_strip_hyphen(name): @@ -1238,9 +1238,9 @@ def write_nodes(scene,povMatName,ntree,file): else: energy=link.from_node.inputs["Energy"].default_value file.write(' subsurface { translucency <%.4g,%.4g,%.4g>*%s }\n'%(r,g,b,energy)) - - - + + + if link.from_node.bl_idname in {'PovraySpecularNode','PovrayPhongNode'}: intensity=0 albedo="" diff --git a/render_povray/ui.py b/render_povray/ui.py index 9777538c..ba763871 100644 --- a/render_povray/ui.py +++ b/render_povray/ui.py @@ -177,7 +177,7 @@ for member in dir(properties_particle): # add all "particle" panels from blende pass del properties_particle - + class RenderButtonsPanel(): bl_space_type = 'PROPERTIES' bl_region_type = 'WINDOW' @@ -259,7 +259,7 @@ class WorldButtonsPanel(): wld = context.world rd = context.scene.render return wld and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES) - + class TextButtonsPanel(): bl_space_type = 'TEXT_EDITOR' bl_region_type = 'UI' @@ -276,16 +276,16 @@ from bl_ui import properties_data_mesh # These panels are kept properties_data_mesh.DATA_PT_custom_props_mesh.COMPAT_ENGINES.add('POVRAY_RENDER') properties_data_mesh.DATA_PT_context_mesh.COMPAT_ENGINES.add('POVRAY_RENDER') - + ## make some native panels contextual to some object variable ## by recreating custom panels inheriting their properties - + class PovDataButtonsPanel(properties_data_mesh.MeshButtonsPanel): COMPAT_ENGINES = {'POVRAY_RENDER'} POV_OBJECT_TYPES = {'PLANE', 'BOX', 'SPHERE', 'CYLINDER', 'CONE', 'TORUS', 'BLOB', 'ISOSURFACE', 'SUPERELLIPSOID', 'SUPERTORUS', 'HEIGHT_FIELD', 'PARAMETRIC', 'POLYCIRCLE'} - + @classmethod def poll(cls, context): engine = context.scene.render.engine @@ -293,58 +293,58 @@ class PovDataButtonsPanel(properties_data_mesh.MeshButtonsPanel): # We use our parent class poll func too, avoids to re-define too much things... return (super(PovDataButtonsPanel, cls).poll(context) and obj and obj.pov.object_as not in cls.POV_OBJECT_TYPES) - - + + # We cannot inherit from RNA classes (like e.g. properties_data_mesh.DATA_PT_vertex_groups). # Complex py/bpy/rna interactions (with metaclass and all) simply do not allow it to work. # So we simply have to explicitly copy here the interesting bits. ;) class DATA_PT_POV_normals(PovDataButtonsPanel, bpy.types.Panel): bl_label = properties_data_mesh.DATA_PT_normals.bl_label - + draw = properties_data_mesh.DATA_PT_normals.draw - + class DATA_PT_POV_texture_space(PovDataButtonsPanel, bpy.types.Panel): bl_label = properties_data_mesh.DATA_PT_texture_space.bl_label bl_options = properties_data_mesh.DATA_PT_texture_space.bl_options - + draw = properties_data_mesh.DATA_PT_texture_space.draw - - + + class DATA_PT_POV_vertex_groups(PovDataButtonsPanel, bpy.types.Panel): bl_label = properties_data_mesh.DATA_PT_vertex_groups.bl_label - + draw = properties_data_mesh.DATA_PT_vertex_groups.draw class DATA_PT_POV_shape_keys(PovDataButtonsPanel, bpy.types.Panel): bl_label = properties_data_mesh.DATA_PT_shape_keys.bl_label - - draw = properties_data_mesh.DATA_PT_shape_keys.draw - + draw = properties_data_mesh.DATA_PT_shape_keys.draw + + class DATA_PT_POV_uv_texture(PovDataButtonsPanel, bpy.types.Panel): bl_label = properties_data_mesh.DATA_PT_uv_texture.bl_label - - draw = properties_data_mesh.DATA_PT_uv_texture.draw - - + + draw = properties_data_mesh.DATA_PT_uv_texture.draw + + class DATA_PT_POV_vertex_colors(PovDataButtonsPanel, bpy.types.Panel): bl_label = properties_data_mesh.DATA_PT_vertex_colors.bl_label - - draw = properties_data_mesh.DATA_PT_vertex_colors.draw - - + + draw = properties_data_mesh.DATA_PT_vertex_colors.draw + + class DATA_PT_POV_customdata(PovDataButtonsPanel, bpy.types.Panel): bl_label = properties_data_mesh.DATA_PT_customdata.bl_label - bl_options = properties_data_mesh.DATA_PT_customdata.bl_options + bl_options = properties_data_mesh.DATA_PT_customdata.bl_options draw = properties_data_mesh.DATA_PT_customdata.draw - - - -del properties_data_mesh - + + +del properties_data_mesh + + ################################################################################ # from bl_ui import properties_data_lamp # for member in dir(properties_data_lamp): @@ -361,13 +361,13 @@ from bl_ui import properties_data_lamp # These panels are kept properties_data_lamp.DATA_PT_custom_props_lamp.COMPAT_ENGINES.add('POVRAY_RENDER') properties_data_lamp.DATA_PT_context_lamp.COMPAT_ENGINES.add('POVRAY_RENDER') - + ## make some native panels contextual to some object variable ## by recreating custom panels inheriting their properties class PovLampButtonsPanel(properties_data_lamp.DataButtonsPanel): COMPAT_ENGINES = {'POVRAY_RENDER'} POV_OBJECT_TYPES = {'RAINBOW'} - + @classmethod def poll(cls, context): engine = context.scene.render.engine @@ -375,25 +375,25 @@ class PovLampButtonsPanel(properties_data_lamp.DataButtonsPanel): # We use our parent class poll func too, avoids to re-define too much things... return (super(PovLampButtonsPanel, cls).poll(context) and obj and obj.pov.object_as not in cls.POV_OBJECT_TYPES) - - + + # We cannot inherit from RNA classes (like e.g. properties_data_mesh.DATA_PT_vertex_groups). # Complex py/bpy/rna interactions (with metaclass and all) simply do not allow it to work. # So we simply have to explicitly copy here the interesting bits. ;) - + class LAMP_PT_POV_preview(PovLampButtonsPanel, bpy.types.Panel): bl_label = properties_data_lamp.DATA_PT_preview.bl_label - + draw = properties_data_lamp.DATA_PT_preview.draw class LAMP_PT_POV_lamp(PovLampButtonsPanel, bpy.types.Panel): bl_label = properties_data_lamp.DATA_PT_lamp.bl_label - + draw = properties_data_lamp.DATA_PT_lamp.draw class LAMP_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel): bl_label = properties_data_lamp.DATA_PT_sunsky.bl_label - + @classmethod def poll(cls, context): lamp = context.lamp @@ -401,11 +401,11 @@ class LAMP_PT_POV_sunsky(PovLampButtonsPanel, bpy.types.Panel): return (lamp and lamp.type == 'SUN') and (engine in cls.COMPAT_ENGINES) draw = properties_data_lamp.DATA_PT_sunsky.draw - + class LAMP_PT_POV_shadow(PovLampButtonsPanel, bpy.types.Panel): bl_label = properties_data_lamp.DATA_PT_shadow.bl_label - - draw = properties_data_lamp.DATA_PT_shadow.draw + + draw = properties_data_lamp.DATA_PT_shadow.draw class LAMP_PT_POV_area(PovLampButtonsPanel, bpy.types.Panel): bl_label = properties_data_lamp.DATA_PT_area.bl_label @@ -415,8 +415,8 @@ class LAMP_PT_POV_area(PovLampButtonsPanel, bpy.types.Panel): lamp = context.lamp engine = context.scene.render.engine return (lamp and lamp.type == 'AREA') and (engine in cls.COMPAT_ENGINES) - - draw = properties_data_lamp.DATA_PT_area.draw + + draw = properties_data_lamp.DATA_PT_area.draw class LAMP_PT_POV_spot(PovLampButtonsPanel, bpy.types.Panel): bl_label = properties_data_lamp.DATA_PT_spot.bl_label @@ -425,20 +425,20 @@ class LAMP_PT_POV_spot(PovLampButtonsPanel, bpy.types.Panel): def poll(cls, context): lamp = context.lamp engine = context.scene.render.engine - return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) - draw = properties_data_lamp.DATA_PT_spot.draw + return (lamp and lamp.type == 'SPOT') and (engine in cls.COMPAT_ENGINES) + draw = properties_data_lamp.DATA_PT_spot.draw class LAMP_PT_POV_falloff_curve(PovLampButtonsPanel, bpy.types.Panel): bl_label = properties_data_lamp.DATA_PT_falloff_curve.bl_label bl_options = properties_data_lamp.DATA_PT_falloff_curve.bl_options - + @classmethod def poll(cls, context): lamp = context.lamp engine = context.scene.render.engine return (lamp and lamp.type in {'POINT', 'SPOT'} and lamp.falloff_type == 'CUSTOM_CURVE') and (engine in cls.COMPAT_ENGINES) - draw = properties_data_lamp.DATA_PT_falloff_curve.draw + draw = properties_data_lamp.DATA_PT_falloff_curve.draw class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel): bl_label = "POV-Ray Rainbow" @@ -448,17 +448,17 @@ class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'RAINBOW' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'RAINBOW' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'RAINBOW': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="Rainbow projection angle: " + str(obj.data.spot_size)) col.label(text="Rainbow width: " + str(obj.data.spot_blend)) col.label(text="Rainbow distance: " + str(obj.data.shadow_buffer_clip_start)) @@ -466,23 +466,23 @@ class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel): col.label(text="Rainbow falloff angle: " + str(obj.pov.falloff_angle)) else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.cone_update", text="Update",icon="MESH_CONE") - + + layout.operator("pov.cone_update", text="Update",icon="MESH_CONE") + #col.label(text="Parameters:") col.prop(obj.data, "spot_size", text="Rainbow Projection Angle") col.prop(obj.data, "spot_blend", text="Rainbow width") col.prop(obj.data, "shadow_buffer_clip_start", text="Visibility distance") col.prop(obj.pov, "arc_angle") col.prop(obj.pov, "falloff_angle") - -del properties_data_lamp + +del properties_data_lamp ############################################################################### - + class RENDER_PT_povray_export_settings(RenderButtonsPanel, bpy.types.Panel): bl_label = "INI Options" bl_options = {'DEFAULT_CLOSED'} @@ -552,7 +552,7 @@ class RENDER_PT_povray_render_settings(RenderButtonsPanel, bpy.types.Panel): col.label(text="Global Settings:") col.prop(scene.pov, "max_trace_level", text="Ray Depth") - + layout.active = scene.pov.global_settings_advanced layout.prop(scene.pov,"charset") align = True @@ -562,9 +562,9 @@ class RENDER_PT_povray_render_settings(RenderButtonsPanel, bpy.types.Panel): row.prop(scene.pov,"ambient_light") row = layout.row(align = align) row.prop(scene.pov,"irid_wavelength") - row = layout.row(align = align) + row = layout.row(align = align) row.prop(scene.pov,"max_intersections") - row = layout.row(align = align) + row = layout.row(align = align) row.prop(scene.pov,"number_of_waves") row = layout.row(align = align) row.prop(scene.pov,"noise_generator") @@ -600,8 +600,8 @@ class RENDER_PT_povray_photons(RenderButtonsPanel, bpy.types.Panel): col = split.column() col.prop(scene.pov, "photon_adc_bailout", text="Photon ADC") col.prop(scene.pov, "photon_gather_max") - - + + box = layout.box() box.label('Photon Map File:') row = box.row() @@ -633,19 +633,19 @@ class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel): prefs = bpy.context.user_preferences.addons[__package__].preferences layout = self.layout scene = context.scene - + layout.active = scene.pov.antialias_enable row = layout.row() row.prop(scene.pov, "antialias_method", text="") - + if prefs.branch_feature_set_povray != 'uberpov' and scene.pov.antialias_method == '2': col = layout.column() col.alignment = 'CENTER' col.label(text="Stochastic Anti Aliasing is") col.label(text="Only Available with UberPOV") col.label(text="Feature Set in User Preferences.") - col.label(text="Using Type 2 (recursive) instead") + col.label(text="Using Type 2 (recursive) instead") else: row.prop(scene.pov, "jitter_enable", text="Jitter") @@ -662,7 +662,7 @@ class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel): row = layout.row() row.prop(scene.pov, "antialias_threshold", text="AA Threshold") row.prop(scene.pov, "antialias_gamma", text="AA Gamma") - + if prefs.branch_feature_set_povray == 'uberpov': row = layout.row() row.prop(scene.pov, "antialias_confidence", text="AA Confidence") @@ -706,11 +706,11 @@ class RENDER_PT_povray_radiosity(RenderButtonsPanel, bpy.types.Panel): col = split.column() col.prop(scene.pov, "radio_adc_bailout", slider=True) - col.prop(scene.pov, "radio_minimum_reuse", text="Min Reuse") + col.prop(scene.pov, "radio_minimum_reuse", text="Min Reuse") col.prop(scene.pov, "radio_gray_threshold", slider=True) col.prop(scene.pov, "radio_pretrace_start", slider=True) col.prop(scene.pov, "radio_low_error_factor", slider=True) - + col = split.column() col.prop(scene.pov, "radio_brightness") col.prop(scene.pov, "radio_maximum_reuse", text="Max Reuse") @@ -775,14 +775,14 @@ class MATERIAL_PT_povray_activate_node(MaterialButtonsPanel, bpy.types.Panel): mat=context.material ob = context.object return mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes) - + def draw(self, context): layout = self.layout # layout.operator("pov.material_use_nodes", icon='SOUND')#'NODETREE') # the above replaced with a context hook below: layout.operator("WM_OT_context_toggle", text="Use POV-Ray Nodes", icon='NODETREE').data_path = \ "material.pov.material_use_nodes" - + class MATERIAL_PT_povray_active_node(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Active Node Settings" bl_context = "material" @@ -856,21 +856,21 @@ class MATERIAL_PT_povray_reflection(MaterialButtonsPanel, bpy.types.Panel): col = layout.column() col.prop(mat.pov, "irid_amount", slider=True) col.prop(mat.pov, "irid_thickness", slider=True) - col.prop(mat.pov, "irid_turbulence", slider=True) + col.prop(mat.pov, "irid_turbulence", slider=True) col.prop(mat.pov, "conserve_energy") col2=col.split().column() - + if not mat.raytrace_mirror.use: - col2.label(text="Please Check Mirror settings :") + col2.label(text="Please Check Mirror settings :") col2.active = mat.raytrace_mirror.use col2.prop(mat.pov, "mirror_use_IOR") if mat.pov.mirror_use_IOR: col2.alignment = 'CENTER' col2.label(text="The current Raytrace ") - col2.label(text="Transparency IOR is: " + str(mat.raytrace_transparency.ior)) + col2.label(text="Transparency IOR is: " + str(mat.raytrace_transparency.ior)) col2.prop(mat.pov, "mirror_metallic") - - + + class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel): bl_label = "POV-Ray Absorption" COMPAT_ENGINES = {'POVRAY_RENDER'} @@ -881,8 +881,8 @@ class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel): mat=context.material ob = context.object return mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes) - - + + def draw_header(self, context): mat = context.material @@ -896,7 +896,7 @@ class MATERIAL_PT_povray_fade_color(MaterialButtonsPanel, bpy.types.Panel): layout.label(text="Raytrace transparency") layout.label(text="depth max Limit needs") layout.label(text="to be non zero to fade") - + pass @@ -904,15 +904,15 @@ class MATERIAL_PT_povray_caustics(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Caustics" COMPAT_ENGINES = {'POVRAY_RENDER'} - + @classmethod def poll(cls, context): engine = context.scene.render.engine mat=context.material ob = context.object return mat and mat.type == "SURFACE" and (engine in cls.COMPAT_ENGINES) and not (mat.pov.material_use_nodes or mat.use_nodes) - - + + def draw_header(self, context): mat = context.material if mat.pov.caustics_enable: @@ -950,7 +950,7 @@ class MATERIAL_PT_povray_replacement_text(MaterialButtonsPanel, bpy.types.Panel) bl_label = "Custom POV Code" COMPAT_ENGINES = {'POVRAY_RENDER'} - + def draw(self, context): layout = self.layout @@ -978,7 +978,7 @@ class TEXTURE_PT_povray_preview(TextureButtonsPanel, bpy.types.Panel): bl_label = "Preview" COMPAT_ENGINES = {'POVRAY_RENDER'} bl_options = {'HIDE_HEADER'} - + @classmethod def poll(cls, context): engine = context.scene.render.engine @@ -1041,9 +1041,9 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): row.prop(tex.pov, "julia_complex_1", text="Complex 1") row.prop(tex.pov, "julia_complex_2", text="Complex 2") row=col.row() - if tex.pov.tex_pattern_type in {'julia','mandel'}: + if tex.pov.tex_pattern_type in {'julia','mandel'}: row.prop(tex.pov, "f_exponent", text="Exponent") - if tex.pov.tex_pattern_type == 'magnet': + if tex.pov.tex_pattern_type == 'magnet': row.prop(tex.pov, "magnet_type", text="Type") row.prop(tex.pov, "f_iter", text="Iterations") row=col.row() @@ -1052,17 +1052,17 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): row=col.row() row.prop(tex.pov, "f_eor", text="Exterior") row.prop(tex.pov, "f_eor_fac", text="Factor E") - if tex.pov.tex_pattern_type == 'gradient': + if tex.pov.tex_pattern_type == 'gradient': layout.label(text="Gradient orientation:") column_flow = layout.column_flow(columns=3, align=True) - column_flow.prop(tex.pov, "grad_orient_x", text="X") + column_flow.prop(tex.pov, "grad_orient_x", text="X") column_flow.prop(tex.pov, "grad_orient_y", text="Y") column_flow.prop(tex.pov, "grad_orient_z", text="Z") if tex.pov.tex_pattern_type == 'pavement': layout.prop(tex.pov, "pave_sides", text="Pavement:number of sides") col = layout.column(align=align) column_flow = col.column_flow(columns=3, align=True) - column_flow.prop(tex.pov, "pave_tiles", text="Tiles") + column_flow.prop(tex.pov, "pave_tiles", text="Tiles") if tex.pov.pave_sides == '4' and tex.pov.pave_tiles == 6: column_flow.prop(tex.pov, "pave_pat_35", text="Pattern") if tex.pov.pave_sides == '6' and tex.pov.pave_tiles == 5: @@ -1087,7 +1087,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): column_flow.label(text="!!! 5 tiles!") column_flow.prop(tex.pov, "pave_form", text="Form") if tex.pov.tex_pattern_type == 'function': - layout.prop(tex.pov, "func_list", text="Functions") + layout.prop(tex.pov, "func_list", text="Functions") if tex.pov.tex_pattern_type == 'function' and tex.pov.func_list != "NONE": func = None if tex.pov.func_list in {"f_noise3d", "f_ph", "f_r", "f_th"}: @@ -1128,15 +1128,15 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): if tex.pov.func_list == "f_helical_torus": func = 8 column_flow = layout.column_flow(columns=3, align=True) - column_flow.label(text="X") + column_flow.label(text="X") column_flow.prop(tex.pov, "func_plus_x", text="") column_flow.prop(tex.pov, "func_x", text="Value") column_flow = layout.column_flow(columns=3, align=True) - column_flow.label(text="Y") + column_flow.label(text="Y") column_flow.prop(tex.pov, "func_plus_y", text="") column_flow.prop(tex.pov, "func_y", text="Value") column_flow = layout.column_flow(columns=3, align=True) - column_flow.label(text="Z") + column_flow.label(text="Z") column_flow.prop(tex.pov, "func_plus_z", text="") column_flow.prop(tex.pov, "func_z", text="Value") row=layout.row(align=align) @@ -1171,8 +1171,8 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): if tex.pov.warp_types not in {"CUBIC","NONE"}: layout.prop(tex.pov, "warp_orientation", text="Warp orientation") col = layout.column(align=align) - row = col.row() - row.prop(tex.pov, "warp_dist_exp", text="Distance exponent") + row = col.row() + row.prop(tex.pov, "warp_dist_exp", text="Distance exponent") row = col.row() row.prop(tex.pov, "modifier_frequency", text="Frequency") row.prop(tex.pov, "modifier_phase", text="Phase") @@ -1182,7 +1182,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): row.label(text="Offset:") row.label(text="Scale:") row.label(text="Rotate:") - col=layout.column(align=align) + col=layout.column(align=align) row=col.row() row.prop(tex.pov, "tex_mov_x", text="X") row.prop(tex.pov, "tex_scale_x", text="X") @@ -1198,7 +1198,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): row=layout.row() row.label(text="Turbulence:") - col=layout.column(align=align) + col=layout.column(align=align) row=col.row() row.prop(tex.pov, "warp_turbulence_x", text="X") row.prop(tex.pov, "modifier_octaves", text="Octaves") @@ -1208,7 +1208,7 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel): row=col.row() row.prop(tex.pov, "warp_turbulence_z", text="Z") row.prop(tex.pov, "modifier_omega", text="Omega") - + class TEXTURE_PT_povray_tex_gamma(TextureButtonsPanel, bpy.types.Panel): bl_label = "Image Gamma" COMPAT_ENGINES = {'POVRAY_RENDER'} @@ -1267,27 +1267,27 @@ class OBJECT_PT_povray_obj_sphere(PovDataButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'SPHERE' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'SPHERE' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'SPHERE': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="Sphere radius: " + str(obj.pov.sphere_radius)) else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.sphere_update", text="Update",icon="SOLID") - + + layout.operator("pov.sphere_update", text="Update",icon="SOLID") + #col.label(text="Parameters:") col.prop(obj.pov, "sphere_radius", text="Radius of Sphere") @@ -1300,28 +1300,28 @@ class OBJECT_PT_povray_obj_cylinder(PovDataButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'CYLINDER' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'CYLINDER' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'CYLINDER': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="Cylinder radius: " + str(obj.pov.cylinder_radius)) col.label(text="Cylinder cap location: " + str(obj.pov.cylinder_location_cap)) else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.cylinder_update", text="Update",icon="MESH_CYLINDER") - + + layout.operator("pov.cylinder_update", text="Update",icon="MESH_CYLINDER") + #col.label(text="Parameters:") col.prop(obj.pov, "cylinder_radius") col.prop(obj.pov, "cylinder_location_cap") @@ -1334,29 +1334,29 @@ class OBJECT_PT_povray_obj_cone(PovDataButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'CONE' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'CONE' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'CONE': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="Cone base radius: " + str(obj.pov.cone_base_radius)) col.label(text="Cone cap radius: " + str(obj.pov.cone_cap_radius)) col.label(text="Cone proxy segments: " + str(obj.pov.cone_segments)) col.label(text="Cone height: " + str(obj.pov.cone_height)) else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.cone_update", text="Update",icon="MESH_CONE") - + + layout.operator("pov.cone_update", text="Update",icon="MESH_CONE") + #col.label(text="Parameters:") col.prop(obj.pov, "cone_base_radius", text="Radius of Cone Base") col.prop(obj.pov, "cone_cap_radius", text="Radius of Cone Cap") @@ -1371,38 +1371,38 @@ class OBJECT_PT_povray_obj_superellipsoid(PovDataButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'SUPERELLIPSOID' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'SUPERELLIPSOID' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'SUPERELLIPSOID': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="Radial segmentation: " + str(obj.pov.se_u)) col.label(text="Lateral segmentation: " + str(obj.pov.se_v)) col.label(text="Ring shape: " + str(obj.pov.se_n1)) col.label(text="Cross-section shape: " + str(obj.pov.se_n2)) col.label(text="Fill up and down: " + str(obj.pov.se_edit)) else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.superellipsoid_update", text="Update",icon="MOD_SUBSURF") - + + layout.operator("pov.superellipsoid_update", text="Update",icon="MOD_SUBSURF") + #col.label(text="Parameters:") col.prop(obj.pov, "se_u") col.prop(obj.pov, "se_v") col.prop(obj.pov, "se_n1") col.prop(obj.pov, "se_n2") col.prop(obj.pov, "se_edit") - - + + class OBJECT_PT_povray_obj_torus(PovDataButtonsPanel, bpy.types.Panel): bl_label = "POV-Ray Torus" COMPAT_ENGINES = {'POVRAY_RENDER'} @@ -1411,29 +1411,29 @@ class OBJECT_PT_povray_obj_torus(PovDataButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'TORUS' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'TORUS' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'TORUS': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="Torus major radius: " + str(obj.pov.torus_major_radius)) col.label(text="Torus minor radius: " + str(obj.pov.torus_minor_radius)) col.label(text="Torus major segments: " + str(obj.pov.torus_major_segments)) col.label(text="Torus minor segments: " + str(obj.pov.torus_minor_segments)) else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.torus_update", text="Update",icon="MESH_TORUS") - + + layout.operator("pov.torus_update", text="Update",icon="MESH_TORUS") + #col.label(text="Parameters:") col.prop(obj.pov, "torus_major_radius") col.prop(obj.pov, "torus_minor_radius") @@ -1448,38 +1448,38 @@ class OBJECT_PT_povray_obj_supertorus(PovDataButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'SUPERTORUS' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'SUPERTORUS' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'SUPERTORUS': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="SuperTorus major radius: " + str(obj.pov.st_major_radius)) col.label(text="SuperTorus minor radius: " + str(obj.pov.st_minor_radius)) col.label(text="SuperTorus major segments: " + str(obj.pov.st_u)) col.label(text="SuperTorus minor segments: " + str(obj.pov.st_v)) - + col.label(text="SuperTorus Ring Manipulator: " + str(obj.pov.st_ring)) col.label(text="SuperTorus Cross Manipulator: " + str(obj.pov.st_cross)) col.label(text="SuperTorus Internal And External radii: " + str(obj.pov.st_ie)) - + col.label(text="SuperTorus accuracy: " + str(ob.pov.st_accuracy)) col.label(text="SuperTorus max gradient: " + str(ob.pov.st_max_gradient)) - + else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.supertorus_update", text="Update",icon="MESH_TORUS") - + + layout.operator("pov.supertorus_update", text="Update",icon="MESH_TORUS") + #col.label(text="Parameters:") col.prop(obj.pov, "st_major_radius") col.prop(obj.pov, "st_minor_radius") @@ -1491,7 +1491,7 @@ class OBJECT_PT_povray_obj_supertorus(PovDataButtonsPanel, bpy.types.Panel): #col.prop(obj.pov, "st_edit") #? col.prop(obj.pov, "st_accuracy") col.prop(obj.pov, "st_max_gradient") - + class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel): bl_label = "POV-Ray Parametric surface" COMPAT_ENGINES = {'POVRAY_RENDER'} @@ -1500,17 +1500,17 @@ class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel): def poll(cls, context): engine = context.scene.render.engine obj = context.object - return (obj and obj.pov.object_as == 'PARAMETRIC' and (engine in cls.COMPAT_ENGINES)) + return (obj and obj.pov.object_as == 'PARAMETRIC' and (engine in cls.COMPAT_ENGINES)) def draw(self, context): layout = self.layout obj = context.object - + col = layout.column() if obj.pov.object_as == 'PARAMETRIC': if obj.pov.unlock_parameters == False: - col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') + col.prop(obj.pov, "unlock_parameters", text="Exported parameters below", icon='LOCKED') col.label(text="Minimum U: " + str(obj.pov.u_min)) col.label(text="Minimum V: " + str(obj.pov.v_min)) col.label(text="Maximum U: " + str(obj.pov.u_max)) @@ -1520,13 +1520,13 @@ class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel): col.label(text="Z Function: " + str(obj.pov.x_eq)) else: - col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') + col.prop(obj.pov, "unlock_parameters", text="Edit exported parameters", icon='UNLOCKED') col.label(text="3D view proxy may get out of synch") col.active = obj.pov.unlock_parameters - - layout.operator("pov.parametric_update", text="Update",icon="SCRIPTPLUGINS") - + + layout.operator("pov.parametric_update", text="Update",icon="SCRIPTPLUGINS") + col.prop(obj.pov, "u_min", text="Minimum U") col.prop(obj.pov, "v_min", text="Minimum V") col.prop(obj.pov, "u_max", text="Maximum U") @@ -1535,7 +1535,7 @@ class OBJECT_PT_povray_obj_parametric(PovDataButtonsPanel, bpy.types.Panel): col.prop(obj.pov, "y_eq", text="Y Function") col.prop(obj.pov, "z_eq", text="Z Function") - + class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, bpy.types.Panel): bl_label = "Custom POV Code" COMPAT_ENGINES = {'POVRAY_RENDER'} @@ -1552,19 +1552,19 @@ class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, bpy.types.Panel): ############################################################################### # Add Povray Objects ############################################################################### - + class Povray_primitives_add_menu(bpy.types.Menu): """Define the menu with presets""" bl_idname = "Povray_primitives_add_menu" bl_label = "Povray" COMPAT_ENGINES = {'POVRAY_RENDER'} - + @classmethod def poll(cls, context): engine = context.scene.render.engine - return (engine == 'POVRAY_RENDER') - + return (engine == 'POVRAY_RENDER') + def draw(self,context): layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' @@ -1574,9 +1574,9 @@ class Povray_primitives_add_menu(bpy.types.Menu): class BasicShapesMenu(bpy.types.Menu): bl_idname = "Basic_shapes_calls" bl_label = "Basic_shapes" - + def draw(self,context): - pov = bpy.types.Object.pov #context.object.pov ? + pov = bpy.types.Object.pov #context.object.pov ? layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("pov.addplane", text="Infinite Plane",icon = 'MESH_PLANE') @@ -1604,13 +1604,13 @@ class BasicShapesMenu(bpy.types.Menu): layout.label(text = "Macro based") layout.operator("pov.addpolygontocircle", text="Polygon To Circle Blending",icon="RETOPO") layout.operator("pov.addloft", text="Loft",icon="SURFACE_NSURFACE") - + class ImportMenu(bpy.types.Menu): bl_idname = "Importer_calls" bl_label = "Import" def draw(self,context): - pov = bpy.types.Object.pov #context.object.pov ? + pov = bpy.types.Object.pov #context.object.pov ? layout = self.layout layout.operator_context = 'INVOKE_REGION_WIN' layout.operator("import_scene.pov",icon="FORCE_LENNARDJONES") @@ -1618,14 +1618,14 @@ class ImportMenu(bpy.types.Menu): def menu_func_add(self, context): engine = context.scene.render.engine if engine == 'POVRAY_RENDER': - self.layout.menu("Povray_primitives_add_menu", icon="PLUGIN") + self.layout.menu("Povray_primitives_add_menu", icon="PLUGIN") def menu_func_import(self, context): engine = context.scene.render.engine if engine == 'POVRAY_RENDER': self.layout.operator("import_scene.pov",icon="FORCE_LENNARDJONES") - + ##############Nodes # def find_node_input(node, name): @@ -1638,7 +1638,7 @@ def menu_func_import(self, context): # #layout.operator("pov.material_use_nodes", icon='SOUND')#'NODETREE') # #layout.operator("pov.use_shading_nodes", icon='NODETREE') # layout.operator("WM_OT_context_toggle", icon='NODETREE').data_path = \ - # "material.pov.material_use_nodes" + # "material.pov.material_use_nodes" # return False # ntree = id_data.node_tree @@ -1677,7 +1677,7 @@ def menu_func_nodes(self, context): ############################################################################### # Camera Povray Settings -############################################################################### +############################################################################### class CAMERA_PT_povray_cam_dof(CameraDataButtonsPanel, bpy.types.Panel): bl_label = "POV-Ray Depth Of Field" COMPAT_ENGINES = {'POVRAY_RENDER'} @@ -1707,7 +1707,7 @@ class CAMERA_PT_povray_cam_dof(CameraDataButtonsPanel, bpy.types.Panel): col.prop(cam.pov, "dof_confidence") - + class CAMERA_PT_povray_cam_nor(CameraDataButtonsPanel, bpy.types.Panel): bl_label = "POV-Ray Perturbation" COMPAT_ENGINES = {'POVRAY_RENDER'} |