コード例 #1
0
ファイル: AssetTracker.cs プロジェクト: thuskey/xenko
 /// <summary>
 /// Called when an asset stop being tracked.
 /// </summary>
 /// <param name="assetItem"></param>
 public abstract void UnTrackAsset(AssetItem assetItem);
コード例 #2
0
        /// <summary>
        /// Create a <see cref="PackageSession"/> that can be used to compile an <see cref="AssetItem"/> by analyzing and resolving its dependencies.
        /// </summary>
        /// <returns>The package packageSession that can be used to compile the asset item.</returns>
        public static PackageSession CreateCompilePackageFromAsset(this PackageSession session, AssetItem originalAssetItem)
        {
            if (originalAssetItem == null)
            {
                throw new ArgumentNullException("originalAssetItem");
            }

            // Find the asset from the session
            var assetItem = session.FindAsset(originalAssetItem.Id);

            if (assetItem == null)
            {
                throw new ArgumentException("Cannot find the specified AssetItem instance in the session");
            }

            // Calculate dependencies
            var dependencies        = session.DependencyManager.ComputeDependencies(assetItem, AssetDependencySearchOptions.Out | AssetDependencySearchOptions.Recursive);
            var assetItemRootCloned = dependencies.Item.Clone();

            // Store the fullpath to the sourcefolder, this avoid us to clone hierarchy of packages
            assetItemRootCloned.SourceFolder = assetItem.FullPath.GetParent();

            // create the compile root package and package session
            var assetPackageCloned    = new Package();
            var compilePackageSession = new PackageSession(assetPackageCloned);

            assetPackageCloned.Assets.Add(assetItemRootCloned);

            // For each asset item dependency, clone it in the new package
            foreach (var item in dependencies)
            {
                // Only add assets not already added (in case of circular dependencies)
                if (assetPackageCloned.Assets.Find(item.Id) == null)
                {
                    // create a copy of the asset item and add it to the appropriate compile package
                    var assetItemCloned = item.Clone();

                    // Store the fullpath to the sourcefolder, this avoid us to clone hierarchy of packages
                    assetItemCloned.SourceFolder = item.FullPath.GetParent();
                    assetPackageCloned.Assets.Add(assetItemCloned);
                }
            }

            return(compilePackageSession);
        }
コード例 #3
0
 internal AssetToImportByImporter(AssetToImport parent, IAssetImporter importer, AssetItem previousItem = null)
 {
     if (parent == null)
     {
         throw new ArgumentNullException("parent");
     }
     if (importer == null)
     {
         throw new ArgumentNullException("importer");
     }
     this.Parent               = parent;
     this.importer             = importer;
     this.Items                = new List <AssetToImportMergeGroup>();
     Enabled                   = true;
     Log                       = new LoggerResult(string.Format("{0} Importer", importer.Name));
     ImporterParameters        = importer.GetDefaultParameters(previousItem != null);
     ImporterParameters.Logger = Log;
     PreviousItem              = previousItem;
 }