Skip to content
Snippets Groups Projects
Commit b63d9bca authored by Campbell Barton's avatar Campbell Barton
Browse files

fix for various errors in scripts

parent 8aa1b14c
No related branches found
No related tags found
No related merge requests found
......@@ -387,7 +387,7 @@ def bvh_node_dict2armature(context,
bone.head = bvh_node.rest_head_world
bone.tail = bvh_node.rest_tail_world
# ZERO AREA BONES.
# Zero Length Bones! (an exceptional case)
if (bone.head - bone.tail).length < 0.001:
print("\tzero length bone found:", bone.name)
if bvh_node.parent:
......
......@@ -488,7 +488,7 @@ def make_material_chunk(material, image):
if not material:
material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, (0.0, 0.0, 0.0)))
material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, (0.8, 0.8, 0.8)))
material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, (1.0, 1.0, 1.0))
material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, (1.0, 1.0, 1.0)))
else:
material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, (material.ambient * material.diffuse_color)[:]))
......
......@@ -254,17 +254,17 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
description="Convert all faces to triangles",
default=False,
)
use_vertex_groups = BoolProperty(
name="Polygroups",
description="",
default=False,
)
use_nurbs = BoolProperty(
name="Nurbs",
name="Write Nurbs",
description="Write nurbs curves as OBJ nurbs rather then "
"converting to geometry",
default=False,
)
use_vertex_groups = BoolProperty(
name="Polygroups",
description="",
default=False,
)
# grouping group
use_blen_objects = BoolProperty(
......
......@@ -147,7 +147,7 @@ def test_nurbs_compat(ob):
return False
def write_nurb(file, ob, ob_mat):
def write_nurb(fw, ob, ob_mat):
tot_verts = 0
cu = ob.data
......@@ -321,7 +321,7 @@ def write_file(filepath, objects, scene,
# Nurbs curve support
if EXPORT_CURVE_AS_NURBS and test_nurbs_compat(ob):
ob_mat = EXPORT_GLOBAL_MATRIX * ob_mat
totverts += write_nurb(file, ob, ob_mat)
totverts += write_nurb(fw, ob, ob_mat)
continue
# END NURBS
......
......@@ -168,16 +168,15 @@ def build_hierarchy(objects):
return par_lookup.get(None, [])
# -----------------------------------------------------------------------------
# H3D Functions
# -----------------------------------------------------------------------------
def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_map):
h3d_file = open(filepath, 'r')
lines = []
last_transform = None
for l in h3d_file:
if l.startswith("void main(void)"):
lines.append("\n")
......@@ -194,7 +193,7 @@ def h3d_shader_glsl_frag_patch(filepath, scene, global_vars, frag_uniform_var_ma
elif l.lstrip().startswith("lamp_visibility_sun_hemi("):
w = l.split(', ')
w[0] = w[0][len("lamp_visibility_sun_hemi(") + 1:]
if not h3d_is_object_view(scene, frag_uniform_var_map[w[0]]):
w[0] = '(mat3(normalize(view_matrix[0].xyz), normalize(view_matrix[1].xyz), normalize(view_matrix[2].xyz)) * -%s)' % w[0]
else:
......@@ -1490,6 +1489,7 @@ def save(operator, context, filepath="",
bpy.ops.object.mode_set(mode='OBJECT')
if use_compress:
import gzip
file = gzip.open(filepath, 'w')
else:
file = open(filepath, 'w')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment