parseConnections method

dynamic parseConnections()

Implementation

parseConnections() {

	var connectionMap = new Map();

	if ( fbxTree.Connections != null  ) {

		var rawConnections = fbxTree.Connections["connections"];

		rawConnections.forEach( ( rawConnection ) {

			var fromID = rawConnection[ 0 ];
			var toID = rawConnection[ 1 ];

        dynamic relationship;
        if(rawConnection.length > 2) {
          relationship = rawConnection[ 2 ];
        }

			if ( ! connectionMap.containsKey( fromID ) ) {

				connectionMap[fromID] = {
					"parents": [],
					"children": []
				};

			}

			var parentRelationship = { "ID": toID, "relationship": relationship };
			connectionMap[fromID]["parents"].add( parentRelationship );

			if ( ! connectionMap.containsKey( toID ) ) {

				connectionMap[toID] = {
					"parents": [],
					"children": []
				};

			}

			var childRelationship = { "ID": fromID, "relationship": relationship };
			connectionMap[toID]["children"].add( childRelationship );

		} );

	}

	return connectionMap;

}