parseSkeleton method

Map<String, dynamic> parseSkeleton(
  1. dynamic relationships,
  2. dynamic deformerNodes
)

Implementation

Map<String, dynamic> parseSkeleton( relationships, deformerNodes ) {

	var rawBones = [];

	relationships["children"].forEach( ( child ) {

		var boneNode = deformerNodes[ child["ID"] ];

		if ( boneNode["attrType"] != 'Cluster' ) return;

		var rawBone = {

			"ID": child["ID"],
			"indices": [],
			"weights": [],
			"transformLink": new Matrix4().fromArray( boneNode["TransformLink"]["a"] ),
			// transform: new Matrix4().fromArray( boneNode.Transform.a ),
			// linkMode: boneNode.Mode,

		};

		if ( boneNode["Indexes"] != null  ) {

			rawBone["indices"] = boneNode["Indexes"]["a"];
			rawBone["weights"] = boneNode["Weights"]["a"];

		}

		rawBones.add( rawBone );

	} );

	return Map<String, dynamic>.from({

		"rawBones": rawBones,
		"bones": []

	});

}