static GF_Err gf_dump_vrml_route(GF_SceneDumper *sdump, GF_Route *r, u32 dump_type)
{
	char toNodeBuf[100], fromNodeBuf[100], *to_node_p, *from_node_p;
	const char *node_name;
	u32 id;
	if (!r->is_setup) {
		gf_node_get_field(r->FromNode, r->FromField.fieldIndex, &r->FromField);
		gf_node_get_field(r->ToNode, r->ToField.fieldIndex, &r->ToField);
		r->is_setup = 1;
	}
	if (!r->FromNode || !r->ToNode) return GF_BAD_PARAM;

	if (sdump->XMLDump || !dump_type) DUMP_IND(sdump);

	to_node_p = toNodeBuf;
	from_node_p = fromNodeBuf;
	node_name = gf_node_get_name_and_id(r->FromNode, &id);
	if (node_name) {
		const char *to_name;
		from_node_p = (char *)node_name;
		to_name = gf_node_get_name(r->ToNode);
		if (to_name) {
			to_node_p = (char *) to_name;
		} else {
			id = gf_node_get_id(r->ToNode);
			sprintf(toNodeBuf, "node_%d", id);
		}
	} else {
		sprintf(fromNodeBuf, "N%d", id-1);
		sprintf(toNodeBuf, "N%d", gf_node_get_id(r->ToNode) - 1);
	}
	if (sdump->XMLDump) {
		gf_fprintf(sdump->trace, "<ROUTE");
		if (r->ID) {
			StartAttribute(sdump, "DEF");
			scene_dump_vrml_route_id(sdump, r->ID, r->name);
			EndAttribute(sdump);
		}
		gf_fprintf(sdump->trace, " fromNode=\"%s\" fromField=\"%s\" toNode=\"%s\" toField=\"%s\"/>\n", from_node_p, r->FromField.name, to_node_p, r->ToField.name);
	} else {
		if (dump_type==2) gf_fprintf(sdump->trace, "ROUTE ");
		if (r->ID) {
			gf_fprintf(sdump->trace, "DEF ");
			scene_dump_vrml_route_id(sdump, r->ID, r->name);
			gf_fprintf(sdump->trace, " ");
		}
		if (dump_type==1) {
			gf_fprintf(sdump->trace, "%s.%s TO %s.%s\n", from_node_p, r->FromField.name, to_node_p, r->ToField.name);
		} else {
			if (dump_type!=2) gf_fprintf(sdump->trace, "ROUTE ");
			gf_fprintf(sdump->trace, "%s.%s TO %s.%s\n", from_node_p, r->FromField.name, to_node_p, r->ToField.name);
		}
	}
	return GF_OK;
}
static GF_Err gf_dump_vrml_route(GF_SceneDumper *sdump, GF_Route *r, u32 dump_type)
{
	char toNodeBuf[100], fromNodeBuf[100], *to_node_p, *from_node_p;
	const char *node_name;
	u32 id;
	if (!r->is_setup) {
		gf_node_get_field(r->FromNode, r->FromField.fieldIndex, &r->FromField);
		gf_node_get_field(r->ToNode, r->ToField.fieldIndex, &r->ToField);
		r->is_setup = 1;
	}
	if (!r->FromNode || !r->ToNode) return GF_BAD_PARAM;

	if (sdump->XMLDump || !dump_type) DUMP_IND(sdump);

	to_node_p = toNodeBuf;
	from_node_p = fromNodeBuf;
	node_name = gf_node_get_name_and_id(r->FromNode, &id);
	if (node_name) {
		const char *to_name;
		from_node_p = (char *)node_name;
		to_name = gf_node_get_name(r->ToNode);
		if (to_name) {
			to_node_p = (char *) to_name;
		} else {
			id = gf_node_get_id(r->ToNode);
			sprintf(toNodeBuf, "node_%d", id);
		}
	} else {
		sprintf(fromNodeBuf, "N%d", id-1);
		sprintf(toNodeBuf, "N%d", gf_node_get_id(r->ToNode) - 1);
	}
	if (sdump->XMLDump) {
		gf_fprintf(sdump->trace, "<ROUTE");
		if (r->ID) {
			StartAttribute(sdump, "DEF");
			scene_dump_vrml_route_id(sdump, r->ID, r->name);
			EndAttribute(sdump);
		}
		gf_fprintf(sdump->trace, " fromNode=\"%s\" fromField=\"%s\" toNode=\"%s\" toField=\"%s\"/>\n", from_node_p, r->FromField.name, to_node_p, r->ToField.name);
	} else {
		if (dump_type==2) gf_fprintf(sdump->trace, "ROUTE ");
		if (r->ID) {
			gf_fprintf(sdump->trace, "DEF ");
			scene_dump_vrml_route_id(sdump, r->ID, r->name);
			gf_fprintf(sdump->trace, " ");
		}
		if (dump_type==1) {
			gf_fprintf(sdump->trace, "%s.%s TO %s.%s\n", from_node_p, r->FromField.name, to_node_p, r->ToField.name);
		} else {
			if (dump_type!=2) gf_fprintf(sdump->trace, "ROUTE ");
			gf_fprintf(sdump->trace, "%s.%s TO %s.%s\n", from_node_p, r->FromField.name, to_node_p, r->ToField.name);
		}
	}
	return GF_OK;
}