23 namespace SOP_MergePackedEnums
34 using namespace UT::Literal;
51 using namespace UT::Literal;
68 using namespace UT::Literal;
100 if (useinput != src.
useinput)
return false;
118 for (
int i = 0; i < list.
entries(); i++)
124 buf.
appendSprintf(
"%s", (list(i).useinput) ?
"true" :
"false");
140 mySetPrimName =
true;
141 myPrimName =
"name"_UTsh;
142 mySetPrimIndex =
false;
143 myPrimIndex =
"index"_UTsh;
144 myNameOverride =
false;
145 myNameOverrideAttrib =
"name"_UTsh;
147 myOnlyPackUnpacked =
false;
148 myIgnoreEmpty =
false;
150 mySingleMode =
false;
166 if (mySetPrimName != src.mySetPrimName)
return false;
167 if (myPrimName != src.myPrimName)
return false;
168 if (mySetPrimIndex != src.mySetPrimIndex)
return false;
169 if (myPrimIndex != src.myPrimIndex)
return false;
170 if (myNameOverride != src.myNameOverride)
return false;
171 if (myNameOverrideAttrib != src.myNameOverrideAttrib)
return false;
172 if (myPack != src.myPack)
return false;
173 if (myOnlyPackUnpacked != src.myOnlyPackUnpacked)
return false;
174 if (myIgnoreEmpty != src.myIgnoreEmpty)
return false;
175 if (myNamingMethod != src.myNamingMethod)
return false;
176 if (mySingleMode != src.mySingleMode)
return false;
177 if (mySingleIndex != src.mySingleIndex)
return false;
178 if (myNames != src.myNames)
return false;
179 if (myPivot != src.myPivot)
return false;
195 mySetPrimName =
true;
197 graph->
evalOpParm(mySetPrimName, nodeidx,
"setprimname", time, 0);
198 myPrimName =
"name"_UTsh;
199 if (
true && ( (
true&&!(((getSetPrimName()!=1)))) ) )
200 graph->
evalOpParm(myPrimName, nodeidx,
"primname", time, 0);
201 mySetPrimIndex =
false;
203 graph->
evalOpParm(mySetPrimIndex, nodeidx,
"setprimindex", time, 0);
204 myPrimIndex =
"index"_UTsh;
205 if (
true && ( (
true&&!(((getSetPrimIndex()!=1)))) ) )
206 graph->
evalOpParm(myPrimIndex, nodeidx,
"primindex", time, 0);
207 myNameOverride =
false;
209 graph->
evalOpParm(myNameOverride, nodeidx,
"nameoverride", time, 0);
210 myNameOverrideAttrib =
"name"_UTsh;
211 if (
true && ( (
true&&!(((getNameOverride()!=1)))) ) )
212 graph->
evalOpParm(myNameOverrideAttrib, nodeidx,
"nameoverrideattrib", time, 0);
215 graph->
evalOpParm(myPack, nodeidx,
"pack", time, 0);
216 myOnlyPackUnpacked =
false;
217 if (
true && ( (
true&&!(((getPack()!=1)))) ) )
218 graph->
evalOpParm(myOnlyPackUnpacked, nodeidx,
"onlypackunpacked", time, 0);
219 myIgnoreEmpty =
false;
221 graph->
evalOpParm(myIgnoreEmpty, nodeidx,
"ignoreempty", time, 0);
224 graph->
evalOpParm(myNamingMethod, nodeidx,
"namingmethod", time, 0);
225 mySingleMode =
false;
227 graph->
evalOpParm(mySingleMode, nodeidx,
"singlemode", time, 0);
229 if (
true && ( (
true&&!(((getSingleMode()!=1)))) ) )
230 graph->
evalOpParm(mySingleIndex, nodeidx,
"singleindex", time, 0);
234 graph->
evalOpParm(length, nodeidx,
"names", time, 0);
235 if (length < 0) length = 0;
236 myNames.setSize(length);
243 auto && _curentry = myNames(i);
245 _curentry.useinput =
true;
247 graph->
evalOpParmInst(_curentry.useinput, nodeidx,
"useinput#", parmidx, offsets, time, 0, 2-1);
248 _curentry.name =
""_UTsh;
250 graph->
evalOpParmInst(_curentry.name, nodeidx,
"name#", parmidx, offsets, time, 0, 2-1);
251 _curentry.treatasfolder = 0;
253 graph->
evalOpParmInst(_curentry.treatasfolder, nodeidx,
"treatasfolder#", parmidx, offsets, time, 0, 2-1);
260 if (
true && ( (
true&&!(((getPack()!=1)))) ) )
261 graph->
evalOpParm(myPivot, nodeidx,
"pivot", time, 0);
277 template <
typename T>
284 if (idx.
size() != instance.
size()+1)
289 coerceValue(value, mySetPrimName);
292 coerceValue(value, myPrimName);
295 coerceValue(value, mySetPrimIndex);
298 coerceValue(value, myPrimIndex);
301 coerceValue(value, myNameOverride);
304 coerceValue(value, myNameOverrideAttrib);
307 coerceValue(value, myPack);
310 coerceValue(value, myOnlyPackUnpacked);
313 coerceValue(value, myIgnoreEmpty);
316 coerceValue(value, myNamingMethod);
319 coerceValue(value, mySingleMode);
322 coerceValue(value, mySingleIndex);
326 coerceValue(value, myNames.entries());
327 else if (instance[0] < myNames.entries())
329 auto && _data = myNames(instance[0]);
333 coerceValue(value, _data.useinput);
336 coerceValue(value, _data.name);
339 coerceValue(value, _data.treatasfolder);
346 coerceValue(value, myPivot);
362 { doGetParmValue(idx, instance, value); }
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 template <
typename T>
391 if (idx.
size() != instance.
size()+1)
396 coerceValue(mySetPrimName, ( ( value ) ));
399 coerceValue(myPrimName, ( ( value ) ));
402 coerceValue(mySetPrimIndex, ( ( value ) ));
405 coerceValue(myPrimIndex, ( ( value ) ));
408 coerceValue(myNameOverride, ( ( value ) ));
411 coerceValue(myNameOverrideAttrib, ( ( value ) ));
414 coerceValue(myPack, ( ( value ) ));
417 coerceValue(myOnlyPackUnpacked, ( ( value ) ));
420 coerceValue(myIgnoreEmpty, ( ( value ) ));
423 coerceValue(myNamingMethod, clampMinValue(0, clampMaxValue(1, value ) ));
426 coerceValue(mySingleMode, ( ( value ) ));
429 coerceValue(mySingleIndex, clampMinValue(1, ( value ) ));
435 coerceValue(newsize, value);
436 if (newsize < 0) newsize = 0;
437 myNames.setSize(newsize);
443 myNames.setSizeIfNeeded(instance[0]+1);
444 auto && _data = myNames(instance[0]);
448 coerceValue(_data.useinput, value);
451 coerceValue(_data.name, value);
454 coerceValue(_data.treatasfolder, value);
461 coerceValue(myPivot, clampMinValue(0, clampMaxValue(1, value ) ));
468 { doSetParmValue(idx, instance, value); }
470 { doSetParmValue(idx, instance, 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); }
506 if (fieldnum.
size() < 1)
511 return "setprimname";
515 return "setprimindex";
519 return "nameoverride";
521 return "nameoverrideattrib";
525 return "onlypackunpacked";
527 return "ignoreempty";
529 return "namingmethod";
533 return "singleindex";
535 if (fieldnum.
size() == 1)
544 return "treatasfolder#";
557 if (fieldnum.
size() < 1)
558 return PARM_UNSUPPORTED;
586 if (fieldnum.
size() == 1)
587 return PARM_MULTIPARM;
598 return PARM_UNSUPPORTED;
603 return PARM_UNSUPPORTED;
639 loadData(is, rampdata);
657 int typelen = colon - data.
buffer();
671 {
int64 iv =
v; UTwrite(os, &iv); }
673 { UTwrite<fpreal64>(os, &
v); }
675 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
677 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
678 UTwrite<fpreal64>(os, &v.
z()); }
680 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
681 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
693 if (s) s->save(ostr);
695 saveData(os, result);
702 ostr << s->getDataTypeToken();
707 saveData(os, result);
711 void save(std::ostream &os)
const
715 saveData(os, mySetPrimName);
716 saveData(os, myPrimName);
717 saveData(os, mySetPrimIndex);
718 saveData(os, myPrimIndex);
719 saveData(os, myNameOverride);
720 saveData(os, myNameOverrideAttrib);
721 saveData(os, myPack);
722 saveData(os, myOnlyPackUnpacked);
723 saveData(os, myIgnoreEmpty);
724 saveData(os, myNamingMethod);
725 saveData(os, mySingleMode);
726 saveData(os, mySingleIndex);
729 UTwrite(os, &length);
732 auto && _curentry = myNames(i);
734 saveData(os, _curentry.useinput);
735 saveData(os, _curentry.name);
736 saveData(os, _curentry.treatasfolder);
740 saveData(os, myPivot);
753 loadData(is, mySetPrimName);
754 loadData(is, myPrimName);
755 loadData(is, mySetPrimIndex);
756 loadData(is, myPrimIndex);
757 loadData(is, myNameOverride);
758 loadData(is, myNameOverrideAttrib);
759 loadData(is, myPack);
760 loadData(is, myOnlyPackUnpacked);
761 loadData(is, myIgnoreEmpty);
762 loadData(is, myNamingMethod);
763 loadData(is, mySingleMode);
764 loadData(is, mySingleIndex);
768 myNames.setSize(length);
771 auto && _curentry = myNames(i);
773 loadData(is, _curentry.useinput);
774 loadData(is, _curentry.name);
775 loadData(is, _curentry.treatasfolder);
779 loadData(is, myPivot);
789 if (!thissop)
return getSetPrimName();
791 OP_Utils::evalOpParm(result, thissop,
"setprimname", cookparms.
getCookTime(), 0);
799 if (!thissop)
return getPrimName();
801 OP_Utils::evalOpParm(result, thissop,
"primname", cookparms.
getCookTime(), 0);
809 if (!thissop)
return getSetPrimIndex();
811 OP_Utils::evalOpParm(result, thissop,
"setprimindex", cookparms.
getCookTime(), 0);
819 if (!thissop)
return getPrimIndex();
821 OP_Utils::evalOpParm(result, thissop,
"primindex", cookparms.
getCookTime(), 0);
829 if (!thissop)
return getNameOverride();
831 OP_Utils::evalOpParm(result, thissop,
"nameoverride", cookparms.
getCookTime(), 0);
839 if (!thissop)
return getNameOverrideAttrib();
841 OP_Utils::evalOpParm(result, thissop,
"nameoverrideattrib", cookparms.
getCookTime(), 0);
849 if (!thissop)
return getPack();
851 OP_Utils::evalOpParm(result, thissop,
"pack", cookparms.
getCookTime(), 0);
859 if (!thissop)
return getOnlyPackUnpacked();
861 OP_Utils::evalOpParm(result, thissop,
"onlypackunpacked", cookparms.
getCookTime(), 0);
869 if (!thissop)
return getIgnoreEmpty();
871 OP_Utils::evalOpParm(result, thissop,
"ignoreempty", cookparms.
getCookTime(), 0);
879 if (!thissop)
return getNamingMethod();
881 OP_Utils::evalOpParm(result, thissop,
"namingmethod", cookparms.
getCookTime(), 0);
889 if (!thissop)
return getSingleMode();
891 OP_Utils::evalOpParm(result, thissop,
"singlemode", cookparms.
getCookTime(), 0);
899 if (!thissop)
return getSingleIndex();
901 OP_Utils::evalOpParm(result, thissop,
"singleindex", cookparms.
getCookTime(), 0);
909 if (!thissop)
return getNames().entries();
911 OP_Utils::evalOpParm(result, thissop,
"names", cookparms.
getCookTime(), 0);
915 {
return opinstNames_useinput(cookparms, &_idx); }
919 if (!thissop)
return (myNames(_idx[0]).useinput);
921 _parmidx[1-1] = _idx[1-1] + 1;
924 OP_Utils::evalOpParmInst(result, thissop,
"useinput#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
928 {
return opinstNames_name(cookparms, &_idx); }
932 if (!thissop)
return (myNames(_idx[0]).
name);
934 _parmidx[1-1] = _idx[1-1] + 1;
937 OP_Utils::evalOpParmInst(result, thissop,
"name#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
941 {
return opinstNames_treatasfolder(cookparms, &_idx); }
945 if (!thissop)
return (myNames(_idx[0]).treatasfolder);
947 _parmidx[1-1] = _idx[1-1] + 1;
950 OP_Utils::evalOpParmInst(result, thissop,
"treatasfolder#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
959 if (!thissop)
return getPivot();
961 OP_Utils::evalOpParm(result, thissop,
"pivot", cookparms.
getCookTime(), 0);
962 return Pivot(result);
973 bool myOnlyPackUnpacked;
975 int64 myNamingMethod;
const UT_StringHolder & getNameOverrideAttrib() const
void setSingleMode(bool val)
UT_StringHolder opPrimIndex(const SOP_NodeVerb::CookParms &cookparms) const
bool opNames_useinput(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
bool opIgnoreEmpty(const SOP_NodeVerb::CookParms &cookparms) const
bool getSetPrimName() const
GLenum GLuint GLenum GLsizei const GLchar * buf
static void saveData(std::ostream &os, UT_Matrix4D v)
bool getIgnoreEmpty() const
static void loadData(UT_IStream &is, UT_Matrix3D &v)
SOP_Node * getNode() const
int64 opinstNames_treatasfolder(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
static void loadData(UT_IStream &is, bool &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
const char * getNestParmName(TempIndex fieldnum) const override
UT_StringHolder opinstNames_name(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
bool load(UT_IStream &is)
static void saveData(std::ostream &os, PRM_DataItemHandle s)
static void loadData(UT_IStream &is, UT_Vector3D &v)
void setSetPrimName(bool val)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
static void loadData(UT_IStream &is, UT_Vector4D &v)
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
void setNameOverrideAttrib(const UT_StringHolder &val)
GLuint GLsizei GLsizei * length
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
An output stream object that owns its own string buffer storage.
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
**But if you need a result
bool opSetPrimName(const SOP_NodeVerb::CookParms &cookparms) const
exint opNames(const SOP_NodeVerb::CookParms &cookparms) const
bool operator!=(const SOP_MergePackedParms &src) const
static void saveData(std::ostream &os, UT_Matrix3D v)
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
int64 opSingleIndex(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void setPrimIndex(const UT_StringHolder &val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
constexpr SYS_FORCE_INLINE T & x() noexcept
Pivot opPivot(const SOP_NodeVerb::CookParms &cookparms) const
int64 getSingleIndex() const
GLuint GLsizei const GLuint const GLintptr * offsets
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
int64 opNames_treatasfolder(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
constexpr SYS_FORCE_INLINE T & x() noexcept
SYS_FORCE_INLINE UT_StringHolder getToken(Pivot enum_value)
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, bool v)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
static void saveData(std::ostream &os, UT_Vector2D v)
NamingMethod opNamingMethod(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opNameOverrideAttrib(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
constexpr SYS_FORCE_INLINE T & z() noexcept
static void loadData(UT_IStream &is, UT_Vector2D &v)
static void saveData(std::ostream &os, UT_Vector3D v)
exint read(bool *array, exint sz=1)
const OP_GraphProxy * graph() const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setNames(const UT_Array< Names > &val)
bool operator==(const SOP_MergePackedParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
static void loadData(UT_IStream &is, UT_Vector2I &v)
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
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
bool opPack(const SOP_NodeVerb::CookParms &cookparms) const
UT_StringHolder opPrimName(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
GLuint const GLchar * name
bool operator!=(const Names &src) const
exint getNestNumParms(TempIndex idx) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &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
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
void setPrimName(const UT_StringHolder &val)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
bool opOnlyPackUnpacked(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
bool operator==(const Names &src) const
exint entries() const
Alias of size(). size() is preferred.
static void saveData(std::ostream &os, UT_Vector4D v)
void setNamingMethod(NamingMethod val)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
static void loadData(UT_IStream &is, UT_Vector3I &v)
bool getNameOverride() const
bool opNameOverride(const SOP_NodeVerb::CookParms &cookparms) const
bool getSetPrimIndex() const
ParmType getNestParmType(TempIndex fieldnum) const override
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
bool isParmColorRamp(exint idx) const override
DEP_MicroNode * depnode() const
void loadFromOpSubclass(const LoadParms &loadparms) override
static void loadData(UT_IStream &is, fpreal64 &v)
LeafData & operator=(const LeafData &)=delete
UT_StringHolder createString(const UT_Array< Names > &list) const
Utility class for containing a color ramp.
bool getOnlyPackUnpacked() const
constexpr SYS_FORCE_INLINE T & w() noexcept
SYS_FORCE_INLINE void append(char character)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static void saveData(std::ostream &os, fpreal64 v)
void setSetPrimIndex(bool val)
const UT_StringHolder & getPrimName() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
fpreal getCookTime() const
void save(std::ostream &os) const
NamingMethod getNamingMethod() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
bool opSingleMode(const SOP_NodeVerb::CookParms &cookparms) const
void setNameOverride(bool val)
void setSingleIndex(int64 val)
const char * findChar(int c) const
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
void setOnlyPackUnpacked(bool val)
const UT_Array< Names > & getNames() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
bool getSingleMode() const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void saveData(std::ostream &os, int64 v)
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const UT_StringHolder & getPrimIndex() const
constexpr SYS_FORCE_INLINE T & y() noexcept
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void loadData(UT_IStream &is, int64 &v)
static void saveData(std::ostream &os, UT_StringHolder s)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
static void saveData(std::ostream &os, UT_Matrix2D v)
constexpr SYS_FORCE_INLINE T & y() noexcept
bool opSetPrimIndex(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE bool isstring() const
bool opinstNames_useinput(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setIgnoreEmpty(bool val)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
UT_StringHolder opNames_name(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
constexpr SYS_FORCE_INLINE T & x() noexcept
void copyFrom(const OP_NodeParms *src) override