def parse(input_filename="default.dae", output_filename="default.json", asset_url="", asset_root=".", infiles=None,
          options=None):

    definitions_asset = standard_include(infiles)

    animations = { }
    animation_clips = { }
    geometries = { }
    effects = { }
    materials = { }
    images = { }
    lights = { }
    nodes = { }
    physics_materials = { }
    physics_models = { }
    physics_bodies = { }
    physics_nodes = { }

    name_map = { }
    geometry_names = { }
    effect_names = { }
    light_names = { }
    node_names = { }
    node_map = { }

    url_handler = UrlHandler(asset_root, input_filename)

    # DOM stuff from here...
    try:
        collada_e = ElementTree.parse(input_filename).getroot()
    except IOError as e:
        LOG.error('Failed loading: %s', input_filename)
        LOG.error('  >> %s', e)
        exit(1)
    except ExpatError as e:
        LOG.error('Failed processing: %s', input_filename)
        LOG.error('  >> %s', e)
        exit(2)
    else:
        if collada_e is not None:
            fix_sid(collada_e, None)

            # Asset...
            asset_e = collada_e.find(tag('asset'))

            # What is the world scale?
            scale = 1.0
            unit_e = asset_e.find(tag('unit'))
            if unit_e is not None:
                scale = float(unit_e.get('meter', '1.0'))

# pylint: disable=C0330
            # What is the up axis?
            upaxis_rotate = None
            upaxis_e = asset_e.find(tag('up_axis'))
            if upaxis_e is not None:
                if upaxis_e.text == 'X_UP':
                    upaxis_rotate = [ 0.0, 1.0, 0.0, 0.0,
                                     -1.0, 0.0, 0.0, 0.0,
                                      0.0, 0.0, 1.0, 0.0,
                                      0.0, 0.0, 0.0, 1.0 ]
                elif upaxis_e.text == 'Z_UP':
                    upaxis_rotate = [ 1.0, 0.0,  0.0, 0.0,
                                      0.0, 0.0, -1.0, 0.0,
                                      0.0, 1.0,  0.0, 0.0,
                                      0.0, 0.0,  0.0, 1.0 ]
                LOG.info('Up axis:%s', upaxis_e.text)
