public static FbxConnectionCache Build(FbxData data) { var res = new FbxConnectionCache(); var node = data.Node.GetChild("Connections"); foreach (var conn in node.Childs) { var sourceId = new FbxObjectId { Id = (long)conn.Properties[1] }; var distId = new FbxObjectId { Id = (long)conn.Properties[2] }; if (!res.ConnectBySourceMap.ContainsKey(sourceId)) { res.ConnectBySourceMap.Add(sourceId, new List <FbxObjectId>()); } if (!res.ConnectByDistMap.ContainsKey(distId)) { res.ConnectByDistMap.Add(distId, new List <FbxObjectId>()); } res.ConnectBySourceMap[sourceId].Add(distId); res.ConnectByDistMap [distId].Add(sourceId); } return(res); }
public FbxGeometry(FbxDocument fbxDocument, FbxNode node) { FbxDocument = fbxDocument; FbxDocument.ObjectCache.Add(this, Id); Id = new FbxObjectId { Id = (long)node.Properties[0] }; foreach (var child in node.Childs) { switch (child.Name) { case "Vertices": ObjectGeometryVertices = new FbxObjectGeometryVertices(child); break; case "PolygonVertexIndex": FbxObjectGeometryPolygonMap = new FbxObjectGeometryPolygonMap(child); ObjectGeometryPolygonVertexIndex = new FbxObjectGeometryPolygonVertexIndex(child, FbxObjectGeometryPolygonMap); break; case "LayerElementNormal": Normal = new FbxObjectGeometryLayerElementNormal(child, FbxObjectGeometryPolygonMap); break; case "LayerElementUV": UV = new FbxObjectGeometryLayerElementUv(child); break; case "LayerElementMaterial": MaterialIndex = new FbxObjectGeometryLayerElementMaterial(child); break; } } }
public List <FbxObjectId> ConnectByDist(FbxObjectId dist) { ConnectByDistMap.TryGetValue(dist, out var res); if (res == null) { return(new List <FbxObjectId>()); } return(res); }
public List <FbxObjectId> ConnectBySource(FbxObjectId source) { ConnectBySourceMap.TryGetValue(source, out var res); if (res == null) { return(new List <FbxObjectId>()); } return(res); }
public FbxObjectMaterial(FbxDocument fbxDocument, FbxNode node) { FbxDocument = fbxDocument; Id = new FbxObjectId { Id = (long)node.Properties[0] }; Name = (string)node.Properties[1]; FbxDocument.ObjectCache.Add(this, Id); }
public FbxObjectTexture(FbxDocument fbxDocument, FbxNode node) { FbxDocument = fbxDocument; Id = new FbxObjectId { Id = (long)node.Properties[0] }; Name = (string)node.Properties[1]; RelativeFilename = (string)node.GetChild("RelativeFilename").Properties[0]; FbxDocument.ObjectCache.Add(this, Id); }
public void Add(IFbxObject node, FbxObjectId Id) { IdToNode.Add(Id, node); NodeToId.Add(node, Id); }
public IFbxObject FbxObject(FbxObjectId id) { IdToNode.TryGetValue(id, out var res); return(res); }