HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UsdUsdFileFormat Class Reference

#include <usdFileFormat.h>

+ Inheritance diagram for UsdUsdFileFormat:

Public Types

typedef std::map< std::string,
std::string
FileFormatArguments
 
- Public Types inherited from SdfFileFormat
typedef std::map< std::string,
std::string
FileFormatArguments
 
- Public Types inherited from TfRefBase
typedef void(* UniqueChangedFuncPtr )(TfRefBase const *, bool)
 

Public Member Functions

virtual USD_API
SdfAbstractDataRefPtr 
InitData (const FileFormatArguments &args) const override
 
virtual USD_API bool CanRead (const std::string &file) const override
 Returns true if file can be read by this format. More...
 
virtual USD_API bool Read (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const override
 
virtual USD_API bool WriteToFile (const SdfLayer &layer, const std::string &filePath, const std::string &comment=std::string(), const FileFormatArguments &args=FileFormatArguments()) const override
 
virtual USD_API bool ReadFromString (SdfLayer *layer, const std::string &str) const override
 
virtual USD_API bool WriteToString (const SdfLayer &layer, std::string *str, const std::string &comment=std::string()) const override
 
virtual USD_API bool WriteToStream (const SdfSpecHandle &spec, std::ostream &out, size_t indent) const override
 Write the provided spec to out indented indent levels. More...
 
- 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. More...
 
SDF_API const TfTokenGetFormatId () const
 Returns the format identifier. More...
 
SDF_API const TfTokenGetTarget () const
 Returns the target for this file format. More...
 
SDF_API const std::stringGetFileCookie () const
 Returns the cookie to be used when writing files with this format. More...
 
SDF_API const TfTokenGetVersionString () const
 Returns the current version of this file format. More...
 
SDF_API bool IsPrimaryFormatForExtensions () const
 
SDF_API const std::vector
< std::string > & 
GetFileExtensions () const
 Returns a list of extensions that this format supports. More...
 
SDF_API const std::stringGetPrimaryFileExtension () const
 
SDF_API bool IsSupportedExtension (const std::string &extension) const
 
virtual SDF_API bool IsPackage () const
 
virtual SDF_API std::string GetPackageRootLayerPath (const std::string &resolvedPath) const
 
virtual SDF_API FileFormatArguments GetDefaultFileFormatArguments () const
 
SDF_API SdfAbstractDataRefPtr InitDetachedData (const FileFormatArguments &args) const
 
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. More...
 
SDF_API bool ShouldSkipAnonymousReload () const
 
SDF_API bool ShouldReadAnonymousLayers () const
 
SDF_API bool ReadDetached (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const
 
virtual SDF_API std::set
< std::string
GetExternalAssetDependencies (const SdfLayer &layer) const
 
SDF_API bool SupportsReading () const
 
SDF_API bool SupportsWriting () const
 
SDF_API bool SupportsEditing () const
 
- Public Member Functions inherited from TfRefBase
 TfRefBase ()
 
 TfRefBase (TfRefBase const &)
 
TfRefBaseoperator= (TfRefBase const &)
 
size_t GetCurrentCount () const
 Return the current reference count of this object. More...
 
bool IsUnique () const
 Return true if only one TfRefPtr points to this object. More...
 
void SetShouldInvokeUniqueChangedListener (bool shouldCall)
 
- Public Member Functions inherited from TfWeakBase
 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 USD_API TfToken GetUnderlyingFormatForLayer (const SdfLayer &layer)
 
- Static Public Member Functions inherited from SdfFileFormat
static SDF_API std::string GetFileExtension (const std::string &s)
 
static SDF_API std::set
< std::string
FindAllFileFormatExtensions ()
 
static SDF_API std::set
< std::string
FindAllDerivedFileFormatExtensions (const TfType &baseType)
 
static SDF_API bool FormatSupportsReading (const std::string &extension, const std::string &target=std::string())
 
static SDF_API bool FormatSupportsWriting (const std::string &extension, const std::string &target=std::string())
 
static SDF_API bool FormatSupportsEditing (const std::string &extension, const std::string &target=std::string())
 
static SDF_API
SdfFileFormatConstPtr 
FindById (const TfToken &formatId)
 
static SDF_API
SdfFileFormatConstPtr 
FindByExtension (const std::string &path, const std::string &target=std::string())
 
static SDF_API
SdfFileFormatConstPtr 
FindByExtension (const std::string &path, const FileFormatArguments &args)
 
- Static Public Member Functions inherited from TfRefBase
static TF_API void SetUniqueChangedListener (UniqueChangedListener listener)
 

Protected Member Functions

SdfAbstractDataRefPtr _InitDetachedData (const FileFormatArguments &args) const override
 
bool _ReadDetached (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const override
 
- Protected Member Functions inherited from SdfFileFormat
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::string &extension)
 Constructor. More...
 
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::string &extension, const SdfSchemaBase &schema)
 
 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. More...
 
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::vector< std::string > &extensions)
 Constructor. More...
 
