HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_SopDependencyScope.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5 */
6 
7 #ifndef __SIM_SopDependencyScope_h__
8 #define __SIM_SopDependencyScope_h__
9 
10 #include "SIMZ_API.h"
11 
12 #include <DEP/DEP_MicroNode.h>
13 #include <SIM/SIM_Data.h>
14 #include <SIM/SIM_Engine.h>
15 #include <SOP/SOP_Node.h>
16 #include <UT/UT_Optional.h>
17 #include <UT/UT_NonCopyable.h>
18 
19 /// Wrapper around a DEP_KeepDependenciesScope for use when cooking a SOP.
20 /// If the SOP has previously been accessed during the simulation
21 /// (SIM_Engine::hasOPInterest()), a DEP_KeepDependenciesScope is used to
22 /// accumulate the dependencies from earlier simulation frames
23 /// This is not done for the first occurrence after a resim, allowing the SOP's
24 /// micronode to reset and rebuild its dependencies.
26 {
27 public:
29  {
30  mySop = data.getNodePathsRelativeTo().getSOPNode(path);
31  if (mySop)
32  {
33  const SIM_Engine &engine = data.getEngine();
34 
35  if (engine.hasOPInterest(mySop))
36  myDepScope.emplace();
37 
38  engine.addOPInterest(mySop);
39  }
40  }
41 
42  SOP_Node *getSOPNode() const { return mySop; }
43 
44 private:
46  SOP_Node *mySop = nullptr;
47 };
48 
49 #endif
#define SIMZ_API
Definition: SIMZ_API.h:10
void addOPInterest(OP_Node *node) const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
const SIM_Engine & getEngine() const
Get the engine that created us (from our data factory).
Definition: SIM_Data.h:455
std::optional< T > UT_Optional
Definition: UT_Optional.h:26
SOP_Node * getSOPNode(const char *path, int addextra=0, bool *got_by_flag=nullptr) const
bool hasOPInterest(OP_Node *node) const
Returns whether there is an explicit interest on the node.
Definition: SIM_Engine.h:369
SIM_SopDependencyScope(const SIM_Data &data, const char *path)
SOP_Node * getSOPNode() const
OP_Node & getNodePathsRelativeTo() const
Definition: format.h:895