Changeset View
Changeset View
Standalone View
Standalone View
io_scene_vrml2/export_vrml2.py
| Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | def save_object(fw, global_matrix, | ||||
| assert(obj.type == 'MESH') | assert(obj.type == 'MESH') | ||||
| if use_mesh_modifiers: | if use_mesh_modifiers: | ||||
| is_editmode = (obj.mode == 'EDIT') | is_editmode = (obj.mode == 'EDIT') | ||||
| if is_editmode: | if is_editmode: | ||||
| bpy.ops.object.editmode_toggle() | bpy.ops.object.editmode_toggle() | ||||
| me = obj.to_mesh(scene, True, 'PREVIEW', calc_tessface=False) | me = obj.to_mesh(bpy.context.depsgraph, True, calc_tessface=False) | ||||
| bm = bmesh.new() | bm = bmesh.new() | ||||
| bm.from_mesh(me) | bm.from_mesh(me) | ||||
| if is_editmode: | if is_editmode: | ||||
| bpy.ops.object.editmode_toggle() | bpy.ops.object.editmode_toggle() | ||||
| else: | else: | ||||
| me = obj.data | me = obj.data | ||||
| if obj.mode == 'EDIT': | if obj.mode == 'EDIT': | ||||
| bm_orig = bmesh.from_edit_mesh(me) | bm_orig = bmesh.from_edit_mesh(me) | ||||
| bm = bm_orig.copy() | bm = bm_orig.copy() | ||||
| else: | else: | ||||
| bm = bmesh.new() | bm = bmesh.new() | ||||
| bm.from_mesh(me) | bm.from_mesh(me) | ||||
| # triangulate first so tessellation matches the view-port. | # triangulate first so tessellation matches the view-port. | ||||
| bmesh.ops.triangulate(bm, faces=bm.faces) | bmesh.ops.triangulate(bm, faces=bm.faces) | ||||
| bm.transform(global_matrix * obj.matrix_world) | bm.transform(global_matrix @ obj.matrix_world) | ||||
| # default empty | # default empty | ||||
| material_colors = [] | material_colors = [] | ||||
| uv_image = None | uv_image = None | ||||
| if use_color: | if use_color: | ||||
| if color_type == 'VERTEX': | if color_type == 'VERTEX': | ||||
| if bm.loops.layers.color.active is None: | if bm.loops.layers.color.active is None: | ||||
| ▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines | |||||