Changeset View
Changeset View
Standalone View
Standalone View
render_povray/render.py
| Context not available. | |||||
| # TODO: verify both matches with blender internal. | # TODO: verify both matches with blender internal. | ||||
| image_map_transforms = "" | image_map_transforms = "" | ||||
| image_map_transforms = ("scale <%.4g,%.4g,%.4g> translate <%.4g,%.4g,%.4g>" % \ | image_map_transforms = ("scale <%.4g,%.4g,%.4g> translate <%.4g,%.4g,%.4g>" % \ | ||||
| ( 1.0 / ts.scale.x, | (1.0 / ts.scale.x, | ||||
| 1.0 / ts.scale.y, | 1.0 / ts.scale.y, | ||||
| 1.0 / ts.scale.z, | 1.0 / ts.scale.z, | ||||
| 0.5-(0.5/ts.scale.x) - (ts.offset.x), | 0.5 - (0.5 / ts.scale.x) - ts.offset.x, | ||||
| 0.5-(0.5/ts.scale.y) - (ts.offset.y), | 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>" % \ | # 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.x, | ||||
| # 1.0 / ts.scale.y, | # 1.0 / ts.scale.y, | ||||
| Context not available. | |||||
| ##############################EndSF########################### | ##############################EndSF########################### | ||||
| def is_renderable(scene, ob): | def is_renderable(scene, ob): | ||||
| return (ob.is_visible(scene) and not ob.hide_render) | return ob.is_visible(scene) and not ob.hide_render | ||||
| def renderable_objects(scene): | def renderable_objects(scene): | ||||
| Context not available. | |||||
| # v(A,B) rotates vector A about origin by vector B. | # v(A,B) rotates vector A about origin by vector B. | ||||
| file.write("#declare lampTarget%s= vrotate(<%.4g,%.4g,%.4g>,<%.4g,%.4g,%.4g>);\n" % \ | file.write("#declare lampTarget%s= vrotate(<%.4g,%.4g,%.4g>,<%.4g,%.4g,%.4g>);\n" % \ | ||||
| (lampCount, -(ob.location.x), -(ob.location.y), -(ob.location.z), | (lampCount, -ob.location.x, -ob.location.y, -ob.location.z, | ||||
| ob.rotation_euler.x, ob.rotation_euler.y, ob.rotation_euler.z)) | ob.rotation_euler.x, ob.rotation_euler.y, ob.rotation_euler.z)) | ||||
| #################################################################################################### | #################################################################################################### | ||||
| Context not available. | |||||
| tabWrite('#declare %s%s=spline {\n'%(dataname,n)) | tabWrite('#declare %s%s=spline {\n'%(dataname,n)) | ||||
| tabWrite('cubic_spline\n') | tabWrite('cubic_spline\n') | ||||
| lp = len(spline.points) | lp = len(spline.points) | ||||
| delta = 1/(lp) | delta = 1 / lp | ||||
| d=-delta | d=-delta | ||||
| point = spline.points[lp-1] | point = spline.points[lp-1] | ||||
| x,y,z,w = point.co[:] | x,y,z,w = point.co[:] | ||||
| Context not available. | |||||
| tabWrite('spline{%s%s},\n'%(dataname,n)) | tabWrite('spline{%s%s},\n'%(dataname,n)) | ||||
| for i in range(n): | for i in range(n): | ||||
| tabWrite('spline{%s%s},\n'%(dataname,(i+1))) | tabWrite('spline{%s%s},\n'%(dataname,(i+1))) | ||||
| tabWrite('spline{%s1},\n'%(dataname)) | tabWrite('spline{%s1},\n' % dataname) | ||||
| tabWrite('spline{%s2}\n'%(dataname)) | tabWrite('spline{%s2}\n' % dataname) | ||||
| tabWrite('}\n') | tabWrite('}\n') | ||||
| # Use some of the Meshmaker.inc macro, here inlined | # Use some of the Meshmaker.inc macro, here inlined | ||||
| file.write('#macro CheckFileName(FileName)\n') | file.write('#macro CheckFileName(FileName)\n') | ||||
| Context not available. | |||||
| file.write(" scattering{ 1, // Type\n") | file.write(" scattering{ 1, // Type\n") | ||||
| file.write(" <1,1,1>*0.1\n") | file.write(" <1,1,1>*0.1\n") | ||||
| file.write(" } // end scattering\n") | file.write(" } // end scattering\n") | ||||
| file.write(" density{density_file df3 \"%s\"\n" % (smokePath)) | file.write(" density{density_file df3 \"%s\"\n" % smokePath) | ||||
| file.write(" color_map {\n") | file.write(" color_map {\n") | ||||
| file.write(" [0.00 rgb 0]\n") | file.write(" [0.00 rgb 0]\n") | ||||
| file.write(" [0.05 rgb 0]\n") | file.write(" [0.05 rgb 0]\n") | ||||
| Context not available. | |||||
| for mod in ob.modifiers: | for mod in ob.modifiers: | ||||
| if mod and hasattr(mod, 'smoke_type'): | if mod and hasattr(mod, 'smoke_type'): | ||||
| smokeFlag=True | smokeFlag=True | ||||
| if (mod.smoke_type == 'DOMAIN'): | if mod.smoke_type == 'DOMAIN': | ||||
| exportSmoke(ob.name) | exportSmoke(ob.name) | ||||
| break # don't render domain mesh or flow emitter mesh, skip to next object. | break # don't render domain mesh or flow emitter mesh, skip to next object. | ||||
| if not smokeFlag: | if not smokeFlag: | ||||
| Context not available. | |||||
| file.write('%i,\n' % (steps + 2)) # +2 because the first point needs tripling to be more than a handle in POV | file.write('%i,\n' % (steps + 2)) # +2 because the first point needs tripling to be more than a handle in POV | ||||
| else: | else: | ||||
| file.write('linear_spline ') | file.write('linear_spline ') | ||||
| file.write('%i,\n' % (steps)) | 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)) | 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: | if ob.material_slots[pSys.settings.material - 1].material and ob.active_material is not None: | ||||
| Context not available. | |||||
| for th in pmaterial.texture_slots: | for th in pmaterial.texture_slots: | ||||
| if th and th.use and th.use_map_color_diffuse: | if th and th.use and th.use_map_color_diffuse: | ||||
| #treat POV textures as bitmaps | #treat POV textures as bitmaps | ||||
| if (th.texture.type == 'IMAGE' and th.texture.image and th.texture_coords == 'UV' and ob.data.uv_textures is not None): # or (th.texture.pov.tex_pattern_type != 'emulator' and th.texture_coords == 'UV' and ob.data.uv_textures is not None): | if th.texture.type == 'IMAGE' and th.texture.image and th.texture_coords == 'UV' and ob.data.uv_textures is not None: # or (th.texture.pov.tex_pattern_type != 'emulator' and th.texture_coords == 'UV' and ob.data.uv_textures is not None): | ||||
| image=th.texture.image | image=th.texture.image | ||||
| image_width = image.size[0] | image_width = image.size[0] | ||||
| image_height = image.size[1] | image_height = image.size[1] | ||||
| Context not available. | |||||
| tabWrite("image_map{%s \"%s\" %s}\n" % \ | tabWrite("image_map{%s \"%s\" %s}\n" % \ | ||||
| (imageFormat(texturesBlend), texturesBlend, imgMapBG(t_blend))) | (imageFormat(texturesBlend), texturesBlend, imgMapBG(t_blend))) | ||||
| tabWrite("}\n") | tabWrite("}\n") | ||||
| tabWrite("%s\n" % (mappingBlend)) | tabWrite("%s\n" % mappingBlend) | ||||
| # The following layered pigment opacifies to black over the texture for | # The following layered pigment opacifies to black over the texture for | ||||
| # transmit below 1 or otherwise adds to itself | # transmit below 1 or otherwise adds to itself | ||||
| tabWrite("pigment {rgb 0 transmit %s}\n" % (t.texture.intensity)) | tabWrite("pigment {rgb 0 transmit %s}\n" % t.texture.intensity) | ||||
| tabWrite("}\n") | tabWrite("}\n") | ||||
| #tabWrite("scale 2\n") | #tabWrite("scale 2\n") | ||||
| #tabWrite("translate -1\n") | #tabWrite("translate -1\n") | ||||
| Context not available. | |||||
| # Border render. | # Border render. | ||||
| if render.use_border: | if render.use_border: | ||||
| file.write("Start_Column=%4g\n" % render.border_min_x) | file.write("Start_Column=%4g\n" % render.border_min_x) | ||||
| file.write("End_Column=%4g\n" % (render.border_max_x)) | file.write("End_Column=%4g\n" % render.border_max_x) | ||||
| file.write("Start_Row=%4g\n" % (1.0 - render.border_max_y)) | file.write("Start_Row=%4g\n" % (1.0 - render.border_max_y)) | ||||
| file.write("End_Row=%4g\n" % (1.0 - render.border_min_y)) | file.write("End_Row=%4g\n" % (1.0 - render.border_min_y)) | ||||
| Context not available. | |||||