20 using namespace UT::Literal;
23 namespace SOP_GroupPromoteEnums
74 includeunshared =
true;
75 useconnectivityattrib =
false;
76 connectivityattrib =
"uv"_sh;
77 primsbyattribbndpts =
false;
87 if (fromtype != src.
fromtype)
return false;
88 if (totype != src.
totype)
return false;
90 if (newname != src.
newname)
return false;
97 if (onlyfull != src.
onlyfull)
return false;
99 if (toattrib != src.
toattrib)
return false;
115 for (
int i = 0; i < list.
entries(); i++)
133 buf.
appendSprintf(
"%s", (list(i).onlyboundary) ?
"true" :
"false");
135 buf.
appendSprintf(
"%s", (list(i).includeunshared) ?
"true" :
"false");
137 buf.
appendSprintf(
"%s", (list(i).useconnectivityattrib) ?
"true" :
"false");
141 buf.
appendSprintf(
"%s", (list(i).primsbyattribbndpts) ?
"true" :
"false");
143 buf.
appendSprintf(
"%s", (list(i).onlyfull) ?
"true" :
"false");
145 buf.
appendSprintf(
"%s", (list(i).removedegen) ?
"true" :
"false");
147 buf.
appendSprintf(
"%s", (list(i).toattrib) ?
"true" :
"false");
168 if (myPromotions != src.myPromotions)
return false;
186 graph->
evalOpParm(length, nodeidx,
"promotions", time, 0);
187 myPromotions.entries(length);
191 auto && _curentry = myPromotions(i);
193 myPromotions(i).enable =
true;
196 myPromotions(i).fromtype = 0;
197 if (
true && ( (!(((_curentry.enable==0)))) ) )
198 graph->
evalOpParmInst(myPromotions(i).fromtype, nodeidx,
"fromtype#", &parmidx, time, 0);
199 myPromotions(i).totype = 1;
200 if (
true && ( (!(((_curentry.enable==0)))) ) )
201 graph->
evalOpParmInst(myPromotions(i).totype, nodeidx,
"totype#", &parmidx, time, 0);
202 myPromotions(i).group =
""_sh;
203 if (
true && ( (!(((_curentry.enable==0)))) ) )
205 myPromotions(i).newname =
""_sh;
206 if (
true && ( (!(((_curentry.enable==0)))) ) )
207 graph->
evalOpParmInst(myPromotions(i).newname, nodeidx,
"newname#", &parmidx, time, 0);
208 myPromotions(i).preserve =
false;
209 if (
true && ( (!(((_curentry.enable==0)))) ) )
211 myPromotions(i).onlyboundary =
false;
212 if (
true && ( (!(((_curentry.enable==0)))) ) )
213 graph->
evalOpParmInst(myPromotions(i).onlyboundary, nodeidx,
"onlyboundary#", &parmidx, time, 0);
214 myPromotions(i).includeunshared =
true;
215 if (
true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
216 graph->
evalOpParmInst(myPromotions(i).includeunshared, nodeidx,
"includeunshared#", &parmidx, time, 0);
217 myPromotions(i).useconnectivityattrib =
false;
218 if (
true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0)))) ) )
219 graph->
evalOpParmInst(myPromotions(i).useconnectivityattrib, nodeidx,
"useconnectivityattrib#", &parmidx, time, 0);
220 myPromotions(i).connectivityattrib =
"uv"_sh;
221 if (
true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.useconnectivityattrib==0)))) ) )
222 graph->
evalOpParmInst(myPromotions(i).connectivityattrib, nodeidx,
"connectivityattrib#", &parmidx, time, 0);
223 myPromotions(i).primsbyattribbndpts =
false;
224 if (
true && ( (!(((_curentry.enable==0))||((_curentry.onlyboundary==0))||((_curentry.totype!=0)))) ) )
225 graph->
evalOpParmInst(myPromotions(i).primsbyattribbndpts, nodeidx,
"primsbyattribbndpts#", &parmidx, time, 0);
226 myPromotions(i).onlyfull =
false;
227 if (
true && ( (!(((_curentry.enable==0))||((_curentry.totype==1))||((_curentry.onlyboundary==1)))) ) )
228 graph->
evalOpParmInst(myPromotions(i).onlyfull, nodeidx,
"onlyfull#", &parmidx, time, 0);
229 myPromotions(i).removedegen =
false;
230 if (
true && ( (!(((_curentry.enable==0))||((_curentry.totype==0)))) ) )
231 graph->
evalOpParmInst(myPromotions(i).removedegen, nodeidx,
"removedegen#", &parmidx, time, 0);
232 myPromotions(i).toattrib =
false;
233 if (
true && ( (!(((_curentry.enable==0))||((_curentry.totype==2)))) ) )
234 graph->
evalOpParmInst(myPromotions(i).toattrib, nodeidx,
"toattrib#", &parmidx, time, 0);
239 myPromotions.clear();
255 template <
typename T>
262 if (idx.
size() != instance.
size()+1)
268 coerceValue(value, myPromotions.entries());
269 else if (instance[0] < myPromotions.entries())
271 auto && _data = myPromotions(instance[0]);
275 coerceValue(value, _data.enable);
278 coerceValue(value, _data.fromtype);
281 coerceValue(value, _data.totype);
284 coerceValue(value, _data.group);
287 coerceValue(value, _data.newname);
290 coerceValue(value, _data.preserve);
293 coerceValue(value, _data.onlyboundary);
296 coerceValue(value, _data.includeunshared);
299 coerceValue(value, _data.useconnectivityattrib);
302 coerceValue(value, _data.connectivityattrib);
305 coerceValue(value, _data.primsbyattribbndpts);
308 coerceValue(value, _data.onlyfull);
311 coerceValue(value, _data.removedegen);
314 coerceValue(value, _data.toattrib);
325 { doGetParmValue(idx, instance, value); }
327 { doGetParmValue(idx, instance, value); }
329 { doGetParmValue(idx, instance, value); }
331 { doGetParmValue(idx, instance, value); }
333 { doGetParmValue(idx, instance, value); }
335 { doGetParmValue(idx, instance, value); }
337 { doGetParmValue(idx, instance, value); }
339 { doGetParmValue(idx, instance, value); }
341 { doGetParmValue(idx, instance, value); }
343 { doGetParmValue(idx, instance, value); }
345 { doGetParmValue(idx, instance, value); }
347 template <
typename T>
354 if (idx.
size() != instance.
size()+1)
362 coerceValue(newsize, value);
363 myPromotions.setSize(newsize);
367 myPromotions.setSizeIfNeeded(instance[0]+1);
368 auto && _data = myPromotions(instance[0]);
372 coerceValue(_data.enable, value);
375 coerceValue(_data.fromtype, value);
378 coerceValue(_data.totype, value);
381 coerceValue(_data.group, value);
384 coerceValue(_data.newname, value);
387 coerceValue(_data.preserve, value);
390 coerceValue(_data.onlyboundary, value);
393 coerceValue(_data.includeunshared, value);
396 coerceValue(_data.useconnectivityattrib, value);
399 coerceValue(_data.connectivityattrib, value);
402 coerceValue(_data.primsbyattribbndpts, value);
405 coerceValue(_data.onlyfull, value);
408 coerceValue(_data.removedegen, value);
411 coerceValue(_data.toattrib, value);
422 { doSetParmValue(idx, instance, value); }
424 { doSetParmValue(idx, instance, value); }
426 { doSetParmValue(idx, instance, value); }
428 { doSetParmValue(idx, instance, value); }
430 { doSetParmValue(idx, instance, value); }
432 { doSetParmValue(idx, instance, value); }
434 { doSetParmValue(idx, instance, value); }
436 { doSetParmValue(idx, instance, value); }
438 { doSetParmValue(idx, instance, value); }
440 { doSetParmValue(idx, instance, value); }
442 { doSetParmValue(idx, instance, value); }
460 if (fieldnum.
size() < 1)
465 if (fieldnum.
size() == 1)
482 return "onlyboundary#";
484 return "includeunshared#";
486 return "useconnectivityattrib#";
488 return "connectivityattrib#";
490 return "primsbyattribbndpts#";
494 return "removedegen#";
507 if (fieldnum.
size() < 1)
508 return PARM_UNSUPPORTED;
512 if (fieldnum.
size() == 1)
513 return PARM_MULTIPARM;
546 return PARM_UNSUPPORTED;
549 return PARM_UNSUPPORTED;
585 loadData(is, rampdata);
603 int typelen = colon - data.
buffer();
617 {
int64 iv =
v; UTwrite(os, &iv); }
619 { UTwrite<fpreal64>(os, &
v); }
621 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
623 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
624 UTwrite<fpreal64>(os, &v.
z()); }
626 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
627 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
639 if (s) s->save(ostr);
641 saveData(os, result);
648 ostr << s->getDataTypeToken();
653 saveData(os, result);
657 void save(std::ostream &os)
const
663 UTwrite(os, &length);
666 saveData(os, myPromotions(i).
enable);
667 saveData(os, myPromotions(i).fromtype);
668 saveData(os, myPromotions(i).totype);
669 saveData(os, myPromotions(i).
group);
670 saveData(os, myPromotions(i).newname);
671 saveData(os, myPromotions(i).
preserve);
672 saveData(os, myPromotions(i).onlyboundary);
673 saveData(os, myPromotions(i).includeunshared);
674 saveData(os, myPromotions(i).useconnectivityattrib);
675 saveData(os, myPromotions(i).connectivityattrib);
676 saveData(os, myPromotions(i).primsbyattribbndpts);
677 saveData(os, myPromotions(i).onlyfull);
678 saveData(os, myPromotions(i).removedegen);
679 saveData(os, myPromotions(i).toattrib);
698 myPromotions.entries(length);
701 loadData(is, myPromotions(i).
enable);
702 loadData(is, myPromotions(i).fromtype);
703 loadData(is, myPromotions(i).totype);
704 loadData(is, myPromotions(i).
group);
705 loadData(is, myPromotions(i).newname);
706 loadData(is, myPromotions(i).
preserve);
707 loadData(is, myPromotions(i).onlyboundary);
708 loadData(is, myPromotions(i).includeunshared);
709 loadData(is, myPromotions(i).useconnectivityattrib);
710 loadData(is, myPromotions(i).connectivityattrib);
711 loadData(is, myPromotions(i).primsbyattribbndpts);
712 loadData(is, myPromotions(i).onlyfull);
713 loadData(is, myPromotions(i).removedegen);
714 loadData(is, myPromotions(i).toattrib);
727 if (!thissop)
return getPromotions().entries();
729 OP_Utils::evalOpParm(result, thissop,
"promotions", cookparms.
getCookTime(), 0);
735 if (!thissop)
return (myPromotions(_idx).
enable);
736 int _parmidx = _idx + 1;
738 OP_Utils::evalOpParmInst(result, thissop,
"enable#", &_parmidx, cookparms.
getCookTime(), 0);
744 if (!thissop)
return (myPromotions(_idx).fromtype);
745 int _parmidx = _idx + 1;
747 OP_Utils::evalOpParmInst(result, thissop,
"fromtype#", &_parmidx, cookparms.
getCookTime(), 0);
753 if (!thissop)
return (myPromotions(_idx).totype);
754 int _parmidx = _idx + 1;
756 OP_Utils::evalOpParmInst(result, thissop,
"totype#", &_parmidx, cookparms.
getCookTime(), 0);
762 if (!thissop)
return (myPromotions(_idx).
group);
763 int _parmidx = _idx + 1;
765 OP_Utils::evalOpParmInst(result, thissop,
"group#", &_parmidx, cookparms.
getCookTime(), 0);
771 if (!thissop)
return (myPromotions(_idx).newname);
772 int _parmidx = _idx + 1;
774 OP_Utils::evalOpParmInst(result, thissop,
"newname#", &_parmidx, cookparms.
getCookTime(), 0);
780 if (!thissop)
return (myPromotions(_idx).
preserve);
781 int _parmidx = _idx + 1;
783 OP_Utils::evalOpParmInst(result, thissop,
"preserve#", &_parmidx, cookparms.
getCookTime(), 0);
789 if (!thissop)
return (myPromotions(_idx).onlyboundary);
790 int _parmidx = _idx + 1;
792 OP_Utils::evalOpParmInst(result, thissop,
"onlyboundary#", &_parmidx, cookparms.
getCookTime(), 0);
798 if (!thissop)
return (myPromotions(_idx).includeunshared);
799 int _parmidx = _idx + 1;
801 OP_Utils::evalOpParmInst(result, thissop,
"includeunshared#", &_parmidx, cookparms.
getCookTime(), 0);
807 if (!thissop)
return (myPromotions(_idx).useconnectivityattrib);
808 int _parmidx = _idx + 1;
810 OP_Utils::evalOpParmInst(result, thissop,
"useconnectivityattrib#", &_parmidx, cookparms.
getCookTime(), 0);
816 if (!thissop)
return (myPromotions(_idx).connectivityattrib);
817 int _parmidx = _idx + 1;
819 OP_Utils::evalOpParmInst(result, thissop,
"connectivityattrib#", &_parmidx, cookparms.
getCookTime(), 0);
825 if (!thissop)
return (myPromotions(_idx).primsbyattribbndpts);
826 int _parmidx = _idx + 1;
828 OP_Utils::evalOpParmInst(result, thissop,
"primsbyattribbndpts#", &_parmidx, cookparms.
getCookTime(), 0);
834 if (!thissop)
return (myPromotions(_idx).onlyfull);
835 int _parmidx = _idx + 1;
837 OP_Utils::evalOpParmInst(result, thissop,
"onlyfull#", &_parmidx, cookparms.
getCookTime(), 0);
843 if (!thissop)
return (myPromotions(_idx).removedegen);
844 int _parmidx = _idx + 1;
846 OP_Utils::evalOpParmInst(result, thissop,
"removedegen#", &_parmidx, cookparms.
getCookTime(), 0);
852 if (!thissop)
return (myPromotions(_idx).toattrib);
853 int _parmidx = _idx + 1;
855 OP_Utils::evalOpParmInst(result, thissop,
"toattrib#", &_parmidx, cookparms.
getCookTime(), 0);
GLuint GLsizei const void GLenum preserve
SOP_Node * getNode() 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)
GT_API const UT_StringHolder time
GLuint const GLfloat * val
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
SYS_FORCE_INLINE const char * buffer() const
const SOP_GraphProxy * graph() const
An output stream object that owns its own string buffer storage.
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
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.
GLint GLenum GLsizei GLint GLsizei const void * data
exint read(bool *array, exint sz=1)
GLuint GLsizei GLsizei * length
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
DEP_MicroNode * depnode() const
exint entries() const
Alias of size(). size() is preferred.
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
Utility class for containing a color ramp.
SYS_FORCE_INLINE void append(char character)
GLdouble GLdouble GLdouble r
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
fpreal getCookTime() const
const char * findChar(int c) const
GLenum GLuint GLsizei const GLchar * buf
GLsizei const GLfloat * value
const OP_Context & context() const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)