23 namespace SOP_WatershedEnums
35 using namespace UT::Literal;
53 using namespace UT::Literal;
72 mySrcAttrib =
"P"_UTsh;
77 myMinima =
"minima"_UTsh;
79 myMaxima =
"maxima"_UTsh;
80 myGenSaddleEdges =
false;
81 mySaddleEdges =
"valleys"_UTsh;
82 myGenRidgeEdges =
false;
83 myRidgeEdges =
"ridges"_UTsh;
84 myGenValleyEdges =
false;
85 myValleyEdges =
"valleys"_UTsh;
98 if (myGroup != src.myGroup)
return false;
99 if (mySrcAttrib != src.mySrcAttrib)
return false;
100 if (mySrcComp != src.mySrcComp)
return false;
101 if (myCellStructure != src.myCellStructure)
return false;
102 if (myThreshold != src.myThreshold)
return false;
103 if (myGenMinima != src.myGenMinima)
return false;
104 if (myMinima != src.myMinima)
return false;
105 if (myGenMaxima != src.myGenMaxima)
return false;
106 if (myMaxima != src.myMaxima)
return false;
107 if (myGenSaddleEdges != src.myGenSaddleEdges)
return false;
108 if (mySaddleEdges != src.mySaddleEdges)
return false;
109 if (myGenRidgeEdges != src.myGenRidgeEdges)
return false;
110 if (myRidgeEdges != src.myRidgeEdges)
return false;
111 if (myGenValleyEdges != src.myGenValleyEdges)
return false;
112 if (myValleyEdges != src.myValleyEdges)
return false;
132 graph->
evalOpParm(myGroup, nodeidx,
"group", time, graph->
isDirect()?
nullptr:depnode);
133 mySrcAttrib =
"P"_UTsh;
135 graph->
evalOpParm(mySrcAttrib, nodeidx,
"srcattrib", time, graph->
isDirect()?
nullptr:depnode);
138 graph->
evalOpParm(mySrcComp, nodeidx,
"srccomp", time, graph->
isDirect()?
nullptr:depnode);
141 graph->
evalOpParm(myCellStructure, nodeidx,
"cellstructure", time, graph->
isDirect()?
nullptr:depnode);
144 graph->
evalOpParm(myThreshold, nodeidx,
"threshold", time, graph->
isDirect()?
nullptr:depnode);
147 graph->
evalOpParm(myGenMinima, nodeidx,
"genminima", time, graph->
isDirect()?
nullptr:depnode);
148 myMinima =
"minima"_UTsh;
149 if (
true && ( (
true&&!(((getGenMinima()==0)))) ) )
150 graph->
evalOpParm(myMinima, nodeidx,
"minima", time, graph->
isDirect()?
nullptr:depnode);
153 graph->
evalOpParm(myGenMaxima, nodeidx,
"genmaxima", time, graph->
isDirect()?
nullptr:depnode);
154 myMaxima =
"maxima"_UTsh;
155 if (
true && ( (
true&&!(((getGenMaxima()==0)))) ) )
156 graph->
evalOpParm(myMaxima, nodeidx,
"maxima", time, graph->
isDirect()?
nullptr:depnode);
157 myGenSaddleEdges =
false;
159 graph->
evalOpParm(myGenSaddleEdges, nodeidx,
"gensaddleedges", time, graph->
isDirect()?
nullptr:depnode);
160 mySaddleEdges =
"valleys"_UTsh;
161 if (
true && ( (
true&&!(((getGenSaddleEdges()==0)))) ) )
162 graph->
evalOpParm(mySaddleEdges, nodeidx,
"saddleedges", time, graph->
isDirect()?
nullptr:depnode);
163 myGenRidgeEdges =
false;
165 graph->
evalOpParm(myGenRidgeEdges, nodeidx,
"genridgeedges", time, graph->
isDirect()?
nullptr:depnode);
166 myRidgeEdges =
"ridges"_UTsh;
167 if (
true && ( (
true&&!(((getGenRidgeEdges()==0)))) ) )
168 graph->
evalOpParm(myRidgeEdges, nodeidx,
"ridgeedges", time, graph->
isDirect()?
nullptr:depnode);
169 myGenValleyEdges =
false;
171 graph->
evalOpParm(myGenValleyEdges, nodeidx,
"genvalleyedges", time, graph->
isDirect()?
nullptr:depnode);
172 myValleyEdges =
"valleys"_UTsh;
173 if (
true && ( (
true&&!(((getGenValleyEdges()==0)))) ) )
174 graph->
evalOpParm(myValleyEdges, nodeidx,
"valleyedges", time, graph->
isDirect()?
nullptr:depnode);
190 template <
typename T>
197 if (idx.
size() != instance.
size()+1)
202 coerceValue(value, myGroup);
205 coerceValue(value, mySrcAttrib);
208 coerceValue(value, mySrcComp);
211 coerceValue(value, myCellStructure);
214 coerceValue(value, myThreshold);
217 coerceValue(value, myGenMinima);
220 coerceValue(value, myMinima);
223 coerceValue(value, myGenMaxima);
226 coerceValue(value, myMaxima);
229 coerceValue(value, myGenSaddleEdges);
232 coerceValue(value, mySaddleEdges);
235 coerceValue(value, myGenRidgeEdges);
238 coerceValue(value, myRidgeEdges);
241 coerceValue(value, myGenValleyEdges);
244 coerceValue(value, myValleyEdges);
260 { doGetParmValue(idx, instance, value); }
262 { doGetParmValue(idx, instance, value); }
264 { doGetParmValue(idx, instance, value); }
266 { doGetParmValue(idx, instance, value); }
268 { doGetParmValue(idx, instance, value); }
270 { doGetParmValue(idx, instance, value); }
272 { doGetParmValue(idx, instance, value); }
274 { doGetParmValue(idx, instance, value); }
276 { doGetParmValue(idx, instance, value); }
278 { doGetParmValue(idx, instance, value); }
280 { doGetParmValue(idx, instance, value); }
282 template <
typename T>
289 if (idx.
size() != instance.
size()+1)
294 coerceValue(myGroup, ( ( value ) ));
297 coerceValue(mySrcAttrib, ( ( value ) ));
300 coerceValue(mySrcComp, clampMinValue(0, clampMaxValue(2, value ) ));
303 coerceValue(myCellStructure, clampMinValue(0, clampMaxValue(1, value ) ));
306 coerceValue(myThreshold, ( ( value ) ));
309 coerceValue(myGenMinima, ( ( value ) ));
312 coerceValue(myMinima, ( ( value ) ));
315 coerceValue(myGenMaxima, ( ( value ) ));
318 coerceValue(myMaxima, ( ( value ) ));
321 coerceValue(myGenSaddleEdges, ( ( value ) ));
324 coerceValue(mySaddleEdges, ( ( value ) ));
327 coerceValue(myGenRidgeEdges, ( ( value ) ));
330 coerceValue(myRidgeEdges, ( ( value ) ));
333 coerceValue(myGenValleyEdges, ( ( value ) ));
336 coerceValue(myValleyEdges, ( ( value ) ));
343 { doSetParmValue(idx, instance, value); }
345 { doSetParmValue(idx, instance, value); }
347 { doSetParmValue(idx, instance, value); }
349 { doSetParmValue(idx, instance, value); }
351 { doSetParmValue(idx, instance, value); }
353 { doSetParmValue(idx, instance, value); }
355 { doSetParmValue(idx, instance, value); }
357 { doSetParmValue(idx, instance, value); }
359 { doSetParmValue(idx, instance, value); }
361 { doSetParmValue(idx, instance, value); }
363 { doSetParmValue(idx, instance, value); }
379 if (fieldnum.
size() < 1)
390 return "cellstructure";
402 return "gensaddleedges";
404 return "saddleedges";
406 return "genridgeedges";
410 return "genvalleyedges";
412 return "valleyedges";
420 if (fieldnum.
size() < 1)
421 return PARM_UNSUPPORTED;
456 return PARM_UNSUPPORTED;
492 loadData(is, rampdata);
510 int typelen = colon - data.
buffer();
524 {
int64 iv =
v; UTwrite(os, &iv); }
526 { UTwrite<fpreal64>(os, &
v); }
528 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
530 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
531 UTwrite<fpreal64>(os, &v.
z()); }
533 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
534 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
546 if (s) s->save(ostr);
548 saveData(os, result);
555 ostr << s->getDataTypeToken();
560 saveData(os, result);
564 void save(std::ostream &os)
const
568 saveData(os, myGroup);
569 saveData(os, mySrcAttrib);
570 saveData(os, mySrcComp);
571 saveData(os, myCellStructure);
572 saveData(os, myThreshold);
573 saveData(os, myGenMinima);
574 saveData(os, myMinima);
575 saveData(os, myGenMaxima);
576 saveData(os, myMaxima);
577 saveData(os, myGenSaddleEdges);
578 saveData(os, mySaddleEdges);
579 saveData(os, myGenRidgeEdges);
580 saveData(os, myRidgeEdges);
581 saveData(os, myGenValleyEdges);
582 saveData(os, myValleyEdges);
595 loadData(is, myGroup);
596 loadData(is, mySrcAttrib);
597 loadData(is, mySrcComp);
598 loadData(is, myCellStructure);
599 loadData(is, myThreshold);
600 loadData(is, myGenMinima);
601 loadData(is, myMinima);
602 loadData(is, myGenMaxima);
603 loadData(is, myMaxima);
604 loadData(is, myGenSaddleEdges);
605 loadData(is, mySaddleEdges);
606 loadData(is, myGenRidgeEdges);
607 loadData(is, myRidgeEdges);
608 loadData(is, myGenValleyEdges);
609 loadData(is, myValleyEdges);
619 if (!thissop)
return getGroup();
621 OP_Utils::evalOpParm(result, thissop,
"group", cookparms.
getCookTime(), 0);
629 if (!thissop)
return getSrcAttrib();
631 OP_Utils::evalOpParm(result, thissop,
"srcattrib", cookparms.
getCookTime(), 0);
639 if (!thissop)
return getSrcComp();
641 OP_Utils::evalOpParm(result, thissop,
"srccomp", cookparms.
getCookTime(), 0);
649 if (!thissop)
return getCellStructure();
651 OP_Utils::evalOpParm(result, thissop,
"cellstructure", cookparms.
getCookTime(), 0);
659 if (!thissop)
return getThreshold();
661 OP_Utils::evalOpParm(result, thissop,
"threshold", cookparms.
getCookTime(), 0);
669 if (!thissop)
return getGenMinima();
671 OP_Utils::evalOpParm(result, thissop,
"genminima", cookparms.
getCookTime(), 0);
679 if (!thissop)
return getMinima();
681 OP_Utils::evalOpParm(result, thissop,
"minima", cookparms.
getCookTime(), 0);
689 if (!thissop)
return getGenMaxima();
691 OP_Utils::evalOpParm(result, thissop,
"genmaxima", cookparms.
getCookTime(), 0);
699 if (!thissop)
return getMaxima();
701 OP_Utils::evalOpParm(result, thissop,
"maxima", cookparms.
getCookTime(), 0);
709 if (!thissop)
return getGenSaddleEdges();
711 OP_Utils::evalOpParm(result, thissop,
"gensaddleedges", cookparms.
getCookTime(), 0);
719 if (!thissop)
return getSaddleEdges();
721 OP_Utils::evalOpParm(result, thissop,
"saddleedges", cookparms.
getCookTime(), 0);
729 if (!thissop)
return getGenRidgeEdges();
731 OP_Utils::evalOpParm(result, thissop,
"genridgeedges", cookparms.
getCookTime(), 0);
739 if (!thissop)
return getRidgeEdges();
741 OP_Utils::evalOpParm(result, thissop,
"ridgeedges", cookparms.
getCookTime(), 0);
749 if (!thissop)
return getGenValleyEdges();
751 OP_Utils::evalOpParm(result, thissop,
"genvalleyedges", cookparms.
getCookTime(), 0);
759 if (!thissop)
return getValleyEdges();
761 OP_Utils::evalOpParm(result, thissop,
"valleyedges", cookparms.
getCookTime(), 0);
769 int64 myCellStructure;
775 bool myGenSaddleEdges;
777 bool myGenRidgeEdges;
779 bool myGenValleyEdges;
void setMaxima(const UT_StringHolder &val)
UT_StringHolder opRidgeEdges(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Matrix4D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
void copyFrom(const OP_NodeParms *src) override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
SOP_Node * getNode() const
CellStructure opCellStructure(const SOP_NodeVerb::CookParms &cookparms) const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
bool getGenSaddleEdges() const
static void loadData(UT_IStream &is, int64 &v)
void setMinima(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void save(std::ostream &os) const
bool load(UT_IStream &is)
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
void setThreshold(fpreal64 val)
GLsizei const GLfloat * value
const UT_StringHolder & getSaddleEdges() const
UT_StringHolder opMaxima(const SOP_NodeVerb::CookParms &cookparms) const
const OP_Context & context() const
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
bool opGenMinima(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
An output stream object that owns its own string buffer storage.
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
static void loadData(UT_IStream &is, bool &v)
**But if you need a result
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
static void saveData(std::ostream &os, bool v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void saveData(std::ostream &os, UT_Vector4D v)
void setGenSaddleEdges(bool val)
constexpr SYS_FORCE_INLINE T & x() noexcept
const UT_StringHolder & getSrcAttrib() const
bool getGenMaxima() const
bool getGenValleyEdges() const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
bool operator==(const SOP_WatershedParms &src) const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
constexpr SYS_FORCE_INLINE T & x() noexcept
bool opGenValleyEdges(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Matrix3D v)
void setSrcComp(SrcComp val)
static void loadData(UT_IStream &is, UT_Vector4I &v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
CellStructure getCellStructure() const
bool operator!=(const SOP_WatershedParms &src) const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_StringHolder s)
bool getGenMinima() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
const UT_StringHolder & getMinima() const
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void setGenMinima(bool val)
bool isParmColorRamp(exint idx) const override
static void loadData(UT_IStream &is, fpreal64 &v)
UT_StringHolder opSaddleEdges(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
constexpr SYS_FORCE_INLINE T & z() noexcept
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
bool opGenMaxima(const SOP_NodeVerb::CookParms &cookparms) const
SrcComp getSrcComp() const
const OP_GraphProxy * graph() const
void setRidgeEdges(const UT_StringHolder &val)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setGenMaxima(bool val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void loadFromOpSubclass(const LoadParms &loadparms) override
static void saveData(std::ostream &os, fpreal64 v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
fpreal64 getThreshold() const
void setValleyEdges(const UT_StringHolder &val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
const char * getNestParmName(TempIndex fieldnum) const override
void setCellStructure(CellStructure val)
void saveBinary(std::ostream &os) const
Save string to binary stream.
static void saveData(std::ostream &os, int64 v)
void setSaddleEdges(const UT_StringHolder &val)
void setGenValleyEdges(bool val)
GT_API const UT_StringHolder version
void setSrcAttrib(const UT_StringHolder &val)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
DEP_MicroNode * depnode() const
const UT_StringHolder & getMaxima() const
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
const UT_StringHolder & getGroup() const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
constexpr SYS_FORCE_INLINE T & w() noexcept
fpreal64 opThreshold(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opValleyEdges(const SOP_NodeVerb::CookParms &cookparms) const
virtual UT_StringHolder baseGetSignature() const
const UT_StringHolder & getValleyEdges() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
const UT_StringHolder & getRidgeEdges() const
fpreal getCookTime() const
bool opGenSaddleEdges(const SOP_NodeVerb::CookParms &cookparms) const
SrcComp opSrcComp(const SOP_NodeVerb::CookParms &cookparms) const
const char * findChar(int c) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
bool opGenRidgeEdges(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool getGenRidgeEdges() const
constexpr SYS_FORCE_INLINE T & y() noexcept
static void saveData(std::ostream &os, UT_Vector2D v)
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
UT_StringHolder opSrcAttrib(const SOP_NodeVerb::CookParms &cookparms) const
void setGenRidgeEdges(bool val)
SYS_FORCE_INLINE UT_StringHolder getToken(SrcComp enum_value)
static void saveData(std::ostream &os, UT_Matrix2D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void setGroup(const UT_StringHolder &val)
ParmType getNestParmType(TempIndex fieldnum) const override
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE bool isstring() const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
exint getNestNumParms(TempIndex idx) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
UT_StringHolder opMinima(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & x() noexcept