14 #ifndef __SOP_NodeVerb_h__
15 #define __SOP_NodeVerb_h__
27 #include <initializer_list>
41 int64 mem = inclusive ?
sizeof(*this) : 0;
42 mem += UTarrayDeepMemoryUsage(stringdata,
false);
69 bool applyGeometryOverrideFromNode(
97 {
return allocCache(); }
99 {
return allocParms(); }
115 myExprInputs.clear();
121 myExprInputs = inputs;
122 myTimeDeps = timedeps;
193 virtual exint nInputs()
const = 0;
200 virtual bool cookInput(
exint idx) = 0;
213 virtual void markInputUnused(
exint idx) = 0;
226 if (idx < 0 || idx >=
nInputs())
228 return myGdps(idx).gdp() !=
nullptr;
241 return myGdps(idx).castAwayConst();
265 , myExprInputs(exprinputs)
283 template <
typename T>
287 template <
typename T>
296 {
return myContext; }
298 {
return myContext.getTime(); }
324 , myExprInputs(nullptr)
325 , myCookEngine(cookengine)
349 template <
typename T>
365 return myNode->getFullPath();
366 if (myPseudoPath.isstring())
368 return "<internal>"_UTsh;
371 {
return myContext; }
373 {
return myContext.getTime(); }
383 if (idx < 0 || idx >= myInputs.size())
385 return myInputs(idx).isValid();
390 return myInputs(idx).gdp();
395 return myInputs(idx);
402 if (!myExprInputs)
return 0;
403 return myExprInputs->size();
407 if (!myExprInputs)
return false;
408 if (idx < 0 || idx > myExprInputs->size())
return false;
409 return (*myExprInputs)(idx).isValid();
413 if (!hasSpareInput(idx))
return nullptr;
414 return (*myExprInputs)(idx).gdp();
419 return (*myExprInputs)(idx);
422 template <
typename T>
440 *myError, myErrorLock);
445 {
if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
450 {
if (myError)
return getLockedErrorManager()->addMessage(type, code, formatError(msg), loc);
454 {
if (myError)
return getLockedErrorManager()->addWarning(type, code, formatError(msg), loc);
458 {
if (myError)
return getLockedErrorManager()->addError(type, code, formatError(msg), loc);
468 return addMessageFmt(work.
buffer());
470 template<
typename... Args>
472 {
return addMessageFmt(fmt, {args...}); }
480 return addWarningFmt(work.
buffer());
482 template<
typename... Args>
484 {
return addWarningFmt(fmt, {args...}); }
492 return addErrorFmt(work.
buffer());
494 template<
typename... Args>
496 {
return addErrorFmt(fmt, {args...}); }
530 path +=
"(as "; path +=
label; path +=
")";
536 bool borrow_only =
false)
const
537 {
if (myError) getLockedErrorManager()->stealErrors(src,0, -1,
UT_ERROR_NONE, borrow_only); }
541 getNode()->select(gtype); }
544 bool add_to_sel =
false)
const
546 getNode()->select(selection, add_to_sel); }
550 bool add_to_sel =
false)
const
552 getNode()->select(group, use_gtype, add_to_sel); }
555 bool add_to_sel =
false)
const
557 getNode()->select(prim, sel_prim, add_to_sel); }
559 bool add_to_sel =
false)
const
561 getNode()->selectPrimitive(primoff, prim_sel, add_to_sel); }
563 bool add_to_sel =
false)
const
565 getNode()->selectPoint(ptoff, point_sel, add_to_sel); }
567 bool add_to_sel =
false)
const
569 getNode()->selectFrom(prim, sel_prim, add_to_sel); }
571 bool add_to_sel =
false)
const
573 getNode()->selectPointsFrom(ptoff, point_sel, add_to_sel); }
575 bool add_to_sel =
false)
const
577 getNode()->select(range, use_rtype, add_to_sel); }
585 getNode()->selectInputGroup(group, grouptype); }
591 getNode()->clearSelection(); }
598 getNode()->clearSelection(gtype); }
605 return getNode()->destroySelection();
614 return getNode()->getHighlight();
619 {
if (getNode())
return getNode()->setupLocalVars();
return false; }
621 {
if (getNode()) getNode()->resetLocalVarRefs(); }
623 {
if (getNode()) getNode()->setCurGdh(index, gdh); }
625 {
if (getNode()) getNode()->clearCurGdh(index); }
627 {
if (getNode()) getNode()->setCurPoint(index, off); }
629 {
if (getNode()) getNode()->clearCurPoint(index); }
631 {
if (getNode()) getNode()->setCurVertex(index, off); }
633 {
if (getNode()) getNode()->clearCurVertex(index); }
635 {
if (getNode()) getNode()->setCurPrim(index, off); }
637 {
if (getNode()) getNode()->clearCurPrim(index); }
639 {
if (getNode()) getNode()->setCurVertexNum(index, num); }
641 {
if (getNode()) getNode()->clearCurVertexNum(index); }
643 int pt,
int vtx)
const
644 {
if (getNode()) getNode()->setVariableOrder(detail, prim, pt, vtx); }
648 {
if (getNode()) getNode()->myUsesSOPLocalVar =
false; }
650 {
if (!getNode())
return false;
651 return getNode()->myUsesSOPLocalVar; }
667 fullpath = getFullPathForDisplay();
668 buf.
sprintf(
"%s: %s", (
const char *) fullpath, msg);
750 virtual bool usesCE()
const {
return false; }
754 virtual void cook(
const CookParms &cookparms)
const = 0;
760 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
SOP_Node * getNode() const
GLuint GLsizei const GLchar * label
const ForbiddenNodeMap * myPrevNodes
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
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.
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.
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)
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
bool destroySelection() const
UT_Array< UT_StringHolder > stringdata
void select(GU_SelectionHandle selection, bool add_to_sel=false) const
virtual bool doExprInputCook() const
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
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.
UT_Map< const OP_Node *, NodeExecuteInfo > ForbiddenNodeMap
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, OP_Node *node, 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
bool wasLocalVariableAccessed() const
UT_ErrorSeverity addMessageFmt(const char *fmt, const Args &...args) const
virtual bool requiresCEFlush() const
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