public static List <Model> LoadModelObj(int id)
        {
            string bndPath = "";

            if (Type == InterrootType.InterrootDS3)
            {
                bndPath = $@"obj\o{id:D6}.objbnd";
            }
            else
            {
                bndPath = $@"obj\o{id:D4}.objbnd";
            }

            var bndName = GetInterrootPath(bndPath);

            BND bnd = LoadDecompressedBND(bndName);

            if (bnd != null)
            {
                var models = LoadModelsFromBnd(bnd);
                TexturePool.AddTextureBnd(bnd, null);
                return(models);
            }

            return(new List <Model>());
        }
        public static List <Model> LoadModelChr(int id)
        {
            var bndName    = GetInterrootPath($@"chr\c{id:D4}.chrbnd");
            var texBndName = GetInterrootPath($@"chr\c{id:D4}.texbnd");
            // Used in Bloodborne
            var texExtendedTpf = GetInterrootPath($@"chr\c{id:D4}_2.tpf.dcx");

            BND bnd = LoadDecompressedBND(bndName);

            if (bnd != null)
            {
                var models = LoadModelsFromBnd(bnd);
                if (Type == InterrootType.InterrootDS3)
                {
                    // DS3 has separate texbnds for textures
                    BND texbnd = LoadDecompressedBND(texBndName);
                    if (texbnd != null)
                    {
                        TexturePool.AddTextureBnd(texbnd, null);
                    }
                }
                else
                {
                    if (File.Exists(texExtendedTpf))
                    {
                        SoulsFormats.TPF tpf = null;
                        lock (_lock_IO)
                        {
                            tpf = SoulsFormats.TPF.Read(texExtendedTpf);
                        }
                        TexturePool.AddTpf(tpf);
                    }
                    TexturePool.AddTextureBnd(bnd, null);
                }
                return(models);
            }

            return(new List <Model>());
        }
 public static void LoadDragDroppedFiles(string[] fileNames)
 {
     LoadingTaskMan.DoLoadingTask("LoadDragDroppedFiles_" + DateTime.Now.Ticks, "Loading dropped models...", prog =>
     {
         var spawnTransform = GFX.World.GetSpawnPointFromMouseCursor(10.0f, false, true, true);
         int i = 0;
         foreach (var fn in fileNames)
         {
             var shortName = Path.GetFileNameWithoutExtension(fn);
             var upper     = fn.ToUpper();
             if (upper.EndsWith(".CHRBND") || upper.EndsWith(".OBJBND") || upper.EndsWith(".PARTSBND"))
             {
                 BND bnd = null;
                 lock (_lock_IO)
                 {
                     bnd = DataFile.LoadFromFile <BND>(fn);
                 }
                 TexturePool.AddTextureBnd(bnd, null);
                 var models = LoadModelsFromBnd(bnd);
                 foreach (var m in models)
                 {
                     GFX.ModelDrawer.AddModelInstance(
                         new ModelInstance(shortName, m, spawnTransform, -1, -1, -1, -1));
                 }
             }
             else if (upper.EndsWith(".FLVER") || upper.EndsWith(".FLVER.DCX"))
             {
                 var flver         = SoulsFormats.FLVER.Read(File.ReadAllBytes(fn));
                 var model         = new Model(flver);
                 var modelInstance = new ModelInstance(shortName, model, spawnTransform, -1, -1, -1, -1);
                 GFX.ModelDrawer.AddModelInstance(modelInstance);
             }
             prog?.Report(1.0 * (++i) / fileNames.Length);
         }
     });
 }