23 namespace SOP_GroupPromoteEnums
37 using namespace UT::Literal;
59 using namespace UT::Literal;
105 onlyboundary =
false;
106 includeunshared =
true;
107 includecurveunshared =
true;
108 useconnectivityattrib =
false;
109 connectivityattrib =
"uv"_UTsh;
111 primsbyattribbndpts =
false;
113 onlyprimsedge =
false;
121 if (enable != src.
enable)
return false;
122 if (fromtype != src.
fromtype)
return false;
123 if (totype != src.
totype)
return false;
124 if (group != src.
group)
return false;
125 if (newname != src.
newname)
return false;
126 if (preserve != src.
preserve)
return false;
132 if (tol != src.
tol)
return false;
134 if (onlyfull != src.
onlyfull)
return false;
137 if (toattrib != src.
toattrib)
return false;
153 for (
int i = 0; i < list.
entries(); i++)
159 buf.
appendSprintf(
"%s", (list(i).enable) ?
"true" :
"false");
169 buf.
appendSprintf(
"%s", (list(i).preserve) ?
"true" :
"false");
171 buf.
appendSprintf(
"%s", (list(i).onlyboundary) ?
"true" :
"false");
173 buf.
appendSprintf(
"%s", (list(i).includeunshared) ?
"true" :
"false");
175 buf.
appendSprintf(
"%s", (list(i).includecurveunshared) ?
"true" :
"false");
177 buf.
appendSprintf(
"%s", (list(i).useconnectivityattrib) ?
"true" :
"false");
183 buf.
appendSprintf(
"%s", (list(i).primsbyattribbndpts) ?
"true" :
"false");
185 buf.
appendSprintf(
"%s", (list(i).onlyfull) ?
"true" :
"false");
187 buf.
appendSprintf(
"%s", (list(i).onlyprimsedge) ?
"true" :
"false");
189 buf.
appendSprintf(
"%s", (list(i).removedegen) ?
"true" :
"false");
191 buf.
appendSprintf(
"%s", (list(i).toattrib) ?
"true" :
"false");
203 myPromotions.setSize(1);
216 if (myPromotions != src.myPromotions)
return false;
237 graph->
evalOpParm(length, nodeidx,
"promotions", time, graph->
isDirect()?
nullptr:depnode);
238 if (length < 0) length = 0;
239 myPromotions.setSize(length);
246 auto && _curentry = myPromotions(i);
248 _curentry.enable =
true;
250 graph->
evalOpParmInst(_curentry.enable, nodeidx,
"enable#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
251 _curentry.fromtype = 0;
252 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
253 graph->
evalOpParmInst(_curentry.fromtype, nodeidx,
"fromtype#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
254 _curentry.totype = 1;
255 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
256 graph->
evalOpParmInst(_curentry.totype, nodeidx,
"totype#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
257 _curentry.group =
""_UTsh;
258 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
259 graph->
evalOpParmInst(_curentry.group, nodeidx,
"group#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
260 _curentry.newname =
""_UTsh;
261 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
262 graph->
evalOpParmInst(_curentry.newname, nodeidx,
"newname#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
263 _curentry.preserve =
false;
264 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
265 graph->
evalOpParmInst(_curentry.preserve, nodeidx,
"preserve#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
266 _curentry.onlyboundary =
false;
267 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
268 graph->
evalOpParmInst(_curentry.onlyboundary, nodeidx,
"onlyboundary#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
269 _curentry.includeunshared =
true;
270 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
271 graph->
evalOpParmInst(_curentry.includeunshared, nodeidx,
"includeunshared#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
272 _curentry.includecurveunshared =
true;
273 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.includeunshared==0)))) ) )
274 graph->
evalOpParmInst(_curentry.includecurveunshared, nodeidx,
"includecurveunshared#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
275 _curentry.useconnectivityattrib =
false;
276 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
277 graph->
evalOpParmInst(_curentry.useconnectivityattrib, nodeidx,
"useconnectivityattrib#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
278 _curentry.connectivityattrib =
"uv"_UTsh;
279 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.useconnectivityattrib==0)))) ) )
280 graph->
evalOpParmInst(_curentry.connectivityattrib, nodeidx,
"connectivityattrib#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
282 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.useconnectivityattrib==0)))) ) )
283 graph->
evalOpParmInst(_curentry.tol, nodeidx,
"tol#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
284 _curentry.primsbyattribbndpts =
false;
285 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.totype!=0)))) ) )
286 graph->
evalOpParmInst(_curentry.primsbyattribbndpts, nodeidx,
"primsbyattribbndpts#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
287 _curentry.onlyfull =
false;
288 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype==1))||((_curentry.onlyboundary==1)))) ) )
289 graph->
evalOpParmInst(_curentry.onlyfull, nodeidx,
"onlyfull#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
290 _curentry.onlyprimsedge =
false;
291 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype!=0))||((_curentry.fromtype==1))||((_curentry.onlyboundary==1))||((_curentry.onlyfull==1)))) ) )
292 graph->
evalOpParmInst(_curentry.onlyprimsedge, nodeidx,
"onlyprimsedge#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
293 _curentry.removedegen =
false;
294 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype==0)))) ) )
295 graph->
evalOpParmInst(_curentry.removedegen, nodeidx,
"removedegen#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
296 _curentry.toattrib =
false;
297 if (
true && ( (
true&&!(((_curentry.enable==0))||((_curentry.totype==2)))) ) )
298 graph->
evalOpParmInst(_curentry.toattrib, nodeidx,
"toattrib#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
303 myPromotions.clear();
319 template <
typename T>
326 if (idx.
size() != instance.
size()+1)
332 coerceValue(value, myPromotions.entries());
333 else if (instance[0] < myPromotions.entries())
335 auto && _data = myPromotions(instance[0]);
339 coerceValue(value, _data.enable);
342 coerceValue(value, _data.fromtype);
345 coerceValue(value, _data.totype);
348 coerceValue(value, _data.group);
351 coerceValue(value, _data.newname);
354 coerceValue(value, _data.preserve);
357 coerceValue(value, _data.onlyboundary);
360 coerceValue(value, _data.includeunshared);
363 coerceValue(value, _data.includecurveunshared);
366 coerceValue(value, _data.useconnectivityattrib);
369 coerceValue(value, _data.connectivityattrib);
372 coerceValue(value, _data.tol);
375 coerceValue(value, _data.primsbyattribbndpts);
378 coerceValue(value, _data.onlyfull);
381 coerceValue(value, _data.onlyprimsedge);
384 coerceValue(value, _data.removedegen);
387 coerceValue(value, _data.toattrib);
407 { doGetParmValue(idx, instance, value); }
409 { doGetParmValue(idx, instance, value); }
411 { doGetParmValue(idx, instance, value); }
413 { doGetParmValue(idx, instance, value); }
415 { doGetParmValue(idx, instance, value); }
417 { doGetParmValue(idx, instance, value); }
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 template <
typename T>
436 if (idx.
size() != instance.
size()+1)
444 coerceValue(newsize, value);
445 if (newsize < 0) newsize = 0;
446 myPromotions.setSize(newsize);
452 myPromotions.setSizeIfNeeded(instance[0]+1);
453 auto && _data = myPromotions(instance[0]);
457 coerceValue(_data.enable, value);
460 coerceValue(_data.fromtype, value);
463 coerceValue(_data.totype, value);
466 coerceValue(_data.group, value);
469 coerceValue(_data.newname, value);
472 coerceValue(_data.preserve, value);
475 coerceValue(_data.onlyboundary, value);
478 coerceValue(_data.includeunshared, value);
481 coerceValue(_data.includecurveunshared, value);
484 coerceValue(_data.useconnectivityattrib, value);
487 coerceValue(_data.connectivityattrib, value);
490 coerceValue(_data.tol, value);
493 coerceValue(_data.primsbyattribbndpts, value);
496 coerceValue(_data.onlyfull, value);
499 coerceValue(_data.onlyprimsedge, value);
502 coerceValue(_data.removedegen, value);
505 coerceValue(_data.toattrib, value);
516 { doSetParmValue(idx, instance, value); }
518 { doSetParmValue(idx, instance, value); }
520 { doSetParmValue(idx, instance, value); }
522 { doSetParmValue(idx, instance, value); }
524 { doSetParmValue(idx, instance, value); }
526 { doSetParmValue(idx, instance, value); }
528 { doSetParmValue(idx, instance, value); }
530 { doSetParmValue(idx, instance, value); }
532 { doSetParmValue(idx, instance, value); }
534 { doSetParmValue(idx, instance, value); }
536 { doSetParmValue(idx, instance, value); }
554 if (fieldnum.
size() < 1)
559 if (fieldnum.
size() == 1)
576 return "onlyboundary#";
578 return "includeunshared#";
580 return "includecurveunshared#";
582 return "useconnectivityattrib#";
584 return "connectivityattrib#";
588 return "primsbyattribbndpts#";
592 return "onlyprimsedge#";
594 return "removedegen#";
607 if (fieldnum.
size() < 1)
608 return PARM_UNSUPPORTED;
612 if (fieldnum.
size() == 1)
613 return PARM_MULTIPARM;
652 return PARM_UNSUPPORTED;
655 return PARM_UNSUPPORTED;
691 loadData(is, rampdata);
709 int typelen = colon - data.
buffer();
723 {
int64 iv =
v; UTwrite(os, &iv); }
725 { UTwrite<fpreal64>(os, &
v); }
727 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
729 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
730 UTwrite<fpreal64>(os, &v.
z()); }
732 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
733 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
745 if (s) s->save(ostr);
747 saveData(os, result);
754 ostr << s->getDataTypeToken();
759 saveData(os, result);
763 void save(std::ostream &os)
const
769 UTwrite(os, &length);
772 auto && _curentry = myPromotions(i);
774 saveData(os, _curentry.enable);
775 saveData(os, _curentry.fromtype);
776 saveData(os, _curentry.totype);
777 saveData(os, _curentry.group);
778 saveData(os, _curentry.newname);
779 saveData(os, _curentry.preserve);
780 saveData(os, _curentry.onlyboundary);
781 saveData(os, _curentry.includeunshared);
782 saveData(os, _curentry.includecurveunshared);
783 saveData(os, _curentry.useconnectivityattrib);
784 saveData(os, _curentry.connectivityattrib);
785 saveData(os, _curentry.tol);
786 saveData(os, _curentry.primsbyattribbndpts);
787 saveData(os, _curentry.onlyfull);
788 saveData(os, _curentry.onlyprimsedge);
789 saveData(os, _curentry.removedegen);
790 saveData(os, _curentry.toattrib);
809 myPromotions.setSize(length);
812 auto && _curentry = myPromotions(i);
814 loadData(is, _curentry.enable);
815 loadData(is, _curentry.fromtype);
816 loadData(is, _curentry.totype);
817 loadData(is, _curentry.group);
818 loadData(is, _curentry.newname);
819 loadData(is, _curentry.preserve);
820 loadData(is, _curentry.onlyboundary);
821 loadData(is, _curentry.includeunshared);
822 loadData(is, _curentry.includecurveunshared);
823 loadData(is, _curentry.useconnectivityattrib);
824 loadData(is, _curentry.connectivityattrib);
825 loadData(is, _curentry.tol);
826 loadData(is, _curentry.primsbyattribbndpts);
827 loadData(is, _curentry.onlyfull);
828 loadData(is, _curentry.onlyprimsedge);
829 loadData(is, _curentry.removedegen);
830 loadData(is, _curentry.toattrib);
843 if (!thissop)
return getPromotions().entries();
845 OP_Utils::evalOpParm(result, thissop,
"promotions", cookparms.
getCookTime(), 0);
849 {
return opinstPromotions_enable(cookparms, &_idx); }
853 if (!thissop)
return (myPromotions(_idx[0]).enable);
855 _parmidx[1-1] = _idx[1-1] + 1;
858 OP_Utils::evalOpParmInst(result, thissop,
"enable#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
862 {
return opinstPromotions_fromtype(cookparms, &_idx); }
866 if (!thissop)
return (myPromotions(_idx[0]).fromtype);
868 _parmidx[1-1] = _idx[1-1] + 1;
871 OP_Utils::evalOpParmInst(result, thissop,
"fromtype#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
875 {
return opinstPromotions_totype(cookparms, &_idx); }
879 if (!thissop)
return (myPromotions(_idx[0]).totype);
881 _parmidx[1-1] = _idx[1-1] + 1;
884 OP_Utils::evalOpParmInst(result, thissop,
"totype#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
888 {
return opinstPromotions_group(cookparms, &_idx); }
892 if (!thissop)
return (myPromotions(_idx[0]).group);
894 _parmidx[1-1] = _idx[1-1] + 1;
897 OP_Utils::evalOpParmInst(result, thissop,
"group#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
901 {
return opinstPromotions_newname(cookparms, &_idx); }
905 if (!thissop)
return (myPromotions(_idx[0]).newname);
907 _parmidx[1-1] = _idx[1-1] + 1;
910 OP_Utils::evalOpParmInst(result, thissop,
"newname#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
914 {
return opinstPromotions_preserve(cookparms, &_idx); }
918 if (!thissop)
return (myPromotions(_idx[0]).preserve);
920 _parmidx[1-1] = _idx[1-1] + 1;
923 OP_Utils::evalOpParmInst(result, thissop,
"preserve#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
927 {
return opinstPromotions_onlyboundary(cookparms, &_idx); }
931 if (!thissop)
return (myPromotions(_idx[0]).onlyboundary);
933 _parmidx[1-1] = _idx[1-1] + 1;
936 OP_Utils::evalOpParmInst(result, thissop,
"onlyboundary#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
940 {
return opinstPromotions_includeunshared(cookparms, &_idx); }
944 if (!thissop)
return (myPromotions(_idx[0]).includeunshared);
946 _parmidx[1-1] = _idx[1-1] + 1;
949 OP_Utils::evalOpParmInst(result, thissop,
"includeunshared#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
953 {
return opinstPromotions_includecurveunshared(cookparms, &_idx); }
957 if (!thissop)
return (myPromotions(_idx[0]).includecurveunshared);
959 _parmidx[1-1] = _idx[1-1] + 1;
962 OP_Utils::evalOpParmInst(result, thissop,
"includecurveunshared#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
966 {
return opinstPromotions_useconnectivityattrib(cookparms, &_idx); }
970 if (!thissop)
return (myPromotions(_idx[0]).useconnectivityattrib);
972 _parmidx[1-1] = _idx[1-1] + 1;
975 OP_Utils::evalOpParmInst(result, thissop,
"useconnectivityattrib#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
979 {
return opinstPromotions_connectivityattrib(cookparms, &_idx); }
983 if (!thissop)
return (myPromotions(_idx[0]).connectivityattrib);
985 _parmidx[1-1] = _idx[1-1] + 1;
988 OP_Utils::evalOpParmInst(result, thissop,
"connectivityattrib#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
992 {
return opinstPromotions_tol(cookparms, &_idx); }
996 if (!thissop)
return (myPromotions(_idx[0]).tol);
998 _parmidx[1-1] = _idx[1-1] + 1;
1001 OP_Utils::evalOpParmInst(result, thissop,
"tol#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
1005 {
return opinstPromotions_primsbyattribbndpts(cookparms, &_idx); }
1009 if (!thissop)
return (myPromotions(_idx[0]).primsbyattribbndpts);
1011 _parmidx[1-1] = _idx[1-1] + 1;
1014 OP_Utils::evalOpParmInst(result, thissop,
"primsbyattribbndpts#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
1018 {
return opinstPromotions_onlyfull(cookparms, &_idx); }
1022 if (!thissop)
return (myPromotions(_idx[0]).onlyfull);
1024 _parmidx[1-1] = _idx[1-1] + 1;
1027 OP_Utils::evalOpParmInst(result, thissop,
"onlyfull#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
1031 {
return opinstPromotions_onlyprimsedge(cookparms, &_idx); }
1035 if (!thissop)
return (myPromotions(_idx[0]).onlyprimsedge);
1037 _parmidx[1-1] = _idx[1-1] + 1;
1040 OP_Utils::evalOpParmInst(result, thissop,
"onlyprimsedge#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
1044 {
return opinstPromotions_removedegen(cookparms, &_idx); }
1048 if (!thissop)
return (myPromotions(_idx[0]).removedegen);
1050 _parmidx[1-1] = _idx[1-1] + 1;
1053 OP_Utils::evalOpParmInst(result, thissop,
"removedegen#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
1057 {
return opinstPromotions_toattrib(cookparms, &_idx); }
1061 if (!thissop)
return (myPromotions(_idx[0]).toattrib);
1063 _parmidx[1-1] = _idx[1-1] + 1;
1066 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
GLsizei const GLfloat * value
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
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)
virtual UT_StringHolder baseGetSignature() const
fpreal getCookTime() const
const char * findChar(int c) const
constexpr SYS_FORCE_INLINE T & y() noexcept
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
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