52 '''Loads and adds a mesh to the blender scene.
56 old = set([obj.name
for obj
in bpy.data.objects])
58 mesh_file = rv.utils.resolve_path(mesh[
'resource'])
59 if '.dae' in mesh_file.lower():
60 bpy.ops.wm.collada_import(filepath = mesh_file)
61 elif '.stl' in mesh_file.lower():
62 bpy.ops.import_mesh.stl(filepath = mesh_file)
63 elif '.ply' in mesh_file.lower():
64 bpy.ops.import_mesh.ply(filepath = mesh_file)
69 new = set([obj.name
for obj
in bpy.data.objects])
70 imported_names = new - old
74 for name
in imported_names:
75 rv.utils.deselect_all()
76 i_obj = bpy.data.objects[name]
79 if 'Camera' in name
or 'Lamp' in name:
80 i_obj.select_set(
True)
81 bpy.ops.object.delete()
87 rv.utils.clear_alpha(i_obj)
89 if "materials" in i_obj.data:
90 if not i_obj.data.materials:
91 rv.utils.set_color(i_obj, mesh)
93 obj_list.append(i_obj)
95 if 'dimensions' in mesh
and top:
96 top.scale = mesh[
'dimensions']