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

VRML: export vertex colors by default and fallback to material colors.

parent 0fee27b5
No related branches found
No related tags found
No related merge requests found
......@@ -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",
......
......@@ -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:
......
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