diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-20 01:18:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-20 01:18:13 +0400 |
commit | b113287a50b96d1e47a32a428d79bcf41f3bf5b4 (patch) | |
tree | 6f41538c70ab701845c2acb094d9c05f2353c267 /io_scene_vrml2 | |
parent | 0fee27b530ac6c3b2eb18209ba7dad3b777267e5 (diff) |
VRML: export vertex colors by default and fallback to material colors.
Diffstat (limited to 'io_scene_vrml2')
-rw-r--r-- | io_scene_vrml2/__init__.py | 5 | ||||
-rw-r--r-- | io_scene_vrml2/export_vrml2.py | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/io_scene_vrml2/__init__.py b/io_scene_vrml2/__init__.py index 470bc8b0..7e02d6b0 100644 --- a/io_scene_vrml2/__init__.py +++ b/io_scene_vrml2/__init__.py @@ -70,9 +70,8 @@ class ExportVRML(bpy.types.Operator, ExportHelper): color_type = EnumProperty( name='Color', items=( - ('MATERIAL', "Material Color", ""), - ('VERTEX', "Vertex Color", "")), - default='MATERIAL', + ('VERTEX', "Vertex Color", ""), + ('MATERIAL', "Material Color", "")), ) use_uv = BoolProperty( name="Texture/UVs", diff --git a/io_scene_vrml2/export_vrml2.py b/io_scene_vrml2/export_vrml2.py index 7b77cc08..29b76ddb 100644 --- a/io_scene_vrml2/export_vrml2.py +++ b/io_scene_vrml2/export_vrml2.py @@ -206,16 +206,16 @@ def save_object(fw, global_matrix, if use_color: if color_type == 'VERTEX': if bm.loops.layers.color.active is None: - use_color = False - elif color_type == 'MATERIAL': + # fallback to material + color_type = 'MATERIAL' + if color_type == 'MATERIAL': if not me.materials: use_color = False else: material_colors = [ "%.2f %.2f %.2f " % (m.diffuse_color[:] if m else (1.0, 1.0, 1.0)) for m in me.materials] - else: - assert(0) + assert(color_type in {'VERTEX', 'MATERIAL'}) if use_uv: if bm.loops.layers.uv.active is None: |