This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
26PXR_NAMESPACE_OPEN_SCOPE
27
29
30using UsdImagingAPISchemaAdapterSharedPtr =
31 std::shared_ptr<class UsdImagingAPISchemaAdapter>;
32
40 : public std::enable_shared_from_this<UsdImagingAPISchemaAdapter>
41{
42public:
43
44 USDIMAGING_API
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
98class UsdImagingAPISchemaAdapterFactoryBase : public TfType::FactoryBase
99{
100public:
101 virtual UsdImagingAPISchemaAdapterSharedPtr New() const = 0;
102};
103
104template <class T>
105class UsdImagingAPISchemaAdapterFactory
106 : public UsdImagingAPISchemaAdapterFactoryBase
107{
108public:
109 virtual UsdImagingAPISchemaAdapterSharedPtr New() const
110 {
111 return std::make_shared<T>();
112 }
113};
114
115PXR_NAMESPACE_CLOSE_SCOPE
116
117#endif
Represents a set of data source locators closed under descendancy.
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Base class of all factory types.
Definition: type.h:56
Base class for all API schema adapters.
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...
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...
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...
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...
This class is used as a context object with global stage information, that gets passed down to dataso...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Definition: prim.h:117
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440