HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_NamedMicroNodes.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  * COMMENTS:
7  * This is the base class to hold named micro nodes.
8  */
9 
10 #ifndef __OP_NAMEDMICRONODES_h__
11 #define __OP_NAMEDMICRONODES_h__
12 
13 #include "OP_API.h"
14 
15 #include "OP_DataMicroNode.h"
16 
17 #include <UT/UT_Array.h>
18 #include <UT/UT_StringHolder.h>
19 #include <UT/UT_StringMap.h>
20 #include <UT/UT_UniquePtr.h>
21 
22 class OP_Node;
23 
24 // Add a name to OP_DataMicroNode and keep a cached list of dependents
25 // The dependents are rebuild only of the named micronode starts with a !
26 // character. We use it for clips: !clip:clip1
28 
29 {
30 public:
32 
33  const char * className() const override;
34  const UT_StringHolder &getMicroNodeName() const;
35 
36  void rebuildDependents();
37  const UT_Array<const OP_NamedDataMicroNode*> &dependents() const;
38 
40  const DEP_PropagateData &data) override;
41 public:
44 
46 };
47 
48 // Base class for Nodes that want to have custom named micronodes.
50 {
51 public:
53  virtual ~OP_NamedMicroNodes();
54 
57 
58  // Change the dataMicroNode on which dependencies are added during
59  // a Python SOP cook.
60  // Use an empty name to revert to the original dataMicroNode.
61  void setCurrentNamedDataMicroNode( const UT_StringHolder &name );
62 
63  // Returns the name of the current NamedMicroNode.
66  { return myDataMicroNodeName; }
67 
68  // Push a named micronode on the stack, connecting it to the current
69  // micronode.
70  void pushNamedDataMicroNode( const UT_StringHolder &name,
71  bool reverse_dir=false );
72 
73  // Pop the current named micronode from the stack, setting the current node
74  // to the previous node from the stack.
75  void popNamedDataMicroNode();
76 
77  // Query the state of the previously cooked micronodes.
78  const UT_StringMap<int> &getNamedDataMicroNodesState() const;
79 
80  // Dirty the state of the previously declared micronodes.
81  void dirtyNamedDataMicroNodes( const UT_StringArray &names);
82 
83  // Extract the named micronode states.
84  void updateNamedDataMicroNodesState();
85 
86  // Mark all the named micronodes as clean.
87  void cleanNamedDataMicroNodes();
88 
89  // Destroy all the named micronodes.
90  // Use when dependencies need to be rebuilt from scratch.
91  // It's the only way to destroy a named micronode.
92  void clearNamedDataMicroNodes();
93 
96  { return myDataMicroNodePtr; }
97 
98  // Pre/Post cook methods to hook the micronode to the real data micronode.
99  // Also stashes myNamedDataMicroNodesState
100  void namedMicroNodesPreCook();
101  void namedMicroNodesPostCook(OP_DataMicroNode &dataMicroNode);
102 private:
103 
104  OP_Node *myOp;
105  UT_StringHolder myDataMicroNodeName;
106  OP_NamedDataMicroNode* myDataMicroNodePtr;
107  UT_Array<OP_NamedDataMicroNode*> myDataMicroNodeStack;
108 
109  UT_Array<UT_UniquePtr<OP_NamedDataMicroNode>> myNamedDataMicroNodesArray;
110  UT_StringMap<exint> myNamedDataMicroNodesMap;
111 
112  UT_StringMap<int> myNamedDataMicroNodesState;
113 };
114 
115 #endif
116 
SYS_FORCE_INLINE const OP_NamedDataMicroNode * namedDataMicroNodeConst() const
void becameDirty(DEP_MicroNode &src, const DEP_PropagateData &data) override
SYS_FORCE_INLINE const UT_StringHolder & currentNamedDataMicroNode() const
const char * className() const override
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLuint const GLchar * name
Definition: glcorearb.h:786
UT_StringHolder myMicroNodeName
LeafData & operator=(const LeafData &)=delete
#define OP_API
Definition: OP_API.h:10
Propagation info for a dep micro node.
Definition: DEP_MicroNode.h:36
Definition: format.h:895
UT_Array< const OP_NamedDataMicroNode * > myDependents
GLenum src
Definition: glcorearb.h:1793