SDF_API SdfFileFormat (const TfToken &formatId, const TfToken &versionString, const TfToken &target, const std::vector< std::string > &extensions, const SdfSchemaBase &schema)
 
 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. More...
 
virtual SDF_API ~SdfFileFormat ()
 Destructor. More...
 
SDF_API bool _ReadAndCopyLayerDataToMemory (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly, bool *didCopyData=nullptr) const
 
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
 
- Protected Member Functions inherited from TfRefBase
virtual TF_API ~TfRefBase ()
 
- Protected Member Functions inherited from TfWeakBase
 ~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
 

Additional Inherited Members

- Static Protected Member Functions inherited from SdfFileFormat
static SDF_API void _SetLayerData (SdfLayer *layer, SdfAbstractDataRefPtr &data)
 
static SDF_API void _SetLayerData (SdfLayer *layer, SdfAbstractDataRefPtr &data, SdfLayerHints hints)
 
static SDF_API
SdfAbstractDataConstPtr 
_GetLayerData (const SdfLayer &layer)
 Get the internal data for layer. More...
 

Detailed Description

File format for USD files.

When creating a file through the SdfLayer::CreateNew() interface, the meaningful SdfFileFormat::FileFormatArguments are as follows:

  • UsdUsdFileFormatTokens->FormatArg , which must be a supported format's 'Id'. The possible values are UsdUsdaFileFormatTokens->Id or UsdUsdcFileFormatTokens->Id.

If no UsdUsdFileFormatTokens->FormatArg is supplied, the default is UsdUsdcFileFormatTokens->Id.

Definition at line 59 of file usdFileFormat.h.

Member Typedef Documentation

Type for specifying additional file format-specific arguments to the various API below.

Definition at line 119 of file fileFormat.h.

Member Function Documentation

SdfAbstractDataRefPtr UsdUsdFileFormat::_InitDetachedData ( const FileFormatArguments args) const
overrideprotectedvirtual
See Also
InitDetachedData

This function must return a new SdfAbstractData object that is detached, i.e. SdfAbstractData::IsDetached returns false.

The default implementation returns an SdfData object.

Reimplemented from SdfFileFormat.

bool UsdUsdFileFormat::_ReadDetached ( SdfLayer layer,
const std::string resolvedPath,
bool  metadataOnly 
) const
overrideprotectedvirtual
See Also
ReadDetached

Upon completion, layer must have an SdfAbstractData object set that is detached, i.e. SdfAbstractData::IsDetached returns false.

The default implementation calls _ReadAndCopyLayerDataToMemory to read the specified layer and copy its data into an SdfData object if it is not detached. If data is copied, a warning will be issued since this may be an expensive operation. If the above behavior is desired, subclasses can just call _ReadAndCopyLayerDataToMemory to do the same thing but without the warning.

Reimplemented from SdfFileFormat.

virtual USD_API bool UsdUsdFileFormat::CanRead ( const std::string file) const
overridevirtual

Returns true if file can be read by this format.

Implements SdfFileFormat.

static USD_API TfToken UsdUsdFileFormat::GetUnderlyingFormatForLayer ( const SdfLayer layer)
static

Returns the value of the "format" argument to be used in the FileFormatArguments when exporting or saving the given layer.

Returns an empty token if the given layer does not have this file format.

virtual USD_API SdfAbstractDataRefPtr UsdUsdFileFormat::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.

virtual USD_API bool UsdUsdFileFormat::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.

virtual USD_API bool UsdUsdFileFormat::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.

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

Writes the content in layer into the file at filePath. If the content is successfully written, this method returns true. Otherwise, false is returned and errors are posted. The default implementation returns false.

Reimplemented from SdfFileFormat.

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

Write the provided spec to out indented indent levels.

Reimplemented from SdfFileFormat.

virtual USD_API bool UsdUsdFileFormat::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.

Member Data Documentation

UsdUsdFileFormat::SDF_FILE_FORMAT_FACTORY_ACCESS
protected

Definition at line 110 of file usdFileFormat.h.


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