diff options
author | Maurice Raybaud <mauriceraybaud@hotmail.fr> | 2017-09-03 12:24:35 +0300 |
---|---|---|
committer | Maurice Raybaud <mauriceraybaud@hotmail.fr> | 2017-09-03 12:31:39 +0300 |
commit | 6314517f4884e1b666b9837e6f36be4d16f631e8 (patch) | |
tree | d062bccbf9018fbff7446c9768ba4ed71bd9ebd4 | |
parent | df3737479fea6be7210786bfba4b64481657538d (diff) |
*Fixed: Cube and Plane meta elements were missing since all meta were no longer exported to mesh but as POV-Ray blobs
-rw-r--r-- | render_povray/render.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/render_povray/render.py b/render_povray/render.py index 8b6b4f25..914fc45a 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -1622,7 +1622,7 @@ def write_pov(filename, scene=None, info_callback=None): prefix = ob.name.split(".")[0] if not prefix in meta_group: meta_group[prefix] = ob # .data.threshold - elems = [(elem, ob) for elem in ob.data.elements if elem.type in {'BALL', 'ELLIPSOID','CAPSULE'}] + elems = [(elem, ob) for elem in ob.data.elements if elem.type in {'BALL', 'ELLIPSOID','CAPSULE','CUBE','PLANE'}] if prefix in meta_elems: meta_elems[prefix].extend(elems) else: @@ -1646,19 +1646,43 @@ def write_pov(filename, scene=None, info_callback=None): if elem.type == 'BALL': tabWrite("sphere { <%.6g, %.6g, %.6g>, %.4g, %.4g " % (loc.x, loc.y, loc.z, elem.radius, stiffness)) + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") elif elem.type == 'ELLIPSOID': tabWrite("sphere{ <%.6g, %.6g, %.6g>,%.4g,%.4g " % (loc.x / elem.size_x, loc.y / elem.size_y, loc.z / elem.size_z, elem.radius, stiffness)) tabWrite("scale <%.6g, %.6g, %.6g>" % (elem.size_x, elem.size_y, elem.size_z)) + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") elif elem.type == 'CAPSULE': tabWrite("cylinder{ <%.6g, %.6g, %.6g>,<%.6g, %.6g, %.6g>,%.4g,%.4g " % ((loc.x - elem.size_x), (loc.y), (loc.z), (loc.x + elem.size_x), (loc.y), (loc.z), elem.radius, stiffness)) #tabWrite("scale <%.6g, %.6g, %.6g>" % (elem.size_x, elem.size_y, elem.size_z)) - writeMatrix(global_matrix * elems[1].matrix_world) - tabWrite("}\n") + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") + + elif elem.type == 'CUBE': + tabWrite("cylinder { -x*8, +x*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1/4,1,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z)) + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") + tabWrite("cylinder { -y*8, +y*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1,1/4,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z)) + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") + tabWrite("cylinder { -z*8, +z*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1,1,1/4> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z)) + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") + + elif elem.type == 'PLANE': + tabWrite("cylinder { -x*8, +x*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1/4,1,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z)) + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") + tabWrite("cylinder { -y*8, +y*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1,1/4,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z)) + writeMatrix(global_matrix * elems[1].matrix_world) + tabWrite("}\n") + try: material = elems[1].data.materials[0] # lame! - blender cant do enything else. except: |