Esempio n. 1
0
        private void AddRegistryObjectDependency(UTinyModule module)
        {
            if (null == module)
            {
                return;
            }

            foreach (var m in module.EnumerateDependencies())
            {
                var path = UTinyPersistence.GetLocation(m);

                // Core or sample module/project don't need to be packaged, they will be included from the manifest.
                if (ShouldPackage(path))
                {
                    AddFileElements(path, false);
                }

                foreach (var asset in AssetIterator.EnumerateAssets(m))
                {
                    if (ShouldPackage(asset.AssetPath))
                    {
                        AddFileElements(asset.AssetPath, false);
                    }
                }
            }
        }
Esempio n. 2
0
        public static UTinyEntityGroup Generate(IRegistry registry, UTinyProject project)
        {
            var entityGroup = registry.CreateEntityGroup(UTinyId.New(), "Assets_Generated");
            var assets      = AssetIterator.EnumerateAssets(project.Module.Dereference(project.Registry));

            foreach (var asset in assets)
            {
                CreateEntityForAsset(registry, project, entityGroup, asset);
            }

            return(entityGroup);
        }
        /// <summary>
        /// Generates `libwebp.js` to handle WebP decompressor
        /// </summary>
        private static void GenerateWebPDecompressor(UTinyBuildOptions options, UTinyBuildResults results)
        {
            // Check if project use WebP texture format
            var module   = options.Project.Module.Dereference(options.Project.Registry);
            var webpUsed = AssetIterator.EnumerateAssets(module)
                           .Select(a => a.Object)
                           .OfType <Texture2D>()
                           .Select(t => UTinyUtility.GetAssetExportSettings(options.Project, t))
                           .OfType <UTinyTextureSettings>()
                           .Any(s => s.FormatType == TextureFormatType.WebP);

            // Warn about WebP usages
            if (options.Project.Settings.IncludeWebPDecompressor)
            {
                if (!webpUsed)
                {
                    Debug.LogWarning("This project does not uses the WebP texture format, but includes the WebP decompressor code. To reduce build size, it is recommended to disable \"Include WebP Decompressor\" in project settings.");
                }
            }
            else // WebP decompressor not included, do not copy to binary dir
            {
                if (webpUsed)
                {
                    Debug.LogWarning("This project uses the WebP texture format, but does not include the WebP decompressor code. The content will not load in browsers that do not natively support the WebP format. To ensure maximum compatibility, enable \"Include WebP Decompressor\" in project settings.");
                }
                return;
            }

            // Copy libwebp to binary dir
            var srcFile = Path.Combine(UTinyBuildPipeline.GetToolDirectory("libwebp"), KWebPDecompressorFileName);
            var dstFile = Path.Combine(results.BinaryFolder.FullName, KWebPDecompressorFileName);

            File.Copy(srcFile, dstFile);

            results.BuildReport.GetOrAddChild(UTinyBuildReport.CodeNode).AddChild(new FileInfo(dstFile));
        }
Esempio n. 4
0
 public IEnumerable <UTinyAssetInfo> GetAssetInfos()
 {
     return(AssetIterator.EnumerateAssets(MainModule.Dereference(Registry)));
 }
Esempio n. 5
0
        public static IList <UTinyExportInfo> Export(UTinyProject project, DirectoryInfo assetsFolder)
        {
            var module = project.Module.Dereference(project.Registry);

            return(AssetIterator.EnumerateAssets(module).Select(asset => Export(project, assetsFolder.FullName, asset)).ToList());
        }