[Bf-extensions-cvs] [b07c8ff9] master: * added support of empty curves and metaballs represented by empty spheres of zero radius
Maurice Raybaud
noreply at git.blender.org
Thu Aug 10 11:13:49 CEST 2017
Commit: b07c8ff94974feca77ce5007ad19147c9e58a983
Author: Maurice Raybaud
Date: Thu Aug 10 11:13:25 2017 +0200
Branches: master
https://developer.blender.org/rBAb07c8ff94974feca77ce5007ad19147c9e58a983
* added support of empty curves and metaballs represented by empty spheres of zero radius
===================================================================
M render_povray/render.py
===================================================================
diff --git a/render_povray/render.py b/render_povray/render.py
index 56b60d83..c3ff42a6 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -1429,162 +1429,168 @@ 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:
+ # Empty curves
+ if len(ob.data.splines)==0:
+ tabWrite("\n//dummy sphere to represent empty curve location\n")
tabWrite("#declare %s =\n"%dataname)
- if ob.pov.curveshape == 'sphere_sweep' and bezier_sweep == False:
- tabWrite("union {\n")
- for spl in ob.data.splines:
- if spl.type != "BEZIER":
- spl_type = "linear"
- if spl.type == "NURBS":
- spl_type = "cubic"
- points=spl.points
- numPoints=len(points)
- if spl.use_cyclic_u:
- numPoints+=3
-
- tabWrite("sphere_sweep { %s_spline %s,\n"%(spl_type,numPoints))
- if spl.use_cyclic_u:
- pt1 = points[len(points)-1]
- wpt1 = pt1.co
- tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt1[0], wpt1[1], wpt1[2], pt1.radius*ob.data.bevel_depth))
- for pt in points:
- wpt = pt.co
- tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt[0], wpt[1], wpt[2], pt.radius*ob.data.bevel_depth))
- if spl.use_cyclic_u:
- for i in range (0,2):
- endPt=points[i]
- wpt = endPt.co
- tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt[0], wpt[1], wpt[2], endPt.radius*ob.data.bevel_depth))
+ tabWrite("sphere {<%.6g, %.6g, %.6g>,0 pigment{rgbt 1} no_image no_reflection no_radiosity photons{pass_through collect off} hollow}\n\n" % (ob.location.x, ob.location.y, ob.location.z)) # ob.name > povdataname)
+ # And non empty curves
+ else:
+ if bezier_sweep == False:
+ tabWrite("#declare %s =\n"%dataname)
+ if ob.pov.curveshape == 'sphere_sweep' and bezier_sweep == False:
+ tabWrite("union {\n")
+ for spl in ob.data.splines:
+ if spl.type != "BEZIER":
+ spl_type = "linear"
+ if spl.type == "NURBS":
+ spl_type = "cubic"
+ points=spl.points
+ numPoints=len(points)
+ if spl.use_cyclic_u:
+ numPoints+=3
+
+ tabWrite("sphere_sweep { %s_spline %s,\n"%(spl_type,numPoints))
+ if spl.use_cyclic_u:
+ pt1 = points[len(points)-1]
+ wpt1 = pt1.co
+ tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt1[0], wpt1[1], wpt1[2], pt1.radius*ob.data.bevel_depth))
+ for pt in points:
+ wpt = pt.co
+ tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt[0], wpt[1], wpt[2], pt.radius*ob.data.bevel_depth))
+ if spl.use_cyclic_u:
+ for i in range (0,2):
+ endPt=points[i]
+ wpt = endPt.co
+ tabWrite("<%.4g,%.4g,%.4g>,%.4g\n" %(wpt[0], wpt[1], wpt[2], endPt.radius*ob.data.bevel_depth))
- tabWrite("}\n")
+ tabWrite("}\n")
- if ob.pov.curveshape == 'sor':
- for spl in ob.data.splines:
- if spl.type in {'POLY','NURBS'}:
+ if ob.pov.curveshape == 'sor':
+ for spl in ob.data.splines:
+ if spl.type in {'POLY','NURBS'}:
+ points=spl.points
+ numPoints=len(points)
+ tabWrite("sor { %s,\n"%numPoints)
+ for pt in points:
+ wpt = pt.co
+ tabWrite("<%.4g,%.4g>\n" %(wpt[0], wpt[1]))
+ else:
+ tabWrite("box { 0,0\n")
+ if ob.pov.curveshape in {'lathe','prism'}:
+ spl = ob.data.splines[0]
+ if spl.type == "BEZIER":
+ points=spl.bezier_points
+ lenCur=len(points)-1
+ lenPts=lenCur*4
+ ifprism = ''
+ if ob.pov.curveshape in {'prism'}:
+ height = ob.data.extrude
+ ifprism = '-%s, %s,'%(height, height)
+ lenCur+=1
+ lenPts+=4
+ tabWrite("%s { bezier_spline %s %s,\n"%(ob.pov.curveshape,ifprism,lenPts))
+ for i in range(0,lenCur):
+ p1=points[i].co
+ pR=points[i].handle_right
+ end = i+1
+ if i == lenCur-1 and ob.pov.curveshape in {'prism'}:
+ end = 0
+ pL=points[end].handle_left
+ p2=points[end].co
+ line="<%.4g,%.4g>"%(p1[0],p1[1])
+ line+="<%.4g,%.4g>"%(pR[0],pR[1])
+ line+="<%.4g,%.4g>"%(pL[0],pL[1])
+ line+="<%.4g,%.4g>"%(p2[0],p2[1])
+ tabWrite("%s\n" %line)
+ else:
points=spl.points
- numPoints=len(points)
- tabWrite("sor { %s,\n"%numPoints)
- for pt in points:
+ lenCur=len(points)
+ lenPts=lenCur
+ ifprism = ''
+ if ob.pov.curveshape in {'prism'}:
+ height = ob.data.extrude
+ ifprism = '-%s, %s,'%(height, height)
+ lenPts+=3
+ spl_type = 'quadratic'
+ if spl.type == 'POLY':
+ spl_type = 'linear'
+ tabWrite("%s { %s_spline %s %s,\n"%(ob.pov.curveshape,spl_type,ifprism,lenPts))
+ if ob.pov.curveshape in {'prism'}:
+ pt = points[len(points)-1]
wpt = pt.co
tabWrite("<%.4g,%.4g>\n" %(wpt[0], wpt[1]))
- else:
- tabWrite("box { 0,0\n")
- if ob.pov.curveshape in {'lathe','prism'}:
- spl = ob.data.splines[0]
- if spl.type == "BEZIER":
- points=spl.bezier_points
- lenCur=len(points)-1
- lenPts=lenCur*4
- ifprism = ''
- if ob.pov.curveshape in {'prism'}:
- height = ob.data.extrude
- ifprism = '-%s, %s,'%(height, height)
- lenCur+=1
- lenPts+=4
- tabWrite("%s { bezier_spline %s %s,\n"%(ob.pov.curveshape,ifprism,lenPts))
- for i in range(0,lenCur):
- p1=points[i].co
- pR=points[i].handle_right
- end = i+1
- if i == lenCur-1 and ob.pov.curveshape in {'prism'}:
- end = 0
- pL=points[end].handle_left
- p2=points[end].co
- line="<%.4g,%.4g>"%(p1[0],p1[1])
- line+="<%.4g,%.4g>"%(pR[0],pR[1])
- line+="<%.4g,%.4g>"%(pL[0],pL[1])
- line+="<%.4g,%.4g>"%(p2[0],p2[1])
- tabWrite("%s\n" %line)
- else:
- points=spl.points
- lenCur=len(points)
- lenPts=lenCur
- ifprism = ''
- if ob.pov.curveshape in {'prism'}:
- height = ob.data.extrude
- ifprism = '-%s, %s,'%(height, height)
- lenPts+=3
- spl_type = 'quadratic'
- if spl.type == 'POLY':
- spl_type = 'linear'
- tabWrite("%s { %s_spline %s %s,\n"%(ob.pov.curveshape,spl_type,ifprism,lenPts))
- if ob.pov.curveshape in {'prism'}:
- pt = points[len(points)-1]
- wpt = pt.co
- tabWrite("<%.4g,%.4g>\n" %(wpt[0], wpt[1]))
- for pt in points:
- wpt = pt.co
- tabWrite("<%.4g,%.4g>\n" %(wpt[0], wpt[1]))
- if ob.pov.curveshape in {'prism'}:
- for i in range(2):
- pt = points[i]
+ for pt in points:
wpt = pt.co
tabWrite("<%.4g,%.4g>\n" %(wpt[0], wpt[1]))
- if bezier_sweep:
- for p in range(len(ob.data.splines)):
- br = []
- depth = ob.data.bevel_depth
- spl = ob.data.splines[p]
- points=spl.bezier_points
- lenCur = len(points)-1
- numPoints = lenCur*4
- if spl.use_cyclic_u:
- lenCur += 1
- numPoints += 4
- tabWrite("#declare %s_points_%s = array[%s]{\n"%(dataname,p,numPoints))
- for i in range(lenCur):
- p1=points[i].co
- pR=points[i].handle_right
- end = i+1
- if spl.use_cyclic_u and i == (lenCur - 1):
- end = 0
- pL=points[end].handle_left
- p2=points[end].co
- r3 = points[end].radius * depth
- r0 = points[i].radius * depth
- r1 = 2/3*r0 + 1/3*r3
- r2 = 1/3*r0 + 2/3*r3
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list