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)
326 , myNode(CAST_SOPNODE(node))
349 template <
typename T>
360 {
return myContext; }
362 {
return myContext.getTime(); }
372 if (idx < 0 || idx >= myInputs.size())
374 return myInputs(idx).isValid();
379 return myInputs(idx).gdp();
384 return myInputs(idx);
391 if (!myExprInputs)
return 0;
392 return myExprInputs->size();
396 if (!myExprInputs)
return false;
397 if (idx < 0 || idx > myExprInputs->size())
return false;
398 return (*myExprInputs)(idx).isValid();
402 if (!hasSpareInput(idx))
return nullptr;
403 return (*myExprInputs)(idx).gdp();
408 return (*myExprInputs)(idx);
411 template <
typename T>
429 *myError, myErrorLock);
434 {
if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
439 {
if (myError)
return getLockedErrorManager()->addMessage(type, code, formatError(msg), loc);
443 {
if (myError)
return getLockedErrorManager()->addWarning(type, code, formatError(msg), loc);
447 {
if (myError)
return getLockedErrorManager()->addError(type, code, formatError(msg), loc);
457 return addMessageFmt(work.
buffer());
459 template<
typename... Args>
461 {
return addMessageFmt(fmt, {args...}); }
469 return addWarningFmt(work.
buffer());
471 template<
typename... Args>
473 {
return addWarningFmt(fmt, {args...}); }
481 return addErrorFmt(work.
buffer());
483 template<
typename... Args>
485 {
return addErrorFmt(fmt, {args...}); }
519 path +=
"(as "; path +=
label; path +=
")";
525 bool borrow_only =
false)
const
526 {
if (myError) getLockedErrorManager()->stealErrors(src,0, -1,
UT_ERROR_NONE, borrow_only); }
530 getNode()->select(gtype); }
533 bool add_to_sel =
false)
const
535 getNode()->select(selection, add_to_sel); }
539 bool add_to_sel =
false)
const
541 getNode()->select(group, use_gtype, add_to_sel); }
544 bool add_to_sel =
false)
const
546 getNode()->select(prim, sel_prim, add_to_sel); }
548 bool add_to_sel =
false)
const
550 getNode()->selectPrimitive(primoff, prim_sel, add_to_sel); }
552 bool add_to_sel =
false)
const
554 getNode()->selectPoint(ptoff, point_sel, add_to_sel); }
556 bool add_to_sel =
false)
const
558 getNode()->selectFrom(prim, sel_prim, add_to_sel); }
560 bool add_to_sel =
false)
const
562 getNode()->selectPointsFrom(ptoff, point_sel, add_to_sel); }
564 bool add_to_sel =
false)
const
566 getNode()->select(range, use_rtype, add_to_sel); }
574 getNode()->selectInputGroup(group, grouptype); }
580 getNode()->clearSelection(); }
587 getNode()->clearSelection(gtype); }
594 return getNode()->destroySelection();
603 return getNode()->getHighlight();
608 {
if (getNode())
return getNode()->setupLocalVars();
return false; }
610 {
if (getNode()) getNode()->resetLocalVarRefs(); }
612 {
if (getNode()) getNode()->setCurGdh(index, gdh); }
614 {
if (getNode()) getNode()->clearCurGdh(index); }
616 {
if (getNode()) getNode()->setCurPoint(index, off); }
618 {
if (getNode()) getNode()->clearCurPoint(index); }
620 {
if (getNode()) getNode()->setCurVertex(index, off); }
622 {
if (getNode()) getNode()->clearCurVertex(index); }
624 {
if (getNode()) getNode()->setCurPrim(index, off); }
626 {
if (getNode()) getNode()->clearCurPrim(index); }
628 {
if (getNode()) getNode()->setCurVertexNum(index, num); }
630 {
if (getNode()) getNode()->clearCurVertexNum(index); }
632 int pt,
int vtx)
const
633 {
if (getNode()) getNode()->setVariableOrder(detail, prim, pt, vtx); }
637 {
if (getNode()) getNode()->myUsesSOPLocalVar =
false; }
639 {
if (!getNode())
return false;
640 return getNode()->myUsesSOPLocalVar; }
660 myNode->getFullPath(fullpath);
661 else if (myPseudoPath.isstring())
662 fullpath.
sprintf(
"<%s>", myPseudoPath.c_str());
664 fullpath =
"<internal>";
665 buf.
sprintf(
"%s: %s", (
const char *) fullpath, msg);
738 virtual bool usesCE()
const {
return false; }
741 virtual void cook(
const CookParms &cookparms)
const = 0;
747 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
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_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
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.
void selectPrimitive(GA_Offset primoff, bool prim_sel=true, bool add_to_sel=false) const
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
SOP_Node * getSrcNode() const
The node that generated this verb, if any...
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
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
int sprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
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