Loading...
Searching...
No Matches
SdfUsdaFileFormat Class Reference

File format used by textual USD files. More...

#include <usdaFileFormat.h>

+ Inheritance diagram for SdfUsdaFileFormat:

Public Member Functions

virtual SDF_API SdfAbstractDataRefPtr InitData (const FileFormatArguments &args) const override
 This method allows the file format to bind to whatever data container is appropriate.
 
virtual SDF_API bool CanRead (const std::string &file) const override
 Returns true if file can be read by this format.
 
virtual SDF_API bool Read (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const override
 Reads scene description from the asset specified by resolvedPath into the layer layer.
 
virtual SDF_API bool WriteToFile (const SdfLayer &layer, const std::string &filePath, const std::string &comment=std::string(), const FileFormatArguments &args=FileFormatArguments()) const override
 WriteToFile writes the layer contents to the file starting with the default output version and upgrading as needed.
 
virtual SDF_API bool SaveToFile (const SdfLayer &layer, const std::string &filePath, const std::string &comment=std::string(), const FileFormatArguments &args=FileFormatArguments()) const override
 SaveToFile writes the layer contents to the file starting with the loaded layer's file version and upgrading as needed.
 
virtual SDF_API bool ReadFromString (SdfLayer *layer, const std::string &str) const override
 Reads data in the string str into the layer layer.
 
virtual SDF_API bool WriteToString (const SdfLayer &layer, std::string *str, const std::string &comment=std::string()) const override
 Writes the content in layer to the string str.
 
virtual SDF_API bool WriteToStream (const SdfSpecHandle &spec, std::ostream &out, size_t indent) const override
 Write the provided spec to out indented indent levels.
 
- Public Member Functions inherited from SdfFileFormat
 SdfFileFormat (const SdfFileFormat &)=delete
 
SdfFileFormatoperator= (const SdfFileFormat &)=delete
 
SDF_API const SdfSchemaBaseGetSchema () const
 Returns the schema for this format.
 
SDF_API const TfTokenGetFormatId () const
 Returns the format identifier.
 
SDF_API const TfTokenGetTarget () const
 Returns the target for this file format.
 
SDF_API const std::string & GetFileCookie () const
 Returns the cookie to be used when writing files with this format.
 
SDF_API const TfTokenGetVersionString () const
 Returns the current version of this file format.
 
SDF_API bool IsPrimaryFormatForExtensions () const
 Returns true if this file format is the primary format for the extensions it handles.
 
SDF_API const std::vector< std::string > & GetFileExtensions () const
 Returns a list of extensions that this format supports.
 
SDF_API const std::string & GetPrimaryFileExtension () const
 Returns the primary file extension for this format.
 
SDF_API bool IsSupportedExtension (const std::string &extension) const
 Returns true if extension matches one of the extensions returned by GetFileExtensions.
 
virtual SDF_API bool IsPackage () const
 Returns true if this file format is a package containing other assets.
 
virtual SDF_API std::string GetPackageRootLayerPath (const std::string &resolvedPath) const
 Returns the path of the "root" layer contained in the package layer at resolvedPath produced by this file format.
 
virtual SDF_API FileFormatArguments GetDefaultFileFormatArguments () const
 Returns the FileFormatArguments that correspond to the default behavior of this file format when no FileFormatArguments are passed to NewLayer or InitData.
 
virtual SDF_API SdfAbstractDataRefPtr InitData (const FileFormatArguments &args) const
 This method allows the file format to bind to whatever data container is appropriate.
 
SDF_API SdfAbstractDataRefPtr InitDetachedData (const FileFormatArguments &args) const
 Returns a new SdfAbstractData providing access to the layer's data.
 
SDF_API SdfLayerRefPtr NewLayer (const SdfFileFormatConstPtr &fileFormat, const std::string &identifier, const std::string &realPath, const ArAssetInfo &assetInfo, const FileFormatArguments &args) const
 Instantiate a layer.
 
SDF_API bool ShouldSkipAnonymousReload () const
 Return true if this file format prefers to skip reloading anonymous layers.
 
SDF_API bool ShouldReadAnonymousLayers () const
 Returns true if anonymous layer identifiers should be passed to Read when a layer is opened or reloaded.
 
virtual SDF_API bool CanRead (const std::string &file) const =0
 Returns true if file can be read by this format.
 
virtual SDF_API bool Read (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const =0
 Reads scene description from the asset specified by resolvedPath into the layer layer.
 
SDF_API bool ReadDetached (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const
 Reads scene description from the asset specified by resolvedPath into the detached layer layer.
 
virtual SDF_API bool WriteToFile (const SdfLayer &layer, const std::string &filePath, const std::string &comment=std::string(), const FileFormatArguments &args=FileFormatArguments()) const
 Writes the content in layer into the file at filePath.
 
virtual SDF_API bool SaveToFile (const SdfLayer &layer, const std::string &filePath, const std::string &comment=std::string(), const FileFormatArguments &args=FileFormatArguments()) const
 Write the content in layer to the file at filePath, which is the backing store for layer itself.
 
virtual SDF_API bool ReadFromString (SdfLayer *layer, const std::string &str) const
 Reads data in the string str into the layer layer.
 
virtual SDF_API bool WriteToStream (const SdfSpecHandle &spec, std::ostream &out, size_t indent) const
 Write the provided spec to out indented indent levels.
 
virtual SDF_API bool WriteToString (const SdfLayer &layer, std::string *str, const std::string &comment=std::string()) const
 Writes the content in layer to the string str.
 
virtual SDF_API std::set< std::string > GetExternalAssetDependencies (const SdfLayer &layer) const
 Returns the set of resolved paths to external asset file dependencies for the given layer.
 
SDF_API bool SupportsReading () const
 Returns true if this file format supports reading.
 
SDF_API bool SupportsWriting () const
 This is a convenience method for invoking FormatSupportsWriting with this format's extension and target.
 
SDF_API bool SupportsEditing () const
 This is a convenience method for invoking FormatSupportsEditing with this format's extension and target.
 
- Public Member Functions inherited from TfRefBase
 TfRefBase (TfRefBase const &)
 
TfRefBaseoperator= (TfRefBase const &)
 
size_t GetCurrentCount () const
 Return the current reference count of this object.
 
bool IsUnique () const
 Return true if only one TfRefPtr points to this object.
 
void SetShouldInvokeUniqueChangedListener (bool shouldCall)
 
- Public Member Functions inherited from TfWeakBase
 TfWeakBase (const TfWeakBase &)
 
const TfWeakBase__GetTfWeakBase__ () const
 
const TfWeakBaseoperator= (const TfWeakBase &)
 
void EnableNotification2 () const
 
TF_API void const * GetUniqueIdentifier () const
 

Static Public Member Functions

static SdfFileVersion GetMinInputVersion ()
 These methods return version info for the current version of the SdfUsdaFileFormat.
 
static SdfFileVersion GetMinOutputVersion ()
 Return the minimum version that it is possible for the software to write.
 
static SdfFileVersion GetMaxInputVersion ()
 Return the maximum version that is is possible for the software to read.
 
static SdfFileVersion GetMaxOutputVersion ()
 Return the maximum version that it is possible for the software to write.
 
static SdfFileVersion GetDefaultOutputVersion ()
 Return the default version for newly created files.
 
- Static Public Member Functions inherited from SdfFileFormat
static SDF_API std::string GetFileExtension (const std::string &s)
 Returns the file extension for path or file name s, without the leading dot character.
 
static SDF_API std::set< std::string > FindAllFileFormatExtensions ()
 Returns a set containing the extension(s) corresponding to all registered file formats.
 
static SDF_API std::set< std::string > FindAllDerivedFileFormatExtensions (const TfType &baseType)
 Returns a set containing the extension(s) corresponding to all registered file formats that derive from baseType.
 
static SDF_API bool FormatSupportsReading (const std::string &extension, const std::string &target=std::string())
 Returns true if the file format for the supplied extension and target pair supports reading.
 
static SDF_API bool FormatSupportsWriting (const std::string &extension, const std::string &target=std::string())
 Returns true if the file format for the supplied extension and target pair supports writing.
 
static SDF_API bool FormatSupportsEditing (const std::string &extension, const std::string &target=std::string())
 Returns true if the file format for the supplied extension and target pair supports editing.
 
static SDF_API SdfFileFormatConstPtr FindById (const TfToken &formatId)
 Returns the file format instance with the specified formatId identifier.
 
static SDF_API SdfFileFormatConstPtr FindByExtension (const std::string &path, const std::string &target=std::string())
 Returns the file format instance that supports the extension for path.
 
static SDF_API SdfFileFormatConstPtr FindByExtension (const std::string &path, const FileFormatArguments &args)
 Returns a file format instance that supports the extension for path and whose target matches one of those specified by the given args.
 
- Static Public Member Functions inherited from TfRefBase
static TF_API void SetUniqueChangedListener (UniqueChangedListener listener)
 

Protected Member Functions

virtual SDF_API ~SdfUsdaFileFormat ()
 Destructor.
 
SDF_API SdfUsdaFileFormat ()
 Constructor.
 
SDF_API SdfUsdaFileFormat (const TfToken &formatId, const TfToken &versionString=TfToken(), const TfToken &target=TfToken())
 Constructor.
 
SDF_API bool _CanReadFromAsset (const std::string &resolvedPath, const std::shared_ptr< ArAsset > &asset) const
 Return true if layer can be read from asset at resolvedPath.
 
SDF_API bool _ReadFromAsset (SdfLayer *layer, const std::string &resolvedPath, const std::shared_ptr< ArAsset > &asset, bool metadataOnly) const
 Read layer from asset at resolvedPath into layer.
 
- Protected Member Functions inherited from SdfFileFormat
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::string &extension)
 Constructor.
 
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::string &extension, const SdfSchemaBase &schema)
 Constructor.
 
 SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::string &extension, const SdfSchemaBase &&schema)=delete
 Disallow temporary SdfSchemaBase objects being passed to the c'tor.
 
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::vector< std::string > &extensions)
 Constructor.
 
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::vector< std::string > &extensions, const SdfSchemaBase &schema)
 Constructor.
 
 SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::vector< std::string > &extensions, const SdfSchemaBase &&schema)=delete
 Disallow temporary SdfSchemaBase objects being passed to the c'tor.
 
