All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
usdInPrivateData.h
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXRUSDKATANA_USDIN_PRIVATEDATA_H
25 #define PXRUSDKATANA_USDIN_PRIVATEDATA_H
26 
27 #include "pxr/pxr.h"
28 #include "usdKatana/usdInArgs.h"
29 
30 #include "pxr/usd/usd/prim.h"
31 #include "pxr/usd/usdShade/materialBindingAPI.h"
32 
33 #include <FnGeolib/op/FnGeolibOp.h>
34 #include <memory>
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 
42 class PxrUsdKatanaUsdInPrivateData : public Foundry::Katana::GeolibPrivateData
43 {
44 
45 public:
48  std::map<SdfPath, SdfPath> baseMaterialPath;
49  // Maintain order of derivedMaterials, for presentation.
50  std::map<SdfPath, std::vector<SdfPath>> derivedMaterialPaths;
51  };
52 
55  bool operator==(const UsdKatanaTimePair& o) const {
56  return usdTime == o.usdTime && katanaTime == o.katanaTime;
57  }
58  bool operator!=(const UsdKatanaTimePair& o) const {
59  return !(*this == o);
60  }
61 
62  double usdTime;
63  double katanaTime;
64  };
65 
67  const UsdPrim& prim,
69  const PxrUsdKatanaUsdInPrivateData* parentData = NULL);
70 
72  {
73  delete _extGb;
74  }
75 
76  const UsdPrim& GetUsdPrim() const {
77  return _prim;
78  }
79 
80  const PxrUsdKatanaUsdInArgsRefPtr GetUsdInArgs() const {
81  return _usdInArgs;
82  }
83 
84  const SdfPath& GetInstancePath() const {
85  return _instancePath;
86  }
87 
88  const SdfPath& GetMasterPath() const {
89  return _masterPath;
90  }
91 
92  const double GetCurrentTime() const {
93  return _currentTime;
94  }
95 
96  const double GetShutterOpen() const {
97  return _shutterOpen;
98  }
99 
100  const double GetShutterClose() const {
101  return _shutterClose;
102  }
103 
109  const bool IsMotionBackward() const;
110 
128  const std::vector<double> GetMotionSampleTimes(
129  const UsdAttribute& attr = UsdAttribute(),
130  bool fallBackToShutterBoundary = false) const;
131 
135  std::vector<UsdKatanaTimePair> GetUsdAndKatanaTimes(
136  const UsdAttribute& attr = UsdAttribute()) const;
137 
138 
141  void setExtensionOpArg(const std::string & name,
142  FnAttribute::Attribute attr) const;
143 
148  FnAttribute::Attribute getExtensionOpArg(const std::string & name,
149  FnAttribute::GroupAttribute opArgs) const;
150 
155  FnAttribute::GroupAttribute updateExtensionOpArgs(
156  FnAttribute::GroupAttribute opArgs) const;
157 
158 
162  GetCollectionQueryCache() const;
164  GetBindingsCache() const;
165 
166 
167 
171  const FnKat::GeolibCookInterface& interface);
172 
173 private:
174 
175  UsdPrim _prim;
176 
177  PxrUsdKatanaUsdInArgsRefPtr _usdInArgs;
178 
179  SdfPath _instancePath;
180  SdfPath _masterPath;
181 
182  double _currentTime;
183  double _shutterOpen;
184  double _shutterClose;
185 
186  std::vector<double> _motionSampleTimesOverride;
187  std::vector<double> _motionSampleTimesFallback;
188 
189 
190  mutable FnAttribute::GroupBuilder * _extGb;
191 
192 
193 
194  typedef std::shared_ptr<UsdShadeMaterialBindingAPI::CollectionQueryCache>
195  _CollectionQueryCachePtr;
196  typedef std::shared_ptr<UsdShadeMaterialBindingAPI::BindingsCache>
197  _BindingsCachePtr;
198 
199  _CollectionQueryCachePtr _collectionQueryCache;
200  _BindingsCachePtr _bindingsCache;
201 
202 
203 };
204 
205 
206 PXR_NAMESPACE_CLOSE_SCOPE
207 
208 #endif // PXRUSDKATANA_USDIN_PRIVATEDATA_H
Private data for each non-root invocation of PxrUsdIn.
FnAttribute::GroupAttribute updateExtensionOpArgs(FnAttribute::GroupAttribute opArgs) const
Called by the hosting op to flush the results of setExtensionOpArg and apply back onto the provided o...
FnAttribute::Attribute getExtensionOpArg(const std::string &name, FnAttribute::GroupAttribute opArgs) const
Allows a registered op or location decorator function to retrieve state accumulated during traversal...
tbb::concurrent_unordered_map< SdfPath, std::unique_ptr< UsdCollectionAPI::MembershipQuery >, SdfPath::Hash > CollectionQueryCache
An unordered list of collection paths mapped to the associated collection&#39;s MembershipQuery object...
Scenegraph object for authoring and retrieving numeric, string, and array valued data, sampled over time.
Definition: attribute.h:176
tbb::concurrent_unordered_map< SdfPath, std::unique_ptr< BindingsAtPrim >, SdfPath::Hash > BindingsCache
An unordered list of prim-paths mapped to the corresponding set of bindings at the associated prim...
const std::vector< double > GetMotionSampleTimes(const UsdAttribute &attr=UsdAttribute(), bool fallBackToShutterBoundary=false) const
Return frame-relative sample times based on how the given attribute is sampled with respect to the sh...
static PxrUsdKatanaUsdInPrivateData * GetPrivateData(const FnKat::GeolibCookInterface &interface)
extract private data from either the interface (its natural location) with room for future growth ...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a &quot;Prim&quot; as ...
Definition: prim.h:131
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:287
const bool IsMotionBackward() const
Return true if motion blur is backward.
UsdShadeMaterialBindingAPI::CollectionQueryCache * GetCollectionQueryCache() const
Access to shared caches relevant to efficient binding of materials across the hierarchy.
std::vector< UsdKatanaTimePair > GetUsdAndKatanaTimes(const UsdAttribute &attr=UsdAttribute()) const
Returns a list of &lt;usd, katana&gt; times for use in clients that wish to multi-sample USD data and build...
Pair for associating a USD time with a Katana time.
Material specialization hierarchy for Usd shading.
void setExtensionOpArg(const std::string &name, FnAttribute::Attribute attr) const
Allows a registered op or location decorator function to set share and accumulate state during traver...