def getJSON(mesh):
    cameras = []
    for cam in mesh.cameras:
        cameras.append({'id':cam.id})
        
    lights = []
    for light in mesh.lights:
        lights.append({'id':light.id, 'type': type(light).__name__})
        
    materials = []
    for material in mesh.materials:
        materials.append({'id':material.id, 'effect':material.effect.id})
        
    effects = []
    for effect in mesh.effects:
        effects.append({'id':effect.id, 'type':effect.shadingtype})
        
    images = []
    for image in mesh.images:
        images.append({'id':image.id, 'name':image.path})
        
    primitives = []
    for geom in mesh.geometries:
        for i, prim in enumerate(geom.primitives):
            primitives.append({'id':"%s%d" % (geom.id, i),
                               'type':type(prim).__name__,
                               'vertices':len(prim.vertex_index) if prim.vertex_index is not None else 0,
                               'normals': prim.normal_index is not None,
                               'texcoords': len(prim.texcoord_indexset) > 0})
        
    json_ret = {'cameras': cameras,
                'lights': lights,
                'materials': materials,
                'effects': effects,
                'images': images,
                'primitives': primitives}
    
    json_ret.update(getRenderInfo(mesh))
    
    boundsInfo = getBoundsInfo(mesh)
    boundsInfo = {'bounds': [boundsInfo['bounds'][0].tolist(), boundsInfo['bounds'][1].tolist()],
                  'center': boundsInfo['center'].tolist(),
                  'center_farthest': boundsInfo['center_farthest'].tolist(),
                  'center_farthest_distance': float(boundsInfo['center_farthest_distance'])}
    json_ret['bounds_info'] = boundsInfo
    
    return json.dumps(json_ret)
dataset/ETHPy150Open pycollada/meshtool/meshtool/filters/print_filters/print_json.py/getJSON/original