void remove_node_id(GF_SceneGraph *sg, GF_Node *node)
{
	NodeIDedItem *reg_node = sg->id_node;
	if (!reg_node) return;
	
	if (reg_node->node==node) {
		sg->id_node = reg_node->next;
		if (sg->id_node_last==reg_node)
			sg->id_node_last = reg_node->next;
		if (reg_node->NodeName) gf_free(reg_node->NodeName);
		gf_free(reg_node);
	} else {
		NodeIDedItem *to_del;
		while (reg_node->next) {
			if (reg_node->next->node!=node) {
				reg_node = reg_node->next;
				continue;
			}
			to_del = reg_node->next;
			reg_node->next = to_del->next;
			if (sg->id_node_last==to_del) {
				sg->id_node_last = reg_node->next ? reg_node->next : reg_node;
			}
			if (to_del->NodeName) gf_free(to_del->NodeName);
			to_del->NodeName = NULL;
			gf_free(to_del);
			break;
		}
	}
}
void remove_node_id(GF_SceneGraph *sg, GF_Node *node)
{
	NodeIDedItem *reg_node = sg->id_node;
	if (!reg_node) return;
	
	if (reg_node->node==node) {
		sg->id_node = reg_node->next;
		if (sg->id_node_last==reg_node)
			sg->id_node_last = reg_node->next;
		if (reg_node->NodeName) gf_free(reg_node->NodeName);
		gf_free(reg_node);
	} else {
		NodeIDedItem *to_del;
		while (reg_node->next) {
			if (reg_node->next->node!=node) {
				reg_node = reg_node->next;
				continue;
			}
			to_del = reg_node->next;
			reg_node->next = to_del->next;
			if (sg->id_node_last==to_del) {
				sg->id_node_last = reg_node->next ? reg_node->next : reg_node;
			}
			if (to_del->NodeName) gf_free(to_del->NodeName);
			to_del->NodeName = NULL;
			gf_free(to_del);
			break;
		}
	}
}