23 namespace SOP_VolumeNormalizeEnums
53 if (volname != src.
volname)
return false;
69 for (
int i = 0; i < list.
entries(); i++)
87 myNumvolumes.setSize(4);
92 myAddRemainder =
false;
108 if (myNumvolumes != src.myNumvolumes)
return false;
109 if (myNorm != src.myNorm)
return false;
110 if (myNorm0Tol != src.myNorm0Tol)
return false;
111 if (myNormalize != src.myNormalize)
return false;
112 if (myThreshold != src.myThreshold)
return false;
113 if (myAddRemainder != src.myAddRemainder)
return false;
114 if (myAbs != src.myAbs)
return false;
115 if (myClampZero != src.myClampZero)
return false;
116 if (myClampOne != src.myClampOne)
return false;
133 graph->
evalOpParm(length, nodeidx,
"numvolumes", time, 0);
134 if (length < 0) length = 0;
135 myNumvolumes.setSize(length);
142 auto && _curentry = myNumvolumes(i);
144 _curentry.volname =
""_UTsh;
146 graph->
evalOpParmInst(_curentry.volname, nodeidx,
"volname#", parmidx, offsets, time, 0, 2-1);
151 myNumvolumes.clear();
154 graph->
evalOpParm(myNorm, nodeidx,
"norm", time, 0);
156 if (
true && ( (
true&&!(((
int64(getNorm())!=0)))) ) )
157 graph->
evalOpParm(myNorm0Tol, nodeidx,
"norm0tol", time, 0);
160 graph->
evalOpParm(myNormalize, nodeidx,
"normalize", time, 0);
161 myThreshold = 0.0001;
163 graph->
evalOpParm(myThreshold, nodeidx,
"threshold", time, 0);
164 myAddRemainder =
false;
166 graph->
evalOpParm(myAddRemainder, nodeidx,
"addremainder", time, 0);
169 graph->
evalOpParm(myAbs, nodeidx,
"abs", time, 0);
172 graph->
evalOpParm(myClampZero, nodeidx,
"clampzero", time, 0);
175 graph->
evalOpParm(myClampOne, nodeidx,
"clampone", time, 0);
191 template <
typename T>
198 if (idx.
size() != instance.
size()+1)
205 else if (instance[0] < myNumvolumes.entries())
207 auto && _data = myNumvolumes(instance[0]);
255 { doGetParmValue(idx, instance, value); }
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 template <
typename T>
284 if (idx.
size() != instance.
size()+1)
293 if (newsize < 0) newsize = 0;
294 myNumvolumes.setSize(newsize);
300 myNumvolumes.setSizeIfNeeded(instance[0]+1);
301 auto && _data = myNumvolumes(instance[0]);
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); }
378 if (fieldnum.
size() < 1)
383 if (fieldnum.
size() == 1)
401 return "addremainder";
415 if (fieldnum.
size() < 1)
416 return PARM_UNSUPPORTED;
420 if (fieldnum.
size() == 1)
421 return PARM_MULTIPARM;
466 {
for (
int r = 0;
r < 2;
r++)
for (
int c = 0; c < 2; c++) is.
bread<
fpreal64>(&v(
r, c), 1); }
468 {
for (
int r = 0;
r < 3;
r++)
for (
int c = 0; c < 3; c++) is.
bread<
fpreal64>(&v(
r, c), 1); }
470 {
for (
int r = 0;
r < 4;
r++)
for (
int c = 0; c < 4; c++) is.
bread<
fpreal64>(&v(
r, c), 1); }
483 loadData(is, rampdata);
501 int typelen = colon - data.
buffer();
515 {
int64 iv =
v; UTwrite(os, &iv); }
517 { UTwrite<fpreal64>(os, &
v); }
519 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
521 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
522 UTwrite<fpreal64>(os, &v.
z()); }
524 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
525 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
537 if (s) s->save(ostr);
539 saveData(os, result);
546 ostr << s->getDataTypeToken();
551 saveData(os, result);
555 void save(std::ostream &os)
const
561 UTwrite(os, &length);
564 auto && _curentry = myNumvolumes(i);
566 saveData(os, _curentry.volname);
570 saveData(os, myNorm);
571 saveData(os, myNorm0Tol);
572 saveData(os, myNormalize);
573 saveData(os, myThreshold);
574 saveData(os, myAddRemainder);
576 saveData(os, myClampZero);
577 saveData(os, myClampOne);
593 myNumvolumes.setSize(length);
596 auto && _curentry = myNumvolumes(i);
598 loadData(is, _curentry.volname);
602 loadData(is, myNorm);
603 loadData(is, myNorm0Tol);
604 loadData(is, myNormalize);
605 loadData(is, myThreshold);
606 loadData(is, myAddRemainder);
608 loadData(is, myClampZero);
609 loadData(is, myClampOne);
619 if (!thissop)
return getNumvolumes().entries();
621 OP_Utils::evalOpParm(result, thissop,
"numvolumes", cookparms.
getCookTime(), 0);
625 {
return opinstNumvolumes_volname(cookparms, &_idx); }
629 if (!thissop)
return (myNumvolumes(_idx[0]).volname);
631 _parmidx[1-1] = _idx[1-1] + 1;
634 OP_Utils::evalOpParmInst(result, thissop,
"volname#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
643 if (!thissop)
return getNorm();
645 OP_Utils::evalOpParm(result, thissop,
"norm", cookparms.
getCookTime(), 0);
653 if (!thissop)
return getNorm0Tol();
655 OP_Utils::evalOpParm(result, thissop,
"norm0tol", cookparms.
getCookTime(), 0);
663 if (!thissop)
return getNormalize();
665 OP_Utils::evalOpParm(result, thissop,
"normalize", cookparms.
getCookTime(), 0);
673 if (!thissop)
return getThreshold();
675 OP_Utils::evalOpParm(result, thissop,
"threshold", cookparms.
getCookTime(), 0);
683 if (!thissop)
return getAddRemainder();
685 OP_Utils::evalOpParm(result, thissop,
"addremainder", cookparms.
getCookTime(), 0);
693 if (!thissop)
return getAbs();
695 OP_Utils::evalOpParm(result, thissop,
"abs", cookparms.
getCookTime(), 0);
703 if (!thissop)
return getClampZero();
705 OP_Utils::evalOpParm(result, thissop,
"clampzero", cookparms.
getCookTime(), 0);
713 if (!thissop)
return getClampOne();
715 OP_Utils::evalOpParm(result, thissop,
"clampone", cookparms.
getCookTime(), 0);
bool operator==(const SOP_VolumeNormalizeParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
GLenum GLuint GLenum GLsizei const GLchar * buf
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
fpreal64 opThreshold(const SOP_NodeVerb::CookParms &cookparms) const
SOP_Node * getNode() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setNorm0Tol(fpreal64 val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
T clampMaxValue(fpreal maxvalue, const T &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void setClampOne(bool val)
exint bread(int32 *buffer, exint asize=1)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
static void saveData(std::ostream &os, UT_Matrix3D v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
exint getNestNumParms(TempIndex idx) const override
static void saveData(std::ostream &os, UT_Matrix2D v)
exint opNumvolumes(const SOP_NodeVerb::CookParms &cookparms) const
bool operator!=(const SOP_VolumeNormalizeParms &src) const
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
Norm opNorm(const SOP_NodeVerb::CookParms &cookparms) const
const OP_Context & context() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
void setAddRemainder(bool val)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
GLuint GLsizei GLsizei * length
An output stream object that owns its own string buffer storage.
void loadFromOpSubclass(const LoadParms &loadparms) override
**But if you need a result
static void loadData(UT_IStream &is, UT_Matrix3D &v)
T clampMinValue(fpreal minvalue, const T &src) const
ParmType getNestParmType(TempIndex fieldnum) const override
static void loadData(UT_IStream &is, UT_Vector4I &v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
bool getAddRemainder() const
constexpr SYS_FORCE_INLINE T & x() noexcept
static void saveData(std::ostream &os, UT_StringHolder s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void copyFrom(const OP_NodeParms *src) override
bool getClampZero() const
SOP_VolumeNormalizeParms()
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
GLuint GLsizei const GLuint const GLintptr * offsets
constexpr SYS_FORCE_INLINE T & x() noexcept
static void saveData(std::ostream &os, PRM_DataItemHandle s)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
bool operator==(const Numvolumes &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
static void saveData(std::ostream &os, UT_Vector3D v)
UT_StringHolder createString(const UT_Array< Numvolumes > &list) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
constexpr SYS_FORCE_INLINE T & z() noexcept
static void saveData(std::ostream &os, int64 v)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
exint read(bool *array, exint sz=1)
const OP_GraphProxy * graph() const
bool isParmColorRamp(exint idx) const override
bool opAbs(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
virtual void evalOpParmInst(int64 &v, NodeIdx node, const char *parmname, const int *inst, const int *offsets, fpreal time, DEP_MicroNode *depnode, int nestlevel=1) const =0
static void saveData(std::ostream &os, UT_Vector2D v)
UT_StringHolder opinstNumvolumes_volname(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setNormalize(bool val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void setClampZero(bool val)
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void loadData(UT_IStream &is, UT_StringHolder &v)
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
static void saveData(std::ostream &os, UT_Vector4D v)
fpreal64 opNorm0Tol(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
static void loadData(UT_IStream &is, UT_Vector2I &v)
exint entries() const
Alias of size(). size() is preferred.
bool operator!=(const Numvolumes &src) const
bool opAddRemainder(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
bool load(UT_IStream &is)
void save(std::ostream &os) const
static void loadData(UT_IStream &is, fpreal64 &v)
void coerceValue(T &result, const S &src) const
static void loadData(UT_IStream &is, UT_Vector3D &v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
bool opClampOne(const SOP_NodeVerb::CookParms &cookparms) const
DEP_MicroNode * depnode() const
static void loadData(UT_IStream &is, UT_Vector3I &v)
bool opClampZero(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opNumvolumes_volname(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void loadData(UT_IStream &is, int64 &v)
bool getNormalize() const
bool opNormalize(const SOP_NodeVerb::CookParms &cookparms) const
Utility class for containing a color ramp.
static void saveData(std::ostream &os, UT_Matrix4D v)
void setNumvolumes(const UT_Array< Numvolumes > &val)
constexpr SYS_FORCE_INLINE T & w() noexcept
SYS_FORCE_INLINE void append(char character)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
fpreal getCookTime() const
void setThreshold(fpreal64 val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static void saveData(std::ostream &os, bool v)
const char * findChar(int c) const
static void saveData(std::ostream &os, fpreal64 v)
fpreal64 getNorm0Tol() const
static void loadData(UT_IStream &is, UT_Vector4D &v)
constexpr SYS_FORCE_INLINE T & y() noexcept
const UT_Array< Numvolumes > & getNumvolumes() const
const char * getNestParmName(TempIndex fieldnum) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
fpreal64 getThreshold() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE bool isstring() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
OP_NodeParms & operator=(const OP_NodeParms &)=default
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
static void loadData(UT_IStream &is, bool &v)
constexpr SYS_FORCE_INLINE T & x() noexcept
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override