apiSchemaAdapter.h
Go to the documentation of this file.
1 //
2 // Copyright 2022 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_IMAGING_USD_IMAGING_API_SCHEMA_ADAPTER_H
8 #define PXR_USD_IMAGING_USD_IMAGING_API_SCHEMA_ADAPTER_H
9 
11 
12 #include "pxr/pxr.h"
13 #include "pxr/usdImaging/usdImaging/api.h"
14 #include "pxr/usdImaging/usdImaging/version.h"
15 #include "pxr/usdImaging/usdImaging/types.h"
16 
17 #include "pxr/usd/usd/prim.h"
18 
19 #include "pxr/imaging/hd/sceneIndex.h"
20 
21 #include "pxr/base/tf/type.h"
22 
23 #include <memory>
24 
25 
26 PXR_NAMESPACE_OPEN_SCOPE
27 
29 
30 using UsdImagingAPISchemaAdapterSharedPtr =
31  std::shared_ptr<class UsdImagingAPISchemaAdapter>;
32 
40  : public std::enable_shared_from_this<UsdImagingAPISchemaAdapter>
41 {
42 public:
43 
44  USDIMAGING_API
45  virtual ~UsdImagingAPISchemaAdapter();
46 
54  USDIMAGING_API
56  UsdPrim const& prim,
57  TfToken const& appliedInstanceName);
58 
65  USDIMAGING_API
67  UsdPrim const& prim,
68  TfToken const& subprim,
69  TfToken const& appliedInstanceName);
70 
78  USDIMAGING_API
79  virtual HdContainerDataSourceHandle GetImagingSubprimData(
80  UsdPrim const& prim,
81  TfToken const& subprim,
82  TfToken const& appliedInstanceName,
83  const UsdImagingDataSourceStageGlobals &stageGlobals);
84 
88  USDIMAGING_API
90  UsdPrim const& prim,
91  TfToken const& subprim,
92  TfToken const& appliedInstanceName,
93  TfTokenVector const& properties,
94  UsdImagingPropertyInvalidationType invalidationType);
95 };
96 
97 
98 class UsdImagingAPISchemaAdapterFactoryBase : public TfType::FactoryBase
99 {
100 public:
101  virtual UsdImagingAPISchemaAdapterSharedPtr New() const = 0;
102 };
103 
104 template <class T>
105 class UsdImagingAPISchemaAdapterFactory
106  : public UsdImagingAPISchemaAdapterFactoryBase
107 {
108 public:
109  virtual UsdImagingAPISchemaAdapterSharedPtr New() const
110  {
111  return std::make_shared<T>();
112  }
113 };
114 
115 PXR_NAMESPACE_CLOSE_SCOPE
116 
117 #endif
virtual USDIMAGING_API HdDataSourceLocatorSet InvalidateImagingSubprim(UsdPrim const &prim, TfToken const &subprim, TfToken const &appliedInstanceName, TfTokenVector const &properties, UsdImagingPropertyInvalidationType invalidationType)
Given the names of USD properties which have changed, an adapter may provide a HdDataSourceLocatorSet...
Base class for all API schema adapters.
virtual USDIMAGING_API TfToken GetImagingSubprimType(UsdPrim const &prim, TfToken const &subprim, TfToken const &appliedInstanceName)
Called to determine whether an API schema specifies the hydra type of a given prim previously defined...
Base class of all factory types.
Definition: type.h:56
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:80
This class is used as a context object with global stage information, that gets passed down to dataso...
virtual USDIMAGING_API HdContainerDataSourceHandle GetImagingSubprimData(UsdPrim const &prim, TfToken const &subprim, TfToken const &appliedInstanceName, const UsdImagingDataSourceStageGlobals &stageGlobals)
Returns an HdContainerDataSourceHandle representing the API schema's contributions to the primary pri...
Represents a set of data source locators closed under descendancy.
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
virtual USDIMAGING_API TfTokenVector GetImagingSubprims(UsdPrim const &prim, TfToken const &appliedInstanceName)
Called to determine whether an API schema defines additional child hydra prims beyond the primary hyd...