HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_ParmChangeMicroNode.h
Go to the documentation of this file.
1 //
2 // Copyright 2017 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 /**
25  \file
26  \brief
27 */
28 #ifndef _GUSD_OP_PARMCHANGEMICRONODE_H_
29 #define _GUSD_OP_PARMCHANGEMICRONODE_H_
30 
31 #include "pxr/pxr.h"
32 
33 #include "gusd/api.h"
34 
35 #include <DEP/DEP_TimedMicroNode.h>
36 #include <OP/OP_Parameters.h>
38 
40 
41 /** Micro node for tracking changes to a set of parameters.
42  This is similar to OP_ParmCache, except that this tracks changes to the
43  *resolved* values of parameters, rather than their dirty states.
44 
45  Only persistent parameters can be tracked. Spare and dynamic parameters
46  (I.e., instances of multi parms) cannot be tracked through this class.
47 
48  This class is not thread safe!*/
50 {
51 public:
53  : DEP_TimedMicroNode(), _node(node), _parmsAdded(false) {}
54 
55  ~GusdOP_ParmChangeMicroNode() override;
56 
57  /** Begin tracking the given parm.
58  If @a vectorIdx is less than zero, all elements of the parm
59  tuple are tracked.*/
60  void addParm(int parmIdx, int vecIdx=-1);
61 
62  /** Update the resolved parm values.
63  @return true if any resolved values changed.*/
64  bool updateVals(fpreal t, int thread=SYSgetSTID());
65 
67  { return requiresUpdate(t) && updateVals(t, thread); }
68 
69  void update(fpreal t) override { updateVals(t); }
70 
71  /** Clear our inputs.
72  This is overridden to disallow clearing of explicit inputs,
73  which are meant to persist on this micro node.*/
74  void clearInputs() override { if(isTimeDependent()) setTimeDependent(false); }
75 
76  struct _ParmCache;
77 
78 private:
79  OP_Parameters& _node;
80 
81  UT_Array<_ParmCache*> _cachedVals;
82  bool _parmsAdded;
83 };
84 
86 
87 #endif /*_GUSD_OP_PARMCHANGEMICRONODE_H_*/
SYS_FORCE_INLINE void setTimeDependent(bool time_dependent)
Flag accessors.
GusdOP_ParmChangeMicroNode(OP_Parameters &node)
bool requiresUpdate(fpreal t) const override
SYS_FORCE_INLINE bool isTimeDependent() const
Flag accessors.
bool updateIfNeeded(fpreal t, int thread=SYSgetSTID())
GLdouble t
Definition: glad.h:2397
void update(fpreal t) override
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
SYS_API int SYSgetSTID()
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
fpreal64 fpreal
Definition: SYS_Types.h:277
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
#define GUSD_API
Definition: api.h:40