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-03-20 01:18:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-03-20 01:18:13 +0400
commitb113287a50b96d1e47a32a428d79bcf41f3bf5b4 (patch)
tree6f41538c70ab701845c2acb094d9c05f2353c267 /io_scene_vrml2
parent0fee27b530ac6c3b2eb18209ba7dad3b777267e5 (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__.py5
-rw-r--r--io_scene_vrml2/export_vrml2.py8
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: