14 #ifndef __SOP_NodeVerb_h__
15 #define __SOP_NodeVerb_h__
28 #include <initializer_list>
42 int64 mem = inclusive ?
sizeof(*this) : 0;
43 mem += UTarrayDeepMemoryUsage(stringdata,
false);
70 bool applyGeometryOverrideFromNode(
98 {
return allocCache(); }
100 {
return allocParms(); }
116 myExprInputs.clear();
122 myExprInputs = inputs;
123 myTimeDeps = timedeps;
138 auto && info = myOpNodeMap.find(op);
139 if (info == myOpNodeMap.end())
return nullptr;
140 return &info->second;
145 if (nodeoridx.
node())
147 auto && info = myOpNodeMap.find(nodeoridx.
node());
148 if (info == myOpNodeMap.end())
return nullptr;
149 return &info->second;
151 auto && info = myIndexMap.find(nodeoridx.
index());
152 if (info == myIndexMap.end())
return nullptr;
153 return &info->second;
158 if (nodeoridx.
node())
159 return myOpNodeMap[nodeoridx.
node()];
160 return myIndexMap[nodeoridx.
index()];
163 exint size()
const {
return myOpNodeMap.size() + myIndexMap.size(); }
165 {
return myOpNodeMap.contains(op); }
168 if (nodeoridx.
node())
return myOpNodeMap.contains(nodeoridx.
node());
169 return myIndexMap.contains(nodeoridx.
index());
177 for (
auto && noderef : myOpNodeMap)
179 noderef.second.clear();
193 static const ForbiddenNodeMap *forbiddenNodes();
194 static const ForbiddenNodeMap *forbiddenNodes(
int thread);
247 virtual exint nInputs()
const = 0;
254 virtual bool cookInput(
exint idx) = 0;
267 virtual void markInputUnused(
exint idx) = 0;
280 if (idx < 0 || idx >=
nInputs())
282 return myGdps(idx).gdp() !=
nullptr;
295 return myGdps(idx).castAwayConst();
319 , myExprInputs(exprinputs)
337 template <
typename T>
341 template <
typename T>
350 {
return myContext; }
352 {
return myContext.getTime(); }
379 , myExprInputs(nullptr)
380 , myCookEngine(cookengine)
381 , myGraphProxy(graphproxy)
383 , myOpNode(nodeoridx)
409 template <
typename T>
425 return myNode.node()->getFullPath();
426 if (myPseudoPath.isstring())
428 return "<internal>"_UTsh;
431 {
return myContext; }
433 {
return myContext.getTime(); }
443 if (idx < 0 || idx >= myInputs.size())
445 return myInputs(idx).isValid();
450 return myInputs(idx).gdp();
455 return myInputs(idx);
462 if (!myExprInputs)
return 0;
463 return myExprInputs->size();
467 if (!myExprInputs)
return false;
468 if (idx < 0 || idx > myExprInputs->size())
return false;
469 return (*myExprInputs)(idx).isValid();
473 if (!hasSpareInput(idx))
return nullptr;
474 return (*myExprInputs)(idx).gdp();
479 return (*myExprInputs)(idx);
482 template <
typename T>
500 *myError, myErrorLock);
505 {
if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
510 {
if (myError)
return getLockedErrorManager()->addMessage(type, code, formatError(msg), loc);
514 {
if (myError)
return getLockedErrorManager()->addWarning(type, code, formatError(msg), loc);
518 {
if (myError)
return getLockedErrorManager()->addError(type, code, formatError(msg), loc);
528 return addMessageFmt(work.
buffer());
530 template<
typename... Args>
532 {
return addMessageFmt(fmt, {args...}); }
540 return addWarningFmt(work.
buffer());
542 template<
typename... Args>
544 {
return addWarningFmt(fmt, {args...}); }
552 return addErrorFmt(work.
buffer());
554 template<
typename... Args>
556 {
return addErrorFmt(fmt, {args...}); }
590 path +=
"(as "; path +=
label; path +=
")";
596 bool borrow_only =
false)
const
597 {
if (myError) getLockedErrorManager()->stealErrors(src,0, -1,
UT_ERROR_NONE, borrow_only); }
601 getNode()->select(gtype); }
604 bool add_to_sel =
false)
const
606 getNode()->select(selection, add_to_sel); }
610 bool add_to_sel =
false)
const
612 getNode()->select(group, use_gtype, add_to_sel); }
615 bool add_to_sel =
false)
const
617 getNode()->select(prim, sel_prim, add_to_sel); }
619 bool add_to_sel =
false)
const
621 getNode()->selectPrimitive(primoff, prim_sel, add_to_sel); }
623 bool add_to_sel =
false)
const
625 getNode()->selectPoint(ptoff, point_sel, add_to_sel); }
627 bool add_to_sel =
false)
const
629 getNode()->selectFrom(prim, sel_prim, add_to_sel); }
631 bool add_to_sel =
false)
const
633 getNode()->selectPointsFrom(ptoff, point_sel, add_to_sel); }
635 bool add_to_sel =
false)
const
637 getNode()->select(range, use_rtype, add_to_sel); }
645 getNode()->selectInputGroup(group, grouptype); }
651 getNode()->clearSelection(); }
658 getNode()->clearSelection(gtype); }
665 return getNode()->destroySelection();
674 return getNode()->getHighlight();
679 {
if (getNode())
return getNode()->setupLocalVars();
return false; }
681 {
if (getNode()) getNode()->resetLocalVarRefs(); }
683 {
if (getNode()) getNode()->setCurGdh(index, gdh); }
685 {
if (getNode()) getNode()->clearCurGdh(index); }
687 {
if (getNode()) getNode()->setCurPoint(index, off); }
689 {
if (getNode()) getNode()->clearCurPoint(index); }
691 {
if (getNode()) getNode()->setCurVertex(index, off); }
693 {
if (getNode()) getNode()->clearCurVertex(index); }
695 {
if (getNode()) getNode()->setCurPrim(index, off); }
697 {
if (getNode()) getNode()->clearCurPrim(index); }
699 {
if (getNode()) getNode()->setCurVertexNum(index, num); }
701 {
if (getNode()) getNode()->clearCurVertexNum(index); }
703 int pt,
int vtx)
const
704 {
if (getNode()) getNode()->setVariableOrder(detail, prim, pt, vtx); }
708 {
if (getNode()) getNode()->myUsesSOPLocalVar =
false; }
710 {
if (!getNode())
return false;
711 return getNode()->myUsesSOPLocalVar; }
727 fullpath = getFullPathForDisplay();
728 buf.
sprintf(
"%s: %s", (
const char *) fullpath, msg);
811 virtual bool usesCE()
const {
return false; }
815 virtual void cook(
const CookParms &cookparms)
const = 0;
821 void notifyGroupParmListeners(
SOP_Node *oldsop,
OP_OpTypeId category() const override
GT_API const UT_StringHolder selection
GLenum GLuint GLenum GLsizei const GLchar * buf
UT_ErrorSeverity addWarningFmt(const char *fmt, const Args &...args) const
const UT_Array< GU_ConstDetailHandle > & exprinputs() const
void setCurGdh(int index, const GU_DetailHandle &gdh) const
OP_GraphProxy::NodeOrIdx myNode
SOP_Node * getNode() const
GLuint GLsizei const GLchar * label
const ForbiddenNodeMap * myPrevNodes
bool contains(OP_GraphProxy::NodeOrIdx nodeoridx) const
DEP_MicroNode * depnode() const
void setPseudoPath(const UT_StringHolder &path)
UT_ErrorSeverity sopAddMessage(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
void addTransformError(const OP_Node &node, const char *label=0) const
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
virtual bool apexInplace() const
void clearCurGdh(int index) const
bool hasSpareInput(exint idx) const
OP_GraphProxy::NodeOrIdx getNodeOrIdx() const
GLsizei const GLchar *const * path
UT_ErrorSeverity addMessageFmt(const char *fmt, std::initializer_list< UT::Format::ArgValue > args) const
void selectPoint(GA_Offset ptoff, bool point_sel=true, bool add_to_sel=false) const
UT_ErrorSeverity addMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Methods to add directly to any present error manager.
void clearCurVertexNum(int index) const
void resetLocalVarRefs() const
SYS_FORCE_INLINE const char * buffer() const
GU_ConstDetailHandle spareInputGeoHandle(exint idx) const
UT_StringHolder getFullPathForDisplay() const
UT_Array< GU_ConstDetailHandle > myExprInputs
UT_ErrorSeverity addMessageFmt(const char *fmt) const
void stealErrors(UT_ErrorManager &src, bool borrow_only=false) const
const GU_Detail * spareInputGeo(exint idx) const
OP_Node * getCwd() const
The getCwd() should be used to evaluate relative paths.
UT_Map< const OP_Node *, NodeExecuteInfo > & opNodeMapNC()
void select(const GA_Range &range, bool use_rtype=true, bool add_to_sel=false) const
const UT_Array< GU_ConstDetailHandle > & myInputs
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
void setExprInputs(const UT_Array< GU_ConstDetailHandle > &exprinputs)
**But if you need a result
const UT_Array< GU_ConstDetailHandle > * myExprInputs
bool setupLocalVars() const
Shims for local variables.
bool contains(const OP_Node *op) const
UT_ErrorSeverity addWarningFmt(const char *fmt, std::initializer_list< UT::Format::ArgValue > args) const
OP_Node * getSrcNode() const
The node that generated this verb, if any...
GU_DetailHandle & myDestGdh
virtual bool doPartialInputCook() const
virtual void resetLocalVariables(SOP_Node *sop) const
void clearCurPoint(int index) const
UT_ErrorSeverity sopAddError(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
A range of elements in an index-map.
DEP_MicroNode * myDepNode
virtual void getErrorFormattedString(UT_WorkBuffer &error_str) const
exint numSpareInputs() const
UT_ErrorSeverity addErrorFmt(const char *fmt) const
GU_ConstDetailHandle inputGeoHandle(exint idx) const
const char * getFullPath(UT_String &str) const
const SOP_NodeParms * myParms
virtual void setupLocalVariables(SOP_Node *sop, const UT_Array< GU_ConstDetailHandle > &inputs) const
size_t appendFormat(const char *fmt, const Args &...args)
const NodeExecuteInfo * findOpNode(const OP_Node *op) const
void addExplicitInput(DEP_MicroNode &inp, bool check_dup=true) const
Methods to wire directly to the optional depnode.
GLint GLint GLsizei GLint GLenum GLenum type
void selectPrimitive(GA_Offset primoff, bool prim_sel=true, bool add_to_sel=false) const
OP_CookEngine myCookEngine
void setCurPrim(int index, GA_Offset off) const
UT_ErrorSeverity addErrorFmt(const char *fmt, const Args &...args) const
NodeExecuteInfo & info(OP_GraphProxy::NodeOrIdx nodeoridx)
bool destroySelection() const
UT_Array< UT_StringHolder > stringdata
void select(GU_SelectionHandle selection, bool add_to_sel=false) const
OP_GraphProxy::NodeIdx getNodeIdx() const
virtual bool doExprInputCook() const
OP_GraphProxy::NodeOrIdx myOpNode
void selectFrom(const GEO_Primitive &prim, bool sel_prim=true, bool add_to_sel=false) const
void clearSelection() const
virtual bool usesCE() const
void setCurPoint(int index, GA_Offset off) const
void selectInputGroup(const GA_Group *group, GA_GroupType grouptype) const
const UT_IntArray & timedeps() const
void setExprInputs(const UT_Array< GU_ConstDetailHandle > &inputs, const UT_IntArray &timedeps)
virtual SOP_NodeCache * allocCache() const
void selectPointsFrom(GA_Offset ptoff, bool point_sel=true, bool add_to_sel=false) const
const OP_Context & getContext() const
void clearCurPrim(int index) const
GLuint const GLchar * name
OP_NodeCache * baseAllocCache() const overridefinal
virtual bool evaluatesParametersDuringCook() const
void setCurVertexNum(int index, exint num) const
void select(GA_GroupType gtype=GA_GROUP_PRIMITIVE) const
UT_SharedPtr< GU_Selection > GU_SelectionHandle
virtual bool cookInputs(const InputParms &parms) const
UT_ErrorManager * error() const
bool hasInput(exint idx) const
const OP_Context & myContext
int sprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
const OP_GraphProxy * graphProxy() const
void select(const GEO_Primitive &prim, bool sel_prim=true, bool add_to_sel=false) const
UT_ErrorSeverity addWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
**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
UT_LockedRawPtr< UT_ErrorManager, OP_Lock > getLockedErrorManager() const
void setCurVertex(int index, GA_Offset off) const
GA_API const UT_StringHolder parms
void select(const GA_Group &group, bool use_gtype=true, bool add_to_sel=false) const
A class holding a VEX function.
UT_ErrorSeverity addWarningFmt(const char *fmt) const
LeafData & operator=(const LeafData &)=delete
OP_API OP_Director * OPgetDirector()
bool selectionEnabled() const
UT_ErrorSeverity addError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
GA_GroupType
An ordinal enum for the different types of groups in GA.
SYS_FORCE_INLINE bool UTisstring(const char *s)
UT_StringHolder formatError(const char *msg) const
Prefix errors so we can get sensible results.
int64 getMemoryUsage(bool inclusive) const
A global error manager scope.
void resetLocalVariableAccessed() const
Tracks if any local variables were accessed by op functions.
const GU_Detail * inputGeo(exint idx) const
void setVariableOrder(int detail, int prim, int pt, int vtx) const
void clearCurVertex(int index) const
UT_StringHolder myPseudoPath
**If you just want to fire and args
SOP_NodeCache * cache() const
fpreal getCookTime() const
CookParms(GU_DetailHandle &destgdh, const UT_Array< GU_ConstDetailHandle > &inputs, OP_CookEngine cookengine, const OP_GraphProxy *graphproxy, OP_GraphProxy::NodeOrIdx nodeoridx, const OP_Context &context, const SOP_NodeParms *parms, SOP_NodeCache *cache, UT_ErrorManager *error, DEP_MicroNode *depnode)
void clearSelection(GA_GroupType gtype) const
UT_ErrorSeverity addErrorFmt(const char *fmt, std::initializer_list< UT::Format::ArgValue > args) const
const NodeExecuteInfo * find(OP_GraphProxy::NodeOrIdx nodeoridx) const
bool wasLocalVariableAccessed() const
UT_ErrorSeverity addMessageFmt(const char *fmt, const Args &...args) const
const UT_Map< const OP_Node *, NodeExecuteInfo > & opNodeMap() const
virtual bool requiresCEFlush() const
const OP_GraphProxy * myGraphProxy
virtual CookMode cookMode(const SOP_NodeParms *parms) const
GU_DetailHandle & gdh() const
The initial state of gdh depends on the cookMode()
UT_ErrorManager * myError
OP_NodeParms * baseAllocParms() const overridefinal