20 using namespace UT::Literal;
23 namespace SOP_SwitchIfEnums
135 attribstringcomp = 0;
149 if (expr != src.
expr)
return false;
150 if (attribtype != src.
attribtype)
return false;
152 if (attributes != src.
attributes)
return false;
156 if (attribval != src.
attribval)
return false;
157 if (attribsval != src.
attribsval)
return false;
158 if (counttype != src.
counttype)
return false;
159 if (countgroup != src.
countgroup)
return false;
160 if (countcomp != src.
countcomp)
return false;
161 if (countval != src.
countval)
return false;
177 for (
int i = 0; i < list.
entries(); i++)
223 myMergeCondition = 0;
234 if (myMergeCondition != src.myMergeCondition)
return false;
235 if (myTestInput != src.myTestInput)
return false;
236 if (myTests != src.myTests)
return false;
259 myMergeCondition = 0;
261 graph->
evalOpParm(myMergeCondition, nodeidx,
"mergecondition", time, 0);
264 graph->
evalOpParm(myTestInput, nodeidx,
"testinput", time, 0);
268 graph->
evalOpParm(length, nodeidx,
"tests", time, 0);
269 myTests.entries(length);
273 auto && _curentry = myTests(i);
275 myTests(i).enable =
true;
279 if (
true && ( (!(((_curentry.enable==0)))) ) )
282 if (
true && ( (!(((_curentry.type!=0))||((_curentry.enable==0)))) ) )
283 graph->
evalOpParmInst(myTests(i).expr, nodeidx,
"expr#", &parmidx, time, 0);
284 myTests(i).attribtype = 0;
285 if (
true && ( (!(((_curentry.type!=1))||((_curentry.enable==0)))) ) )
286 graph->
evalOpParmInst(myTests(i).attribtype, nodeidx,
"attribtype#", &parmidx, time, 0);
287 myTests(i).attribowner = 3;
288 if (
true && ( (!(((_curentry.type!=1)&&(_curentry.type!=3))||((_curentry.enable==0)))) ) )
289 graph->
evalOpParmInst(myTests(i).attribowner, nodeidx,
"attribowner#", &parmidx, time, 0);
290 myTests(i).attributes =
""_sh;
291 if (
true && ( (!(((_curentry.type!=1)&&(_curentry.type!=3))||((_curentry.enable==0)))) ) )
292 graph->
evalOpParmInst(myTests(i).attributes, nodeidx,
"attributes#", &parmidx, time, 0);
293 myTests(i).attribvaltype = 0;
294 if (
true && ( (!(((_curentry.type!=3))||((_curentry.enable==0)))) ) )
295 graph->
evalOpParmInst(myTests(i).attribvaltype, nodeidx,
"attribvaltype#", &parmidx, time, 0);
296 myTests(i).attribfloatcomp = 0;
297 if (
true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=0))||((_curentry.enable==0)))) ) )
298 graph->
evalOpParmInst(myTests(i).attribfloatcomp, nodeidx,
"attribfloatcomp#", &parmidx, time, 0);
299 myTests(i).attribstringcomp = 0;
300 if (
true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=1))||((_curentry.enable==0)))) ) )
301 graph->
evalOpParmInst(myTests(i).attribstringcomp, nodeidx,
"attribstringcomp#", &parmidx, time, 0);
302 myTests(i).attribval = 0;
303 if (
true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=0))||((_curentry.enable==0)))) ) )
304 graph->
evalOpParmInst(myTests(i).attribval, nodeidx,
"attribval#", &parmidx, time, 0);
305 myTests(i).attribsval =
""_sh;
306 if (
true && ( (!(((_curentry.type!=3))||((_curentry.attribvaltype!=1))||((_curentry.enable==0)))) ) )
307 graph->
evalOpParmInst(myTests(i).attribsval, nodeidx,
"attribsval#", &parmidx, time, 0);
308 myTests(i).counttype = 0;
309 if (
true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
310 graph->
evalOpParmInst(myTests(i).counttype, nodeidx,
"counttype#", &parmidx, time, 0);
311 myTests(i).countgroup =
""_sh;
312 if (
true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
313 graph->
evalOpParmInst(myTests(i).countgroup, nodeidx,
"countgroup#", &parmidx, time, 0);
314 myTests(i).countcomp = 0;
315 if (
true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
316 graph->
evalOpParmInst(myTests(i).countcomp, nodeidx,
"countcomp#", &parmidx, time, 0);
317 myTests(i).countval = 0;
318 if (
true && ( (!(((_curentry.type!=2))||((_curentry.enable==0)))) ) )
319 graph->
evalOpParmInst(myTests(i).countval, nodeidx,
"countval#", &parmidx, time, 0);
340 template <
typename T>
347 if (idx.
size() != instance.
size()+1)
352 coerceValue(value, myMergeCondition);
355 coerceValue(value, myTestInput);
359 coerceValue(value, myTests.entries());
360 else if (instance[0] < myTests.entries())
362 auto && _data = myTests(instance[0]);
366 coerceValue(value, _data.enable);
369 coerceValue(value, _data.type);
372 coerceValue(value, _data.expr);
375 coerceValue(value, _data.attribtype);
378 coerceValue(value, _data.attribowner);
381 coerceValue(value, _data.attributes);
384 coerceValue(value, _data.attribvaltype);
387 coerceValue(value, _data.attribfloatcomp);
390 coerceValue(value, _data.attribstringcomp);
393 coerceValue(value, _data.attribval);
396 coerceValue(value, _data.attribsval);
399 coerceValue(value, _data.counttype);
402 coerceValue(value, _data.countgroup);
405 coerceValue(value, _data.countcomp);
408 coerceValue(value, _data.countval);
419 { doGetParmValue(idx, instance, value); }
421 { doGetParmValue(idx, instance, value); }
423 { doGetParmValue(idx, instance, value); }
425 { doGetParmValue(idx, instance, value); }
427 { doGetParmValue(idx, instance, value); }
429 { doGetParmValue(idx, instance, value); }
431 { doGetParmValue(idx, instance, value); }
433 { doGetParmValue(idx, instance, value); }
435 { doGetParmValue(idx, instance, value); }
437 { doGetParmValue(idx, instance, value); }
439 { doGetParmValue(idx, instance, value); }
441 template <
typename T>
448 if (idx.
size() != instance.
size()+1)
453 coerceValue(myMergeCondition, value);
456 coerceValue(myTestInput, value);
462 coerceValue(newsize, value);
463 myTests.setSize(newsize);
467 myTests.setSizeIfNeeded(instance[0]+1);
468 auto && _data = myTests(instance[0]);
472 coerceValue(_data.enable, value);
475 coerceValue(_data.type, value);
478 coerceValue(_data.expr, value);
481 coerceValue(_data.attribtype, value);
484 coerceValue(_data.attribowner, value);
487 coerceValue(_data.attributes, value);
490 coerceValue(_data.attribvaltype, value);
493 coerceValue(_data.attribfloatcomp, value);
496 coerceValue(_data.attribstringcomp, value);
499 coerceValue(_data.attribval, value);
502 coerceValue(_data.attribsval, value);
505 coerceValue(_data.counttype, value);
508 coerceValue(_data.countgroup, value);
511 coerceValue(_data.countcomp, value);
514 coerceValue(_data.countval, value);
525 { doSetParmValue(idx, instance, value); }
527 { doSetParmValue(idx, instance, value); }
529 { doSetParmValue(idx, instance, value); }
531 { doSetParmValue(idx, instance, value); }
533 { doSetParmValue(idx, instance, value); }
535 { doSetParmValue(idx, instance, value); }
537 { doSetParmValue(idx, instance, value); }
539 { doSetParmValue(idx, instance, value); }
541 { doSetParmValue(idx, instance, value); }
543 { doSetParmValue(idx, instance, value); }
545 { doSetParmValue(idx, instance, value); }
563 if (fieldnum.
size() < 1)
568 return "mergecondition";
572 if (fieldnum.
size() == 1)
583 return "attribtype#";
585 return "attribowner#";
587 return "attributes#";
589 return "attribvaltype#";
591 return "attribfloatcomp#";
593 return "attribstringcomp#";
597 return "attribsval#";
601 return "countgroup#";
616 if (fieldnum.
size() < 1)
617 return PARM_UNSUPPORTED;
625 if (fieldnum.
size() == 1)
626 return PARM_MULTIPARM;
661 return PARM_UNSUPPORTED;
664 return PARM_UNSUPPORTED;
700 loadData(is, rampdata);
718 int typelen = colon - data.
buffer();
732 {
int64 iv =
v; UTwrite(os, &iv); }
734 { UTwrite<fpreal64>(os, &
v); }
736 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
738 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
739 UTwrite<fpreal64>(os, &v.
z()); }
741 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
742 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
754 if (s) s->save(ostr);
756 saveData(os, result);
763 ostr << s->getDataTypeToken();
768 saveData(os, result);
772 void save(std::ostream &os)
const
776 saveData(os, myMergeCondition);
777 saveData(os, myTestInput);
780 UTwrite(os, &length);
783 saveData(os, myTests(i).
enable);
784 saveData(os, myTests(i).
type);
785 saveData(os, myTests(i).expr);
786 saveData(os, myTests(i).attribtype);
787 saveData(os, myTests(i).attribowner);
788 saveData(os, myTests(i).attributes);
789 saveData(os, myTests(i).attribvaltype);
790 saveData(os, myTests(i).attribfloatcomp);
791 saveData(os, myTests(i).attribstringcomp);
792 saveData(os, myTests(i).attribval);
793 saveData(os, myTests(i).attribsval);
794 saveData(os, myTests(i).counttype);
795 saveData(os, myTests(i).countgroup);
796 saveData(os, myTests(i).countcomp);
797 saveData(os, myTests(i).countval);
813 loadData(is, myMergeCondition);
814 loadData(is, myTestInput);
818 myTests.entries(length);
821 loadData(is, myTests(i).
enable);
822 loadData(is, myTests(i).
type);
823 loadData(is, myTests(i).expr);
824 loadData(is, myTests(i).attribtype);
825 loadData(is, myTests(i).attribowner);
826 loadData(is, myTests(i).attributes);
827 loadData(is, myTests(i).attribvaltype);
828 loadData(is, myTests(i).attribfloatcomp);
829 loadData(is, myTests(i).attribstringcomp);
830 loadData(is, myTests(i).attribval);
831 loadData(is, myTests(i).attribsval);
832 loadData(is, myTests(i).counttype);
833 loadData(is, myTests(i).countgroup);
834 loadData(is, myTests(i).countcomp);
835 loadData(is, myTests(i).countval);
848 if (!thissop)
return getMergeCondition();
850 OP_Utils::evalOpParm(result, thissop,
"mergecondition", cookparms.
getCookTime(), 0);
858 if (!thissop)
return getTestInput();
860 OP_Utils::evalOpParm(result, thissop,
"testinput", cookparms.
getCookTime(), 0);
868 if (!thissop)
return getTests().entries();
870 OP_Utils::evalOpParm(result, thissop,
"tests", cookparms.
getCookTime(), 0);
876 if (!thissop)
return (myTests(_idx).
enable);
877 int _parmidx = _idx + 1;
879 OP_Utils::evalOpParmInst(result, thissop,
"enable#", &_parmidx, cookparms.
getCookTime(), 0);
885 if (!thissop)
return (myTests(_idx).
type);
886 int _parmidx = _idx + 1;
888 OP_Utils::evalOpParmInst(result, thissop,
"type#", &_parmidx, cookparms.
getCookTime(), 0);
894 if (!thissop)
return (myTests(_idx).expr);
895 int _parmidx = _idx + 1;
897 OP_Utils::evalOpParmInst(result, thissop,
"expr#", &_parmidx, cookparms.
getCookTime(), 0);
903 if (!thissop)
return (myTests(_idx).attribtype);
904 int _parmidx = _idx + 1;
906 OP_Utils::evalOpParmInst(result, thissop,
"attribtype#", &_parmidx, cookparms.
getCookTime(), 0);
912 if (!thissop)
return (myTests(_idx).attribowner);
913 int _parmidx = _idx + 1;
915 OP_Utils::evalOpParmInst(result, thissop,
"attribowner#", &_parmidx, cookparms.
getCookTime(), 0);
921 if (!thissop)
return (myTests(_idx).attributes);
922 int _parmidx = _idx + 1;
924 OP_Utils::evalOpParmInst(result, thissop,
"attributes#", &_parmidx, cookparms.
getCookTime(), 0);
930 if (!thissop)
return (myTests(_idx).attribvaltype);
931 int _parmidx = _idx + 1;
933 OP_Utils::evalOpParmInst(result, thissop,
"attribvaltype#", &_parmidx, cookparms.
getCookTime(), 0);
939 if (!thissop)
return (myTests(_idx).attribfloatcomp);
940 int _parmidx = _idx + 1;
942 OP_Utils::evalOpParmInst(result, thissop,
"attribfloatcomp#", &_parmidx, cookparms.
getCookTime(), 0);
948 if (!thissop)
return (myTests(_idx).attribstringcomp);
949 int _parmidx = _idx + 1;
951 OP_Utils::evalOpParmInst(result, thissop,
"attribstringcomp#", &_parmidx, cookparms.
getCookTime(), 0);
957 if (!thissop)
return (myTests(_idx).attribval);
958 int _parmidx = _idx + 1;
960 OP_Utils::evalOpParmInst(result, thissop,
"attribval#", &_parmidx, cookparms.
getCookTime(), 0);
966 if (!thissop)
return (myTests(_idx).attribsval);
967 int _parmidx = _idx + 1;
969 OP_Utils::evalOpParmInst(result, thissop,
"attribsval#", &_parmidx, cookparms.
getCookTime(), 0);
975 if (!thissop)
return (myTests(_idx).counttype);
976 int _parmidx = _idx + 1;
978 OP_Utils::evalOpParmInst(result, thissop,
"counttype#", &_parmidx, cookparms.
getCookTime(), 0);
984 if (!thissop)
return (myTests(_idx).countgroup);
985 int _parmidx = _idx + 1;
987 OP_Utils::evalOpParmInst(result, thissop,
"countgroup#", &_parmidx, cookparms.
getCookTime(), 0);
993 if (!thissop)
return (myTests(_idx).countcomp);
994 int _parmidx = _idx + 1;
996 OP_Utils::evalOpParmInst(result, thissop,
"countcomp#", &_parmidx, cookparms.
getCookTime(), 0);
1002 if (!thissop)
return (myTests(_idx).countval);
1003 int _parmidx = _idx + 1;
1005 OP_Utils::evalOpParmInst(result, thissop,
"countval#", &_parmidx, cookparms.
getCookTime(), 0);
1011 int64 myMergeCondition;
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
const char * getNestParmName(TempIndex fieldnum) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
SOP_Node * getNode() const
static void loadData(UT_IStream &is, UT_StringHolder &v)
exint getNestNumParms(TempIndex idx) const override
UT_StringHolder countgroup
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
exint opTests(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
int64 opTests_countcomp(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
virtual void evalOpParmInst(int64 &v, NodeIdx node, const char *parmname, int *inst, fpreal time, DEP_MicroNode *depnode) const =0
exint bread(int32 *buffer, exint asize=1)
static void loadData(UT_IStream &is, bool &v)
GT_API const UT_StringHolder time
GLuint const GLfloat * val
bool operator==(const Tests &src) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, UT_Vector3D &v)
UT_StringHolder opTests_attribsval(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
const UT_Array< Tests > & getTests() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
int64 opTests_attribtype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
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 buildFromOp(const SOP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
bool operator==(const SOP_SwitchIfParms &src) const
UT_StringHolder opTests_attributes(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void loadFromOpSubclass(const LoadParms &loadparms) override
UT_StringHolder createString(const UT_Array< Tests > &list) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void saveData(std::ostream &os, UT_Matrix2D v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
UT_StringHolder attributes
static void saveData(std::ostream &os, UT_Vector2D v)
static void saveData(std::ostream &os, UT_Matrix3D v)
int64 opTests_attribfloatcomp(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
bool operator!=(const SOP_SwitchIfParms &src) const
MergeCondition getMergeCondition() const
void setMergeCondition(MergeCondition val)
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
GLint GLenum GLsizei GLint GLsizei const void * data
exint read(bool *array, exint sz=1)
static void saveData(std::ostream &os, UT_Vector3D v)
int64 opTests_type(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opTests_counttype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
GLuint GLsizei GLsizei * length
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
static void saveData(std::ostream &os, UT_Vector4D v)
MergeCondition opMergeCondition(const SOP_NodeVerb::CookParms &cookparms) const
GLuint GLuint GLsizei GLenum type
void setTests(const UT_Array< Tests > &val)
TestInput getTestInput() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
SYS_FORCE_INLINE void strcat(const char *src)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void saveData(std::ostream &os, fpreal64 v)
void saveBinary(std::ostream &os) const
Save string to binary stream.
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
UT_StringHolder opTests_countgroup(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opTests_attribstringcomp(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
int64 opTests_countval(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
bool opTests_enable(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
exint entries() const
Alias of size(). size() is preferred.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
int64 opTests_attribowner(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
int64 opTests_attribvaltype(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
fpreal64 opTests_attribval(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
TestInput opTestInput(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, bool v)
ParmType getNestParmType(TempIndex fieldnum) const override
bool operator!=(const Tests &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setTestInput(TestInput val)
static void saveData(std::ostream &os, int64 v)
bool load(UT_IStream &is)
Utility class for containing a color ramp.
UT_StringHolder attribsval
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void loadData(UT_IStream &is, fpreal64 &v)
SYS_FORCE_INLINE void append(char character)
static void saveData(std::ostream &os, UT_Matrix4D v)
GLdouble GLdouble GLdouble r
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
~SOP_SwitchIfParms() override
static void saveData(std::ostream &os, UT_StringHolder s)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
fpreal getCookTime() const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void copyFrom(const SOP_NodeParms *src) override
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void save(std::ostream &os) const
const char * findChar(int c) const
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, int64 &v)
GLenum GLuint GLsizei const GLchar * buf
GLsizei const GLfloat * value
const OP_Context & context() const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
int64 opTests_expr(const SOP_NodeVerb::CookParms &cookparms, exint _idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, UT_Matrix2D &v)
SYS_FORCE_INLINE bool isstring() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)