*Added POV-Ray Primitives, available in ADD menu

*Added Import Menu using PovSphere primitive to import pov files output from Avogadro
*Added editable properties and update for pov objects
This commit is contained in:
Maurice Raybaud 2015-11-12 15:57:29 +01:00
parent 2391d5041b
commit 8e88b29ff9
3 changed files with 4892 additions and 1045 deletions

View File

@ -20,9 +20,10 @@
bl_info = {
"name": "POV-Ray 3.7",
"author": "Campbell Barton, Silvio Falcinelli, Maurice Raybaud, Constantin Rahn, Bastien Montagne",
"author": "Campbell Barton, Silvio Falcinelli, Maurice Raybaud, "
"Constantin Rahn, Bastien Montagne, Leonid Desyatkov",
"version": (0, 0, 9),
"blender": (2, 57, 0),
"blender": (2, 75, 0),
"location": "Render > Engine > POV-Ray 3.7",
"description": "Basic POV-Ray 3.7 integration for blender",
"warning": "this script is RC",
@ -39,6 +40,7 @@ if "bpy" in locals():
else:
import bpy
import addon_utils # To use some other addons
from bpy.types import (
AddonPreferences,
PropertyGroup,
@ -52,6 +54,7 @@ else:
FloatVectorProperty,
EnumProperty,
PointerProperty,
CollectionProperty,
)
from . import (
ui,
@ -59,6 +62,7 @@ else:
update_files,
)
def string_strip_hyphen(name):
return name.replace("-", "")
@ -69,34 +73,40 @@ class RenderPovSettingsScene(PropertyGroup):
# File Options
tempfiles_enable = BoolProperty(
name="Enable Tempfiles",
description="Enable the OS-Tempfiles. Otherwise set the path where to save the files",
description="Enable the OS-Tempfiles. Otherwise set the path where"
" to save the files",
default=True)
pov_editor = BoolProperty(
name="POV-Ray editor",
description="Don't Close POV-Ray editor after rendering (Overriden by /EXIT command)",
description="Don't Close POV-Ray editor after rendering (Overriden"
" by /EXIT command)",
default=False)
deletefiles_enable = BoolProperty(
name="Delete files",
description="Delete files after rendering. Doesn't work with the image",
description="Delete files after rendering. "
"Doesn't work with the image",
default=True)
scene_name = StringProperty(
name="Scene Name",
description="Name of POV-Ray scene to create. Empty name will use the name of "
"the blend file",
description="Name of POV-Ray scene to create. Empty name will use "
"the name of the blend file",
maxlen=1024)
scene_path = StringProperty(
name="Export scene path",
# description="Path to directory where the exported scene (POV and INI) is created", # Bug in POV-Ray RC3
# Bug in POV-Ray RC3
# description="Path to directory where the exported scene "
# "(POV and INI) is created",
description="Path to directory where the files are created",
maxlen=1024, subtype="DIR_PATH")
renderimage_path = StringProperty(
name="Rendered image path",
description="Full path to directory where the rendered image is saved",
description="Full path to directory where the rendered image is "
"saved",
maxlen=1024, subtype="DIR_PATH")
list_lf_enable = BoolProperty(
name="LF in lists",
description="Enable line breaks in lists (vectors and indices). Disabled: "
"lists are exported in one line",
description="Enable line breaks in lists (vectors and indices). "
"Disabled: lists are exported in one line",
default=True)
# Not a real pov option, just to know if we should write
@ -104,10 +114,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",
@ -121,7 +133,9 @@ class RenderPovSettingsScene(PropertyGroup):
media_color = FloatVectorProperty(
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'}, subtype='COLOR')
default=(0.001, 0.001, 0.001),
options={'ANIMATABLE'},
subtype='COLOR')
baking_enable = BoolProperty(
name="Enable Baking",
@ -147,8 +161,9 @@ class RenderPovSettingsScene(PropertyGroup):
# Real pov options
command_line_switches = StringProperty(
name="Command Line Switches",
description="Command line switches consist of a + (plus) or - (minus) sign, followed "
"by one or more alphabetic characters and possibly a numeric value",
description="Command line switches consist of a + (plus) or - "
"(minus) sign, followed by one or more alphabetic "
"characters and possibly a numeric value",
maxlen=500)
antialias_enable = BoolProperty(
@ -157,13 +172,15 @@ class RenderPovSettingsScene(PropertyGroup):
antialias_method = EnumProperty(
name="Method",
description="AA-sampling method. Type 1 is an adaptive, non-recursive, super-sampling "
"method. Type 2 is an adaptive and recursive super-sampling method. "
"Type 3 is a stochastic halton based super-sampling method",
description="AA-sampling method. Type 1 is an adaptive, "
"non-recursive, super-sampling method. Type 2 is an "
"adaptive and recursive super-sampling method. Type 3 "
"is a stochastic halton based super-sampling method",
items=(("0", "non-recursive AA", "Type 1 Sampling in POV-Ray"),
("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 "
@ -180,8 +197,9 @@ class RenderPovSettingsScene(PropertyGroup):
jitter_enable = BoolProperty(
name="Jitter",
description="Enable Jittering. Adds noise into the sampling process (it should be "
"avoided to use jitter in animation)",
description="Enable Jittering. Adds noise into the sampling "
"process (it should be avoided to use jitter in "
"animation)",
default=False)
jitter_amount = FloatProperty(
@ -190,34 +208,56 @@ class RenderPovSettingsScene(PropertyGroup):
antialias_gamma = FloatProperty(
name="Antialias Gamma",
description="POV-Ray compares gamma-adjusted values for super sampling. Antialias "
"Gamma sets the Gamma before comparison",
description="POV-Ray compares gamma-adjusted values for super "
"sampling. Antialias Gamma sets the Gamma before "
"comparison",
min=0.0, max=5.0, soft_min=0.01, soft_max=2.5, default=2.5)
max_trace_level = IntProperty(
name="Max Trace Level",
description="Number of reflections/refractions allowed on ray path",
description="Number of reflections/refractions allowed on ray "
"path",
min=1, max=256, default=5)
########################### PHOTONS #######################################
photon_enable = BoolProperty(
name="Photons",
description="Enable global photons",
default=False)
photon_enable_count = BoolProperty(
name="Spacing / Count",
description="Enable count photons",
default=False)
photon_count = IntProperty(
name="Count",
description="Photons count",
min=1, max=100000000, default=20000)
photon_spacing = FloatProperty(
name="Spacing",
description="Average distance between photons on surfaces. half this get four times "
"as many surface photons",
min=0.001, max=1.000, soft_min=0.001, soft_max=1.000, default=0.005, precision=3)
description="Average distance between photons on surfaces. half "
"this get four times as many surface photons",
min=0.001, max=1.000, default=0.005,
soft_min=0.001, soft_max=1.000, precision=3)
photon_max_trace_level = IntProperty(
name="Max Trace Level",
description="Number of reflections/refractions allowed on ray path",
description="Number of reflections/refractions allowed on ray "
"path",
min=1, max=256, default=5)
photon_adc_bailout = FloatProperty(
name="ADC Bailout",
description="The adc_bailout for photons. Use adc_bailout = "
"0.01 / brightest_ambient_object for good results",
min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default=0.1, precision=3)
min=0.0, max=1000.0, default=0.1,
soft_min=0.0, soft_max=1.0, precision=3)
photon_gather_min = IntProperty(
name="Gather Min", description="Minimum number of photons gathered for each point",
name="Gather Min", description="Minimum number of photons gathered"
"for each point",
min=1, max=256, default=20)
photon_gather_max = IntProperty(
@ -228,7 +268,7 @@ class RenderPovSettingsScene(PropertyGroup):
name="ADC Bailout",
description="The adc_bailout for radiosity rays. Use "
"adc_bailout = 0.01 / brightest_ambient_object for good results",
min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default=0.01, precision=3)
min=0.0, max=1000.0, soft_min=0.0, soft_max=1.0, default=0.0039, precision=4)
radio_always_sample = BoolProperty(
name="Always Sample",
@ -291,7 +331,7 @@ class RenderPovSettingsScene(PropertyGroup):
name="Recursion Limit",
description="how many recursion levels are used to calculate "
"the diffuse inter-reflection",
min=1, max=20, default=3)
min=1, max=20, default=1)
radio_pretrace_start = FloatProperty(
name="Pretrace Start",
@ -303,7 +343,7 @@ class RenderPovSettingsScene(PropertyGroup):
name="Pretrace End",
description="Fraction of the screen width which sets the size of the blocks "
"in the mosaic preview last pass",
min=0.001, max=1.00, soft_min=0.01, soft_max=1.00, default=0.04, precision=3)
min=0.000925, max=1.00, soft_min=0.01, soft_max=1.00, default=0.04, precision=3)
###############################################################################
@ -352,7 +392,8 @@ class RenderPovSettingsMaterial(PropertyGroup):
min=0.0, max=10.0, soft_min=0.000, soft_max=1.0, default=0)
interior_fade_color = FloatVectorProperty(
name="Fade Color", description="Color of filtered attenuation for transparent materials",
name="Fade Color", description="Color of filtered attenuation for transparent "
"materials",
precision=4, step=0.01, min=0.0, soft_max=1.0,
default=(0, 0, 0), options={'ANIMATABLE'}, subtype='COLOR')
@ -439,29 +480,44 @@ class RenderPovSettingsTexture(PropertyGroup):
tex_pattern_type = EnumProperty(
name="Texture_Type",
description="Choose between Blender or POV-Ray parameters to specify texture",
items= (('agate', 'Agate', '','PLUGIN', 0), ('aoi', 'Aoi', '', 'PLUGIN', 1),
('average', 'Average', '', 'PLUGIN', 2), ('boxed', 'Boxed', '', 'PLUGIN', 3),
('bozo', 'Bozo', '', 'PLUGIN', 4), ('bumps', 'Bumps', '', 'PLUGIN', 5),
('cells', 'Cells', '', 'PLUGIN', 6), ('crackle', 'Crackle', '', 'PLUGIN', 7),
('cubic', 'Cubic', '', 'PLUGIN', 8), ('cylindrical', 'Cylindrical', '', 'PLUGIN', 9),
items= (('agate', 'Agate', '','PLUGIN', 0),
('aoi', 'Aoi', '', 'PLUGIN', 1),
('average', 'Average', '', 'PLUGIN', 2),
('boxed', 'Boxed', '', 'PLUGIN', 3),
('bozo', 'Bozo', '', 'PLUGIN', 4),
('bumps', 'Bumps', '', 'PLUGIN', 5),
('cells', 'Cells', '', 'PLUGIN', 6),
('crackle', 'Crackle', '', 'PLUGIN', 7),
('cubic', 'Cubic', '', 'PLUGIN', 8),
('cylindrical', 'Cylindrical', '', 'PLUGIN', 9),
('density_file', 'Density', '(.df3)', 'PLUGIN', 10),
('dents', 'Dents', '', 'PLUGIN', 11),
('fractal', 'Fractal', '', 'PLUGIN', 12),
('function', 'Function', '', 'PLUGIN', 13),
('gradient', 'Gradient', '', 'PLUGIN', 14), ('granite', 'Granite', '', 'PLUGIN', 15),
('gradient', 'Gradient', '', 'PLUGIN', 14),
('granite', 'Granite', '', 'PLUGIN', 15),
('image_pattern', 'Image pattern', '', 'PLUGIN', 16),
('leopard', 'Leopard', '', 'PLUGIN', 17),
('marble', 'Marble', '', 'PLUGIN', 18), ('onion', 'Onion', '', 'PLUGIN', 19),
('marble', 'Marble', '', 'PLUGIN', 18),
('onion', 'Onion', '', 'PLUGIN', 19),
('pigment_pattern', 'pigment pattern', '', 'PLUGIN', 20),
('planar', 'Planar', '', 'PLUGIN', 21), ('quilted', 'Quilted', '', 'PLUGIN', 22),
('radial', 'Radial', '', 'PLUGIN', 23), ('ripples', 'Ripples', '', 'PLUGIN', 24),
('planar', 'Planar', '', 'PLUGIN', 21),
('quilted', 'Quilted', '', 'PLUGIN', 22),
('radial', 'Radial', '', 'PLUGIN', 23),
('ripples', 'Ripples', '', 'PLUGIN', 24),
('slope', 'Slope', '', 'PLUGIN', 25),
('spherical', 'Spherical', '', 'PLUGIN', 26), ('spiral1', 'Spiral1', '', 'PLUGIN', 27),
('spiral2', 'Spiral2', '', 'PLUGIN', 28), ('spotted', 'Spotted', '', 'PLUGIN', 29),
('waves', 'Waves', '', 'PLUGIN', 30), ('wood', 'Wood', '', 'PLUGIN', 31),
('wrinkles', 'Wrinkles', '', 'PLUGIN', 32), ('brick', "Brick", "", 'PLUGIN', 33),
('checker', "Checker", "", 'PLUGIN', 34), ('hexagon', "Hexagon", "", 'PLUGIN', 35),
('object', "Mesh", "", 'PLUGIN', 36), ('emulator', "Internal Emulator", "", 'PLUG', 37)),
('spherical', 'Spherical', '', 'PLUGIN', 26),
('spiral1', 'Spiral1', '', 'PLUGIN', 27),
('spiral2', 'Spiral2', '', 'PLUGIN', 28),
('spotted', 'Spotted', '', 'PLUGIN', 29),
('waves', 'Waves', '', 'PLUGIN', 30),
('wood', 'Wood', '', 'PLUGIN', 31),
('wrinkles', 'Wrinkles', '', 'PLUGIN', 32),
('brick', "Brick", "", 'PLUGIN', 33),
('checker', "Checker", "", 'PLUGIN', 34),
('hexagon', "Hexagon", "", 'PLUGIN', 35),
('object', "Mesh", "", 'PLUGIN', 36),
('emulator', "Internal Emulator", "", 'PLUG', 37)),
default='emulator',
)
@ -479,8 +535,9 @@ class RenderPovSettingsTexture(PropertyGroup):
warp_types = EnumProperty(
name="Warp Types",
description="Select the type of warp",
items=(('PLANAR', "Planar", ""), ('CUBIC', "Cubic", ""), ('SPHERICAL', "Spherical", ""),
('TOROIDAL', "Toroidal", ""), ('CYLINDRICAL', "Cylindrical", ""),('NONE', "None", "No indentation")),
items=(('PLANAR', "Planar", ""), ('CUBIC', "Cubic", ""),
('SPHERICAL', "Spherical", ""), ('TOROIDAL', "Toroidal", ""),
('CYLINDRICAL', "Cylindrical", ""), ('NONE', "None", "No indentation")),
default='NONE')
warp_orientation = EnumProperty(
@ -492,8 +549,8 @@ class RenderPovSettingsTexture(PropertyGroup):
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', "")),
items=(('ramp', "Ramp", ""), ('sine', "Sine", ""), ('scallop', "Scallop", ""),
('cubic', "Cubic", ""), ('poly', "Poly", ""), ('triangle', 'Triangle', "")),
default='ramp')
gen_noise = IntProperty(
@ -544,12 +601,14 @@ class RenderPovSettingsTexture(PropertyGroup):
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",
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",
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)
modifier_turbulence = FloatProperty(
@ -703,8 +762,8 @@ class RenderPovSettingsTexture(PropertyGroup):
description="",
min=0, max=4, default=0)
#########FUNCTIONS#########################################################################################################################
#########FUNCTIONS#########################################################################################################################
#########FUNCTIONS#############################################################################
#########FUNCTIONS#############################################################################
func_list = EnumProperty(
name="Functions",
@ -715,21 +774,27 @@ 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_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_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_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_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_kampyle_of_eudoxus","Kampyle of eudoxus",""),
("f_kampyle_of_eudoxus_2d","Kampyle of eudoxus 2d",""), ("f_klein_bottle","Klein bottle",""),
("f_kummer_surface_v1","Kummer surface v1",""), ("f_kummer_surface_v2","Kummer surface v2",""),
("f_lemniscate_of_gerono","Lemniscate of gerono",""), ("f_lemniscate_of_gerono_2d","Lemniscate of gerono 2d",""),
("f_hunt_surface","Hunt surface",""),
("f_hyperbolic_torus","Hyperbolic torus",""),
("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",""),
("f_kummer_surface_v1","Kummer surface v1",""),
("f_kummer_surface_v2","Kummer surface v2",""),
("f_lemniscate_of_gerono","Lemniscate of gerono",""),
("f_lemniscate_of_gerono_2d","Lemniscate of gerono 2d",""),
("f_mesh1","Mesh1",""), ("f_mitre","Mitre",""),
("f_nodal_cubic","Nodal cubic",""), ("f_noise3d","Noise3d",""),
("f_noise_generator","Noise generator",""), ("f_odd","Odd",""),
@ -738,7 +803,8 @@ class RenderPovSettingsTexture(PropertyGroup):
("f_pillow","Pillow",""), ("f_piriform","Piriform",""),
("f_piriform_2d","Piriform 2d",""), ("f_poly4","Poly4",""),
("f_polytubes","Polytubes",""), ("f_quantum","Quantum",""),
("f_quartic_paraboloid","Quartic paraboloid",""), ("f_quartic_saddle","Quartic saddle",""),
("f_quartic_paraboloid","Quartic paraboloid",""),
("f_quartic_saddle","Quartic saddle",""),
("f_quartic_cylinder","Quartic cylinder",""), ("f_r","R",""),
("f_ridge","Ridge",""), ("f_ridged_mf","Ridged mf",""),
("f_rounded_box","Rounded box",""), ("f_sphere","Sphere",""),
@ -748,7 +814,8 @@ class RenderPovSettingsTexture(PropertyGroup):
("f_superellipsoid","Superellipsoid",""), ("f_th","Th",""),
("f_torus","Torus",""), ("f_torus2","Torus2",""),
("f_torus_gumdrop","Torus gumdrop",""), ("f_umbrella","Umbrella",""),
("f_witch_of_agnesi","Witch of agnesi",""), ("f_witch_of_agnesi_2d","Witch of agnesi 2d","")),
("f_witch_of_agnesi","Witch of agnesi",""),
("f_witch_of_agnesi_2d","Witch of agnesi 2d","")),
default='NONE')
@ -879,10 +946,13 @@ class RenderPovSettingsTexture(PropertyGroup):
tex_scale_z = FloatProperty(
name="Scale Z",
description="",
min=0.0, max=10000.0, default=1.0)
min=0.0, max=10000.0, default=1.0)
###############################################################################
# Object POV properties.
###############################################################################
class RenderPovSettingsObject(PropertyGroup):
# Importance sampling
importance_value = FloatProperty(
@ -916,7 +986,399 @@ class RenderPovSettingsObject(PropertyGroup):
"it points at. Any POV shape expected e.g: isosurface {}",
default="")
#############POV-Ray specific object properties.############################
object_as = StringProperty(maxlen=1024)
imported_loc = FloatVectorProperty(
name="Imported Pov location",
precision=6,
default=(0.0, 0.0, 0.0))
unlock_parameters = BoolProperty(name="Lock",default = False)
curveshape = EnumProperty(
name="Povray Shape Type",
items=(("birail", "Birail", ""),
("cairo", "Cairo", ""),
("lathe", "Lathe", ""),
("loft", "Loft", ""),
("prism", "Prism", ""),
("sphere_sweep", "Sphere Sweep", "")),
default="sphere_sweep")
mesh_write_as = EnumProperty(
name="Mesh Write As",
items=(("blobgrid", "Blob Grid", ""),
("grid", "Grid", ""),
("mesh", "Mesh", "")),
default="mesh")
# shape_as_light = StringProperty(name="Light",maxlen=1024)
# object_ior = FloatProperty(
# name="IOR", description="IOR",
# min=1.0, max=10.0,default=1.0)
# fake_caustics_power = FloatProperty(
# name="Power", description="Fake caustics power",
# min=0.0, max=10.0,default=0.0)
# target = BoolProperty(name="Target",description="",default=False)
# target_value = FloatProperty(
# name="Value", description="",
# min=0.0, max=1.0,default=1.0)
# refraction = BoolProperty(name="Refraction",description="",default=False)
# dispersion = BoolProperty(name="Dispersion",description="",default=False)
# dispersion_value = FloatProperty(
# name="Dispersion", description="Good values are 1.01 to 1.1. ",
# min=1.0, max=1.2,default=1.01)
# dispersion_samples = IntProperty(name="Samples",min=2, max=100,default=7)
# 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", ""),
("bounded_by", "Bounded_by", ""),
("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)
cylinder_radius = FloatProperty(name="Cylinder R",min=0.00, max=10.0, default=0.04)
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)
def prop_update_sphere(self, context):
bpy.ops.pov.sphere_update()
sphere_radius = FloatProperty(name="Sphere radius",min=0.00, max=10.0, default=0.5, update=prop_update_sphere)
def prop_update_cone(self, context):
bpy.ops.pov.cone_update()
cone_base_radius = FloatProperty(
name = "Base radius", description = "The first radius of the cone",
default = 1.0, min = 0.01, max = 100.0, update=prop_update_cone)
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)
cone_height = FloatProperty(
name = "Height", description = "Height of the cone",
default = 2.0, min = 0.01, max = 100.0, update=prop_update_cone)
cone_base_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)
v_min = FloatProperty(name = "V Min",
description = "",
default = 0.0, update=prop_update_parametric)
u_max = FloatProperty(name = "U Max",
description = "",
default = 6.28, update=prop_update_parametric)
v_max = FloatProperty(name = "V Max",
description = "",
default = 12.57, update=prop_update_parametric)
x_eq = StringProperty(
maxlen=1024, default = "cos(v)*(1+cos(u))*sin(v/8)", update=prop_update_parametric)
y_eq = StringProperty(
maxlen=1024, default = "sin(u)*sin(v/8)+cos(v/8)*1.5", update=prop_update_parametric)
z_eq = StringProperty(
maxlen=1024, default = "sin(v)*(1+cos(u))*sin(v/8)", update=prop_update_parametric)
###########Torus
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)
torus_minor_segments = IntProperty(
name = "Segments", description = "Cross-section segmentation of proxy mesh",
default = 12, min = 3, max = 720, update=prop_update_torus)
torus_major_radius = FloatProperty(
name="Major radius",
description="Major radius",
min=0.00, max=100.00, default=1.0, update=prop_update_torus)
torus_minor_radius = FloatProperty(
name="Minor radius",
description="Minor radius",
min=0.00, max=100.00, default=0.25, update=prop_update_torus)
###########Rainbow
arc_angle = FloatProperty(name = "Arc angle",
description = "The angle of the raynbow arc in degrees",
default = 360, min = 0.01, max = 360.0)
falloff_angle = FloatProperty(name = "Falloff angle",
description = "The angle after which rainbow dissolves into background",
default = 360, min = 0.0, max = 360)
###########HeightFields
quality = IntProperty(name = "Quality",
description = "",
default = 100, min = 1, max = 100)
hf_filename = StringProperty(maxlen = 1024)
hf_gamma = FloatProperty(
name="Gamma",
description="Gamma",
min=0.0001, max=20.0, default=1.0)
hf_premultiplied = BoolProperty(
name="Premultiplied",
description="Premultiplied",
default=True)
hf_smooth = BoolProperty(
name="Smooth",
description="Smooth",
default=False)
hf_water = FloatProperty(
name="Water Level",
description="Wather Level",
min=0.00, max=1.00, default=0.0)
hf_hierarchy = BoolProperty(
name="Hierarchy",
description="Height field hierarchy",
default=True)
##############Superellipsoid
def prop_update_superellipsoid(self, context):
bpy.ops.pov.superellipsoid_update()
se_param1 = FloatProperty(
name="Parameter 1",
description="",
min=0.00, max=10.0, default=0.04)
se_param2 = FloatProperty(
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,
update=prop_update_superellipsoid)
se_v = IntProperty(name = "V-segments",
description = "lateral segmentation",
default = 20, min = 4, max = 265,
update=prop_update_superellipsoid)
se_n1 = FloatProperty(name = "Ring manipulator",
description = "Manipulates the shape of the Ring",
default = 1.0, min = 0.01, max = 100.0,
update=prop_update_superellipsoid)
se_n2 = FloatProperty(name = "Cross manipulator",
description = "Manipulates the shape of the cross-section",
default = 1.0, min = 0.01, max = 100.0,
update=prop_update_superellipsoid)
se_edit = EnumProperty(items=[("NOTHING", "Nothing", ""),
("NGONS", "N-Gons", ""),
("TRIANGLES", "Triangles", "")],
name="Fill up and down",
description="",
default='TRIANGLES',
update=prop_update_superellipsoid)
#############Used for loft and Superellipsoid, etc.
curveshape = EnumProperty(
name="Povray Shape Type",
items=(("birail", "Birail", ""),
("cairo", "Cairo", ""),
("lathe", "Lathe", ""),
("loft", "Loft", ""),
("prism", "Prism", ""),
("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",
min=0.00, max=100.00, default=1.0,
update=prop_update_supertorus)
st_minor_radius = FloatProperty(
name="Minor radius",
description="Minor radius",
min=0.00, max=100.00, default=0.25,
update=prop_update_supertorus)
st_ring = FloatProperty(
name="Ring",
description="Ring manipulator",
min=0.0001, max=100.00, default=1.00,
update=prop_update_supertorus)
st_cross = FloatProperty(
name="Cross",
description="Cross manipulator",
min=0.0001, max=100.00, default=1.00,
update=prop_update_supertorus)
st_accuracy = FloatProperty(
name="Accuracy",
description="Supertorus accuracy",
min=0.00001, max=1.00, default=0.001)
st_max_gradient = FloatProperty(
name="Gradient",
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,
update=prop_update_supertorus)
st_r = FloatProperty(name = "small radius",
description = "The radius of the tube",
default = 0.3, min = 0.01, max = 100.0,
update=prop_update_supertorus)
st_u = IntProperty(name = "U-segments",
description = "radial segmentation",
default = 16, min = 3, max = 265,
update=prop_update_supertorus)
st_v = IntProperty(name = "V-segments",
description = "lateral segmentation",
default = 8, min = 3, max = 265,
update=prop_update_supertorus)
st_n1 = FloatProperty(name = "Ring manipulator",
description = "Manipulates the shape of the Ring",
default = 1.0, min = 0.01, max = 100.0,
update=prop_update_supertorus)
st_n2 = FloatProperty(name = "Cross manipulator",
description = "Manipulates the shape of the cross-section",
default = 1.0, min = 0.01, max = 100.0,
update=prop_update_supertorus)
st_ie = BoolProperty(name = "Use Int.+Ext. radii",
description = "Use internal and external radii",
default = False,
update=prop_update_supertorus)
st_edit = BoolProperty(name="",
description="",
default=False,
options={'HIDDEN'},
update=prop_update_supertorus)
########################Loft
loft_n = IntProperty(name = "Segments",
description = "Vertical segments",
default = 16, min = 3, max = 720)
loft_rings_bottom = IntProperty(name = "Bottom",
description = "Bottom rings",
default = 5, min = 2, max = 100)
loft_rings_side = IntProperty(name = "Side",
description = "Side rings",
default = 10, min = 2, max = 100)
loft_thick = FloatProperty(name = "Thickness",
description = "Manipulates the shape of the Ring",
default = 0.3, min = 0.01, max = 1.0)
loft_r = FloatProperty(name = "Radius",
description = "Radius",
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)
###################Prism
prism_n = IntProperty(name = "Sides",
description = "Number of sides",
default = 5, min = 3, max = 720)
prism_r = FloatProperty(name = "Radius",
description = "Radius",
default = 1.0)
##################Isosurface
iso_function_text = StringProperty(name="Function Text",maxlen=1024)#,update=iso_props_update_callback)
##################PolygonToCircle
polytocircle_resolution = IntProperty(name = "Resolution",
description = "",
default = 3, min = 0, max = 256)
polytocircle_ngon = IntProperty(name = "NGon",
description = "",
min = 3, max = 64,default = 5)
polytocircle_ngonR = FloatProperty(name = "NGon Radius",
description = "",
default = 0.3)
polytocircle_circleR = FloatProperty(name = "Circle Radius",
description = "",
default = 1.0)
#################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.
###############################################################################
@ -965,6 +1427,7 @@ class RenderPovSettingsCamera(PropertyGroup):
default="")
###############################################################################
# Text POV properties.
###############################################################################
@ -983,8 +1446,10 @@ class PovrayPreferences(AddonPreferences):
branch_feature_set_povray = EnumProperty(
name="Feature Set",
description="Choose between official (POV-Ray) or (UberPOV) development branch features to write in the pov file",
items= (('povray', 'Official POV-Ray', '','PLUGIN', 0), ('uberpov', 'Unofficial UberPOV', '', 'PLUGIN', 1)),
description="Choose between official (POV-Ray) or (UberPOV) "
"development branch features to write in the pov file",
items= (('povray', 'Official POV-Ray', '','PLUGIN', 0),
('uberpov', 'Unofficial UberPOV', '', 'PLUGIN', 1)),
default='povray'
)
@ -998,29 +1463,54 @@ class PovrayPreferences(AddonPreferences):
layout.prop(self, "branch_feature_set_povray")
layout.prop(self, "filepath_povray")
def register():
bpy.utils.register_module(__name__)
bpy.types.INFO_MT_add.prepend(ui.menu_func_add)
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.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.Object.povsuperellipsoid = CollectionProperty(type=RenderPovSettingsSuperellipsoid_add)
#bpy.types.Object.povsupertorus = CollectionProperty(type=RenderPovSettingsSupertorus_add)
#bpy.types.Object.povloft = CollectionProperty(type=RenderPovSettingsLoft_add)
#bpy.types.Object.povrainbow = CollectionProperty(type=RenderPovSettingsRainbow_add)
#bpy.types.Object.povheightfield = CollectionProperty(type=RenderPovSettingsHeightField_add)
#bpy.types.Object.povtorus = CollectionProperty(type=RenderPovSettingsTorus_add)
#bpy.types.Object.povprism = CollectionProperty(type=RenderPovSettingsPrism_add)
#bpy.types.Object.povpolygontocircle = CollectionProperty(type=RenderPovSettingsPolygonToCircle_add)
bpy.types.Camera.pov = PointerProperty(type=RenderPovSettingsCamera)
bpy.types.Text.pov = PointerProperty(type=RenderPovSettingsText)
def unregister():
bpy.utils.unregister_module(__name__)
#bpy.types.TEXTURE_PT_context_texture.remove(TEXTURE_PT_povray_type)
del bpy.types.Scene.pov
del bpy.types.Material.pov
del bpy.types.Texture.pov
del bpy.types.Object.pov
#del bpy.types.Object.povsuperellipsoid
#del bpy.types.Object.povsupertorus
#del bpy.types.Object.povloft
#del bpy.types.Object.povrainbow
#del bpy.types.Object.povheightfield
#del bpy.types.Object.povtorus
#del bpy.types.Object.povprism
#del bpy.types.Object.povpolygontocircle
del bpy.types.Camera.pov
del bpy.types.Text.pov
addon_utils.disable("add_mesh_extra_objects", default_set=False)
bpy.types.INFO_MT_file_import.remove(ui.menu_func_import)
bpy.types.INFO_MT_add.remove(ui.menu_func_add)
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@ properties_render.RENDER_PT_shading.COMPAT_ENGINES.add('POVRAY_RENDER')
properties_render.RENDER_PT_output.COMPAT_ENGINES.add('POVRAY_RENDER')
del properties_render
# Use only a subset of the world panels
from bl_ui import properties_world
properties_world.WORLD_PT_preview.COMPAT_ENGINES.add('POVRAY_RENDER')
@ -37,25 +38,8 @@ properties_world.WORLD_PT_world.COMPAT_ENGINES.add('POVRAY_RENDER')
properties_world.WORLD_PT_mist.COMPAT_ENGINES.add('POVRAY_RENDER')
del properties_world
# Example of wrapping every class 'as is'
from bl_ui import properties_material
for member in dir(properties_material):
subclass = getattr(properties_material, member)
try:
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except:
pass
del properties_material
from bl_ui import properties_data_mesh
for member in dir(properties_data_mesh):
subclass = getattr(properties_data_mesh, member)
try:
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except:
pass
del properties_data_mesh
from bl_ui import properties_texture
from bl_ui.properties_texture import context_tex_datablock
for member in dir(properties_texture):
@ -67,6 +51,20 @@ for member in dir(properties_texture):
del properties_texture
# Example of wrapping every class 'as is' except some
from bl_ui import properties_material
for member in dir(properties_material):
subclass = getattr(properties_material, member)
if subclass not in (properties_material.MATERIAL_PT_transp_game,
properties_material.MATERIAL_PT_game_settings,
properties_material.MATERIAL_PT_physics):
try:
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except:
pass
del properties_material
from bl_ui import properties_data_camera
for member in dir(properties_data_camera):
subclass = getattr(properties_data_camera, member)
@ -76,14 +74,8 @@ for member in dir(properties_data_camera):
pass
del properties_data_camera
from bl_ui import properties_data_lamp
for member in dir(properties_data_lamp):
subclass = getattr(properties_data_lamp, member)
try:
subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
except:
pass
del properties_data_lamp
from bl_ui import properties_particle as properties_particle
for member in dir(properties_particle): # add all "particle" panels from blender
@ -94,7 +86,6 @@ 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'
@ -153,7 +144,6 @@ class ObjectButtonsPanel():
rd = context.scene.render
return obj and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
class CameraDataButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@ -190,7 +180,217 @@ class TextButtonsPanel():
rd = context.scene.render
return text and (rd.use_game_engine is False) and (rd.engine in cls.COMPAT_ENGINES)
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
obj = context.object
# 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
class DATA_PT_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
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
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
draw = properties_data_mesh.DATA_PT_customdata.draw
del properties_data_mesh
################################################################################
# from bl_ui import properties_data_lamp
# for member in dir(properties_data_lamp):
# subclass = getattr(properties_data_lamp, member)
# try:
# subclass.COMPAT_ENGINES.add('POVRAY_RENDER')
# except:
# pass
# del properties_data_lamp
#########################LAMPS################################
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
obj = context.object
# 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
engine = context.scene.render.engine
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
class LAMP_PT_POV_area(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_area.bl_label
@classmethod
def poll(cls, context):
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
class LAMP_PT_POV_spot(PovLampButtonsPanel, bpy.types.Panel):
bl_label = properties_data_lamp.DATA_PT_spot.bl_label
@classmethod
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
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
class OBJECT_PT_povray_obj_rainbow(PovLampButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Rainbow"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
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))
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.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))
col.label(text="Rainbow arc angle: " + str(obj.pov.arc_angle))
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.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")
#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
###############################################################################
class RENDER_PT_povray_export_settings(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Export Settings"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@ -267,9 +467,11 @@ class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel):
bl_label = "Anti-Aliasing"
COMPAT_ENGINES = {'POVRAY_RENDER'}
def draw_header(self, context):
prefs = bpy.context.user_preferences.addons[__package__].preferences
scene = context.scene
if bpy.context.user_preferences.addons[__package__].preferences.branch_feature_set_povray != 'uberpov' and scene.pov.antialias_method =='2':
if prefs.branch_feature_set_povray != 'uberpov' and scene.pov.antialias_method == '2':
self.layout.prop(scene.pov, "antialias_enable", text="", icon='ERROR')
elif scene.pov.antialias_enable:
self.layout.prop(scene.pov, "antialias_enable", text="", icon='ANTIALIASED')
@ -277,16 +479,16 @@ class RENDER_PT_povray_antialias(RenderButtonsPanel, bpy.types.Panel):
self.layout.prop(scene.pov, "antialias_enable", text="", icon='ALIASED')
def draw(self, context):
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 bpy.context.user_preferences.addons[__package__].preferences.branch_feature_set_povray != 'uberpov' and scene.pov.antialias_method =='2':
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")
@ -309,11 +511,11 @@ 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 bpy.context.user_preferences.addons[__package__].preferences.branch_feature_set_povray == 'uberpov':
if prefs.branch_feature_set_povray == 'uberpov':
row = layout.row()
row.prop(scene.pov, "antialias_confidence", text="AA Confidence")
if scene.pov.antialias_method =='2':
if scene.pov.antialias_method == '2':
row.enabled = True
else:
row.enabled = False
@ -691,22 +893,26 @@ class TEXTURE_PT_povray_parameters(TextureButtonsPanel, bpy.types.Panel):
"f_quartic_saddle","f_sphere","f_steiners_roman",
"f_torus_gumdrop","f_umbrella"}:
func = 1
if tex.pov.func_list in {"f_bicorn","f_bifolia","f_boy_surface","f_superellipsoid","f_torus"}:
if tex.pov.func_list in {"f_bicorn","f_bifolia","f_boy_surface","f_superellipsoid",
"f_torus"}:
func = 2
if tex.pov.func_list in {"f_ellipsoid","f_folium_surface","f_hyperbolic_torus",
"f_kampyle_of_eudoxus","f_parabolic_torus",
"f_quartic_cylinder","f_torus2"}:
func = 3
if tex.pov.func_list in {"f_blob2","f_cross_ellipsoids","f_flange_cover",
"f_isect_ellipsoids","f_kummer_surface_v2","f_ovals_of_cassini",
"f_rounded_box","f_spikes_2d","f_strophoid"}:
"f_isect_ellipsoids","f_kummer_surface_v2",
"f_ovals_of_cassini","f_rounded_box","f_spikes_2d",
"f_strophoid"}:
func = 4
if tex.pov.func_list in {"f_algbr_cyl1","f_algbr_cyl2","f_algbr_cyl3","f_algbr_cyl4",
"f_blob","f_mesh1","f_poly4","f_spikes"}:
if tex.pov.func_list in {"f_algbr_cyl1","f_algbr_cyl2","f_algbr_cyl3",
"f_algbr_cyl4","f_blob","f_mesh1","f_poly4","f_spikes"}:
func = 5
if tex.pov.func_list in {"f_devils_curve_2d","f_dupin_cyclid","f_folium_surface_2d",
"f_hetero_mf","f_kampyle_of_eudoxus_2d","f_lemniscate_of_gerono_2d",
"f_polytubes","f_ridge","f_ridged_mf","f_spiral","f_witch_of_agnesi"}:
if tex.pov.func_list in {"f_devils_curve_2d","f_dupin_cyclid",
"f_folium_surface_2d","f_hetero_mf",
"f_kampyle_of_eudoxus_2d","f_lemniscate_of_gerono_2d",
"f_polytubes","f_ridge","f_ridged_mf","f_spiral",
"f_witch_of_agnesi"}:
func = 6
if tex.pov.func_list in {"f_helix1","f_helix2","f_piriform_2d","f_strophoid_2d"}:
func = 7
@ -844,6 +1050,249 @@ class OBJECT_PT_povray_obj_importance(ObjectButtonsPanel, bpy.types.Panel):
col.prop(obj.pov, "spacing_multiplier", text="Photons Spacing Multiplier")
class OBJECT_PT_povray_obj_sphere(PovDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Sphere"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
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))
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.label(text="Sphere radius: " + str(obj.pov.sphere_radius))
else:
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")
#col.label(text="Parameters:")
col.prop(obj.pov, "sphere_radius", text="Radius of Sphere")
class OBJECT_PT_povray_obj_cone(PovDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Cone"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
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))
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.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.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")
#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")
col.prop(obj.pov, "cone_segments", text="Segmentation of Cone proxy")
col.prop(obj.pov, "cone_height", text="Height of the cone")
class OBJECT_PT_povray_obj_superellipsoid(PovDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Superquadric ellipsoid"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
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))
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.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.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")
#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'}
#bl_options = {'HIDE_HEADER'}
@classmethod
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))
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.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.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")
#col.label(text="Parameters:")
col.prop(obj.pov, "torus_major_radius")
col.prop(obj.pov, "torus_minor_radius")
col.prop(obj.pov, "torus_major_segments")
col.prop(obj.pov, "torus_minor_segments")
class OBJECT_PT_povray_obj_supertorus(PovDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray SuperTorus"
COMPAT_ENGINES = {'POVRAY_RENDER'}
#bl_options = {'HIDE_HEADER'}
@classmethod
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))
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.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.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")
#col.label(text="Parameters:")
col.prop(obj.pov, "st_major_radius")
col.prop(obj.pov, "st_minor_radius")
col.prop(obj.pov, "st_u")
col.prop(obj.pov, "st_v")
col.prop(obj.pov, "st_ring")
col.prop(obj.pov, "st_cross")
col.prop(obj.pov, "st_ie")
#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'}
#bl_options = {'HIDE_HEADER'}
@classmethod
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))
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.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))
col.label(text="Minimum V: " + str(obj.pov.v_min))
col.label(text="X Function: " + str(obj.pov.x_eq))
col.label(text="Y Function: " + str(obj.pov.y_eq))
col.label(text="Z Function: " + str(obj.pov.x_eq))
else:
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")
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")
col.prop(obj.pov, "v_max", text="Minimum V")
col.prop(obj.pov, "x_eq", text="X Function")
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'}
@ -857,7 +1306,86 @@ class OBJECT_PT_povray_replacement_text(ObjectButtonsPanel, bpy.types.Panel):
col.label(text="Replace properties with:")
col.prop(obj.pov, "replacement_text", text="")
###############################################################################
# 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')
def draw(self,context):
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.menu(BasicShapesMenu.bl_idname, text = "Primitives",icon="GROUP")
layout.menu(ImportMenu.bl_idname, text = "Import",icon="IMPORT")
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 ?
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("pov.addplane", text="Infinite Plane",icon = 'MESH_PLANE')
layout.operator("pov.addbox", text="Box",icon = 'MESH_CUBE')
layout.operator("pov.addsphere", text="Sphere",icon = 'SOLID')
layout.operator("pov.addcylinder", text="Cylinder",icon="MESH_CYLINDER")
layout.operator("pov.cone_add", text="Cone",icon="MESH_CONE")
layout.operator("pov.addtorus", text="Torus",icon = 'MESH_TORUS')
layout.separator()
layout.operator("pov.addparametric", text="Parametric",icon = 'SCRIPTPLUGINS')
layout.operator("pov.addrainbow", text="Rainbow",icon="COLOR")
layout.operator("pov.addlathe", text="Lathe",icon = 'MOD_SCREW')
layout.operator("pov.addprism", text="Prism",icon = 'MOD_SOLIDIFY')
layout.operator("pov.addsuperellipsoid", text="Superquadric Ellipsoid",icon = 'MOD_SUBSURF')
layout.operator("pov.addheightfield", text="Height Field",icon="RNDCURVE")
layout.operator("pov.addspheresweep", text="Sphere Sweep",icon = 'FORCE_CURVE')
layout.separator()
layout.operator("pov.addblobsphere", text="Blob Sphere",icon = 'META_DATA')
layout.separator()
layout.label("Isosurfaces")
layout.operator("pov.addisosurfacebox", text="Isosurface Box",icon="META_CUBE")
layout.operator("pov.addisosurfacesphere", text="Isosurface Sphere",icon="META_BALL")
layout.operator("pov.addsupertorus", text="Supertorus",icon="SURFACE_NTORUS")
layout.separator()
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 ?
layout = self.layout
layout.operator_context = 'INVOKE_REGION_WIN'
layout.operator("import_scene.avogadro", text="Avogadro",icon="FORCE_LENNARDJONES")
def menu_func_add(self, context):
engine = context.scene.render.engine
if engine == 'POVRAY_RENDER':
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.avogadro", text="POV-Ray Avogadro (.pov)",icon="FORCE_LENNARDJONES")
###############################################################################
# Camera Povray Settings
###############################################################################
class CAMERA_PT_povray_cam_dof(CameraDataButtonsPanel, bpy.types.Panel):
bl_label = "POV-Ray Depth Of Field"
COMPAT_ENGINES = {'POVRAY_RENDER'}
@ -911,3 +1439,4 @@ class TEXT_PT_povray_custom_code(TextButtonsPanel, bpy.types.Panel):
text = context.space_data.text
if text:
layout.prop(text.pov, "custom_code", text="Add as POV code")