13 #ifndef HOUDINI_UTILS_OP_NODECHAIN_HAS_BEEN_INCLUDED
14 #define HOUDINI_UTILS_OP_NODECHAIN_HAS_BEEN_INCLUDED
16 #include <OP/OP_Context.h>
17 #include <OP/OP_Channels.h>
18 #include <OP/OP_Director.h>
19 #include <OP/OP_Node.h>
20 #include <SYS/SYS_Types.h>
21 #include <UT/UT_String.h>
22 #include <UT/UT_Thread.h>
26 #if defined(PRODDEV_BUILD) || defined(DWREAL_IS_DOUBLE)
31 #ifndef OPENVDB_HOUDINI_API
32 #define OPENVDB_HOUDINI_API
50 template<
typename NodeType>
52 inline std::vector<NodeType*>
53 getNodeChain(OP_Context& context, NodeType* startNode,
bool addInterest =
true)
58 static inline OP_Node* nextInput(
62 OP_Node* input = node->getInput(0,
true);
64 OP_Node* passThrough = input->getPassThroughNode(now,
true);
65 if (!passThrough)
break;
72 const fpreal now = context.getTime();
74 std::vector<NodeType*> nodes;
75 for (OP_Node* node = startNode; node != NULL; node = Local::nextInput(now, node)) {
77 if (!node->needToCook(context,
true))
break;
79 if (NodeType* candidate =
dynamic_cast<NodeType*
>(node)) {
80 nodes.push_back(candidate);
83 std::string opname = node->getName().toStdString().substr(0, 4);
84 if (opname ==
"null")
continue;
88 std::reverse(nodes.begin(), nodes.end());
90 if (addInterest && startNode != nodes[0] && nodes[0]->getInput(0)) {
91 startNode->addExtraInput(nodes[0]->getInput(0), OP_INTEREST_DATA);
115 *OPgetDirector()->getCommandManager(),
119 mDirector(OPgetDirector()),
120 mThread(context.getThread())
122 mDirector->pushCwd(mThread, &node);
129 CH_AutoEvaluateTime mAutoEvaluator;
130 OP_Director* mDirector;
136 #endif // HOUDINI_UTILS_OP_NODECHAIN_HAS_BEEN_INCLUDED