# pylint: enable=C0330

            # Core COLLADA elements are:
            #
            # library_animation_clips       - not supported
            # library_animations            - not supported
            # instance_animation            - not supported
            # library_cameras               - not supported
            # instance_camera               - supported
            # library_controllers           - not supported
            # instance_controller           - supported
            # library_geometries            - supported
            # instance_geometry             - supported
            # library_lights                - supported
            # instance_light                - supported
            # library_nodes                 - not supported
            # instance_node                 - supported
            # library_visual_scenes         - supported
            # instance_visual_scene         - not supported
            # scene                         - not supported

            geometries_e = collada_e.find(tag('library_geometries'))
            if geometries_e is not None:
                for x in geometries_e.findall(tag('geometry')):
                    g = Dae2Geometry(x, scale, geometries_e, name_map, geometry_names)
                    # For now we only support mesh and convex_mesh
                    if g.type == 'mesh' or g.type == 'convex_mesh':
                        geometries[g.id] = g
            else:
                LOG.info('Collada file without:library_geometries:%s', input_filename)

            lights_e = collada_e.find(tag('library_lights'))
            if lights_e is not None:
                for x in lights_e.findall(tag('light')):
                    l = Dae2Light(x, name_map, light_names)
                    lights[l.id] = l

            controllers_e = collada_e.find(tag('library_controllers'))
            visual_scenes_e = collada_e.find(tag('library_visual_scenes'))
            if visual_scenes_e is not None:
                visual_scene_e = visual_scenes_e.findall(tag('visual_scene'))
                if visual_scene_e is not None:
                    if len(visual_scene_e) > 1:
                        LOG.warning('Collada file with more than 1:visual_scene:%s', input_filename)
                    node_e = visual_scene_e[0].findall(tag('node'))
                    for n in node_e:
                        n = Dae2Node(n, scale, None, upaxis_rotate, None, controllers_e, collada_e,
                                     name_map, node_names, node_map, geometries)
                        nodes[n.id] = n
                    if len(node_e) == 0:
                        LOG.warning('Collada file without:node:%s', input_filename)
                else:
                    LOG.warning('Collada file without:visual_scene:%s', input_filename)
            else:
                LOG.warning('Collada file without:library_visual_scenes:%s', input_filename)

            animations_e = collada_e.find(tag('library_animations'))
            if animations_e is not None:
                for x in animations_e.findall(tag('animation')):
                    a = Dae2Animation(x, animations_e, name_map, animations)
                    animations[a.id] = a

            animation_clips_e = collada_e.find(tag('library_animation_clips'))
            if animation_clips_e is not None:
                for x in animation_clips_e.findall(tag('animation_clip')):
                    c = Dae2AnimationClip(x, scale, upaxis_rotate, animation_clips_e, name_map, animations, nodes, None)
                    animation_clips[c.id] = c
            else:
                if animations_e is not None:
                    LOG.info('Exporting default animations from:%s', input_filename)
                    for n in nodes:
                        c = Dae2AnimationClip(x, scale, upaxis_rotate, None, name_map, animations, nodes, n)
                        if c.anim:
                            animation_clips[c.id] = c


            # FX COLLADA elements are:
            #
            # library_effects               - supported
            # instance_effect               - supported
            # library_materials             - supported
            # instance_material             - supported
            # library_images                - supported
            # instance_image                - not supported

            # Images have to be read before effects and materials
            images_e = collada_e.find(tag('library_images'))
            if images_e is not None:
                for x in images_e.findall(tag('image')):
                    i = Dae2Image(x, url_handler, name_map)
                    images[i.id] = i

            effects_e = collada_e.find(tag('library_effects'))
            if effects_e is not None:
                for x in effects_e.iter(tag('image')):
                    i = Dae2Image(x, url_handler, name_map)
                    images[i.id] = i

                for x in effects_e.findall(tag('effect')):
                    e = Dae2Effect(x, url_handler, name_map, effect_names)
                    effects[e.id] = e
            else:
                LOG.info('Collada file without:library_effects:%s', input_filename)
                # json.AddObject("default")
                # json.AddString("type", "lambert")

            materials_e = collada_e.find(tag('library_materials'))
            if materials_e is not None:
                for x in materials_e.findall(tag('material')):
                    m = Dae2Material(x, name_map)
                    materials[m.id] = m
            else:
                LOG.info('Collada file without:library_materials:%s', input_filename)
                # json.AddObject("default")
                # json.AddString("effect", "default")

            # Physics COLLADA elements are:
            #
            # library_force_fields          - not supported
            # instance_force_field          - not supported
            # library_physics_materials     - supported
            # instance_physics_material     - supported
            # library_physics_models        - supported
            # instance_physics_model        - supported
            # library_physics_scenes        - supported
            # instance_physics_scene        - not supported
            # instance_rigid_body           - supported
            # instance_rigid_constraint     - not supported

            physics_materials_e = collada_e.find(tag('library_physics_materials'))
            if physics_materials_e is not None:
                for x in physics_materials_e.findall(tag('physics_material')):
                    m = Dae2PhysicsMaterial(x, name_map)
                    physics_materials[m.id] = m

            physics_models_e = collada_e.find(tag('library_physics_models'))
            if physics_models_e is not None:
                for x in physics_models_e.findall(tag('physics_model')):
                    m = Dae2PhysicsModel(x, geometries_e, physics_bodies, name_map)
                    physics_models[m.id] = m

            physics_scenes_e = collada_e.find(tag('library_physics_scenes'))
            if physics_scenes_e is not None:
                physics_scene_e = physics_scenes_e.findall(tag('physics_scene'))
                if physics_scene_e is not None:
                    if len(physics_scene_e) > 1:
                        LOG.warning('Collada file with more than 1:physics_scene:%s', input_filename)
                    for x in physics_scene_e[0].findall(tag('instance_physics_model')):
                        i = Dae2InstancePhysicsModel(x)
                        physics_nodes[i.name] = i

            # Drop reference to the etree
            collada_e = None

    # Process asset...
    for _, node in nodes.iteritems():
        node.process(nodes)

    for _, geometry in geometries.iteritems():
        geometry.process(definitions_asset, nodes, options.nvtristrip, materials, effects)

    # Create JSON...
    json_asset = JsonAsset()

    def _attach(asset_type):
        if options.include_types is not None:
            return asset_type in options.include_types
        if options.exclude_types is not None:
            return asset_type not in options.exclude_types
        return True

    # By default attach images map
    if _attach('images'):
        for _, image in images.iteritems():
            image.attach(json_asset)

    if _attach('effects'):
        for _, effect in effects.iteritems():
            effect.attach(json_asset, definitions_asset)

    if _attach('materials'):
        for _, material in materials.iteritems():
            material.attach(json_asset, definitions_asset, name_map)

    if _attach('geometries'):
        for _, geometry in geometries.iteritems():
            geometry.attach(json_asset)

    if _attach('lights'):
        for _, light in lights.iteritems():
            light.attach(json_asset, definitions_asset)

    if _attach('nodes'):
        for _, node in nodes.iteritems():
            node.attach(json_asset, url_handler, name_map)

    if _attach('animations'):
        for _, animation_clip in animation_clips.iteritems():
            animation_clip.attach(json_asset, name_map)

    if _attach('physicsmaterials'):
        for _, physics_material in physics_materials.iteritems():
            physics_material.attach(json_asset)

    if _attach('physicsnodes'):
        for _, physics_node in physics_nodes.iteritems():
            physics_node.attach(json_asset, physics_bodies, name_map, node_map)

    if _attach('physicsmodels'):
        for _, physics_model in physics_models.iteritems():
            physics_model.attach(json_asset)

    if not options.keep_unused_images:
        remove_unreferenced_images(json_asset)

    # Write JSON...
    try:
        standard_json_out(json_asset, output_filename, options)
    except IOError as e:
        LOG.error('Failed processing: %s', output_filename)
        LOG.error('  >> %s', e)
        exit(3)

    return json_asset
# pylint: enable=R0914
Return the source location (the starting character) of the entity
dataset/ETHPy150Open turbulenz/turbulenz_tools/turbulenz_tools/tools/dae2json.py/parse--crossover with--dataset/ETHPy150Open punchagan/cinspect/cinspect/vendor/clang/cindex.py/Cursor.location