UsdLayerExport
**************

|sparkles| **New in Katana 7.5**

Introduction
------------
The UsdLayerExport node allow users to export the incoming Usd Native Nodes and their layers to
disk.


UsdLayerExporter Plug-ins
-------------------------

You may add additional plug-ins to the UsdLayerExporter behavior in order to validate, or even alter
the USD layer before it gets written to disk. There are two ways to perform this.

The first way is via the AssetAPI. When the UsdLayerExport node exports a layer, it utilizes
the ``AssetAPI`` Asset Plug-in's ``createAssetAndPath`` and ``postCreateAsset`` methods. These allow
editing of the final destination and format (via the ``fileExtension`` field) of the USD layer, and
also access to the layer on disk respectively. This happens outside of the ``UsdLayerExporter``
class itself, and is implemented for the UsdLayerExport node.

Alternatively, we have provided a plug-in system to allow for access to the in-memory layer prior
to exporting to disk. This would be after any stitching, or flattening of the layer, as requested
on the UsdLayerExport node or UsdLayerExporter class. This happens on every export call for the
UsdLayerExporter class.

To register a new UsdLayerExporter plug-in, you will have to derive from
``UsdProcessingEngine.UsdExport.UsdLayerExporterPlugin``, and implement the ``PostStitchLayers``
method. This method must return ``True`` if the export should continue, or ``False`` if the export
should not continue and raise an error; which can be logged in Katana's existing logging system.
An example can be found at
``$KATANA_ROOT/plugins/Src/UsdProcessingEngine/UsdLayerExporterPlugins/FnUsdLayerValidation.py``.

Once the plug-in is written, it must be added to a subdirectory of a ``KATANA_RESOURCES`` path
called ``/UsdLayerExporterPlugins`` to be picked up automatically at start-up by Katana.

UsdLayerExporter
----------------

The UsdLayerExporter is a public class which should allow custom use of the logic which the
UsdLayerExport node utilizes.

.. note:: This class expects the filepath on disk to write to; as such it is recommended to use
    the AssetAPI :doc:`Asset API (C++)</OpsAndOpScript/AssetAPI/Python>`.

.. automodule:: UsdProcessingEngine.UsdLayerExporter

.. |sparkles| unicode:: U+2728