示例#1
0
 public override void ChangeAssetPath(string fromPath, string toPath)
 {
     if (!FileInspector.IsSwc(fromPath))
     {
         base.ChangeAssetPath(fromPath, toPath);
     }
     else
     {
         LibraryAsset asset = SwcLibraries[GetRelativePath(fromPath)];
         SwcLibraries.Remove(asset);
         asset.Path = GetRelativePath(toPath);
         SwcLibraries.Add(asset);
     }
 }
示例#2
0
 public override void ChangeAssetPath(string fromPath, string toPath)
 {
     if (!IsLoomLib(fromPath))
     {
         return;
     }
     else
     {
         LibraryAsset asset = LoomLibraries[GetRelativePath(fromPath)];
         LoomLibraries.Remove(asset);
         asset.Path = GetRelativePath(toPath);
         LoomLibraries.Add(asset);
     }
 }
示例#3
0
        private void LoadAsset()
        {
            if (!FileDialog.Open(out string path,
                                 filter:
                                 "All Image Files (*.bmp; *.jpg; *.jpeg; *.png; *.tif; *.tiff)\0*.bmp;*.jpg;*.jpeg;*.png;*.tif;*.tiff\0" +
                                 "PNG (*.png)\0*.png\0" +
                                 "JPG (*.jpg; *.jpeg)\0*.jpg;*.jpeg\0" +
                                 "BMP (*.bmp)\0*.bmp\0" +
                                 "GIF (*.gif)\0*.gif\0" +
                                 "TIFF (*.tif; *.tiff)\0*.tif;*.tiff\0" +
                                 "EXIF (*.exif)\0*.exif\0" +
                                 "All Files (*.*)\0*.*\0"))
            {
                return;
            }

            SelectedTextureAsset = new TextureAsset(path);
            SelectedTextureAsset.Load();
            textureAssets.Add(SelectedTextureAsset);

            selectedIndex = textureAssets.GetAll().Count - 1;
            selectedIndex = Math.Clamp(selectedIndex, 0, Math.Max(textureAssets.GetAll().Count - 1, 0));

            ResetView();
        }
示例#4
0
        public static GensMaterial LoadMaterial(string path,
                                                string name = null, bool nonEditable = true)
        {
            // Don't bother loading this material again if we've already loaded it
            if (string.IsNullOrEmpty(name))
            {
                name = Path.GetFileNameWithoutExtension(path);
            }

            if (Materials.ContainsKey(name))
            {
                return(Materials[name]);
            }

            // Figure out what type of material to use
            GensMaterial mat; // TODO: Set to generic material type once one is made

            switch (Types.CurrentDataType)
            {
            case Types.DataTypes.Forces:
            case Types.DataTypes.LW:
            case Types.DataTypes.Gens:
            case Types.DataTypes.SU:
                mat = new GensMaterial();
                break;

            // TODO: Add Storybook Support
            case Types.DataTypes.Storybook:
                throw new NotImplementedException(
                          "Could not load, Storybook materials are not yet supported!");

            // TODO: Add Colors Support
            case Types.DataTypes.Colors:
                throw new NotImplementedException(
                          "Could not load, Colors materials are not yet supported!");

            // TODO: Add 06 Support
            case Types.DataTypes.S06:
                throw new NotImplementedException(
                          "Could not load, '06 materials are not yet supported!");

            // TODO: Add Heroes/Shadow Support
            case Types.DataTypes.Shadow:
            case Types.DataTypes.Heroes:
                throw new NotImplementedException(
                          "Could not load, Heroes/Shadow materials are not yet supported!");

            // TODO: Add SA2 Support
            case Types.DataTypes.SA2:
                throw new NotImplementedException(
                          "Could not load, SA2 materials are not yet supported!");

            default:
                throw new Exception(
                          "Could not load, game type has not been set!");
            }

            // Material
            mat.Load(path);

            string dir    = Path.GetDirectoryName(path);
            var    resDir = ResourceDirectories.AddDirectory(dir);

            Materials.Add(name, new Asset <GensMaterial>(resDir, mat, nonEditable));

            // Textures
            foreach (var tex in mat.Texset.Textures)
            {
                GetTexture(tex.TextureName);
            }

            return(mat);
        }
示例#5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="type"></param>
 public void AddAsset(Asset desc)
 {
     assets.Add(desc);
 }