virtual SDF_API ~SdfFileFormat ()
 Destructor.
 
SDF_API bool _ReadAndCopyLayerDataToMemory (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly, bool *didCopyData=nullptr) const
 Helper function for _ReadDetached.
 
virtual SDF_API SdfLayer_InstantiateNewLayer (const SdfFileFormatConstPtr &fileFormat, const std::string &identifier, const std::string &realPath, const ArAssetInfo &assetInfo, const FileFormatArguments &args) const
 
virtual SDF_API bool _ShouldSkipAnonymousReload () const
 
virtual SDF_API bool _ShouldReadAnonymousLayers () const
 File format subclasses may override this to specify whether Read should be called when creating, opening, or reloading an anonymous layer of this format.
 
virtual SDF_API SdfAbstractDataRefPtr _InitDetachedData (const FileFormatArguments &args) const
 
virtual SDF_API bool _ReadDetached (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const
 
- Protected Member Functions inherited from TfWeakBase
TfRefPtr< Tf_Remnant > _Register () const
 
template<class T >
TfRefPtr< Tf_Remnant > _Register (T *tempRmnt) const
 
bool _HasRemnant () const
 

Protected Attributes

 SDF_FILE_FORMAT_FACTORY_ACCESS
 

Friends

class SdfUsdFileFormat
 

Additional Inherited Members

- Public Types inherited from SdfFileFormat
typedef std::map< std::string, std::string > FileFormatArguments
 Type for specifying additional file format-specific arguments to the various API below.
 
- Public Types inherited from TfRefBase
typedef void(* UniqueChangedFuncPtr) (TfRefBase const *, bool)
 
- Static Protected Member Functions inherited from SdfFileFormat
static SDF_API void _SetLayerData (SdfLayer *layer, SdfAbstractDataRefPtr &data)
 Set the internal data for layer to data, possibly transferring ownership of data.
 
static SDF_API void _SetLayerData (SdfLayer *layer, SdfAbstractDataRefPtr &data, SdfLayerHints hints)
 Set the internal data for layer to data, possibly transferring ownership of data.
 
static SDF_API SdfAbstractDataConstPtr _GetLayerData (const SdfLayer &layer)
 Get the internal data for layer.
 

Detailed Description

File format used by textual USD files.

Definition at line 52 of file usdaFileFormat.h.

Constructor & Destructor Documentation

◆ ~SdfUsdaFileFormat()

virtual SDF_API ~SdfUsdaFileFormat ( )
protectedvirtual

Destructor.

◆ SdfUsdaFileFormat() [1/2]

SDF_API SdfUsdaFileFormat ( )
protected

Constructor.

◆ SdfUsdaFileFormat() [2/2]

SDF_API SdfUsdaFileFormat ( const TfToken formatId,
const TfToken versionString = TfToken(),
const TfToken target = TfToken() 
)
explicitprotected

Constructor.

This form of the constructor may be used by formats that use the .usda text format as their internal representation. If a non-empty versionString and target are provided, they will be used as the file format version and target; otherwise the .usda format version and target will be implicitly used.

Member Function Documentation

◆ _CanReadFromAsset()

SDF_API bool _CanReadFromAsset ( const std::string &  resolvedPath,
const std::shared_ptr< ArAsset > &  asset 
) const
protected

Return true if layer can be read from asset at resolvedPath.

◆ _ReadFromAsset()

SDF_API bool _ReadFromAsset ( SdfLayer layer,
const std::string &  resolvedPath,
const std::shared_ptr< ArAsset > &  asset,
bool  metadataOnly 
) const
protected

Read layer from asset at resolvedPath into layer.

◆ CanRead()

virtual SDF_API bool CanRead ( const std::string &  file) const
overridevirtual

Returns true if file can be read by this format.

Implements SdfFileFormat.

◆ GetDefaultOutputVersion()

static SdfFileVersion GetDefaultOutputVersion ( )
static

Return the default version for newly created files.

◆ GetMaxInputVersion()

static SdfFileVersion GetMaxInputVersion ( )
static

Return the maximum version that is is possible for the software to read.

◆ GetMaxOutputVersion()

static SdfFileVersion GetMaxOutputVersion ( )
static

Return the maximum version that it is possible for the software to write.

◆ GetMinInputVersion()

static SdfFileVersion GetMinInputVersion ( )
static

These methods return version info for the current version of the SdfUsdaFileFormat.

These versions will be kept in sync with the abilities of the parsing and writing code, but it's convenient to gather them all here. Return the minimum version that is is possible for the software to read.

◆ GetMinOutputVersion()

static SdfFileVersion GetMinOutputVersion ( )
static

Return the minimum version that it is possible for the software to write.

◆ InitData()

virtual SDF_API SdfAbstractDataRefPtr InitData ( const FileFormatArguments args) const
overridevirtual

This method allows the file format to bind to whatever data container is appropriate.

Returns a shared pointer to an SdfAbstractData implementation.

Reimplemented from SdfFileFormat.

◆ Read()

virtual SDF_API bool Read ( SdfLayer layer,
const std::string &  resolvedPath,
bool  metadataOnly 
) const
overridevirtual

Reads scene description from the asset specified by resolvedPath into the layer layer.

metadataOnly is a flag that asks for only the layer metadata to be read in, which can be much faster if that is all that is required. Note that this is just a hint: some FileFormat readers may disregard this flag and still fully populate the layer contents.

Returns true if the asset is successfully read into layer, false otherwise.

Implements SdfFileFormat.

◆ ReadFromString()

virtual SDF_API bool ReadFromString ( SdfLayer layer,
const std::string &  str 
) const
overridevirtual

Reads data in the string str into the layer layer.

If the file is successfully read, this method returns true. Otherwise, false is returned and errors are posted.

Reimplemented from SdfFileFormat.

◆ SaveToFile()

virtual SDF_API bool SaveToFile ( const SdfLayer layer,
const std::string &  filePath,
const std::string &  comment = std::string(),
const FileFormatArguments args = FileFormatArguments() 
) const
overridevirtual

SaveToFile writes the layer contents to the file starting with the loaded layer's file version and upgrading as needed.

Reimplemented from SdfFileFormat.

◆ WriteToFile()

virtual SDF_API bool WriteToFile ( const SdfLayer layer,
const std::string &  filePath,
const std::string &  comment = std::string(),
const FileFormatArguments args = FileFormatArguments() 
) const
overridevirtual

WriteToFile writes the layer contents to the file starting with the default output version and upgrading as needed.

Reimplemented from SdfFileFormat.

◆ WriteToStream()

virtual SDF_API bool WriteToStream ( const SdfSpecHandle &  spec,
std::ostream &  out,
size_t  indent 
) const
overridevirtual

Write the provided spec to out indented indent levels.

Reimplemented from SdfFileFormat.

◆ WriteToString()

virtual SDF_API bool WriteToString ( const SdfLayer layer,
std::string *  str,
const std::string &  comment = std::string() 
) const
overridevirtual

Writes the content in layer to the string str.

This function should write a textual representation of layer to the stream that can be read back in via ReadFromString.

Reimplemented from SdfFileFormat.

Friends And Related Function Documentation

◆ SdfUsdFileFormat

friend class SdfUsdFileFormat
friend

Definition at line 168 of file usdaFileFormat.h.

Member Data Documentation

◆ SDF_FILE_FORMAT_FACTORY_ACCESS

SDF_FILE_FORMAT_FACTORY_ACCESS
protected

Definition at line 129 of file usdaFileFormat.h.


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