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;
129 graph->
evalOpParm(myGroup, nodeidx,
"group", time, 0);
130 mySrcAttrib =
"P"_UTsh;
132 graph->
evalOpParm(mySrcAttrib, nodeidx,
"srcattrib", time, 0);
135 graph->
evalOpParm(mySrcComp, nodeidx,
"srccomp", time, 0);
138 graph->
evalOpParm(myCellStructure, nodeidx,
"cellstructure", time, 0);
141 graph->
evalOpParm(myThreshold, nodeidx,
"threshold", time, 0);
144 graph->
evalOpParm(myGenMinima, nodeidx,
"genminima", time, 0);
145 myMinima =
"minima"_UTsh;
146 if (
true && ( (
true&&!(((getGenMinima()==0)))) ) )
147 graph->
evalOpParm(myMinima, nodeidx,
"minima", time, 0);
150 graph->
evalOpParm(myGenMaxima, nodeidx,
"genmaxima", time, 0);
151 myMaxima =
"maxima"_UTsh;
152 if (
true && ( (
true&&!(((getGenMaxima()==0)))) ) )
153 graph->
evalOpParm(myMaxima, nodeidx,
"maxima", time, 0);
154 myGenSaddleEdges =
false;
156 graph->
evalOpParm(myGenSaddleEdges, nodeidx,
"gensaddleedges", time, 0);
157 mySaddleEdges =
"valleys"_UTsh;
158 if (
true && ( (
true&&!(((getGenSaddleEdges()==0)))) ) )
159 graph->
evalOpParm(mySaddleEdges, nodeidx,
"saddleedges", time, 0);
160 myGenRidgeEdges =
false;
162 graph->
evalOpParm(myGenRidgeEdges, nodeidx,
"genridgeedges", time, 0);
163 myRidgeEdges =
"ridges"_UTsh;
164 if (
true && ( (
true&&!(((getGenRidgeEdges()==0)))) ) )
165 graph->
evalOpParm(myRidgeEdges, nodeidx,
"ridgeedges", time, 0);
166 myGenValleyEdges =
false;
168 graph->
evalOpParm(myGenValleyEdges, nodeidx,
"genvalleyedges", time, 0);
169 myValleyEdges =
"valleys"_UTsh;
170 if (
true && ( (
true&&!(((getGenValleyEdges()==0)))) ) )
171 graph->
evalOpParm(myValleyEdges, nodeidx,
"valleyedges", time, 0);
187 template <
typename T>
194 if (idx.
size() != instance.
size()+1)
199 coerceValue(value, myGroup);
202 coerceValue(value, mySrcAttrib);
205 coerceValue(value, mySrcComp);
208 coerceValue(value, myCellStructure);
211 coerceValue(value, myThreshold);
214 coerceValue(value, myGenMinima);
217 coerceValue(value, myMinima);
220 coerceValue(value, myGenMaxima);
223 coerceValue(value, myMaxima);
226 coerceValue(value, myGenSaddleEdges);
229 coerceValue(value, mySaddleEdges);
232 coerceValue(value, myGenRidgeEdges);
235 coerceValue(value, myRidgeEdges);
238 coerceValue(value, myGenValleyEdges);
241 coerceValue(value, myValleyEdges);
257 { doGetParmValue(idx, instance, value); }
259 { doGetParmValue(idx, instance, value); }
261 { doGetParmValue(idx, instance, value); }
263 { doGetParmValue(idx, instance, value); }
265 { doGetParmValue(idx, instance, value); }
267 { doGetParmValue(idx, instance, value); }
269 { doGetParmValue(idx, instance, value); }
271 { doGetParmValue(idx, instance, value); }
273 { doGetParmValue(idx, instance, value); }
275 { doGetParmValue(idx, instance, value); }
277 { doGetParmValue(idx, instance, value); }
279 template <
typename T>
286 if (idx.
size() != instance.
size()+1)
291 coerceValue(myGroup, ( ( value ) ));
294 coerceValue(mySrcAttrib, ( ( value ) ));
297 coerceValue(mySrcComp, clampMinValue(0, clampMaxValue(2, value ) ));
300 coerceValue(myCellStructure, clampMinValue(0, clampMaxValue(1, value ) ));
303 coerceValue(myThreshold, ( ( value ) ));
306 coerceValue(myGenMinima, ( ( value ) ));
309 coerceValue(myMinima, ( ( value ) ));
312 coerceValue(myGenMaxima, ( ( value ) ));
315 coerceValue(myMaxima, ( ( value ) ));
318 coerceValue(myGenSaddleEdges, ( ( value ) ));
321 coerceValue(mySaddleEdges, ( ( value ) ));
324 coerceValue(myGenRidgeEdges, ( ( value ) ));
327 coerceValue(myRidgeEdges, ( ( value ) ));
330 coerceValue(myGenValleyEdges, ( ( value ) ));
333 coerceValue(myValleyEdges, ( ( value ) ));
340 { doSetParmValue(idx, instance, value); }
342 { doSetParmValue(idx, instance, value); }
344 { doSetParmValue(idx, instance, value); }
346 { doSetParmValue(idx, instance, value); }
348 { doSetParmValue(idx, instance, value); }
350 { doSetParmValue(idx, instance, value); }
352 { doSetParmValue(idx, instance, value); }
354 { doSetParmValue(idx, instance, value); }
356 { doSetParmValue(idx, instance, value); }
358 { doSetParmValue(idx, instance, value); }
360 { doSetParmValue(idx, instance, value); }
376 if (fieldnum.
size() < 1)
387 return "cellstructure";
399 return "gensaddleedges";
401 return "saddleedges";
403 return "genridgeedges";
407 return "genvalleyedges";
409 return "valleyedges";
417 if (fieldnum.
size() < 1)
418 return PARM_UNSUPPORTED;
453 return PARM_UNSUPPORTED;
489 loadData(is, rampdata);
507 int typelen = colon - data.
buffer();
521 {
int64 iv =
v; UTwrite(os, &iv); }
523 { UTwrite<fpreal64>(os, &
v); }
525 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
527 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
528 UTwrite<fpreal64>(os, &v.
z()); }
530 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
531 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
543 if (s) s->save(ostr);
545 saveData(os, result);
552 ostr << s->getDataTypeToken();
557 saveData(os, result);
561 void save(std::ostream &os)
const
565 saveData(os, myGroup);
566 saveData(os, mySrcAttrib);
567 saveData(os, mySrcComp);
568 saveData(os, myCellStructure);
569 saveData(os, myThreshold);
570 saveData(os, myGenMinima);
571 saveData(os, myMinima);
572 saveData(os, myGenMaxima);
573 saveData(os, myMaxima);
574 saveData(os, myGenSaddleEdges);
575 saveData(os, mySaddleEdges);
576 saveData(os, myGenRidgeEdges);
577 saveData(os, myRidgeEdges);
578 saveData(os, myGenValleyEdges);
579 saveData(os, myValleyEdges);
592 loadData(is, myGroup);
593 loadData(is, mySrcAttrib);
594 loadData(is, mySrcComp);
595 loadData(is, myCellStructure);
596 loadData(is, myThreshold);
597 loadData(is, myGenMinima);
598 loadData(is, myMinima);
599 loadData(is, myGenMaxima);
600 loadData(is, myMaxima);
601 loadData(is, myGenSaddleEdges);
602 loadData(is, mySaddleEdges);
603 loadData(is, myGenRidgeEdges);
604 loadData(is, myRidgeEdges);
605 loadData(is, myGenValleyEdges);
606 loadData(is, myValleyEdges);
616 if (!thissop)
return getGroup();
618 OP_Utils::evalOpParm(result, thissop,
"group", cookparms.
getCookTime(), 0);
626 if (!thissop)
return getSrcAttrib();
628 OP_Utils::evalOpParm(result, thissop,
"srcattrib", cookparms.
getCookTime(), 0);
636 if (!thissop)
return getSrcComp();
638 OP_Utils::evalOpParm(result, thissop,
"srccomp", cookparms.
getCookTime(), 0);
646 if (!thissop)
return getCellStructure();
648 OP_Utils::evalOpParm(result, thissop,
"cellstructure", cookparms.
getCookTime(), 0);
656 if (!thissop)
return getThreshold();
658 OP_Utils::evalOpParm(result, thissop,
"threshold", cookparms.
getCookTime(), 0);
666 if (!thissop)
return getGenMinima();
668 OP_Utils::evalOpParm(result, thissop,
"genminima", cookparms.
getCookTime(), 0);
676 if (!thissop)
return getMinima();
678 OP_Utils::evalOpParm(result, thissop,
"minima", cookparms.
getCookTime(), 0);
686 if (!thissop)
return getGenMaxima();
688 OP_Utils::evalOpParm(result, thissop,
"genmaxima", cookparms.
getCookTime(), 0);
696 if (!thissop)
return getMaxima();
698 OP_Utils::evalOpParm(result, thissop,
"maxima", cookparms.
getCookTime(), 0);
706 if (!thissop)
return getGenSaddleEdges();
708 OP_Utils::evalOpParm(result, thissop,
"gensaddleedges", cookparms.
getCookTime(), 0);
716 if (!thissop)
return getSaddleEdges();
718 OP_Utils::evalOpParm(result, thissop,
"saddleedges", cookparms.
getCookTime(), 0);
726 if (!thissop)
return getGenRidgeEdges();
728 OP_Utils::evalOpParm(result, thissop,
"genridgeedges", cookparms.
getCookTime(), 0);
736 if (!thissop)
return getRidgeEdges();
738 OP_Utils::evalOpParm(result, thissop,
"ridgeedges", cookparms.
getCookTime(), 0);
746 if (!thissop)
return getGenValleyEdges();
748 OP_Utils::evalOpParm(result, thissop,
"genvalleyedges", cookparms.
getCookTime(), 0);
756 if (!thissop)
return getValleyEdges();
758 OP_Utils::evalOpParm(result, thissop,
"valleyedges", cookparms.
getCookTime(), 0);
766 int64 myCellStructure;
772 bool myGenSaddleEdges;
774 bool myGenRidgeEdges;
776 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)
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
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
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)
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
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