25 #ifndef PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_SCHEMA_BASED_H
26 #define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_SCHEMA_BASED_H
35 namespace UsdImagingDataSourceSchemaBased_Impl
62 template<
typename UsdSchemaType,
63 typename UsdSchemaBaseTypes,
69 UsdSchemaType, UsdSchemaBaseTypes, Translator>;
86 UsdSchemaType usdSchema,
91 static const std::vector<_Mapping> &_GetMappings();
95 UsdSchemaType _usdSchema;
101 namespace UsdImagingDataSourceSchemaBased_Impl
111 template<
typename Translator,
112 typename ThisUsdSchemaType>
115 for (
const TfToken &usdAttributeName :
116 ThisUsdSchemaType::GetSchemaAttributeNames(
120 Translator::UsdAttributeNameToHdName(usdAttributeName);
125 Translator::GetContainerLocator().Append(hdName) });
130 template<
typename Translator,
131 typename UsdSchemaBaseTypes>
134 template<
typename Translator>
142 template<
typename Translator,
143 typename UsdSchemaType,
144 typename ...UsdSchemaTypes>
149 _FillMappings<Translator, UsdSchemaType>(
result);
150 _MappingsFiller<Translator, std::tuple<UsdSchemaTypes...>>::Fill(result);
154 template<
typename UsdSchemaType,
155 typename UsdSchemaBasesTypes,
157 std::vector<_Mapping>
160 std::vector<_Mapping>
result;
162 _FillMappings<Translator, UsdSchemaType>(&
result);
172 for (
const _Mapping &mapping : mappings) {
173 result.push_back(mapping.hdName);
180 template<
typename UsdSchemaType,
181 typename UsdSchemaBasesTypes,
192 template<
typename UsdSchemaType,
193 typename UsdSchemaBasesTypes,
195 HdDataSourceBaseHandle
200 if (mapping.hdName == name) {
203 mapping.usdAttributeName)) {
214 "Could not get usd attribute '%s' even though "
215 "it is on the schema.",
216 mapping.usdAttributeName.GetText());
224 template<
typename UsdSchemaType,
225 typename UsdSchemaBasesTypes,
235 for (
const TfToken &usdName : usdNames) {
237 if (mapping.usdAttributeName == usdName) {
238 locators.
insert(mapping.locator);
246 template<
typename UsdSchemaType,
247 typename UsdSchemaBasesTypes,
252 UsdSchemaType usdSchema,
254 : _sceneIndexPath(sceneIndexPath)
255 , _usdSchema(usdSchema)
256 , _stageGlobals(stageGlobals)
260 template<
typename UsdSchemaType,
261 typename UsdSchemaBasesTypes,
263 const std::vector<UsdImagingDataSourceSchemaBased_Impl::_Mapping> &
267 static const std::vector<_Mapping> mappings =
268 UsdImagingDataSourceSchemaBased_Impl::
269 _GetMappings<UsdSchemaType, UsdSchemaBasesTypes, Translator>();
276 #endif // PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_SCHEMA_BASED_H
HdDataSourceLocator locator
void _FillMappings(std::vector< _Mapping > *const result)
static HdDataSourceLocatorSet Invalidate(const TfToken &subprim, const TfTokenVector &usdNames)
Translate usdNames to data source locators.
**But if you need a result
static void Fill(std::vector< _Mapping > *const result)
HdDataSourceBaseHandle Get(const TfToken &name) override
static void Fill(std::vector< _Mapping > *const result)
USDIMAGING_API HdSampledDataSourceHandle UsdImagingDataSourceAttributeNew(const UsdAttribute &usdAttr, const UsdImagingDataSourceStageGlobals &stageGlobals, const SdfPath &sceneIndexPath=SdfPath::EmptyPath(), const HdDataSourceLocator &timeVaryingFlagLocator=HdDataSourceLocator::EmptyLocator())
std::vector< TfToken > TfTokenVector
Convenience types.
GLuint const GLchar * name
HD_API void insert(const HdDataSourceLocator &locator)
TfTokenVector _GetNames(const std::vector< _Mapping > &mappings)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
HD_DECLARE_DATASOURCE(This)
USD_API UsdAttribute GetAttribute(const TfToken &attrName) const
TfTokenVector GetNames() override
bool IsEmpty() const
Returns true iff this token contains the empty string "".
std::vector< _Mapping > _GetMappings()