Пример #1
0
    public bool LoadPart(out BrickMesh brickMesh, string fileName, string basePath, Dictionary <string, Queue <string> > canonicalPathCache)
    {
        brickMesh = null;

        if (!IsInitialized)
        {
            Debug.Log(string.Format("LdPartsLoader is not initialized"));
            return(false);
        }

        if (!LoadSubFiles(fileName, basePath, canonicalPathCache))
        {
            return(false);
        }

        while (subFileNames.Count > 0)
        {
            string fname = subFileNames.FirstOrDefault();
            if (fname != null)
            {
                subFileNames.Remove(fname);
            }
            if (!LoadSubFiles(fname, basePath, canonicalPathCache))
            {
                return(false);
            }
        }

        Dictionary <string, string> partsListCache = new Dictionary <string, string>();

        return(ldFileParser.Start(out brickMesh, fileName, partsListCache, fileCache, true));
    }
Пример #2
0
    public BrickMesh Load(bool usePartAsset)
    {
        string mainModelName;

        if (!LoadMPDFile(out mainModelName))
        {
            return(null);
        }

        LdFileParser.FileLines val;
        string cacheModelName = mainModelName.Replace(@"\", @"/").ToLower();

        if (!fileCache.TryGetValue(cacheModelName, out val))
        {
            Debug.Log(string.Format("Cannot find file cache for {0}", mainModelName));
            return(null);
        }

        BrickMesh model = null;

        if (!ldFileParser.Start(out model, mainModelName, partsListCache, fileCache, usePartAsset))
        {
            return(null);
        }

        Debug.Log(string.Format("Parsing model finished: {0}", mainModelName));
        return(model);
    }