All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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"
27
28#include "pxr/base/tf/token.h"
29#include "pxr/base/tf/type.h"
30
31PXR_NAMESPACE_OPEN_SCOPE
32
33class SdfAssetPath;
34
35// -------------------------------------------------------------------------- //
36// ASSETPREVIEWSAPI //
37// -------------------------------------------------------------------------- //
38
78{
79public:
83 static const UsdSchemaKind schemaKind = UsdSchemaKind::SingleApplyAPI;
84
90 : UsdAPISchemaBase(prim)
91 {
92 }
93
97 explicit UsdMediaAssetPreviewsAPI(const UsdSchemaBase& schemaObj)
98 : UsdAPISchemaBase(schemaObj)
99 {
100 }
101
103 USDMEDIA_API
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
166protected:
170 USDMEDIA_API
172
173private:
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
185public:
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
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
224
231 USDMEDIA_API
233 GetAssetDefaultPreviews(const std::string &layerPath);
234
236 USDMEDIA_API
238 GetAssetDefaultPreviews(const SdfLayerHandle &layer);
239
240private:
241 UsdStageRefPtr _defaultMaskedStage;
242};
243
244PXR_NAMESPACE_CLOSE_SCOPE
245
246#endif
Contains an asset path and an optional resolved path.
Definition: assetPath.h:30
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
TfType represents a dynamic runtime type.
Definition: type.h:48
The base class for all API schemas.
Definition: apiSchemaBase.h:99
AssetPreviewsAPI is the interface for authoring and accessing precomputed, lightweight previews of as...
static const UsdSchemaKind schemaKind
Compile time constant representing what kind of schema this class is.
virtual USDMEDIA_API ~UsdMediaAssetPreviewsAPI()
Destructor.
USDMEDIA_API UsdSchemaKind _GetSchemaKind() const override
Returns the kind of schema this class belongs to.
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.
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...
USDMEDIA_API bool GetDefaultThumbnails(Thumbnails *defaultThumbnails) const
Fetch the default Thumbnails data, returning true if data was successfully fetched.
UsdMediaAssetPreviewsAPI(const UsdSchemaBase &schemaObj)
Construct a UsdMediaAssetPreviewsAPI on the prim held by schemaObj .
USDMEDIA_API void ClearDefaultThumbnails() const
Remove the entire entry for default Thumbnails in the current UsdEditTarget.
USDMEDIA_API void SetDefaultThumbnails(const Thumbnails &defaultThumbnails) const
Author the default thumbnails dictionary from the provided Thumbnails data.
static USDMEDIA_API UsdMediaAssetPreviewsAPI Apply(const UsdPrim &prim)
Applies this single-apply API schema to the given prim.
static USDMEDIA_API UsdMediaAssetPreviewsAPI GetAssetDefaultPreviews(const SdfLayerHandle &layer)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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 bool CanApply(const UsdPrim &prim, std::string *whyNot=nullptr)
Returns true if this single-apply API schema can be applied to the given prim.
UsdMediaAssetPreviewsAPI(const UsdPrim &prim=UsdPrim())
Construct a UsdMediaAssetPreviewsAPI on UsdPrim prim .
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
The base class for all schema types in Usd.
Definition: schemaBase.h:39
Singleton registry that provides access to schema type information and the prim definitions for regis...
UsdSchemaKind
An enum representing which kind of schema a given schema class belongs to.
Definition: common.h:112
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...
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440
Basic Sdf data types.