HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usdzFileFormat.h
Go to the documentation of this file.
1 //
2 // Copyright 2018 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_USD_USDZ_FILE_FORMAT_H
8 #define PXR_USD_USD_USDZ_FILE_FORMAT_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/usd/usd/api.h"
12 #include "pxr/usd/sdf/fileFormat.h"
14 
15 #include <string>
16 
18 
20 
21 #define USD_USDZ_FILE_FORMAT_TOKENS \
22  ((Id, "usdz")) \
23  ((Version, "1.0")) \
24  ((Target, "usd"))
25 
27  UsdUsdzFileFormatTokens, USD_API, USD_USDZ_FILE_FORMAT_TOKENS);
28 
29 /// \class UsdUsdzFileFormat
30 ///
31 /// File format for package .usdz files.
33 {
34 public:
36 
37  USD_API
38  virtual bool IsPackage() const override;
39 
40  USD_API
41  virtual std::string GetPackageRootLayerPath(
42  const std::string& resolvedPath) const override;
43 
44  USD_API
45  virtual SdfAbstractDataRefPtr
46  InitData(const FileFormatArguments& args) const override;
47 
48  USD_API
49  virtual bool CanRead(const std::string &file) const override;
50 
51  USD_API
52  virtual bool Read(
53  SdfLayer* layer,
54  const std::string& resolvedPath,
55  bool metadataOnly) const override;
56 
57  USD_API
58  virtual bool WriteToFile(
59  const SdfLayer& layer,
60  const std::string& filePath,
61  const std::string& comment = std::string(),
62  const FileFormatArguments& args = FileFormatArguments()) const override;
63 
64  USD_API
65  virtual bool ReadFromString(
66  SdfLayer* layer,
67  const std::string& str) const override;
68 
69  USD_API
70  virtual bool WriteToString(
71  const SdfLayer& layer,
72  std::string* str,
73  const std::string& comment = std::string()) const override;
74 
75  USD_API
76  virtual bool WriteToStream(
77  const SdfSpecHandle &spec,
78  std::ostream& out,
79  size_t indent) const override;
80 
81 protected:
83 
84  bool _ReadDetached(
85  SdfLayer* layer,
86  const std::string& resolvedPath,
87  bool metadataOnly) const override;
88 
89 private:
91  virtual ~UsdUsdzFileFormat();
92 
93  template <bool Detached>
94  bool _ReadHelper(
95  SdfLayer* layer,
96  const std::string& resolvedPath,
97  bool metadataOnly) const;
98 };
99 
101 
102 #endif // PXR_USD_USD_USDZ_FILE_FORMAT_H
Definition: layer.h:81
virtual USD_API std::string GetPackageRootLayerPath(const std::string &resolvedPath) const override
virtual USD_API SdfAbstractDataRefPtr InitData(const FileFormatArguments &args) const override
#define USD_API
Definition: api.h:23
#define USD_USDZ_FILE_FORMAT_TOKENS
PXR_NAMESPACE_OPEN_SCOPE TF_DECLARE_WEAK_AND_REF_PTRS(UsdUsdzFileFormat)
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.
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
bool _ReadDetached(SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const override
virtual USD_API bool CanRead(const std::string &file) const override
Returns true if file can be read by this format.
virtual USD_API bool ReadFromString(SdfLayer *layer, const std::string &str) const override
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
virtual USD_API bool IsPackage() const override
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
virtual USD_API bool Read(SdfLayer *layer, const std::string &resolvedPath, bool metadataOnly) const override
**If you just want to fire and args
Definition: thread.h:618
virtual USD_API bool WriteToString(const SdfLayer &layer, std::string *str, const std::string &comment=std::string()) 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
std::map< std::string, std::string > FileFormatArguments
Definition: fileFormat.h:102
TF_DECLARE_PUBLIC_TOKENS(UsdUsdzFileFormatTokens, USD_API, USD_USDZ_FILE_FORMAT_TOKENS)