コード例 #1
0
        protected override IEnumerable <AssetItem> CreateAssets(AssetTemplateGeneratorParameters parameters)
        {
            var files = parameters.Tags.Get(SourceFilesPathKey);

            if (files == null)
            {
                return(base.CreateAssets(parameters));
            }

            var importParameters = new AssetImporterParameters {
                Logger = parameters.Logger
            };

            importParameters.SelectedOutputTypes.Add(typeof(SkeletonAsset), true);

            var importedAssets = new List <AssetItem>();

            foreach (var file in files)
            {
                // TODO: should we allow to select the importer?
                var importer = AssetRegistry.FindImporterForFile(file).OfType <ModelAssetImporter>().FirstOrDefault();
                if (importer == null)
                {
                    parameters.Logger.Warning($"No importer found for file \"{file}\"");
                    continue;
                }

                var assets = importer.Import(file, importParameters).Select(x => new AssetItem(UPath.Combine(parameters.TargetLocation, x.Location), x.Asset)).ToList();
                // Create unique names amongst the list of assets
                importedAssets.AddRange(MakeUniqueNames(assets));
            }

            return(importedAssets);
        }
コード例 #2
0
 protected override IAssetImporter GetImporter()
 {
     return(AssetRegistry.FindImporterForFile(Asset.Source).OfType <ModelAssetImporter>().FirstOrDefault());
 }
コード例 #3
0
 protected override IAssetImporter GetImporter()
 {
     return(AssetRegistry.FindImporterForFile(Asset.Source).FirstOrDefault(x => x.RootAssetTypes.Contains(typeof(SpriteStudioModelAsset))));
 }
コード例 #4
0
ファイル: TestAssetImport.cs プロジェクト: rohitshe/Code
        public void CheckImporter()
        {
            var importer = AssetRegistry.FindImporterForFile("test.tmp").FirstOrDefault();

            Assert.NotNull(importer);
        }