25 #ifndef PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_SCHEMA_BASED_H 26 #define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_SCHEMA_BASED_H 28 #include "pxr/usdImaging/usdImaging/dataSourceGprim.h" 29 #include "pxr/usdImaging/usdImaging/dataSourceStageGlobals.h" 31 #include "pxr/imaging/hd/dataSource.h" 33 PXR_NAMESPACE_OPEN_SCOPE
52 template<
typename UsdSchemaType,
59 HD_DECLARE_DATASOURCE(
This);
66 HdDataSourceBaseHandle
Get(
const TfToken &name)
override {
67 for (
const _NameInfo &info : _GetNameInfos()) {
68 if (info.hdName == name) {
70 _usdSchema.GetPrim().GetAttribute(
71 info.usdAttributeName)) {
73 UsdImagingDataSourceAttributeNew(
82 "Could not get usd attribute '%s' even though " 83 "it is on the schema.",
84 info.usdAttributeName.GetText());
98 for (
const TfToken &usdName : usdNames) {
99 for (
const _NameInfo &info : _GetNameInfos()) {
100 if (info.usdAttributeName == usdName) {
101 locators.insert(info.locator);
113 UsdSchemaType usdSchema,
115 : _sceneIndexPath(sceneIndexPath)
116 , _usdSchema(usdSchema)
117 , _stageGlobals(stageGlobals)
129 std::vector<_NameInfo>
130 _GetNameInfosUncached()
132 std::vector<_NameInfo> result;
133 for (
const TfToken &usdAttributeName :
134 UsdSchemaType::GetSchemaAttributeNames(
137 const TfToken hdName = Translator::UsdAttributeNameToHdName(
143 Translator::GetContainerLocator().Append(hdName) });
150 const std::vector<_NameInfo> &
153 static const std::vector<_NameInfo> result = _GetNameInfosUncached();
162 for (
const _NameInfo &info : _GetNameInfos()) {
163 result.push_back(info.hdName);
170 UsdSchemaType _usdSchema;
174 PXR_NAMESPACE_CLOSE_SCOPE
176 #endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_IMPLICITS_IMPL_H bool IsEmpty() const
Returns true iff this token contains the empty string "".
static HdDataSourceLocatorSet Invalidate(const TfToken &subprim, const TfTokenVector &usdNames)
Translate usdNames to data source locators.
#define TF_CODING_ERROR(fmt, args)
Issue an internal programming error, but continue execution.
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Scenegraph object for authoring and retrieving numeric, string, and array valued data,...
Token for efficient comparison, assignment, and hashing of known strings.
Represents an object that can identify the location of a data source.
TfTokenVector GetNames() override
Returns the list of names for which Get(...) is expected to return a non-null value.
This class is used as a context object with global stage information, that gets passed down to dataso...
Represents a set of data source locators closed under descendancy.
std::vector< TfToken > TfTokenVector
Convenience types.
A path value used to locate objects in layers or scenegraphs.
A container data source created from a Usd schema which accesses the attributes on the underlying Usd...
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the child datasource of the given name.