|
| SdfFileFormat (const SdfFileFormat &)=delete |
|
SdfFileFormat & | operator= (const SdfFileFormat &)=delete |
|
SDF_API const SdfSchemaBase & | GetSchema () const |
| Returns the schema for this format. More...
|
|
SDF_API const TfToken & | GetFormatId () const |
| Returns the format identifier. More...
|
|
SDF_API const TfToken & | GetTarget () const |
| Returns the target for this file format. More...
|
|
SDF_API const std::string & | GetFileCookie () const |
| Returns the cookie to be used when writing files with this format. More...
|
|
SDF_API const TfToken & | GetVersionString () 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::string & | GetPrimaryFileExtension () 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 |
|
virtual SDF_API
SdfAbstractDataRefPtr | InitData (const FileFormatArguments &args) 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 |
|
virtual SDF_API bool | CanRead (const std::string &file) const =0 |
| Returns true if file can be read by this format. More...
|
|
virtual SDF_API bool | Read (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const =0 |
|
SDF_API bool | ReadDetached (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const |
|
virtual SDF_API bool | WriteToFile (const SdfLayer &layer, const std::string &filePath, const std::string &comment=std::string(), const FileFormatArguments &args=FileFormatArguments()) const |
|
virtual SDF_API bool | ReadFromString (SdfLayer *layer, const std::string &str) const |
|
virtual SDF_API bool | WriteToStream (const SdfSpecHandle &spec, std::ostream &out, size_t indent) const |
| Write the provided spec to out indented indent levels. More...
|
|
virtual SDF_API bool | WriteToString (const SdfLayer &layer, std::string *str, const std::string &comment=std::string()) 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 |
|
| TfRefBase () |
|
| TfRefBase (TfRefBase const &) |
|
TfRefBase & | operator= (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) |
|
| TfWeakBase () |
|
| TfWeakBase (const TfWeakBase &) |
|
const TfWeakBase & | __GetTfWeakBase__ () const |
|
const TfWeakBase & | operator= (const TfWeakBase &) |
|
void | EnableNotification2 () const |
|
TF_API void const * | GetUniqueIdentifier () const |
|
|
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 |
|
virtual SDF_API
SdfAbstractDataRefPtr | _InitDetachedData (const FileFormatArguments &args) const |
|
virtual SDF_API bool | _ReadDetached (SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const |
|
virtual TF_API | ~TfRefBase () |
|
| ~TfWeakBase () |
|
TfRefPtr< Tf_Remnant > | _Register () const |
|
template<class T > |
TfRefPtr< Tf_Remnant > | _Register (T *tempRmnt) const |
|
bool | _HasRemnant () const |
|
Base class for file format implementations.
Definition at line 64 of file fileFormat.h.
SDF_API bool SdfFileFormat::_ReadAndCopyLayerDataToMemory |
( |
SdfLayer * |
layer, |
|
|
const std::string & |
resolvedPath, |
|
|
bool |
metadataOnly, |
|
|
bool * |
didCopyData = nullptr |
|
) |
| const |
|
protected |
Helper function for _ReadDetached.
Calls Read with the given parameters. If successful and layer
is not detached (i.e., SdfLayer::IsDetached returns false) copies the layer data into an SdfData object and set that into layer
. If this copy occurs and didCopyData
is given, it will be set to true.
Note that the copying process is a simple spec-by-spec, field-by-field value copy. This process may not produce detached layers if the data object used by layer
after the initial call to Read returns VtValues that are not detached. One example is a VtValue holding a VtArray backed by a foreign data source attached to a memory mapping.
Returns true if Read was successful, false otherwise.
- 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 in UsdUsdFileFormat, and UsdUsdzFileFormat.
Returns the file format instance that supports the extension for path
. If a format with a matching extension is not found, this returns a null file format pointer.
An extension may be handled by multiple file formats, but each with a different target. In such cases, if no target
is specified, the file format that is registered as the primary plugin will be returned. Otherwise, the file format whose target matches target
will be returned.
Returns the set of resolved paths to external asset file dependencies for the given layer
. These are additional dependencies, specific to the file format, that are needed when generating the layer's contents and would not otherwise be discoverable through composition dependencies (i.e. sublayers, references, and payloads).
The default implementation returns an empty set. Derived file formats that depend on external assets to read and generate layer content should implement this function to return the external asset paths.
- See Also
- SdfLayer::GetExternalAssetDependencies
-
SdfLayer::Reload
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.
Implemented in UsdUsdFileFormat, UsdUsdzFileFormat, SdfTextFileFormat, and UsdUsdcFileFormat.
Reads scene description from the asset specified by resolvedPath
into the detached layer layer
. After reading is completed, layer
must be detached from any underlying storage.
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 if the the asset could not be read or if the resulting layer is not detached.
SDF_API bool SdfFileFormat::ShouldReadAnonymousLayers |
( |
| ) |
const |
Returns true if anonymous layer identifiers should be passed to Read when a layer is opened or reloaded.
Anonymous layers will not have an asset backing and thus for most file formats there is nothing that can be read for an anonymous layer. However, there are file formats that use Read to generate dynamic layer content without reading any data from the resolved asset associated with the layer's identifier.
For these types of file formats it is useful to be able to open anonymous layers and allow Read to populate them to avoid requiring a placeholder asset to exist just so Read can populate the layer.