23 namespace SOP_ControlEnums
35 using namespace UT::Literal;
59 using namespace UT::Literal;
87 using namespace UT::Literal;
120 if (snappos != src.
snappos)
return false;
136 for (
int i = 0; i < list.
entries(); i++)
142 buf.
appendSprintf(
"(%f, %f, %f)", list(i).snappos.x(), list(i).snappos.y(), list(i).snappos.z());
163 myShadedMode =
false;
165 mySnapPoints.setSize(0);
178 if (myUseColor != src.myUseColor)
return false;
179 if (myColor != src.myColor)
return false;
180 if (mySize != src.mySize)
return false;
181 if (myCenter != src.myCenter)
return false;
182 if (myRotate != src.myRotate)
return false;
183 if (myUniformScale != src.myUniformScale)
return false;
184 if (myDisplayIcon != src.myDisplayIcon)
return false;
185 if (myControlType != src.myControlType)
return false;
186 if (myOrientation != src.myOrientation)
return false;
187 if (myShadedMode != src.myShadedMode)
return false;
188 if (myPacked != src.myPacked)
return false;
189 if (mySnapPoints != src.mySnapPoints)
return false;
207 graph->
evalOpParm(myUseColor, nodeidx,
"usecolor", time, 0);
210 graph->
evalOpParm(myColor, nodeidx,
"color", time, 0);
213 graph->
evalOpParm(mySize, nodeidx,
"size", time, 0);
216 graph->
evalOpParm(myCenter, nodeidx,
"t", time, 0);
219 graph->
evalOpParm(myRotate, nodeidx,
"r", time, 0);
222 graph->
evalOpParm(myUniformScale, nodeidx,
"scale", time, 0);
225 graph->
evalOpParm(myDisplayIcon, nodeidx,
"displayicon", time, 0);
227 if (
true && ( (
true&&!(((
int64(getDisplayIcon())==1)))) ) )
228 graph->
evalOpParm(myControlType, nodeidx,
"controltype", time, 0);
230 if (
true && ( (
true&&!(((
int64(getDisplayIcon())==1))||((
int64(getDisplayIcon())!=1)&&(
int64(getControlType())!=1)&&(
int64(getControlType())!=3)&&(
int64(getControlType())!=4)&&(
int64(getControlType())!=6)))) ) )
231 graph->
evalOpParm(myOrientation, nodeidx,
"orientation", time, 0);
232 myShadedMode =
false;
234 graph->
evalOpParm(myShadedMode, nodeidx,
"shadedmode", time, 0);
237 graph->
evalOpParm(myPacked, nodeidx,
"packed", time, 0);
241 graph->
evalOpParm(length, nodeidx,
"numsnappoints", time, 0);
242 if (length < 0) length = 0;
243 mySnapPoints.setSize(length);
250 auto && _curentry = mySnapPoints(i);
254 graph->
evalOpParmInst(_curentry.snappos, nodeidx,
"snappos#", parmidx, offsets, time, 0, 2-1);
259 mySnapPoints.clear();
275 template <
typename T>
282 if (idx.
size() != instance.
size()+1)
287 coerceValue(value, myUseColor);
290 coerceValue(value, myColor);
293 coerceValue(value, mySize);
296 coerceValue(value, myCenter);
299 coerceValue(value, myRotate);
302 coerceValue(value, myUniformScale);
305 coerceValue(value, myDisplayIcon);
308 coerceValue(value, myControlType);
311 coerceValue(value, myOrientation);
314 coerceValue(value, myShadedMode);
317 coerceValue(value, myPacked);
321 coerceValue(value, mySnapPoints.entries());
322 else if (instance[0] < mySnapPoints.entries())
324 auto && _data = mySnapPoints(instance[0]);
328 coerceValue(value, _data.snappos);
348 { doGetParmValue(idx, instance, value); }
350 { doGetParmValue(idx, instance, value); }
352 { doGetParmValue(idx, instance, value); }
354 { doGetParmValue(idx, instance, value); }
356 { doGetParmValue(idx, instance, value); }
358 { doGetParmValue(idx, instance, value); }
360 { doGetParmValue(idx, instance, value); }
362 { doGetParmValue(idx, instance, value); }
364 { doGetParmValue(idx, instance, value); }
366 { doGetParmValue(idx, instance, value); }
368 { doGetParmValue(idx, instance, value); }
370 template <
typename T>
377 if (idx.
size() != instance.
size()+1)
382 coerceValue(myUseColor, ( ( value ) ));
385 coerceValue(myColor, ( ( value ) ));
388 coerceValue(mySize, ( ( value ) ));
391 coerceValue(myCenter, ( ( value ) ));
394 coerceValue(myRotate, ( ( value ) ));
397 coerceValue(myUniformScale, ( ( value ) ));
400 coerceValue(myDisplayIcon, clampMinValue(0, clampMaxValue(2, value ) ));
403 coerceValue(myControlType, clampMinValue(0, clampMaxValue(7, value ) ));
406 coerceValue(myOrientation, clampMinValue(0, clampMaxValue(6, value ) ));
409 coerceValue(myShadedMode, ( ( value ) ));
412 coerceValue(myPacked, ( ( value ) ));
418 coerceValue(newsize, value);
419 if (newsize < 0) newsize = 0;
420 mySnapPoints.setSize(newsize);
426 mySnapPoints.setSizeIfNeeded(instance[0]+1);
427 auto && _data = mySnapPoints(instance[0]);
431 coerceValue(_data.snappos, value);
442 { doSetParmValue(idx, instance, value); }
444 { doSetParmValue(idx, instance, value); }
446 { doSetParmValue(idx, instance, value); }
448 { doSetParmValue(idx, instance, value); }
450 { doSetParmValue(idx, instance, value); }
452 { doSetParmValue(idx, instance, value); }
454 { doSetParmValue(idx, instance, value); }
456 { doSetParmValue(idx, instance, value); }
458 { doSetParmValue(idx, instance, value); }
460 { doSetParmValue(idx, instance, value); }
462 { doSetParmValue(idx, instance, value); }
480 if (fieldnum.
size() < 1)
497 return "displayicon";
499 return "controltype";
501 return "orientation";
507 if (fieldnum.
size() == 1)
508 return "numsnappoints";
523 if (fieldnum.
size() < 1)
524 return PARM_UNSUPPORTED;
550 if (fieldnum.
size() == 1)
551 return PARM_MULTIPARM;
558 return PARM_UNSUPPORTED;
561 return PARM_UNSUPPORTED;
597 loadData(is, rampdata);
615 int typelen = colon - data.
buffer();
629 {
int64 iv =
v; UTwrite(os, &iv); }
631 { UTwrite<fpreal64>(os, &
v); }
633 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
635 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
636 UTwrite<fpreal64>(os, &v.
z()); }
638 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
639 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
651 if (s) s->save(ostr);
653 saveData(os, result);
660 ostr << s->getDataTypeToken();
665 saveData(os, result);
669 void save(std::ostream &os)
const
673 saveData(os, myUseColor);
674 saveData(os, myColor);
675 saveData(os, mySize);
676 saveData(os, myCenter);
677 saveData(os, myRotate);
678 saveData(os, myUniformScale);
679 saveData(os, myDisplayIcon);
680 saveData(os, myControlType);
681 saveData(os, myOrientation);
682 saveData(os, myShadedMode);
683 saveData(os, myPacked);
686 UTwrite(os, &length);
689 auto && _curentry = mySnapPoints(i);
691 saveData(os, _curentry.snappos);
707 loadData(is, myUseColor);
708 loadData(is, myColor);
709 loadData(is, mySize);
710 loadData(is, myCenter);
711 loadData(is, myRotate);
712 loadData(is, myUniformScale);
713 loadData(is, myDisplayIcon);
714 loadData(is, myControlType);
715 loadData(is, myOrientation);
716 loadData(is, myShadedMode);
717 loadData(is, myPacked);
721 mySnapPoints.setSize(length);
724 auto && _curentry = mySnapPoints(i);
726 loadData(is, _curentry.snappos);
739 if (!thissop)
return getUseColor();
741 OP_Utils::evalOpParm(result, thissop,
"usecolor", cookparms.
getCookTime(), 0);
749 if (!thissop)
return getColor();
751 OP_Utils::evalOpParm(result, thissop,
"color", cookparms.
getCookTime(), 0);
759 if (!thissop)
return getSize();
761 OP_Utils::evalOpParm(result, thissop,
"size", cookparms.
getCookTime(), 0);
769 if (!thissop)
return getCenter();
771 OP_Utils::evalOpParm(result, thissop,
"t", cookparms.
getCookTime(), 0);
779 if (!thissop)
return getRotate();
781 OP_Utils::evalOpParm(result, thissop,
"r", cookparms.
getCookTime(), 0);
789 if (!thissop)
return getUniformScale();
791 OP_Utils::evalOpParm(result, thissop,
"scale", cookparms.
getCookTime(), 0);
799 if (!thissop)
return getDisplayIcon();
801 OP_Utils::evalOpParm(result, thissop,
"displayicon", cookparms.
getCookTime(), 0);
809 if (!thissop)
return getControlType();
811 OP_Utils::evalOpParm(result, thissop,
"controltype", cookparms.
getCookTime(), 0);
819 if (!thissop)
return getOrientation();
821 OP_Utils::evalOpParm(result, thissop,
"orientation", cookparms.
getCookTime(), 0);
829 if (!thissop)
return getShadedMode();
831 OP_Utils::evalOpParm(result, thissop,
"shadedmode", cookparms.
getCookTime(), 0);
839 if (!thissop)
return getPacked();
841 OP_Utils::evalOpParm(result, thissop,
"packed", cookparms.
getCookTime(), 0);
849 if (!thissop)
return getSnapPoints().entries();
851 OP_Utils::evalOpParm(result, thissop,
"numsnappoints", cookparms.
getCookTime(), 0);
855 {
return opinstSnapPoints_snappos(cookparms, &_idx); }
859 if (!thissop)
return (mySnapPoints(_idx[0]).snappos);
861 _parmidx[1-1] = _idx[1-1] + 1;
864 OP_Utils::evalOpParmInst(result, thissop,
"snappos#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
static void loadData(UT_IStream &is, UT_Vector4D &v)
DisplayIcon opDisplayIcon(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
GLenum GLuint GLenum GLsizei const GLchar * buf
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
SOP_Node * getNode() const
static void saveData(std::ostream &os, UT_StringHolder s)
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
bool operator!=(const SOP_ControlParms &src) const
UT_Vector3D getRotate() const
void copyFrom(const OP_NodeParms *src) override
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
void setCenter(UT_Vector3D val)
void setSnapPoints(const UT_Array< SnapPoints > &val)
void setUseColor(bool val)
static void loadData(UT_IStream &is, UT_Vector4I &v)
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
const OP_Context & context() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
UT_Vector3D getSize() const
bool isParmColorRamp(exint idx) const override
GLuint GLsizei GLsizei * length
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
static void loadData(UT_IStream &is, UT_Matrix4D &v)
An output stream object that owns its own string buffer storage.
**But if you need a result
const char * getNestParmName(TempIndex fieldnum) const override
static void saveData(std::ostream &os, UT_Matrix2D v)
Orientation getOrientation() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &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.
static void saveData(std::ostream &os, UT_Vector4D v)
UT_StringHolder createString(const UT_Array< SnapPoints > &list) const
constexpr SYS_FORCE_INLINE T & x() noexcept
static void saveData(std::ostream &os, UT_Vector3D v)
static void loadData(UT_IStream &is, int64 &v)
bool opShadedMode(const SOP_NodeVerb::CookParms &cookparms) const
GLuint GLsizei const GLuint const GLintptr * offsets
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
constexpr SYS_FORCE_INLINE T & x() noexcept
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
static void loadData(UT_IStream &is, UT_Vector3I &v)
void loadFromOpSubclass(const LoadParms &loadparms) override
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
static void saveData(std::ostream &os, UT_Matrix4D v)
UT_Vector3D opRotate(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector3D opColor(const SOP_NodeVerb::CookParms &cookparms) const
bool operator!=(const SnapPoints &src) const
static void saveData(std::ostream &os, int64 v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
bool load(UT_IStream &is)
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
static void loadData(UT_IStream &is, fpreal64 &v)
constexpr SYS_FORCE_INLINE T & z() noexcept
bool operator==(const SnapPoints &src) const
SYS_FORCE_INLINE UT_StringHolder getToken(DisplayIcon enum_value)
const UT_Array< SnapPoints > & getSnapPoints() const
exint read(bool *array, exint sz=1)
static void saveData(std::ostream &os, UT_Matrix3D v)
const OP_GraphProxy * graph() const
fpreal64 opUniformScale(const SOP_NodeVerb::CookParms &cookparms) const
ControlType getControlType() const
void save(std::ostream &os) const
exint opSnapPoints(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setUniformScale(fpreal64 val)
exint getNestNumParms(TempIndex idx) const override
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 getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
UT_Vector3D opinstSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
static void saveData(std::ostream &os, bool v)
UT_Vector3T< fpreal64 > UT_Vector3D
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
UT_Vector3D opCenter(const SOP_NodeVerb::CookParms &cookparms) const
Orientation opOrientation(const SOP_NodeVerb::CookParms &cookparms) const
UT_Vector3D getColor() const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
SYS_FORCE_INLINE void strcat(const char *src)
bool opUseColor(const SOP_NodeVerb::CookParms &cookparms) const
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.
void setSize(UT_Vector3D val)
bool opPacked(const SOP_NodeVerb::CookParms &cookparms) const
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void setOrientation(Orientation val)
UT_Vector3D opSize(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
DEP_MicroNode * depnode() const
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void loadData(UT_IStream &is, UT_Vector3D &v)
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
void setControlType(ControlType val)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
constexpr SYS_FORCE_INLINE T & w() noexcept
SYS_FORCE_INLINE void append(char character)
void setRotate(UT_Vector3D val)
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
static void loadData(UT_IStream &is, UT_StringHolder &v)
bool operator==(const SOP_ControlParms &src) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
fpreal getCookTime() const
ParmType getNestParmType(TempIndex fieldnum) const override
const char * findChar(int c) const
void setShadedMode(bool val)
fpreal64 getUniformScale() const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
static void loadData(UT_IStream &is, bool &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
constexpr SYS_FORCE_INLINE T & y() noexcept
static void saveData(std::ostream &os, UT_Vector2D v)
void setColor(UT_Vector3D val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void setDisplayIcon(DisplayIcon val)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE bool isstring() const
bool getShadedMode() const
DisplayIcon getDisplayIcon() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
UT_Vector3D opSnapPoints_snappos(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
UT_Vector3D getCenter() const
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static void loadData(UT_IStream &is, UT_Vector2I &v)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
ControlType opControlType(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & x() noexcept