23 namespace SOP_VolumeNormalizeEnums
37 using namespace UT::Literal;
68 if (volname != src.
volname)
return false;
84 for (
int i = 0; i < list.
entries(); i++)
102 myNumvolumes.setSize(4);
106 myThreshold = 0.0001;
107 myAddRemainder =
false;
123 if (myNumvolumes != src.myNumvolumes)
return false;
124 if (myNorm != src.myNorm)
return false;
125 if (myNorm0Tol != src.myNorm0Tol)
return false;
126 if (myNormalize != src.myNormalize)
return false;
127 if (myThreshold != src.myThreshold)
return false;
128 if (myAddRemainder != src.myAddRemainder)
return false;
129 if (myAbs != src.myAbs)
return false;
130 if (myClampZero != src.myClampZero)
return false;
131 if (myClampOne != src.myClampOne)
return false;
148 graph->
evalOpParm(length, nodeidx,
"numvolumes", time, 0);
149 if (length < 0) length = 0;
150 myNumvolumes.setSize(length);
157 auto && _curentry = myNumvolumes(i);
159 _curentry.volname =
""_UTsh;
161 graph->
evalOpParmInst(_curentry.volname, nodeidx,
"volname#", parmidx, offsets, time, 0, 2-1);
166 myNumvolumes.clear();
169 graph->
evalOpParm(myNorm, nodeidx,
"norm", time, 0);
171 if (
true && ( (
true&&!(((
int64(getNorm())!=0)))) ) )
172 graph->
evalOpParm(myNorm0Tol, nodeidx,
"norm0tol", time, 0);
175 graph->
evalOpParm(myNormalize, nodeidx,
"normalize", time, 0);
176 myThreshold = 0.0001;
178 graph->
evalOpParm(myThreshold, nodeidx,
"threshold", time, 0);
179 myAddRemainder =
false;
181 graph->
evalOpParm(myAddRemainder, nodeidx,
"addremainder", time, 0);
184 graph->
evalOpParm(myAbs, nodeidx,
"abs", time, 0);
187 graph->
evalOpParm(myClampZero, nodeidx,
"clampzero", time, 0);
190 graph->
evalOpParm(myClampOne, nodeidx,
"clampone", time, 0);
206 template <
typename T>
213 if (idx.
size() != instance.
size()+1)
219 coerceValue(value, myNumvolumes.entries());
220 else if (instance[0] < myNumvolumes.entries())
222 auto && _data = myNumvolumes(instance[0]);
226 coerceValue(value, _data.volname);
233 coerceValue(value, myNorm);
236 coerceValue(value, myNorm0Tol);
239 coerceValue(value, myNormalize);
242 coerceValue(value, myThreshold);
245 coerceValue(value, myAddRemainder);
248 coerceValue(value, myAbs);
251 coerceValue(value, myClampZero);
254 coerceValue(value, myClampOne);
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 { doGetParmValue(idx, instance, value); }
284 { doGetParmValue(idx, instance, value); }
286 { doGetParmValue(idx, instance, value); }
288 { doGetParmValue(idx, instance, value); }
290 { doGetParmValue(idx, instance, value); }
292 template <
typename T>
299 if (idx.
size() != instance.
size()+1)
307 coerceValue(newsize, value);
308 if (newsize < 0) newsize = 0;
309 myNumvolumes.setSize(newsize);
315 myNumvolumes.setSizeIfNeeded(instance[0]+1);
316 auto && _data = myNumvolumes(instance[0]);
320 coerceValue(_data.volname, value);
327 coerceValue(myNorm, clampMinValue(0, clampMaxValue(4, value ) ));
330 coerceValue(myNorm0Tol, ( ( value ) ));
333 coerceValue(myNormalize, ( ( value ) ));
336 coerceValue(myThreshold, clampMinValue(0, ( value ) ));
339 coerceValue(myAddRemainder, ( ( value ) ));
342 coerceValue(myAbs, ( ( value ) ));
345 coerceValue(myClampZero, ( ( value ) ));
348 coerceValue(myClampOne, ( ( 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); }
365 { doSetParmValue(idx, instance, value); }
367 { doSetParmValue(idx, instance, value); }
369 { doSetParmValue(idx, instance, value); }
371 { doSetParmValue(idx, instance, value); }
373 { doSetParmValue(idx, instance, value); }
375 { doSetParmValue(idx, instance, value); }
393 if (fieldnum.
size() < 1)
398 if (fieldnum.
size() == 1)
416 return "addremainder";
430 if (fieldnum.
size() < 1)
431 return PARM_UNSUPPORTED;
435 if (fieldnum.
size() == 1)
436 return PARM_MULTIPARM;
443 return PARM_UNSUPPORTED;
462 return PARM_UNSUPPORTED;
498 loadData(is, rampdata);
516 int typelen = colon - data.
buffer();
530 {
int64 iv =
v; UTwrite(os, &iv); }
532 { UTwrite<fpreal64>(os, &
v); }
534 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
536 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
537 UTwrite<fpreal64>(os, &v.
z()); }
539 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
540 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
552 if (s) s->save(ostr);
554 saveData(os, result);
561 ostr << s->getDataTypeToken();
566 saveData(os, result);
570 void save(std::ostream &os)
const
576 UTwrite(os, &length);
579 auto && _curentry = myNumvolumes(i);
581 saveData(os, _curentry.volname);
585 saveData(os, myNorm);
586 saveData(os, myNorm0Tol);
587 saveData(os, myNormalize);
588 saveData(os, myThreshold);
589 saveData(os, myAddRemainder);
591 saveData(os, myClampZero);
592 saveData(os, myClampOne);
608 myNumvolumes.setSize(length);
611 auto && _curentry = myNumvolumes(i);
613 loadData(is, _curentry.volname);
617 loadData(is, myNorm);
618 loadData(is, myNorm0Tol);
619 loadData(is, myNormalize);
620 loadData(is, myThreshold);
621 loadData(is, myAddRemainder);
623 loadData(is, myClampZero);
624 loadData(is, myClampOne);
634 if (!thissop)
return getNumvolumes().entries();
636 OP_Utils::evalOpParm(result, thissop,
"numvolumes", cookparms.
getCookTime(), 0);
640 {
return opinstNumvolumes_volname(cookparms, &_idx); }
644 if (!thissop)
return (myNumvolumes(_idx[0]).volname);
646 _parmidx[1-1] = _idx[1-1] + 1;
649 OP_Utils::evalOpParmInst(result, thissop,
"volname#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
658 if (!thissop)
return getNorm();
660 OP_Utils::evalOpParm(result, thissop,
"norm", cookparms.
getCookTime(), 0);
668 if (!thissop)
return getNorm0Tol();
670 OP_Utils::evalOpParm(result, thissop,
"norm0tol", cookparms.
getCookTime(), 0);
678 if (!thissop)
return getNormalize();
680 OP_Utils::evalOpParm(result, thissop,
"normalize", cookparms.
getCookTime(), 0);
688 if (!thissop)
return getThreshold();
690 OP_Utils::evalOpParm(result, thissop,
"threshold", cookparms.
getCookTime(), 0);
698 if (!thissop)
return getAddRemainder();
700 OP_Utils::evalOpParm(result, thissop,
"addremainder", cookparms.
getCookTime(), 0);
708 if (!thissop)
return getAbs();
710 OP_Utils::evalOpParm(result, thissop,
"abs", cookparms.
getCookTime(), 0);
718 if (!thissop)
return getClampZero();
720 OP_Utils::evalOpParm(result, thissop,
"clampzero", cookparms.
getCookTime(), 0);
728 if (!thissop)
return getClampOne();
730 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
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)
ParmType getNestParmType(TempIndex fieldnum) const override
static void loadData(UT_IStream &is, UT_Vector4I &v)
SYS_FORCE_INLINE UT_StringHolder getToken(Norm enum_value)
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)
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)
LeafData & operator=(const LeafData &)=delete
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
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