All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
usdzPackage.h File Reference
+ Include dependency graph for usdzPackage.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

USDUTILS_API bool UsdUtilsCreateNewUsdzPackage (const SdfAssetPath &assetPath, const std::string &usdzFilePath, const std::string &firstLayerName=std::string(), bool editLayersInPlace=false)
 Creates a USDZ package containing the specified asset, identified by its assetPath.
 
USDUTILS_API bool UsdUtilsCreateNewARKitUsdzPackage (const SdfAssetPath &assetPath, const std::string &usdzFilePath, const std::string &firstLayerName=std::string(), bool editLayersInplace=false)
 Similar to UsdUtilsCreateNewUsdzPackage, this function packages all of the dependencies of the given asset.
 

Function Documentation

◆ UsdUtilsCreateNewARKitUsdzPackage()

USDUTILS_API bool UsdUtilsCreateNewARKitUsdzPackage ( const SdfAssetPath assetPath,
const std::string &  usdzFilePath,
const std::string &  firstLayerName = std::string(),
bool  editLayersInplace = false 
)

Similar to UsdUtilsCreateNewUsdzPackage, this function packages all of the dependencies of the given asset.

Assets targeted at the initial usdz implementation in ARKit operate under greater constraints than usdz files for more general 'in house' uses, and this option attempts to ensure that these constraints are honored; this may involve more transformations to the data, which may cause loss of features such as VariantSets. Any anonymous layers that are encountered during dependency discovery will be serialized into the resulting package.

If firstLayerName is specified, it is modified to have the ".usdc" extension, as required by the initial usdz implementation in ARKit.

The editLayersInPlace parameter controls the strategy used for managing changes to layers (including the root layer and all transitive layer dependencies) that occur during the package creation process. When editLayersInPlace is false, a temporary, anonymous copy of each modified layer is created and written into the package. This has the advantage of leaving source layers untouched at the expense of creating a copy of each modified layer in memory for the duration of this function.

When editLayersInPlace is set to true, layers are modified in-place and not reverted or persisted once the package has been created. In this case, there is no overhead of creating copies of each modified layer. If you have UsdStages open during the function call that reference the layers being modified, you may receive warnings or composition errors. While these errors will not affect the resulting package adversely, it is strongly recommended that this function is run in isolation after any source UsdStages have been closed.

Returns true if the package was created successfully.

Note
Clients of this function must take care of configuring the asset resolver context before invoking the function. To create a default resolver context, use CreateDefaultContextForAsset() with the asset path.
If the given asset has a dependency on a directory (i.e. an external reference to a directory path), the dependency is ignored and the contents of the directory are not included in the created package.
See also
UsdUtilsCreateNewUsdzPackage()

◆ UsdUtilsCreateNewUsdzPackage()

USDUTILS_API bool UsdUtilsCreateNewUsdzPackage ( const SdfAssetPath assetPath,
const std::string &  usdzFilePath,
const std::string &  firstLayerName = std::string(),
bool  editLayersInPlace = false 
)

Creates a USDZ package containing the specified asset, identified by its assetPath.

The created package will include a localized version of the asset itself and all of its external dependencies. Any anonymous layers that are encountered during dependency discovery will be serialized into the resulting package. Due to localization, the packaged layers might be modified to have different asset paths.

You can optionally specify a different package-internal name for the first layer of the asset by specifying firstLayerName. By default, firstLayerName is empty, meaning that the original name is preserved.

The editLayersInPlace parameter controls the strategy used for managing changes to layers (including the root layer and all transitive layer dependencies) that occur during the package creation process. When editLayersInPlace is false, a temporary, anonymous copy of each modified layer is created and written into the package. This has the advantage of leaving source layers untouched at the expense of creating a copy of each modified layer in memory for the duration of this function.

When editLayersInPlace is set to true, layers are modified in-place and not reverted or persisted once the package has been created. In this case, there is no overhead of creating copies of each modified layer. If you have UsdStages open during the function call that reference the layers being modified, you may receive warnings or composition errors. While these errors will not affect the resulting package adversely, it is strongly recommended that this function is run in isolation after any source UsdStages have been closed.

Returns true if the package was created successfully.

Note
Clients of this function must take care of configuring the asset resolver context before invoking the function. To create a default resolver context, use CreateDefaultContextForAsset() with the asset path.
If the given asset has a dependency on a directory (i.e. an external reference to a directory path), the dependency is ignored and the contents of the directory are not included in the created package.
See also
UsdUtilsCreateNewARKitUsdzPackage()