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;
210 graph->
evalOpParm(myUseColor, nodeidx,
"usecolor", time, graph->
isDirect()?
nullptr:depnode);
213 graph->
evalOpParm(myColor, nodeidx,
"color", time, graph->
isDirect()?
nullptr:depnode);
225 graph->
evalOpParm(myUniformScale, nodeidx,
"scale", time, graph->
isDirect()?
nullptr:depnode);
228 graph->
evalOpParm(myDisplayIcon, nodeidx,
"displayicon", time, graph->
isDirect()?
nullptr:depnode);
230 if (
true && ( (
true&&!(((
int64(getDisplayIcon())==1)))) ) )
231 graph->
evalOpParm(myControlType, nodeidx,
"controltype", time, graph->
isDirect()?
nullptr:depnode);
233 if (
true && ( (
true&&!(((
int64(getDisplayIcon())==1))||((
int64(getDisplayIcon())!=1)&&(
int64(getControlType())!=1)&&(
int64(getControlType())!=3)&&(
int64(getControlType())!=4)&&(
int64(getControlType())!=6)))) ) )
234 graph->
evalOpParm(myOrientation, nodeidx,
"orientation", time, graph->
isDirect()?
nullptr:depnode);
235 myShadedMode =
false;
237 graph->
evalOpParm(myShadedMode, nodeidx,
"shadedmode", time, graph->
isDirect()?
nullptr:depnode);
240 graph->
evalOpParm(myPacked, nodeidx,
"packed", time, graph->
isDirect()?
nullptr:depnode);
244 graph->
evalOpParm(length, nodeidx,
"numsnappoints", time, graph->
isDirect()?
nullptr:depnode);
245 if (length < 0) length = 0;
246 mySnapPoints.setSize(length);
253 auto && _curentry = mySnapPoints(i);
257 graph->
evalOpParmInst(_curentry.snappos, nodeidx,
"snappos#", parmidx, offsets, time, graph->
isDirect()?
nullptr:depnode, 2-1);
262 mySnapPoints.clear();
278 template <
typename T>
285 if (idx.
size() != instance.
size()+1)
290 coerceValue(value, myUseColor);
293 coerceValue(value, myColor);
296 coerceValue(value, mySize);
299 coerceValue(value, myCenter);
302 coerceValue(value, myRotate);
305 coerceValue(value, myUniformScale);
308 coerceValue(value, myDisplayIcon);
311 coerceValue(value, myControlType);
314 coerceValue(value, myOrientation);
317 coerceValue(value, myShadedMode);
320 coerceValue(value, myPacked);
324 coerceValue(value, mySnapPoints.entries());
325 else if (instance[0] < mySnapPoints.entries())
327 auto && _data = mySnapPoints(instance[0]);
331 coerceValue(value, _data.snappos);
351 { doGetParmValue(idx, instance, value); }
353 { doGetParmValue(idx, instance, value); }
355 { doGetParmValue(idx, instance, value); }
357 { doGetParmValue(idx, instance, value); }
359 { doGetParmValue(idx, instance, value); }
361 { doGetParmValue(idx, instance, value); }
363 { doGetParmValue(idx, instance, value); }
365 { doGetParmValue(idx, instance, value); }
367 { doGetParmValue(idx, instance, value); }
369 { doGetParmValue(idx, instance, value); }
371 { doGetParmValue(idx, instance, value); }
373 template <
typename T>
380 if (idx.
size() != instance.
size()+1)
385 coerceValue(myUseColor, ( ( value ) ));
388 coerceValue(myColor, ( ( value ) ));
391 coerceValue(mySize, ( ( value ) ));
394 coerceValue(myCenter, ( ( value ) ));
397 coerceValue(myRotate, ( ( value ) ));
400 coerceValue(myUniformScale, ( ( value ) ));
403 coerceValue(myDisplayIcon, clampMinValue(0, clampMaxValue(2, value ) ));
406 coerceValue(myControlType, clampMinValue(0, clampMaxValue(7, value ) ));
409 coerceValue(myOrientation, clampMinValue(0, clampMaxValue(6, value ) ));
412 coerceValue(myShadedMode, ( ( value ) ));
415 coerceValue(myPacked, ( ( value ) ));
421 coerceValue(newsize, value);
422 if (newsize < 0) newsize = 0;
423 mySnapPoints.setSize(newsize);
429 mySnapPoints.setSizeIfNeeded(instance[0]+1);
430 auto && _data = mySnapPoints(instance[0]);
434 coerceValue(_data.snappos, value);
445 { doSetParmValue(idx, instance, value); }
447 { doSetParmValue(idx, instance, value); }
449 { doSetParmValue(idx, instance, value); }
451 { doSetParmValue(idx, instance, value); }
453 { doSetParmValue(idx, instance, value); }
455 { doSetParmValue(idx, instance, value); }
457 { doSetParmValue(idx, instance, value); }
459 { doSetParmValue(idx, instance, value); }
461 { doSetParmValue(idx, instance, value); }
463 { doSetParmValue(idx, instance, value); }
465 { doSetParmValue(idx, instance, value); }
483 if (fieldnum.
size() < 1)
500 return "displayicon";
502 return "controltype";
504 return "orientation";
510 if (fieldnum.
size() == 1)
511 return "numsnappoints";
526 if (fieldnum.
size() < 1)
527 return PARM_UNSUPPORTED;
553 if (fieldnum.
size() == 1)
554 return PARM_MULTIPARM;
561 return PARM_UNSUPPORTED;
564 return PARM_UNSUPPORTED;
600 loadData(is, rampdata);
618 int typelen = colon - data.
buffer();
632 {
int64 iv =
v; UTwrite(os, &iv); }
634 { UTwrite<fpreal64>(os, &
v); }
636 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
638 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
639 UTwrite<fpreal64>(os, &v.
z()); }
641 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
642 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
654 if (s) s->save(ostr);
656 saveData(os, result);
663 ostr << s->getDataTypeToken();
668 saveData(os, result);
672 void save(std::ostream &os)
const
676 saveData(os, myUseColor);
677 saveData(os, myColor);
678 saveData(os, mySize);
679 saveData(os, myCenter);
680 saveData(os, myRotate);
681 saveData(os, myUniformScale);
682 saveData(os, myDisplayIcon);
683 saveData(os, myControlType);
684 saveData(os, myOrientation);
685 saveData(os, myShadedMode);
686 saveData(os, myPacked);
689 UTwrite(os, &length);
692 auto && _curentry = mySnapPoints(i);
694 saveData(os, _curentry.snappos);
710 loadData(is, myUseColor);
711 loadData(is, myColor);
712 loadData(is, mySize);
713 loadData(is, myCenter);
714 loadData(is, myRotate);
715 loadData(is, myUniformScale);
716 loadData(is, myDisplayIcon);
717 loadData(is, myControlType);
718 loadData(is, myOrientation);
719 loadData(is, myShadedMode);
720 loadData(is, myPacked);
724 mySnapPoints.setSize(length);
727 auto && _curentry = mySnapPoints(i);
729 loadData(is, _curentry.snappos);
742 if (!thissop)
return getUseColor();
744 OP_Utils::evalOpParm(result, thissop,
"usecolor", cookparms.
getCookTime(), 0);
752 if (!thissop)
return getColor();
754 OP_Utils::evalOpParm(result, thissop,
"color", cookparms.
getCookTime(), 0);
762 if (!thissop)
return getSize();
764 OP_Utils::evalOpParm(result, thissop,
"size", cookparms.
getCookTime(), 0);
772 if (!thissop)
return getCenter();
774 OP_Utils::evalOpParm(result, thissop,
"t", cookparms.
getCookTime(), 0);
782 if (!thissop)
return getRotate();
784 OP_Utils::evalOpParm(result, thissop,
"r", cookparms.
getCookTime(), 0);
792 if (!thissop)
return getUniformScale();
794 OP_Utils::evalOpParm(result, thissop,
"scale", cookparms.
getCookTime(), 0);
802 if (!thissop)
return getDisplayIcon();
804 OP_Utils::evalOpParm(result, thissop,
"displayicon", cookparms.
getCookTime(), 0);
812 if (!thissop)
return getControlType();
814 OP_Utils::evalOpParm(result, thissop,
"controltype", cookparms.
getCookTime(), 0);
822 if (!thissop)
return getOrientation();
824 OP_Utils::evalOpParm(result, thissop,
"orientation", cookparms.
getCookTime(), 0);
832 if (!thissop)
return getShadedMode();
834 OP_Utils::evalOpParm(result, thissop,
"shadedmode", cookparms.
getCookTime(), 0);
842 if (!thissop)
return getPacked();
844 OP_Utils::evalOpParm(result, thissop,
"packed", cookparms.
getCookTime(), 0);
852 if (!thissop)
return getSnapPoints().entries();
854 OP_Utils::evalOpParm(result, thissop,
"numsnappoints", cookparms.
getCookTime(), 0);
858 {
return opinstSnapPoints_snappos(cookparms, &_idx); }
862 if (!thissop)
return (mySnapPoints(_idx[0]).snappos);
864 _parmidx[1-1] = _idx[1-1] + 1;
867 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
GLsizei const GLfloat * value
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
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
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
virtual UT_StringHolder baseGetSignature() const
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)
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
void setColor(UT_Vector3D val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void setDisplayIcon(DisplayIcon val)
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