[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4549] trunk/py/scripts/addons/ io_scene_x3d/export_x3d.py: fix [#35496] export to x3d, headlight not turned on
Campbell Barton
ideasman42 at gmail.com
Tue May 28 00:50:36 CEST 2013
Revision: 4549
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4549
Author: campbellbarton
Date: 2013-05-27 22:50:35 +0000 (Mon, 27 May 2013)
Log Message:
-----------
fix [#35496] export to x3d, headlight not turned on
Modified Paths:
--------------
trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
Modified: trunk/py/scripts/addons/io_scene_x3d/export_x3d.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/export_x3d.py 2013-05-26 14:30:44 UTC (rev 4548)
+++ trunk/py/scripts/addons/io_scene_x3d/export_x3d.py 2013-05-27 22:50:35 UTC (rev 4549)
@@ -90,6 +90,10 @@
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 @@
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 @@
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 @@
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 @@
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:
More information about the Bf-extensions-cvs
mailing list