23 namespace SOP_NameEnums
35 using namespace UT::Literal;
66 if (group != src.
group)
return false;
83 for (
int i = 0; i < list.
entries(); i++)
119 if (enable != src.
enable)
return false;
120 if (global != src.
global)
return false;
121 if (from != src.
from)
return false;
122 if (to != src.
to)
return false;
138 for (
int i = 0; i < list.
entries(); i++)
144 buf.
appendSprintf(
"%s", (list(i).enable) ?
"true" :
"false");
146 buf.
appendSprintf(
"%s", (list(i).global) ?
"true" :
"false");
162 myAttribname =
"name"_UTsh;
164 myDonamefromgroup =
false;
165 myNamefromgroupmask =
"piece*"_UTsh;
166 myNumnames.setSize(1);
167 myNumrenames.setSize(0);
180 if (myAttribname != src.myAttribname)
return false;
181 if (myClass != src.myClass)
return false;
182 if (myDonamefromgroup != src.myDonamefromgroup)
return false;
183 if (myNamefromgroupmask != src.myNamefromgroupmask)
return false;
184 if (myNumnames != src.myNumnames)
return false;
185 if (myNumrenames != src.myNumrenames)
return false;
202 myAttribname =
"name"_UTsh;
204 graph->
evalOpParm(myAttribname, nodeidx,
"attribname", time, graph->
isDirect()?
nullptr:depnode);
207 graph->
evalOpParm(myClass, nodeidx,
"class", time, graph->
isDirect()?
nullptr:depnode);
208 myDonamefromgroup =
false;
210 graph->
evalOpParm(myDonamefromgroup, nodeidx,
"donamefromgroup", time, graph->
isDirect()?
nullptr:depnode);
211 myNamefromgroupmask =
"piece*"_UTsh;
212 if (
true && ( (
true&&!(((getDonamefromgroup()==0)))) ) )
213 graph->
evalOpParm(myNamefromgroupmask, nodeidx,
"namefromgroupmask", time, graph->
isDirect()?
nullptr:depnode);
217 graph->
evalOpParm(length, nodeidx,
"numnames", time, graph->
isDirect()?
nullptr:depnode);
218 if (length < 0) length = 0;
219 myNumnames.setSize(length);
226 auto && _curentry = myNumnames(i);
228 _curentry.group =
""_UTsh;
230 graph->
evalOpParmInst(_curentry.group, nodeidx,
"group#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
231 _curentry.name =
""_UTsh;
233 graph->
evalOpParmInst(_curentry.name, nodeidx,
"name#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
242 graph->
evalOpParm(length, nodeidx,
"numrenames", time, graph->
isDirect()?
nullptr:depnode);
243 if (length < 0) length = 0;
244 myNumrenames.setSize(length);
251 auto && _curentry = myNumrenames(i);
253 _curentry.enable =
true;
255 graph->
evalOpParmInst(_curentry.enable, nodeidx,
"enable#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
256 _curentry.global =
false;
257 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
258 graph->
evalOpParmInst(_curentry.global, nodeidx,
"global#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
259 _curentry.from =
""_UTsh;
260 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
261 graph->
evalOpParmInst(_curentry.from, nodeidx,
"from#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
262 _curentry.to =
""_UTsh;
263 if (
true && ( (
true&&!(((_curentry.enable==0)))) ) )
264 graph->
evalOpParmInst(_curentry.to, nodeidx,
"to#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
269 myNumrenames.clear();
285 template <
typename T>
292 if (idx.
size() != instance.
size()+1)
297 coerceValue(value, myAttribname);
300 coerceValue(value, myClass);
303 coerceValue(value, myDonamefromgroup);
306 coerceValue(value, myNamefromgroupmask);
310 coerceValue(value, myNumnames.entries());
311 else if (instance[0] < myNumnames.entries())
313 auto && _data = myNumnames(instance[0]);
317 coerceValue(value, _data.group);
320 coerceValue(value, _data.name);
328 coerceValue(value, myNumrenames.entries());
329 else if (instance[0] < myNumrenames.entries())
331 auto && _data = myNumrenames(instance[0]);
335 coerceValue(value, _data.enable);
338 coerceValue(value, _data.global);
341 coerceValue(value, _data.from);
344 coerceValue(value, _data.to);
364 { doGetParmValue(idx, instance, value); }
366 { doGetParmValue(idx, instance, value); }
368 { doGetParmValue(idx, instance, value); }
370 { doGetParmValue(idx, instance, value); }
372 { doGetParmValue(idx, instance, value); }
374 { doGetParmValue(idx, instance, value); }
376 { doGetParmValue(idx, instance, value); }
378 { doGetParmValue(idx, instance, value); }
380 { doGetParmValue(idx, instance, value); }
382 { doGetParmValue(idx, instance, value); }
384 { doGetParmValue(idx, instance, value); }
386 template <
typename T>
393 if (idx.
size() != instance.
size()+1)
398 coerceValue(myAttribname, ( ( value ) ));
401 coerceValue(myClass, clampMinValue(0, clampMaxValue(2, value ) ));
404 coerceValue(myDonamefromgroup, ( ( value ) ));
407 coerceValue(myNamefromgroupmask, ( ( value ) ));
413 coerceValue(newsize, value);
414 if (newsize < 0) newsize = 0;
415 myNumnames.setSize(newsize);
421 myNumnames.setSizeIfNeeded(instance[0]+1);
422 auto && _data = myNumnames(instance[0]);
426 coerceValue(_data.group, value);
429 coerceValue(_data.name, value);
439 coerceValue(newsize, value);
440 if (newsize < 0) newsize = 0;
441 myNumrenames.setSize(newsize);
447 myNumrenames.setSizeIfNeeded(instance[0]+1);
448 auto && _data = myNumrenames(instance[0]);
452 coerceValue(_data.enable, value);
455 coerceValue(_data.global, value);
458 coerceValue(_data.from, value);
461 coerceValue(_data.to, value);
472 { doSetParmValue(idx, instance, value); }
474 { doSetParmValue(idx, instance, value); }
476 { doSetParmValue(idx, instance, value); }
478 { doSetParmValue(idx, instance, value); }
480 { doSetParmValue(idx, instance, value); }
482 { doSetParmValue(idx, instance, value); }
484 { doSetParmValue(idx, instance, value); }
486 { doSetParmValue(idx, instance, value); }
488 { doSetParmValue(idx, instance, value); }
490 { doSetParmValue(idx, instance, value); }
492 { doSetParmValue(idx, instance, value); }
512 if (fieldnum.
size() < 1)
521 return "donamefromgroup";
523 return "namefromgroupmask";
525 if (fieldnum.
size() == 1)
537 if (fieldnum.
size() == 1)
559 if (fieldnum.
size() < 1)
560 return PARM_UNSUPPORTED;
572 if (fieldnum.
size() == 1)
573 return PARM_MULTIPARM;
582 return PARM_UNSUPPORTED;
584 if (fieldnum.
size() == 1)
585 return PARM_MULTIPARM;
598 return PARM_UNSUPPORTED;
601 return PARM_UNSUPPORTED;
637 loadData(is, rampdata);
655 int typelen = colon - data.
buffer();
669 {
int64 iv =
v; UTwrite(os, &iv); }
671 { UTwrite<fpreal64>(os, &
v); }
673 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
675 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
676 UTwrite<fpreal64>(os, &v.
z()); }
678 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
679 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
691 if (s) s->save(ostr);
693 saveData(os, result);
700 ostr << s->getDataTypeToken();
705 saveData(os, result);
709 void save(std::ostream &os)
const
713 saveData(os, myAttribname);
714 saveData(os, myClass);
715 saveData(os, myDonamefromgroup);
716 saveData(os, myNamefromgroupmask);
719 UTwrite(os, &length);
722 auto && _curentry = myNumnames(i);
724 saveData(os, _curentry.group);
725 saveData(os, _curentry.name);
731 UTwrite(os, &length);
734 auto && _curentry = myNumrenames(i);
736 saveData(os, _curentry.enable);
737 saveData(os, _curentry.global);
738 saveData(os, _curentry.from);
739 saveData(os, _curentry.to);
755 loadData(is, myAttribname);
756 loadData(is, myClass);
757 loadData(is, myDonamefromgroup);
758 loadData(is, myNamefromgroupmask);
762 myNumnames.setSize(length);
765 auto && _curentry = myNumnames(i);
767 loadData(is, _curentry.group);
768 loadData(is, _curentry.name);
775 myNumrenames.setSize(length);
778 auto && _curentry = myNumrenames(i);
780 loadData(is, _curentry.enable);
781 loadData(is, _curentry.global);
782 loadData(is, _curentry.from);
783 loadData(is, _curentry.to);
796 if (!thissop)
return getAttribname();
798 OP_Utils::evalOpParm(result, thissop,
"attribname", cookparms.
getCookTime(), 0);
806 if (!thissop)
return getClass();
808 OP_Utils::evalOpParm(result, thissop,
"class", cookparms.
getCookTime(), 0);
809 return Class(result);
816 if (!thissop)
return getDonamefromgroup();
818 OP_Utils::evalOpParm(result, thissop,
"donamefromgroup", cookparms.
getCookTime(), 0);
826 if (!thissop)
return getNamefromgroupmask();
828 OP_Utils::evalOpParm(result, thissop,
"namefromgroupmask", cookparms.
getCookTime(), 0);
836 if (!thissop)
return getNumnames().entries();
838 OP_Utils::evalOpParm(result, thissop,
"numnames", cookparms.
getCookTime(), 0);
842 {
return opinstNumnames_group(cookparms, &_idx); }
846 if (!thissop)
return (myNumnames(_idx[0]).group);
848 _parmidx[1-1] = _idx[1-1] + 1;
851 OP_Utils::evalOpParmInst(result, thissop,
"group#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
855 {
return opinstNumnames_name(cookparms, &_idx); }
859 if (!thissop)
return (myNumnames(_idx[0]).
name);
861 _parmidx[1-1] = _idx[1-1] + 1;
864 OP_Utils::evalOpParmInst(result, thissop,
"name#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
873 if (!thissop)
return getNumrenames().entries();
875 OP_Utils::evalOpParm(result, thissop,
"numrenames", cookparms.
getCookTime(), 0);
879 {
return opinstNumrenames_enable(cookparms, &_idx); }
883 if (!thissop)
return (myNumrenames(_idx[0]).enable);
885 _parmidx[1-1] = _idx[1-1] + 1;
888 OP_Utils::evalOpParmInst(result, thissop,
"enable#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
892 {
return opinstNumrenames_global(cookparms, &_idx); }
896 if (!thissop)
return (myNumrenames(_idx[0]).global);
898 _parmidx[1-1] = _idx[1-1] + 1;
901 OP_Utils::evalOpParmInst(result, thissop,
"global#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
905 {
return opinstNumrenames_from(cookparms, &_idx); }
909 if (!thissop)
return (myNumrenames(_idx[0]).from);
911 _parmidx[1-1] = _idx[1-1] + 1;
914 OP_Utils::evalOpParmInst(result, thissop,
"from#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
918 {
return opinstNumrenames_to(cookparms, &_idx); }
922 if (!thissop)
return (myNumrenames(_idx[0]).to);
924 _parmidx[1-1] = _idx[1-1] + 1;
927 OP_Utils::evalOpParmInst(result, thissop,
"to#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
935 bool myDonamefromgroup;
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
Class opClass(const SOP_NodeVerb::CookParms &cookparms) const
bool operator==(const Numrenames &src) const
GLenum GLuint GLenum GLsizei const GLchar * buf
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
SOP_Node * getNode() const
bool operator==(const SOP_NameParms &src) const
static void saveData(std::ostream &os, UT_Vector3D v)
exint bread(int32 *buffer, exint asize=1)
static void saveData(std::ostream &os, UT_Vector4D v)
UT_StringHolder opNumrenames_from(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
GT_API const UT_StringHolder time
UT_StringHolder opAttribname(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & y() noexcept
GLsizei const GLfloat * value
void setDonamefromgroup(bool val)
void copyFrom(const OP_NodeParms *src) override
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
constexpr SYS_FORCE_INLINE T & z() noexcept
void loadFromOpSubclass(const LoadParms &loadparms) override
SYS_FORCE_INLINE const char * buffer() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
GLuint GLsizei GLsizei * length
An output stream object that owns its own string buffer storage.
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
UT_StringHolder createString(const UT_Array< Numnames > &list) const
**But if you need a result
static void saveData(std::ostream &os, int64 v)
exint opNumnames(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder createString(const UT_Array< Numrenames > &list) const
static void loadData(UT_IStream &is, UT_Vector4D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
static void loadData(UT_IStream &is, UT_Vector3I &v)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
bool opDonamefromgroup(const SOP_NodeVerb::CookParms &cookparms) const
bool load(UT_IStream &is)
constexpr SYS_FORCE_INLINE T & x() noexcept
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void saveData(std::ostream &os, UT_Vector2D v)
const UT_StringHolder & getAttribname() const
static void saveData(std::ostream &os, UT_Matrix2D v)
GLuint GLsizei const GLuint const GLintptr * offsets
UT_StringHolder opinstNumnames_group(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool getDonamefromgroup() const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
constexpr SYS_FORCE_INLINE T & x() noexcept
UT_StringHolder opNamefromgroupmask(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opinstNumrenames_from(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
void setNamefromgroupmask(const UT_StringHolder &val)
bool operator!=(const Numnames &src) const
UT_StringHolder opinstNumrenames_to(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
exint getNestNumParms(TempIndex idx) const override
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
const char * getNestParmName(TempIndex fieldnum) const override
constexpr SYS_FORCE_INLINE T & z() noexcept
void setNumnames(const UT_Array< Numnames > &val)
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
exint read(bool *array, exint sz=1)
const OP_GraphProxy * graph() const
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
static void saveData(std::ostream &os, bool v)
static void loadData(UT_IStream &is, int64 &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
UT_StringHolder opNumnames_group(const SOP_NodeVerb::CookParms &cookparms, int _idx) 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
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
GLuint const GLchar * name
bool opinstNumrenames_global(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
const UT_Array< Numnames > & getNumnames() const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
static void saveData(std::ostream &os, UT_Matrix4D v)
SYS_FORCE_INLINE UT_StringHolder getToken(Class enum_value)
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
GT_API const UT_StringHolder version
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
exint entries() const
Alias of size(). size() is preferred.
UT_StringHolder opNumrenames_to(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
exint opNumrenames(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opNumnames_name(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void setNumrenames(const UT_Array< Numrenames > &val)
void save(std::ostream &os) const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
bool opinstNumrenames_enable(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
DEP_MicroNode * depnode() const
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
bool opNumrenames_global(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
const UT_StringHolder & getNamefromgroupmask() const
static void saveData(std::ostream &os, fpreal64 v)
constexpr SYS_FORCE_INLINE T & w() noexcept
SYS_FORCE_INLINE void append(char character)
static void saveData(std::ostream &os, UT_Matrix3D v)
virtual UT_StringHolder baseGetSignature() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
static void loadData(UT_IStream &is, bool &v)
bool opNumrenames_enable(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
bool operator!=(const Numrenames &src) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
void setAttribname(const UT_StringHolder &val)
fpreal getCookTime() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
bool operator==(const Numnames &src) const
static void loadData(UT_IStream &is, UT_Vector4I &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
bool isParmColorRamp(exint idx) const override
UT_StringHolder opinstNumnames_name(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
const char * findChar(int c) const
ParmType getNestParmType(TempIndex fieldnum) const override
static void saveData(std::ostream &os, UT_StringHolder s)
constexpr SYS_FORCE_INLINE T & y() noexcept
static void saveData(std::ostream &os, PRM_DataItemHandle s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
const UT_Array< Numrenames > & getNumrenames() const
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
constexpr SYS_FORCE_INLINE T & y() noexcept
bool operator!=(const SOP_NameParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
constexpr SYS_FORCE_INLINE T & x() noexcept