Loading...
Searching...
No Matches
usdaData.h
1//
2// Copyright 2025 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_SDF_USDA_DATA_H
8#define PXR_USD_SDF_USDA_DATA_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/sdf/data.h"
12#include "pxr/usd/sdf/fileVersion.h"
13#include "pxr/usd/ar/asset.h"
14
15PXR_NAMESPACE_OPEN_SCOPE
16
18
19// SdfUsdaData is an SdfData for text files. It has several static methods that
20// are convenient for determining if a text file can be read or for parsing the
21// header of a text file. Otherwise, it is just an SdfData that also keeps track
22// of an SdfFileVersion for the layer.
23class SdfUsdaData: public SdfData
24{
25public:
26 SDF_API
27 SdfUsdaData();
28
29 SDF_API
30 virtual ~SdfUsdaData();
31
32 SDF_API
33 static bool
34 CanRead(const std::string& assetPath);
35
36 SDF_API
37 static bool
38 CanRead(const std::string& assetPath,
39 const std::shared_ptr<ArAsset>& asset);
40
41 // Validate a layer's version string.
42 //
43 // If the version string represents a version that we can read, return the
44 // SdfFileVersion and empty the string pointed to by reason. If the version
45 // string cannot be read, return an invalid version and store an appropriate
46 // error message in *reason.
47 SDF_API
48 static SdfFileVersion
49 ValidateLayerVersionString(const std::string& versionStr,
50 std::string* reason);
51
52 // The version of this layer.
53 SDF_API
54 SdfFileVersion
55 GetLayerVersion() const
56 {
57 return _layerVersion;
58 }
59
60 // Set the version as parsed from the file (if it is a legal version)
61 SDF_API
62 void
63 SetLayerVersion(const SdfFileVersion& version);
64
65private:
66 SdfFileVersion _layerVersion;
67};
68
69PXR_NAMESPACE_CLOSE_SCOPE
70
71#endif // PXR_USD_SDF_USDA_DATA_H
SdfData provides concrete scene description data storage.
Definition: data.h:33
#define TF_DECLARE_WEAK_AND_REF_PTRS(type)
Define standard weak, ref, and vector pointer types.
Definition: declarePtrs.h:72