Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-05-28 02:50:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-28 02:50:35 +0400
commit57f50365ec2e8532616174d282621010b21737f0 (patch)
tree059fe29370da348d5a8247b2ef3599da0dc2dd78 /io_scene_x3d/export_x3d.py
parent5d12c16e8ed3a90a2890273104a8a95fbec37cd4 (diff)
fix [#35496] export to x3d, headlight not turned on
Diffstat (limited to 'io_scene_x3d/export_x3d.py')
-rw-r--r--io_scene_x3d/export_x3d.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 0b325044..d044baa9 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -90,6 +90,10 @@ def suffix_quoted_str(value, suffix):
return value[:-1] + suffix + value[-1:]
+def bool_as_str(value):
+ return ('false', 'true')[bool(value)]
+
+
def clean_def(txt):
# see report [#28256]
if not txt:
@@ -397,10 +401,10 @@ def export(file,
else:
return
- def writeNavigationInfo(ident, scene):
+ def writeNavigationInfo(ident, scene, has_lamp):
ident_step = ident + (' ' * (-len(ident) + \
fw('%s<NavigationInfo ' % ident)))
- fw('headlight="false"\n')
+ fw('headlight="%s"\n' % bool_as_str(not has_lamp))
fw(ident_step + 'visibilityLimit="0.0"\n')
fw(ident_step + 'type=\'"EXAMINE", "ANY"\'\n')
fw(ident_step + 'avatarSize="0.25, 1.75, 0.75"\n')
@@ -708,7 +712,7 @@ def export(file,
fw('%s<IndexedTriangleSet ' % ident)))
# --- Write IndexedTriangleSet Attributes (same as IndexedFaceSet)
- fw('solid="%s"\n' % ('true' if material and material.game_settings.use_backface_culling else 'false'))
+ fw('solid="%s"\n' % bool_as_str(material and material.game_settings.use_backface_culling))
if use_normals or is_force_normals:
fw(ident_step + 'normalPerVertex="true"\n')
@@ -851,7 +855,7 @@ def export(file,
fw('%s<IndexedFaceSet ' % ident)))
# --- Write IndexedFaceSet Attributes (same as IndexedTriangleSet)
- fw('solid="%s"\n' % ('true' if material and material.game_settings.use_backface_culling else 'false'))
+ fw('solid="%s"\n' % bool_as_str(material and material.game_settings.use_backface_culling))
if is_smooth:
# use Auto-Smooth angle, if enabled. Otherwise make
# the mesh perfectly smooth by creaseAngle > pi.
@@ -1503,21 +1507,21 @@ def export(file,
bpy.data.materials.tag(False)
bpy.data.images.tag(False)
+ if use_selection:
+ objects = [obj for obj in scene.objects if obj.is_visible(scene) and obj.select]
+ else:
+ objects = [obj for obj in scene.objects if obj.is_visible(scene)]
+
print('Info: starting X3D export to %r...' % file.name)
ident = ''
ident = writeHeader(ident)
- writeNavigationInfo(ident, scene)
+ writeNavigationInfo(ident, scene, any(obj.type == 'LAMP' for obj in objects))
writeBackground(ident, world)
writeFog(ident, world)
ident = '\t\t'
- if use_selection:
- objects = [obj for obj in scene.objects if obj.is_visible(scene) and obj.select]
- else:
- objects = [obj for obj in scene.objects if obj.is_visible(scene)]
-
if use_hierarchy:
objects_hierarchy = build_hierarchy(objects)
else: