Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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;
            }
        }
    }
Exemplo n.º 3
0
 public List <FbxObjectId> ConnectByDist(FbxObjectId dist)
 {
     ConnectByDistMap.TryGetValue(dist, out var res);
     if (res == null)
     {
         return(new List <FbxObjectId>());
     }
     return(res);
 }
Exemplo n.º 4
0
 public List <FbxObjectId> ConnectBySource(FbxObjectId source)
 {
     ConnectBySourceMap.TryGetValue(source, out var res);
     if (res == null)
     {
         return(new List <FbxObjectId>());
     }
     return(res);
 }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
 public void Add(IFbxObject node, FbxObjectId Id)
 {
     IdToNode.Add(Id, node);
     NodeToId.Add(node, Id);
 }
Exemplo n.º 8
0
 public IFbxObject FbxObject(FbxObjectId id)
 {
     IdToNode.TryGetValue(id, out var res);
     return(res);
 }