assetPreviewsAPI.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef USDMEDIA_GENERATED_ASSETPREVIEWSAPI_H
8 #define USDMEDIA_GENERATED_ASSETPREVIEWSAPI_H
9 
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usd/usdMedia/api.h"
15 #include "pxr/usd/usd/prim.h"
16 #include "pxr/usd/usd/stage.h"
18 
19 #include "pxr/usd/sdf/types.h"
20 
21 
22 #include "pxr/base/vt/value.h"
23 
24 #include "pxr/base/gf/vec3d.h"
25 #include "pxr/base/gf/vec3f.h"
26 #include "pxr/base/gf/matrix4d.h"
27 
28 #include "pxr/base/tf/token.h"
29 #include "pxr/base/tf/type.h"
30 
31 PXR_NAMESPACE_OPEN_SCOPE
32 
33 class SdfAssetPath;
34 
35 // -------------------------------------------------------------------------- //
36 // ASSETPREVIEWSAPI //
37 // -------------------------------------------------------------------------- //
38 
78 {
79 public:
84 
89  explicit UsdMediaAssetPreviewsAPI(const UsdPrim& prim=UsdPrim())
90  : UsdAPISchemaBase(prim)
91  {
92  }
93 
97  explicit UsdMediaAssetPreviewsAPI(const UsdSchemaBase& schemaObj)
98  : UsdAPISchemaBase(schemaObj)
99  {
100  }
101 
103  USDMEDIA_API
104  virtual ~UsdMediaAssetPreviewsAPI();
105 
109  USDMEDIA_API
110  static const TfTokenVector &
111  GetSchemaAttributeNames(bool includeInherited=true);
112 
122  USDMEDIA_API
124  Get(const UsdStagePtr &stage, const SdfPath &path);
125 
126 
143  USDMEDIA_API
144  static bool
145  CanApply(const UsdPrim &prim, std::string *whyNot=nullptr);
146 
162  USDMEDIA_API
164  Apply(const UsdPrim &prim);
165 
166 protected:
170  USDMEDIA_API
171  UsdSchemaKind _GetSchemaKind() const override;
172 
173 private:
174  // needs to invoke _GetStaticTfType.
175  friend class UsdSchemaRegistry;
176  USDMEDIA_API
177  static const TfType &_GetStaticTfType();
178 
179  static bool _IsTypedSchema();
180 
181  // override SchemaBase virtuals.
182  USDMEDIA_API
183  const TfType &_GetTfType() const override;
184 
185 public:
186  // ===================================================================== //
187  // Feel free to add custom code below this line, it will be preserved by
188  // the code generator.
189  //
190  // Just remember to:
191  // - Close the class declaration with };
192  // - Close the namespace with PXR_NAMESPACE_CLOSE_SCOPE
193  // - Close the include guard with #endif
194  // ===================================================================== //
195  // --(BEGIN CUSTOM CODE)--
196 
202  struct Thumbnails
203  {
204  USDMEDIA_API
205  explicit Thumbnails(const SdfAssetPath &defaultImage=SdfAssetPath());
206 
207  SdfAssetPath defaultImage;
208  };
209 
212  USDMEDIA_API
213  bool GetDefaultThumbnails(Thumbnails *defaultThumbnails) const;
214 
217  USDMEDIA_API
218  void SetDefaultThumbnails(const Thumbnails &defaultThumbnails) const;
219 
222  USDMEDIA_API
223  void ClearDefaultThumbnails() const;
224 
231  USDMEDIA_API
233  GetAssetDefaultPreviews(const std::string &layerPath);
234 
236  USDMEDIA_API
238  GetAssetDefaultPreviews(const SdfLayerHandle &layer);
239 
240 private:
241  UsdStageRefPtr _defaultMaskedStage;
242 };
243 
244 PXR_NAMESPACE_CLOSE_SCOPE
245 
246 #endif
UsdMediaAssetPreviewsAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdMediaAssetPreviewsAPI on UsdPrim prim .
static USDMEDIA_API const TfTokenVector & GetSchemaAttributeNames(bool includeInherited=true)
Return a vector of names of all pre-declared attributes for this schema class and all its ancestor cl...
The base class for all API schemas.
Definition: apiSchemaBase.h:94
Basic Sdf data types.
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
USDMEDIA_API void ClearDefaultThumbnails() const
Remove the entire entry for default Thumbnails in the current UsdEditTarget.
Single Apply API schema.
AssetPreviewsAPI is the interface for authoring and accessing precomputed, lightweight previews of as...
static USDMEDIA_API bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Returns true if this single-apply API schema can be applied to the given prim.
static USDMEDIA_API UsdMediaAssetPreviewsAPI Get(const UsdStagePtr &stage, const SdfPath &path)
Return a UsdMediaAssetPreviewsAPI holding the prim adhering to this schema at path on stage.
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:116
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:489
USDMEDIA_API bool GetDefaultThumbnails(Thumbnails *defaultThumbnails) const
Fetch the default Thumbnails data, returning true if data was successfully fetched.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:280
static USDMEDIA_API UsdMediaAssetPreviewsAPI GetAssetDefaultPreviews(const std::string &layerPath)
Return a schema object that can be used to interrogate previews for the default prim of the stage con...
static USDMEDIA_API UsdMediaAssetPreviewsAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
virtual USDMEDIA_API ~UsdMediaAssetPreviewsAPI()
Destructor.
Contains an asset path and optional evaluated and resolved paths.
Definition: assetPath.h:78
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
USDMEDIA_API void SetDefaultThumbnails(const Thumbnails &defaultThumbnails) const
Author the default thumbnails dictionary from the provided Thumbnails data.
TfType represents a dynamic runtime type.
Definition: type.h:47
Singleton registry that provides access to schema type information and the prim definitions for regis...
The base class for all schema types in Usd.
Definition: schemaBase.h:39
Thumbnails is a value type that serves as schema to aid in serialization and deserialization of thumb...
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...
USDMEDIA_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
UsdMediaAssetPreviewsAPI(const UsdSchemaBase &schemaObj)
Construct a UsdMediaAssetPreviewsAPI on the prim held by schemaObj .