Exemplo n.º 1
0
/*!
 * Return a node object by id.
 *
 * This function performs a recursive search for the specified node.
 *
 * \param node The parent node for the search
 * \param node_id The target node id.
 *
 * \return A pointer to the first matching node, or NULL if not found.
 */
Lib3dsNode*
lib3ds_node_by_id(Lib3dsNode *node, uint16_t node_id) {
    Lib3dsNode *p, *q;

    for (p = node->childs; p != 0; p = p->next) {
        if (p->node_id == node_id) {
            return(p);
        }
        q = lib3ds_node_by_id(p, node_id);
        if (q) {
            return(q);
        }
    }
    return(0);
}
Exemplo n.º 2
0
/*!
 * Return a node object by id.
 *
 * This function performs a recursive search for the specified node.
 *
 * \param file The Lib3dsFile to be searched.
 * \param node_id The target node id.
 *
 * \return A pointer to the first matching node, or NULL if not found.
 *
 * \see lib3ds_node_by_id
 */
Lib3dsNode*
lib3ds_file_node_by_id(Lib3dsFile *file, uint16_t node_id) {
    Lib3dsNode *p, *q;

    assert(file);
    for (p = file->nodes; p != 0; p = p->next) {
        if (p->node_id == node_id) {
            return(p);
        }
        q = lib3ds_node_by_id(p, node_id);
        if (q) {
            return(q);
        }
    }
    return(0);
}
Exemplo n.º 3
0
/*!
 * \ingroup file
 */
Lib3dsNode*
lib3ds_file_node_by_id(Lib3dsFile *file, Lib3dsWord node_id)
{
    Lib3dsNode *p,*q;

    ASSERT(file);
    for (p=file->nodes; p!=0; p=p->next) {
        if (p->node_id==node_id) {
            return(p);
        }
        q=lib3ds_node_by_id(p, node_id);
        if (q) {
            return(q);
        }
    }
    return(0);
}