23 namespace SOP_GroupPromoteEnums
37 using namespace UT::Literal;
59 using namespace UT::Literal;
104 onlyboundary =
false;
105 includeunshared =
true;
106 includecurveunshared =
true;
107 useconnectivityattrib =
false;
108 connectivityattrib =
"uv"_UTsh;
109 primsbyattribbndpts =
false;
111 onlyprimsedge =
false;
119 if (enable != src.
enable)
return false;
120 if (fromtype != src.
fromtype)
return false;
121 if (totype != src.
totype)
return false;
122 if (group != src.
group)
return false;
123 if (newname != src.
newname)
return false;
124 if (preserve != src.
preserve)
return false;
131 if (onlyfull != src.
onlyfull)
return false;
134 if (toattrib != src.
toattrib)
return false;
150 for (
int i = 0; i < list.
entries(); i++)
156 buf.
appendSprintf(
"%s", (list(i).enable) ?
"true" :
"false");
166 buf.
appendSprintf(
"%s", (list(i).preserve) ?
"true" :
"false");
168 buf.
appendSprintf(
"%s", (list(i).onlyboundary) ?
"true" :
"false");
170 buf.
appendSprintf(
"%s", (list(i).includeunshared) ?
"true" :
"false");
172 buf.
appendSprintf(
"%s", (list(i).includecurveunshared) ?
"true" :
"false");
174 buf.
appendSprintf(
"%s", (list(i).useconnectivityattrib) ?
"true" :
"false");
178 buf.
appendSprintf(
"%s", (list(i).primsbyattribbndpts) ?
"true" :
"false");
180 buf.
appendSprintf(
"%s", (list(i).onlyfull) ?
"true" :
"false");
182 buf.
appendSprintf(
"%s", (list(i).onlyprimsedge) ?
"true" :
"false");
184 buf.
appendSprintf(
"%s", (list(i).removedegen) ?
"true" :
"false");
186 buf.
appendSprintf(
"%s", (list(i).toattrib) ?
"true" :
"false");
198 myPromotions.setSize(1);
211 if (myPromotions != src.myPromotions)
return false;
229 graph->
evalOpParm(length, nodeidx,
"promotions", time, 0);
230 if (length < 0) length = 0;
231 myPromotions.setSize(length);
238 auto && _curentry = myPromotions(i);
240 _curentry.enable =
true;
242 graph->
evalOpParmInst(_curentry.enable, nodeidx,
"enable#", parmidx, offsets, time, 0, 2-1);
243 _curentry.fromtype = 0;
244 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
245 graph->
evalOpParmInst(_curentry.fromtype, nodeidx,
"fromtype#", parmidx, offsets, time, 0, 2-1);
246 _curentry.totype = 1;
247 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
248 graph->
evalOpParmInst(_curentry.totype, nodeidx,
"totype#", parmidx, offsets, time, 0, 2-1);
249 _curentry.group =
""_UTsh;
250 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
251 graph->
evalOpParmInst(_curentry.group, nodeidx,
"group#", parmidx, offsets, time, 0, 2-1);
252 _curentry.newname =
""_UTsh;
253 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
254 graph->
evalOpParmInst(_curentry.newname, nodeidx,
"newname#", parmidx, offsets, time, 0, 2-1);
255 _curentry.preserve =
false;
256 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
257 graph->
evalOpParmInst(_curentry.preserve, nodeidx,
"preserve#", parmidx, offsets, time, 0, 2-1);
258 _curentry.onlyboundary =
false;
259 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
260 graph->
evalOpParmInst(_curentry.onlyboundary, nodeidx,
"onlyboundary#", parmidx, offsets, time, 0, 2-1);
261 _curentry.includeunshared =
true;
262 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
263 graph->
evalOpParmInst(_curentry.includeunshared, nodeidx,
"includeunshared#", parmidx, offsets, time, 0, 2-1);
264 _curentry.includecurveunshared =
true;
265 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.includeunshared==0)))) ) )
266 graph->
evalOpParmInst(_curentry.includecurveunshared, nodeidx,
"includecurveunshared#", parmidx, offsets, time, 0, 2-1);
267 _curentry.useconnectivityattrib =
false;
268 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
269 graph->
evalOpParmInst(_curentry.useconnectivityattrib, nodeidx,
"useconnectivityattrib#", parmidx, offsets, time, 0, 2-1);
270 _curentry.connectivityattrib =
"uv"_UTsh;
271 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.useconnectivityattrib==0)))) ) )
272 graph->
evalOpParmInst(_curentry.connectivityattrib, nodeidx,
"connectivityattrib#", parmidx, offsets, time, 0, 2-1);
273 _curentry.primsbyattribbndpts =
false;
274 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.totype!=0)))) ) )
275 graph->
evalOpParmInst(_curentry.primsbyattribbndpts, nodeidx,
"primsbyattribbndpts#", parmidx, offsets, time, 0, 2-1);
276 _curentry.onlyfull =
false;
277 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype==1))||((_curentry.onlyboundary==1)))) ) )
278 graph->
evalOpParmInst(_curentry.onlyfull, nodeidx,
"onlyfull#", parmidx, offsets, time, 0, 2-1);
279 _curentry.onlyprimsedge =
false;
280 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype!=0))||((_curentry.fromtype==1))||((_curentry.onlyboundary==1))||((_curentry.onlyfull==1)))) ) )
281 graph->
evalOpParmInst(_curentry.onlyprimsedge, nodeidx,
"onlyprimsedge#", parmidx, offsets, time, 0, 2-1);
282 _curentry.removedegen =
false;
283 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype==0)))) ) )
284 graph->
evalOpParmInst(_curentry.removedegen, nodeidx,
"removedegen#", parmidx, offsets, time, 0, 2-1);
285 _curentry.toattrib =
false;
286 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype==2)))) ) )
287 graph->
evalOpParmInst(_curentry.toattrib, nodeidx,
"toattrib#", parmidx, offsets, time, 0, 2-1);
292 myPromotions.clear();
308 template <
typename T>
315 if (idx.
size() != instance.
size()+1)
321 coerceValue(value, myPromotions.entries());
322 else if (instance[0] < myPromotions.entries())
324 auto && _data = myPromotions(instance[0]);
328 coerceValue(value, _data.enable);
331 coerceValue(value, _data.fromtype);
334 coerceValue(value, _data.totype);
337 coerceValue(value, _data.group);
340 coerceValue(value, _data.newname);
343 coerceValue(value, _data.preserve);
346 coerceValue(value, _data.onlyboundary);
349 coerceValue(value, _data.includeunshared);
352 coerceValue(value, _data.includecurveunshared);
355 coerceValue(value, _data.useconnectivityattrib);
358 coerceValue(value, _data.connectivityattrib);
361 coerceValue(value, _data.primsbyattribbndpts);
364 coerceValue(value, _data.onlyfull);
367 coerceValue(value, _data.onlyprimsedge);
370 coerceValue(value, _data.removedegen);
373 coerceValue(value, _data.toattrib);
393 { doGetParmValue(idx, instance, value); }
395 { doGetParmValue(idx, instance, value); }
397 { doGetParmValue(idx, instance, value); }
399 { doGetParmValue(idx, instance, value); }
401 { doGetParmValue(idx, instance, value); }
403 { doGetParmValue(idx, instance, value); }
405 { doGetParmValue(idx, instance, value); }
407 { doGetParmValue(idx, instance, value); }
409 { doGetParmValue(idx, instance, value); }
411 { doGetParmValue(idx, instance, value); }
413 { doGetParmValue(idx, instance, value); }
415 template <
typename T>
422 if (idx.
size() != instance.
size()+1)
430 coerceValue(newsize, value);
431 if (newsize < 0) newsize = 0;
432 myPromotions.setSize(newsize);
438 myPromotions.setSizeIfNeeded(instance[0]+1);
439 auto && _data = myPromotions(instance[0]);
443 coerceValue(_data.enable, value);
446 coerceValue(_data.fromtype, value);
449 coerceValue(_data.totype, value);
452 coerceValue(_data.group, value);
455 coerceValue(_data.newname, value);
458 coerceValue(_data.preserve, value);
461 coerceValue(_data.onlyboundary, value);
464 coerceValue(_data.includeunshared, value);
467 coerceValue(_data.includecurveunshared, value);
470 coerceValue(_data.useconnectivityattrib, value);
473 coerceValue(_data.connectivityattrib, value);
476 coerceValue(_data.primsbyattribbndpts, value);
479 coerceValue(_data.onlyfull, value);
482 coerceValue(_data.onlyprimsedge, value);
485 coerceValue(_data.removedegen, value);
488 coerceValue(_data.toattrib, value);
499 { doSetParmValue(idx, instance, value); }
501 { doSetParmValue(idx, instance, value); }
503 { doSetParmValue(idx, instance, value); }
505 { doSetParmValue(idx, instance, value); }
507 { doSetParmValue(idx, instance, value); }
509 { doSetParmValue(idx, instance, value); }
511 { doSetParmValue(idx, instance, value); }
513 { doSetParmValue(idx, instance, value); }
515 { doSetParmValue(idx, instance, value); }
517 { doSetParmValue(idx, instance, value); }
519 { doSetParmValue(idx, instance, value); }
537 if (fieldnum.
size() < 1)
542 if (fieldnum.
size() == 1)
559 return "onlyboundary#";
561 return "includeunshared#";
563 return "includecurveunshared#";
565 return "useconnectivityattrib#";
567 return "connectivityattrib#";
569 return "primsbyattribbndpts#";
573 return "onlyprimsedge#";
575 return "removedegen#";
588 if (fieldnum.
size() < 1)
589 return PARM_UNSUPPORTED;
593 if (fieldnum.
size() == 1)
594 return PARM_MULTIPARM;
631 return PARM_UNSUPPORTED;
634 return PARM_UNSUPPORTED;
670 loadData(is, rampdata);
688 int typelen = colon - data.
buffer();
702 {
int64 iv =
v; UTwrite(os, &iv); }
704 { UTwrite<fpreal64>(os, &
v); }
706 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
708 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
709 UTwrite<fpreal64>(os, &v.
z()); }
711 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
712 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
724 if (s) s->save(ostr);
726 saveData(os, result);
733 ostr << s->getDataTypeToken();
738 saveData(os, result);
742 void save(std::ostream &os)
const
748 UTwrite(os, &length);
751 auto && _curentry = myPromotions(i);
753 saveData(os, _curentry.enable);
754 saveData(os, _curentry.fromtype);
755 saveData(os, _curentry.totype);
756 saveData(os, _curentry.group);
757 saveData(os, _curentry.newname);
758 saveData(os, _curentry.preserve);
759 saveData(os, _curentry.onlyboundary);
760 saveData(os, _curentry.includeunshared);
761 saveData(os, _curentry.includecurveunshared);
762 saveData(os, _curentry.useconnectivityattrib);
763 saveData(os, _curentry.connectivityattrib);
764 saveData(os, _curentry.primsbyattribbndpts);
765 saveData(os, _curentry.onlyfull);
766 saveData(os, _curentry.onlyprimsedge);
767 saveData(os, _curentry.removedegen);
768 saveData(os, _curentry.toattrib);
787 myPromotions.setSize(length);
790 auto && _curentry = myPromotions(i);
792 loadData(is, _curentry.enable);
793 loadData(is, _curentry.fromtype);
794 loadData(is, _curentry.totype);
795 loadData(is, _curentry.group);
796 loadData(is, _curentry.newname);
797 loadData(is, _curentry.preserve);
798 loadData(is, _curentry.onlyboundary);
799 loadData(is, _curentry.includeunshared);
800 loadData(is, _curentry.includecurveunshared);
801 loadData(is, _curentry.useconnectivityattrib);
802 loadData(is, _curentry.connectivityattrib);
803 loadData(is, _curentry.primsbyattribbndpts);
804 loadData(is, _curentry.onlyfull);
805 loadData(is, _curentry.onlyprimsedge);
806 loadData(is, _curentry.removedegen);
807 loadData(is, _curentry.toattrib);
820 if (!thissop)
return getPromotions().entries();
822 OP_Utils::evalOpParm(result, thissop,
"promotions", cookparms.
getCookTime(), 0);
826 {
return opinstPromotions_enable(cookparms, &_idx); }
830 if (!thissop)
return (myPromotions(_idx[0]).enable);
832 _parmidx[1-1] = _idx[1-1] + 1;
835 OP_Utils::evalOpParmInst(result, thissop,
"enable#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
839 {
return opinstPromotions_fromtype(cookparms, &_idx); }
843 if (!thissop)
return (myPromotions(_idx[0]).fromtype);
845 _parmidx[1-1] = _idx[1-1] + 1;
848 OP_Utils::evalOpParmInst(result, thissop,
"fromtype#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
852 {
return opinstPromotions_totype(cookparms, &_idx); }
856 if (!thissop)
return (myPromotions(_idx[0]).totype);
858 _parmidx[1-1] = _idx[1-1] + 1;
861 OP_Utils::evalOpParmInst(result, thissop,
"totype#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
865 {
return opinstPromotions_group(cookparms, &_idx); }
869 if (!thissop)
return (myPromotions(_idx[0]).group);
871 _parmidx[1-1] = _idx[1-1] + 1;
874 OP_Utils::evalOpParmInst(result, thissop,
"group#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
878 {
return opinstPromotions_newname(cookparms, &_idx); }
882 if (!thissop)
return (myPromotions(_idx[0]).newname);
884 _parmidx[1-1] = _idx[1-1] + 1;
887 OP_Utils::evalOpParmInst(result, thissop,
"newname#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
891 {
return opinstPromotions_preserve(cookparms, &_idx); }
895 if (!thissop)
return (myPromotions(_idx[0]).preserve);
897 _parmidx[1-1] = _idx[1-1] + 1;
900 OP_Utils::evalOpParmInst(result, thissop,
"preserve#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
904 {
return opinstPromotions_onlyboundary(cookparms, &_idx); }
908 if (!thissop)
return (myPromotions(_idx[0]).onlyboundary);
910 _parmidx[1-1] = _idx[1-1] + 1;
913 OP_Utils::evalOpParmInst(result, thissop,
"onlyboundary#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
917 {
return opinstPromotions_includeunshared(cookparms, &_idx); }
921 if (!thissop)
return (myPromotions(_idx[0]).includeunshared);
923 _parmidx[1-1] = _idx[1-1] + 1;
926 OP_Utils::evalOpParmInst(result, thissop,
"includeunshared#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
930 {
return opinstPromotions_includecurveunshared(cookparms, &_idx); }
934 if (!thissop)
return (myPromotions(_idx[0]).includecurveunshared);
936 _parmidx[1-1] = _idx[1-1] + 1;
939 OP_Utils::evalOpParmInst(result, thissop,
"includecurveunshared#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
943 {
return opinstPromotions_useconnectivityattrib(cookparms, &_idx); }
947 if (!thissop)
return (myPromotions(_idx[0]).useconnectivityattrib);
949 _parmidx[1-1] = _idx[1-1] + 1;
952 OP_Utils::evalOpParmInst(result, thissop,
"useconnectivityattrib#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
956 {
return opinstPromotions_connectivityattrib(cookparms, &_idx); }
960 if (!thissop)
return (myPromotions(_idx[0]).connectivityattrib);
962 _parmidx[1-1] = _idx[1-1] + 1;
965 OP_Utils::evalOpParmInst(result, thissop,
"connectivityattrib#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
969 {
return opinstPromotions_primsbyattribbndpts(cookparms, &_idx); }
973 if (!thissop)
return (myPromotions(_idx[0]).primsbyattribbndpts);
975 _parmidx[1-1] = _idx[1-1] + 1;
978 OP_Utils::evalOpParmInst(result, thissop,
"primsbyattribbndpts#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
982 {
return opinstPromotions_onlyfull(cookparms, &_idx); }
986 if (!thissop)
return (myPromotions(_idx[0]).onlyfull);
988 _parmidx[1-1] = _idx[1-1] + 1;
991 OP_Utils::evalOpParmInst(result, thissop,
"onlyfull#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
995 {
return opinstPromotions_onlyprimsedge(cookparms, &_idx); }
999 if (!thissop)
return (myPromotions(_idx[0]).onlyprimsedge);
1001 _parmidx[1-1] = _idx[1-1] + 1;
1004 OP_Utils::evalOpParmInst(result, thissop,
"onlyprimsedge#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
1008 {
return opinstPromotions_removedegen(cookparms, &_idx); }
1012 if (!thissop)
return (myPromotions(_idx[0]).removedegen);
1014 _parmidx[1-1] = _idx[1-1] + 1;
1017 OP_Utils::evalOpParmInst(result, thissop,
"removedegen#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
1021 {
return opinstPromotions_toattrib(cookparms, &_idx); }
1025 if (!thissop)
return (myPromotions(_idx[0]).toattrib);
1027 _parmidx[1-1] = _idx[1-1] + 1;
1030 OP_Utils::evalOpParmInst(result, thissop,
"toattrib#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
GLenum GLuint GLenum GLsizei const GLchar * buf
SOP_Node * getNode() const
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
GLuint GLsizei GLsizei * length
An output stream object that owns its own string buffer storage.
**But if you need a result
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
constexpr SYS_FORCE_INLINE T & x() noexcept
GLuint GLsizei const GLuint const GLintptr * offsets
constexpr SYS_FORCE_INLINE T & x() noexcept
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
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
exint read(bool *array, exint sz=1)
const OP_GraphProxy * graph() const
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
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
GT_API const UT_StringHolder version
exint entries() const
Alias of size(). size() is preferred.
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
DEP_MicroNode * depnode() const
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
constexpr SYS_FORCE_INLINE T & w() noexcept
SYS_FORCE_INLINE void append(char character)
fpreal getCookTime() const
const char * findChar(int c) const
constexpr SYS_FORCE_INLINE T & y() noexcept
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
constexpr SYS_FORCE_INLINE T & x() noexcept