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;
151 graph->
evalOpParm(length, nodeidx,
"numvolumes", time, graph->
isDirect()?
nullptr:depnode);
152 if (length < 0) length = 0;
153 myNumvolumes.setSize(length);
160 auto && _curentry = myNumvolumes(i);
162 _curentry.volname =
""_UTsh;
164 graph->
evalOpParmInst(_curentry.volname, nodeidx,
"volname#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
169 myNumvolumes.clear();
174 if (
true && ( (
true&&!(((
int64(getNorm())!=0)))) ) )
175 graph->
evalOpParm(myNorm0Tol, nodeidx,
"norm0tol", time, graph->
isDirect()?
nullptr:depnode);
178 graph->
evalOpParm(myNormalize, nodeidx,
"normalize", time, graph->
isDirect()?
nullptr:depnode);
179 myThreshold = 0.0001;
181 graph->
evalOpParm(myThreshold, nodeidx,
"threshold", time, graph->
isDirect()?
nullptr:depnode);
182 myAddRemainder =
false;
184 graph->
evalOpParm(myAddRemainder, nodeidx,
"addremainder", time, graph->
isDirect()?
nullptr:depnode);
190 graph->
evalOpParm(myClampZero, nodeidx,
"clampzero", time, graph->
isDirect()?
nullptr:depnode);
193 graph->
evalOpParm(myClampOne, nodeidx,
"clampone", time, graph->
isDirect()?
nullptr:depnode);
209 template <
typename T>
216 if (idx.
size() != instance.
size()+1)
222 coerceValue(value, myNumvolumes.entries());
223 else if (instance[0] < myNumvolumes.entries())
225 auto && _data = myNumvolumes(instance[0]);
229 coerceValue(value, _data.volname);
236 coerceValue(value, myNorm);
239 coerceValue(value, myNorm0Tol);
242 coerceValue(value, myNormalize);
245 coerceValue(value, myThreshold);
248 coerceValue(value, myAddRemainder);
251 coerceValue(value, myAbs);
254 coerceValue(value, myClampZero);
257 coerceValue(value, myClampOne);
273 { doGetParmValue(idx, instance, value); }
275 { doGetParmValue(idx, instance, value); }
277 { doGetParmValue(idx, instance, value); }
279 { doGetParmValue(idx, instance, value); }
281 { doGetParmValue(idx, instance, value); }
283 { doGetParmValue(idx, instance, value); }
285 { doGetParmValue(idx, instance, value); }
287 { doGetParmValue(idx, instance, value); }
289 { doGetParmValue(idx, instance, value); }
291 { doGetParmValue(idx, instance, value); }
293 { doGetParmValue(idx, instance, value); }
295 template <
typename T>
302 if (idx.
size() != instance.
size()+1)
310 coerceValue(newsize, value);
311 if (newsize < 0) newsize = 0;
312 myNumvolumes.setSize(newsize);
318 myNumvolumes.setSizeIfNeeded(instance[0]+1);
319 auto && _data = myNumvolumes(instance[0]);
323 coerceValue(_data.volname, value);
330 coerceValue(myNorm, clampMinValue(0, clampMaxValue(4, value ) ));
333 coerceValue(myNorm0Tol, ( ( value ) ));
336 coerceValue(myNormalize, ( ( value ) ));
339 coerceValue(myThreshold, clampMinValue(0, ( value ) ));
342 coerceValue(myAddRemainder, ( ( value ) ));
345 coerceValue(myAbs, ( ( value ) ));
348 coerceValue(myClampZero, ( ( value ) ));
351 coerceValue(myClampOne, ( ( value ) ));
358 { doSetParmValue(idx, instance, value); }
360 { doSetParmValue(idx, instance, value); }
362 { doSetParmValue(idx, instance, value); }
364 { doSetParmValue(idx, instance, value); }
366 { doSetParmValue(idx, instance, value); }
368 { doSetParmValue(idx, instance, value); }
370 { doSetParmValue(idx, instance, value); }
372 { doSetParmValue(idx, instance, value); }
374 { doSetParmValue(idx, instance, value); }
376 { doSetParmValue(idx, instance, value); }
378 { doSetParmValue(idx, instance, value); }
396 if (fieldnum.
size() < 1)
401 if (fieldnum.
size() == 1)
419 return "addremainder";
433 if (fieldnum.
size() < 1)
434 return PARM_UNSUPPORTED;
438 if (fieldnum.
size() == 1)
439 return PARM_MULTIPARM;
446 return PARM_UNSUPPORTED;
465 return PARM_UNSUPPORTED;
501 loadData(is, rampdata);
519 int typelen = colon - data.
buffer();
533 {
int64 iv =
v; UTwrite(os, &iv); }
535 { UTwrite<fpreal64>(os, &
v); }
537 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
539 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
540 UTwrite<fpreal64>(os, &v.
z()); }
542 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
543 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
555 if (s) s->save(ostr);
557 saveData(os, result);
564 ostr << s->getDataTypeToken();
569 saveData(os, result);
573 void save(std::ostream &os)
const
579 UTwrite(os, &length);
582 auto && _curentry = myNumvolumes(i);
584 saveData(os, _curentry.volname);
588 saveData(os, myNorm);
589 saveData(os, myNorm0Tol);
590 saveData(os, myNormalize);
591 saveData(os, myThreshold);
592 saveData(os, myAddRemainder);
594 saveData(os, myClampZero);
595 saveData(os, myClampOne);
611 myNumvolumes.setSize(length);
614 auto && _curentry = myNumvolumes(i);
616 loadData(is, _curentry.volname);
620 loadData(is, myNorm);
621 loadData(is, myNorm0Tol);
622 loadData(is, myNormalize);
623 loadData(is, myThreshold);
624 loadData(is, myAddRemainder);
626 loadData(is, myClampZero);
627 loadData(is, myClampOne);
637 if (!thissop)
return getNumvolumes().entries();
639 OP_Utils::evalOpParm(result, thissop,
"numvolumes", cookparms.
getCookTime(), 0);
643 {
return opinstNumvolumes_volname(cookparms, &_idx); }
647 if (!thissop)
return (myNumvolumes(_idx[0]).volname);
649 _parmidx[1-1] = _idx[1-1] + 1;
652 OP_Utils::evalOpParmInst(result, thissop,
"volname#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
661 if (!thissop)
return getNorm();
663 OP_Utils::evalOpParm(result, thissop,
"norm", cookparms.
getCookTime(), 0);
671 if (!thissop)
return getNorm0Tol();
673 OP_Utils::evalOpParm(result, thissop,
"norm0tol", cookparms.
getCookTime(), 0);
681 if (!thissop)
return getNormalize();
683 OP_Utils::evalOpParm(result, thissop,
"normalize", cookparms.
getCookTime(), 0);
691 if (!thissop)
return getThreshold();
693 OP_Utils::evalOpParm(result, thissop,
"threshold", cookparms.
getCookTime(), 0);
701 if (!thissop)
return getAddRemainder();
703 OP_Utils::evalOpParm(result, thissop,
"addremainder", cookparms.
getCookTime(), 0);
711 if (!thissop)
return getAbs();
713 OP_Utils::evalOpParm(result, thissop,
"abs", cookparms.
getCookTime(), 0);
721 if (!thissop)
return getClampZero();
723 OP_Utils::evalOpParm(result, thissop,
"clampzero", cookparms.
getCookTime(), 0);
731 if (!thissop)
return getClampOne();
733 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
GLsizei const GLfloat * value
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
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)
virtual UT_StringHolder baseGetSignature() const
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
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
const UT_Array< Numvolumes > & getNumvolumes() const
const char * getNestParmName(TempIndex fieldnum) const override
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