Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
SiliconStudio.Assets.AssetImportSession Class Reference

This class is handling importItem of assets into a session. See remarks for usage. More...

Public Member Functions

 AssetImportSession (PackageSession session)
 Initializes a new instance of the AssetImportSession class. More...
 
bool IsFileSupported (UFile file)
 Determines whether the specified file is supported More...
 
AssetToImport AddFile (UFile file, Package package, UDirectory directory)
 Adds a file to import. More...
 
IEnumerable< AssetToImportAddFiles (IEnumerable< UFile > files, Package package, UDirectory directory)
 Adds files to import. More...
 
AssetToImport AddFile (UFile file, IAssetImporter importer, Package package, UDirectory directory)
 Adds a file to import. More...
 
bool IsExistingAssetForReImportSupported (AssetItem assetItem)
 Determines whether the specified asset is supporting re-import. More...
 
AssetToImport AddExistingAssetForReImport (AssetItem assetItem)
 Adds an existing asset for reimport More...
 
bool Stage (CancellationToken?cancelToken=null)
 Analyze files for preparing them for the merge and import steps. This must be called first after calling AddFile(SiliconStudio.Core.IO.UFile,Package,SiliconStudio.Core.IO.UDirectory) methods. More...
 
void Merge (CancellationToken?cancelToken=null)
 Merges each asset with the selected asset specified in AssetToImportMergeGroup.SelectedItem More...
 
ImportResult Import ()
 Imports all assets More...
 
void Import (ImportResult result)
 Imports all assets More...
 
void Reset ()
 Resets the current importItem session. More...
 

Properties

List< AssetToImportImports [get]
 Gets the list of import being processed by this instance. More...
 
bool HasErrors [get]
 Gets a value indicating whether this instance has errors. More...
 

Events

EventHandler
< AssetImportSessionEvent
Progress
 Occurs when this import session is making progress. More...
 

Detailed Description

This class is handling importItem of assets into a session. See remarks for usage.

var importSession = new AssetImportSession(session);
// First add files to the session
importSession.AddFile("C:\xxx\yyy\test.fbx", package, "zzz");
// accessing importSession.Imports will return the list of files to importItem
// Prepare files for importItem.
importSession.Stage();
// importSession.Imports.Items contains the list of items that will be imported
// Here we need to select the assets that will be used for merge if there are any
foreach(var fileItem in importSession.Imports)
{
foreach(var importItemByImporter in importSession.ByImporters)
{
foreach(var importItem in importItemByImporter.Items)
{
// Select for example the first mergeable item
importItem.SelectedItem = (importItem.Merges.Count > 0) ? importItem.Merges[0].PreviousItem : importItem.Item;
}
}
}
// Merge assets if necessary
importSession.Merge();
// Import all assets
importSession.Import();

Definition at line 56 of file AssetImportSession.cs.

Constructor & Destructor Documentation

SiliconStudio.Assets.AssetImportSession.AssetImportSession ( PackageSession  session)

Initializes a new instance of the AssetImportSession class.

Parameters
sessionThe session.
Exceptions
System.ArgumentNullExceptionsession

Definition at line 74 of file AssetImportSession.cs.

Member Function Documentation

AssetToImport SiliconStudio.Assets.AssetImportSession.AddExistingAssetForReImport ( AssetItem  assetItem)

Adds an existing asset for reimport

Parameters
assetItemThe asset item.
Exceptions
System.ArgumentNullExceptionassetItem

Definition at line 262 of file AssetImportSession.cs.

References SiliconStudio.Core.IO.UPath.GetDirectory(), SiliconStudio.Assets.AssetItem.Location, SiliconStudio.Assets.AssetItem.Package, and SiliconStudio.Assets.Package.Session.

AssetToImport SiliconStudio.Assets.AssetImportSession.AddFile ( UFile  file,
Package  package,
UDirectory  directory 
)

Adds a file to import.

Parameters
fileThe file.
packageThe package where to import this file.
directoryThe directory relative to package where to import this file.
Exceptions
System.ArgumentNullExceptionfile or package or directory
System.ArgumentExceptionFile [{0}] does not exist or is not an absolute path.ToFormat(file)

Definition at line 135 of file AssetImportSession.cs.

