Loading...
Searching...
No Matches
dataSourceMaterial.h
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_DATA_SOURCE_MATERIAL_H
8#define PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_MATERIAL_H
9
10#include "pxr/imaging/hd/dataSource.h"
11
12#include "pxr/usd/usd/prim.h"
13
14#include "pxr/usdImaging/usdImaging/dataSourcePrim.h"
15#include "pxr/usdImaging/usdImaging/dataSourceStageGlobals.h"
16
18
19#include <tbb/concurrent_unordered_map.h>
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23// ----------------------------------------------------------------------------
24
32{
33public:
34 HD_DECLARE_DATASOURCE(UsdImagingDataSourceMaterial);
35
37 HdDataSourceBaseHandle Get(const TfToken &name) override;
38
40
41private:
42
48 const UsdPrim &usdPrim,
49 const UsdImagingDataSourceStageGlobals &stageGlobals,
50 const TfToken &fixedTerminalName = TfToken()
51 );
52
53
54private:
55
56 const UsdPrim _usdPrim;
57 const UsdImagingDataSourceStageGlobals &_stageGlobals;
58
59 // Cache the networks by context name.
60 using _ContextMap = tbb::concurrent_unordered_map<
61 TfToken, HdDataSourceBaseHandle, TfToken::HashFunctor>;
62
63
64 const TfToken _fixedTerminalName;
65 _ContextMap _networks;
66};
67
68HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceMaterial);
69
70// ----------------------------------------------------------------------------
71
76class UsdImagingDataSourceMaterialPrim : public UsdImagingDataSourcePrim
77{
78public:
79 HD_DECLARE_DATASOURCE(UsdImagingDataSourceMaterialPrim);
80
81 TfTokenVector GetNames() override;
82 HdDataSourceBaseHandle Get(const TfToken &name) override;
83
84 ~UsdImagingDataSourceMaterialPrim() override;
85
87 const UsdPrim &prim,
88 const TfToken &subprim,
89 const TfTokenVector &properties,
90 UsdImagingPropertyInvalidationType invalidationType);
91
92private:
93 USDIMAGING_API
94 UsdImagingDataSourceMaterialPrim(
95 const SdfPath &sceneIndexPath,
96 const UsdPrim &usdPrim,
97 const UsdImagingDataSourceStageGlobals &stageGlobals);
98};
99
100HD_DECLARE_DATASOURCE_HANDLES(UsdImagingDataSourceMaterialPrim);
101
102PXR_NAMESPACE_CLOSE_SCOPE
103
104#endif //PXR_USD_IMAGING_USD_IMAGING_DATA_SOURCE_MATERIAL_H
A datasource representing structured (named, hierarchical) data, for example a geometric primitive or...
Definition: dataSource.h:99
Represents a set of data source locators closed under descendancy.
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
A data source mapping for data source material.
TfTokenVector GetNames() override
Returns the list of names for which Get(...) is expected to return a non-null value.
HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the child datasource of the given name.
Data source representing a basic USD prim.
USDIMAGING_API TfTokenVector GetNames() override
Returns the names for which this data source can return meaningful results.
static USDIMAGING_API HdDataSourceLocatorSet Invalidate(UsdPrim const &prim, const TfToken &subprim, const TfTokenVector &properties, UsdImagingPropertyInvalidationType invalidationType)
Returns the hydra attribute set we should invalidate if the value of the USD properties in properties...
USDIMAGING_API HdDataSourceBaseHandle Get(const TfToken &name) override
Returns the data source representing name, if valid.
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
Functor to use for hash maps from tokens to other things.
Definition: token.h:149
std::vector< TfToken > TfTokenVector
Convenience types.
Definition: token.h:440