14 #ifndef __SOP_NodeVerb_h__
15 #define __SOP_NodeVerb_h__
25 #include <initializer_list>
39 int64 mem = inclusive ?
sizeof(*this) : 0;
40 mem += UTarrayDeepMemoryUsage(stringdata,
false);
67 virtual int64 getMemoryUsage(
bool inclusive)
const;
72 void clearVexContext();
101 , myCookEngine(cookengine)
115 template <
typename T>
125 {
if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
127 { addExplicitInput(inp,
true); }
132 {
if (myError)
return myError->addMessage(type, code, formatError(msg), loc);
136 {
if (myError)
return myError->addWarning(type, code, formatError(msg), loc);
140 {
if (myError)
return myError->addError(type, code, formatError(msg), loc);
145 {
return addMessage(
"SOP", code, msg, loc); }
148 {
return addWarning(
"SOP", code, msg, loc); }
151 {
return addError(
"SOP", code, msg, loc); }
154 bool borrow_only =
false)
const
155 {
if (myError) myError->stealErrors(src,0, -1,
UT_ERROR_NONE, borrow_only); }
171 void loadFromOp(
const LoadParms &loadparms);
173 bool applyVexpression(
const char *vexpression,
179 bool applyVexpressionFromNode(
210 { getNestParmValue( {idx}, {},
value ); }
212 { getNestParmValue( {idx}, {},
value ); }
214 { getNestParmValue( {idx}, {},
value ); }
216 { getNestParmValue( {idx}, {},
value ); }
218 { getNestParmValue( {idx}, {},
value ); }
220 { getNestParmValue( {idx}, {},
value ); }
222 { getNestParmValue( {idx}, {},
value ); }
224 { getNestParmValue( {idx}, {},
value ); }
226 { getNestParmValue( {idx}, {},
value ); }
228 { getNestParmValue( {idx}, {},
value ); }
230 { getNestParmValue( {idx}, {},
value ); }
233 { setNestParmValue( {idx}, {},
value ); }
235 { setNestParmValue( {idx}, {},
value ); }
237 { setNestParmValue( {idx}, {},
value ); }
239 { setNestParmValue( {idx}, {},
value ); }
241 { setNestParmValue( {idx}, {},
value ); }
243 { setNestParmValue( {idx}, {},
value ); }
245 { setNestParmValue( {idx}, {},
value ); }
247 { setNestParmValue( {idx}, {},
value ); }
249 { setNestParmValue( {idx}, {},
value ); }
251 { setNestParmValue( {idx}, {},
value ); }
253 { setNestParmValue( {idx}, {},
value ); }
264 myVec = &*list.begin();
267 mySize = list.size();
272 mySize = list.
size();
316 virtual void loadFromOpSubclass(
const LoadParms &loadparms) = 0;
319 template <
typename T,
typename S>
391 template <
typename T>
406 const T *
get()
const {
return myVerb; }
431 myExprInputs.clear();
437 myExprInputs = inputs;
438 myTimeDeps = timedeps;
503 virtual exint nInputs()
const = 0;
510 virtual bool cookInput(
exint idx) = 0;
522 virtual void markInputUnused(
exint idx) = 0;
536 if (idx < 0 || idx >= nInputs())
538 return myGdps(idx).gdp() !=
nullptr;
551 return myGdps(idx).castAwayConst();
558 return inputGeo(idx);
574 , myExprInputs(exprinputs)
588 template <
typename T>
592 template <
typename T>
623 , myCookEngine(cookengine)
624 , myNode(CAST_SOPNODE(node))
642 template <
typename T>
653 {
return myContext; }
655 {
return myContext.getTime(); }
662 if (!myNode)
return true;
663 return myNode->getFlags().getManagesDataIDs();
674 if (idx < 0 || idx >= myInputs.size())
676 return myInputs(idx).isValid();
681 return myInputs(idx).gdp();
686 return myInputs(idx);
689 template <
typename T>
704 {
if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
709 {
if (myError)
return getLockedErrorManager()->addMessage(type, code, formatError(msg), loc);
713 {
if (myError)
return getLockedErrorManager()->addWarning(type, code, formatError(msg), loc);
717 {
if (myError)
return getLockedErrorManager()->addError(type, code, formatError(msg), loc);
722 {
return addMessage(
"SOP", code, msg, loc); }
725 {
return addWarning(
"SOP", code, msg, loc); }
728 {
return addError(
"SOP", code, msg, loc); }
736 path +=
"(as "; path +=
label; path +=
")";
742 bool borrow_only =
false)
const
743 {
if (myError) getLockedErrorManager()->stealErrors(src,0, -1,
UT_ERROR_NONE, borrow_only); }
747 getNode()->select(gtype); }
750 bool add_to_sel =
false)
const
752 getNode()->select(selection, add_to_sel); }
756 bool add_to_sel =
false)
const
758 getNode()->select(group, use_gtype, add_to_sel); }
761 bool add_to_sel =
false)
const
763 getNode()->select(prim, sel_prim, add_to_sel); }
765 bool add_to_sel =
false)
const
767 getNode()->selectPrimitive(primoff, prim_sel, add_to_sel); }
769 bool add_to_sel =
false)
const
771 getNode()->selectPoint(ptoff, point_sel, add_to_sel); }
773 bool add_to_sel =
false)
const
775 getNode()->selectFrom(prim, sel_prim, add_to_sel); }
777 bool add_to_sel =
false)
const
779 getNode()->selectPointsFrom(ptoff, point_sel, add_to_sel); }
781 bool add_to_sel =
false)
const
783 getNode()->select(range, use_rtype, add_to_sel); }
791 getNode()->selectInputGroup(group, grouptype); }
797 getNode()->clearSelection(); }
804 getNode()->clearSelection(gtype); }
811 return getNode()->destroySelection();
820 return getNode()->getHighlight();
825 {
if (getNode())
return getNode()->setupLocalVars();
return false; }
827 {
if (getNode()) getNode()->resetLocalVarRefs(); }
829 {
if (getNode()) getNode()->setCurGdh(index, gdh); }
831 {
if (getNode()) getNode()->clearCurGdh(index); }
833 {
if (getNode()) getNode()->setCurPoint(index, off); }
835 {
if (getNode()) getNode()->clearCurPoint(index); }
837 {
if (getNode()) getNode()->setCurVertex(index, off); }
839 {
if (getNode()) getNode()->clearCurVertex(index); }
841 {
if (getNode()) getNode()->setCurPrim(index, off); }
843 {
if (getNode()) getNode()->clearCurPrim(index); }
845 {
if (getNode()) getNode()->setCurVertexNum(index, num); }
847 {
if (getNode()) getNode()->clearCurVertexNum(index); }
849 int pt,
int vtx)
const
850 {
if (getNode()) getNode()->setVariableOrder(detail, prim, pt, vtx); }
854 {
if (getNode()) getNode()->myUsesSOPLocalVar =
false; }
856 {
if (!getNode())
return false;
857 return getNode()->myUsesSOPLocalVar; }
874 myNode->getFullPath(fullpath);
876 fullpath =
"<internal>";
877 buf.
sprintf(
"%s: %s", (
const char *) fullpath, msg);
887 *myError, myErrorLock);
944 virtual bool usesCE()
const {
return false; }
947 virtual void cook(
const CookParms &cookparms)
const = 0;
953 void notifyGroupParmListeners(
SOP_Node *oldsop,
const OP_Context & myContext
virtual void getParmValue(exint idx, UT_Matrix3D &value) const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const
GT_API const UT_StringHolder selection
const UT_Array< GU_ConstDetailHandle > & exprinputs() const
TempIndex(const UT_ExintArray &list)
void setCurGdh(int index, const GU_DetailHandle &gdh) const
static void registerVerb(SOP_NodeVerb *verb)
SOP_Node * getNode() const
const ForbiddenNodeMap * myPrevNodes
bool getManagesDataIDs() const
DEP_MicroNode * depnode() const
GLuint const GLchar * name
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value)
virtual ParmType getNestParmType(TempIndex idx) const
UT_ErrorSeverity sopAddMessage(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
virtual void getParmValue(exint idx, UT_Vector2D &value) const
virtual void setParmValue(exint idx, const exint &value)
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 void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const
exint operator[](const exint off) const
void clearCurGdh(int index) const
virtual void setParmValue(exint idx, const UT_Vector4D &value)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value)
void stealErrors(UT_ErrorManager &src, bool borrow_only=false) 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.
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const
UT_ErrorSeverity addWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
void clearCurVertexNum(int index) 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 resetLocalVarRefs() const
const SOP_GraphProxy * graph() const
UT_Array< GU_ConstDetailHandle > myExprInputs
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value)
void stealErrors(UT_ErrorManager &src, bool borrow_only=false) const
OP_Node * getCwd() const
The getCwd() should be used to evaluate relative paths.
UT_ErrorSeverity sopAddMessage(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
void select(const GA_Range &range, bool use_rtype=true, bool add_to_sel=false) const
virtual ParmType getParmType(exint idx) const
TempIndex(std::initializer_list< exint > list)
CVEX_Function * myVexFunction
const UT_Array< GU_ConstDetailHandle > & myInputs
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
virtual void setParmValue(exint idx, const UT_Matrix3D &value)
bool setupLocalVars() const
Shims for local variables.
virtual void getParmValue(exint idx, UT_Vector4D &value) const
static void unregisterVerb(SOP_NodeVerb *verb)
GU_DetailHandle & myDestGdh
virtual bool doPartialInputCook() const
virtual void resetLocalVariables(SOP_Node *sop) const
UT_StringHolder myVEXpression
UT_ErrorManager * error() 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 setParmValue(exint idx, const UT_Vector2D &value)
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const
virtual void getParmValue(exint idx, PRM_DataItemHandle &value) const
virtual void getParmValue(exint idx, UT_Matrix4D &value) const
virtual void getParmValue(exint idx, fpreal &value) const
UT_ErrorSeverity addError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value)
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
const exint * begin() const
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
virtual void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
void setCurPrim(int index, GA_Offset off) const
CVEX_Context * myVexContext
bool destroySelection() const
UT_Array< UT_StringHolder > stringdata
void select(GU_SelectionHandle selection, bool add_to_sel=false) const
virtual void setParmValue(exint idx, const fpreal &value)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
void addExplicitInput(DEP_MicroNode &inp)
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const
void selectFrom(const GEO_Primitive &prim, bool sel_prim=true, bool add_to_sel=false) const
UT_ErrorManager * myError
virtual const char * getNestParmName(TempIndex idx) const
void clearSelection() const
virtual bool usesCE() const
SOP_Node * getSrcNode() const
The node that generated this verb, if any...
virtual void setParmValue(exint idx, const UT_Matrix2D &value)
void setCurPoint(int index, GA_Offset off) const
UT_Array< SOP_CVEXDataBacking > myWriteBacking
void selectInputGroup(const GA_Group *group, GA_GroupType grouptype) const
const UT_IntArray & timedeps() const
virtual exint getNumParms() const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const
void setExprInputs(const UT_Array< GU_ConstDetailHandle > &inputs, const UT_IntArray &timedeps)
virtual SOP_NodeCache * allocCache() const
virtual exint getNestNumParms(TempIndex idx) const
void selectPointsFrom(GA_Offset ptoff, bool point_sel=true, bool add_to_sel=false) const
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value)
CookParms(GU_DetailHandle &destgdh, const UT_Array< GU_ConstDetailHandle > &inputs, SOP_CookEngine cookengine, OP_Node *node, const OP_Context &context, const SOP_NodeParms *parms, SOP_NodeCache *cache, UT_ErrorManager *error, DEP_MicroNode *depnode)
const OP_Context & getContext() 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_ErrorSeverity sopAddError(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
void clearCurPrim(int index) const
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value)
virtual void setParmValue(exint idx, const UT_Vector3D &value)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value)
virtual void getParmValue(exint idx, exint &value) const
virtual bool evaluatesParametersDuringCook() const
virtual void getParmValue(exint idx, UT_Vector3D &value) const
void setCurVertexNum(int index, exint num) const
GLuint GLuint GLsizei GLenum type
void select(GA_GroupType gtype=GA_GROUP_PRIMITIVE) const
LoadParms(SOP_NodeParms *parms, SOP_CookEngine cookengine, const SOP_GraphProxy *graph, exint nodeidx, const OP_Context &context, SOP_NodeCache *cache, UT_ErrorManager *error, DEP_MicroNode *depnode)
UT_SharedPtr< GU_Selection > GU_SelectionHandle
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value)
virtual bool cookInputs(const InputParms &parms) const
UT_ErrorManager * error() const
bool hasInput(exint idx) const
GLuint GLsizei GLsizei GLchar * label
virtual void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const
const OP_Context & myContext
int sprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
virtual void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const
DEP_MicroNode * depnode() const
GLsizei const GLchar *const * path
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
UT_LockedRawPtr< UT_ErrorManager, OP_Lock > getLockedErrorManager() const
void setCurVertex(int index, GA_Offset off) const
UT_Array< SOP_CVEXDataBacking > myReadBacking
void select(const GA_Group &group, bool use_gtype=true, bool add_to_sel=false) const
A class holding a VEX function.
virtual void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const
SYS_FORCE_INLINE bool UTisstring(const char *s)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value)
const SOP_GraphProxy * myGraph
SOP_NodeCache * cache() const
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.
virtual const char * getParmName(exint idx) const
UT_Map< const OP_Node *, NodeExecuteInfo > ForbiddenNodeMap
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
SOP_NodeCache * cache() const
fpreal getCookTime() const
virtual void setParmValue(exint idx, const UT_StringHolder &value)
virtual void setParmValue(exint idx, const UT_Matrix4D &value)
void clearSelection(GA_GroupType gtype) const
virtual void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
bool wasLocalVariableAccessed() const
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value)
virtual bool requiresCEFlush() const
virtual void getParmValue(exint idx, UT_Matrix2D &value) const
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
GLenum GLuint GLsizei const GLchar * buf
void coerceValue(T &result, const S &src) const
GLsizei const GLfloat * value
const OP_Context & context() const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
virtual void setParmValue(exint idx, const PRM_DataItemHandle &value)
virtual CookMode cookMode(const SOP_NodeParms *parms) const
void addExplicitInput(DEP_MicroNode &inp, bool check_dup)
Methods to wire directly to the optional depnode.
GU_DetailHandle & gdh() const
The initial state of gdh depends on the cookMode()
UT_ErrorManager * myError
virtual void copyFrom(const SOP_NodeParms *src)
DEP_MicroNode * myDepNode
virtual void getParmValue(exint idx, UT_StringHolder &value) const