AssetToImport SiliconStudio.Assets.AssetImportSession.AddFile ( UFile  file,
IAssetImporter  importer,
Package  package,
UDirectory  directory 
)

Adds a file to import.

Parameters
fileThe file.
importerThe associated importer to this file.
packageThe package where to import this file.
directoryThe directory relative to package where to import this file.
Exceptions
System.ArgumentNullExceptionfile or importer or package or directory or importer [{0}] is not supporting file [{1}].ToFormat(importer.Name, file)
System.ArgumentExceptionFile [{0}] does not exist or is not an absolute path.ToFormat(file)
System.InvalidOperationExceptionCurrent session does not contain package

Definition at line 205 of file AssetImportSession.cs.

References SiliconStudio.Assets.IAssetImporter.Name.

IEnumerable<AssetToImport> SiliconStudio.Assets.AssetImportSession.AddFiles ( IEnumerable< UFile files,
Package  package,
UDirectory  directory 
)

Adds files to import.

Parameters
filesThe files.
packageThe package where to import this file.
directoryThe directory relative to package where to import this file.
Exceptions
System.ArgumentNullExceptionfiles or package or directory

Definition at line 170 of file AssetImportSession.cs.

ImportResult SiliconStudio.Assets.AssetImportSession.Import ( )

Imports all assets

Returns
Result of the import.

Definition at line 550 of file AssetImportSession.cs.

void SiliconStudio.Assets.AssetImportSession.Import ( ImportResult  result)

Imports all assets

Returns
Results of the import where logs will be outputed.

Definition at line 561 of file AssetImportSession.cs.

References SiliconStudio.Assets.AssetItem.Id.

bool SiliconStudio.Assets.AssetImportSession.IsExistingAssetForReImportSupported ( AssetItem  assetItem)

Determines whether the specified asset is supporting re-import.

Parameters
assetItemThe asset item.
Returns
true if the specified asset is supporting re-import; otherwise, false.
Exceptions
System.ArgumentNullExceptionassetItem

Definition at line 233 of file AssetImportSession.cs.

References SiliconStudio.Assets.AssetItem.Package, and SiliconStudio.Assets.Package.Session.

bool SiliconStudio.Assets.AssetImportSession.IsFileSupported ( UFile  file)

Determines whether the specified file is supported

Parameters
fileThe file.
Returns
true if the specified file is supported; otherwise, false.
Exceptions
System.ArgumentNullExceptionfile

Definition at line 111 of file AssetImportSession.cs.

References SiliconStudio.Core.IO.UFile.GetFileExtension(), and SiliconStudio.Core.IO.UPath.IsAbsolute.

void SiliconStudio.Assets.AssetImportSession.Merge ( CancellationToken?  cancelToken = null)

Merges each asset with the selected asset specified in AssetToImportMergeGroup.SelectedItem

Parameters
cancelTokenThe cancel token.

Definition at line 387 of file AssetImportSession.cs.

void SiliconStudio.Assets.AssetImportSession.Reset ( )

Resets the current importItem session.

Definition at line 676 of file AssetImportSession.cs.

bool SiliconStudio.Assets.AssetImportSession.Stage ( CancellationToken?  cancelToken = null)

Analyze files for preparing them for the merge and import steps. This must be called first after calling AddFile(SiliconStudio.Core.IO.UFile,Package,SiliconStudio.Core.IO.UDirectory) methods.

Returns
true if staging was successfull otherwise. See remarks for checking errors

If this method returns false, errors should be checked on each AssetToImport from the Imports list.

Definition at line 305 of file AssetImportSession.cs.

Property Documentation

bool SiliconStudio.Assets.AssetImportSession.HasErrors
get

Gets a value indicating whether this instance has errors.

true if this instance has errors; otherwise, false.

Definition at line 98 of file AssetImportSession.cs.

List<AssetToImport> SiliconStudio.Assets.AssetImportSession.Imports
get

Gets the list of import being processed by this instance.

The imports.

Definition at line 86 of file AssetImportSession.cs.

Event Documentation

EventHandler<AssetImportSessionEvent> SiliconStudio.Assets.AssetImportSession.Progress

Occurs when this import session is making progress.

Definition at line 67 of file AssetImportSession.cs.


The documentation for this class was generated from the following file: