23 namespace SOP_NormalEnums
37 using namespace UT::Literal;
59 using namespace UT::Literal;
79 using namespace UT::Literal;
100 myOverrideNormal =
false;
101 myAttribName =
"N"_UTsh;
121 if (myGroup != src.myGroup)
return false;
122 if (myGrouptype != src.myGrouptype)
return false;
123 if (myOverrideNormal != src.myOverrideNormal)
return false;
124 if (myAttribName != src.myAttribName)
return false;
125 if (myDoCompute != src.myDoCompute)
return false;
126 if (myType != src.myType)
return false;
127 if (myCuspangle != src.myCuspangle)
return false;
128 if (myMethod != src.myMethod)
return false;
129 if (myOrigIfZero != src.myOrigIfZero)
return false;
130 if (myNormalize != src.myNormalize)
return false;
131 if (myReverse != src.myReverse)
return false;
149 graph->
evalOpParm(myGroup, nodeidx,
"group", time, 0);
152 graph->
evalOpParm(myGrouptype, nodeidx,
"grouptype", time, 0);
153 myOverrideNormal =
false;
155 graph->
evalOpParm(myOverrideNormal, nodeidx,
"overridenormal", time, 0);
156 myAttribName =
"N"_UTsh;
157 if (
true && ( (
true&&!(((getOverrideNormal()==0)))) ) )
158 graph->
evalOpParm(myAttribName, nodeidx,
"normalattrib", time, 0);
161 graph->
evalOpParm(myDoCompute, nodeidx,
"docompute", time, 0);
163 if (
true && ( (
true&&!(((getDoCompute()==0)))) ) )
164 graph->
evalOpParm(myType, nodeidx,
"type", time, 0);
166 if (
true && ( (
true&&!(((getDoCompute()==0))||((
int64(getType())!=1)))) ) )
167 graph->
evalOpParm(myCuspangle, nodeidx,
"cuspangle", time, 0);
169 if (
true && ( (
true&&!(((getDoCompute()==0)))) ) )
170 graph->
evalOpParm(myMethod, nodeidx,
"method", time, 0);
172 if (
true && ( (
true&&!(((getDoCompute()==0)))) ) )
173 graph->
evalOpParm(myOrigIfZero, nodeidx,
"origifzero", time, 0);
175 if (
true && ( (
true&&!(((getDoCompute()==1)))) ) )
176 graph->
evalOpParm(myNormalize, nodeidx,
"normalize", time, 0);
179 graph->
evalOpParm(myReverse, nodeidx,
"reverse", time, 0);
195 template <
typename T>
202 if (idx.
size() != instance.
size()+1)
207 coerceValue(value, myGroup);
210 coerceValue(value, myGrouptype);
213 coerceValue(value, myOverrideNormal);
216 coerceValue(value, myAttribName);
219 coerceValue(value, myDoCompute);
222 coerceValue(value, myType);
225 coerceValue(value, myCuspangle);
228 coerceValue(value, myMethod);
231 coerceValue(value, myOrigIfZero);
234 coerceValue(value, myNormalize);
237 coerceValue(value, myReverse);
253 { doGetParmValue(idx, instance, value); }
255 { doGetParmValue(idx, instance, value); }
257 { doGetParmValue(idx, instance, value); }
259 { doGetParmValue(idx, instance, value); }
261 { doGetParmValue(idx, instance, value); }
263 { doGetParmValue(idx, instance, value); }
265 { doGetParmValue(idx, instance, value); }
267 { doGetParmValue(idx, instance, value); }
269 { doGetParmValue(idx, instance, value); }
271 { doGetParmValue(idx, instance, value); }
273 { doGetParmValue(idx, instance, value); }
275 template <
typename T>
282 if (idx.
size() != instance.
size()+1)
287 coerceValue(myGroup, ( ( value ) ));
290 coerceValue(myGrouptype, clampMinValue(0, clampMaxValue(4, value ) ));
293 coerceValue(myOverrideNormal, ( ( value ) ));
296 coerceValue(myAttribName, ( ( value ) ));
299 coerceValue(myDoCompute, ( ( value ) ));
302 coerceValue(myType, clampMinValue(0, clampMaxValue(3, value ) ));
305 coerceValue(myCuspangle, clampMinValue(0, clampMaxValue(180, value ) ));
308 coerceValue(myMethod, clampMinValue(0, clampMaxValue(2, value ) ));
311 coerceValue(myOrigIfZero, ( ( value ) ));
314 coerceValue(myNormalize, ( ( value ) ));
317 coerceValue(myReverse, ( ( value ) ));
324 { doSetParmValue(idx, instance, value); }
326 { doSetParmValue(idx, instance, value); }
328 { doSetParmValue(idx, instance, value); }
330 { doSetParmValue(idx, instance, value); }
332 { doSetParmValue(idx, instance, value); }
334 { doSetParmValue(idx, instance, value); }
336 { doSetParmValue(idx, instance, value); }
338 { doSetParmValue(idx, instance, value); }
340 { doSetParmValue(idx, instance, value); }
342 { doSetParmValue(idx, instance, value); }
344 { doSetParmValue(idx, instance, value); }
360 if (fieldnum.
size() < 1)
369 return "overridenormal";
371 return "normalattrib";
393 if (fieldnum.
size() < 1)
394 return PARM_UNSUPPORTED;
421 return PARM_UNSUPPORTED;
457 loadData(is, rampdata);
475 int typelen = colon - data.
buffer();
489 {
int64 iv =
v; UTwrite(os, &iv); }
491 { UTwrite<fpreal64>(os, &
v); }
493 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
495 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
496 UTwrite<fpreal64>(os, &v.
z()); }
498 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
499 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
511 if (s) s->save(ostr);
513 saveData(os, result);
520 ostr << s->getDataTypeToken();
525 saveData(os, result);
529 void save(std::ostream &os)
const
533 saveData(os, myGroup);
534 saveData(os, myGrouptype);
535 saveData(os, myOverrideNormal);
536 saveData(os, myAttribName);
537 saveData(os, myDoCompute);
538 saveData(os, myType);
539 saveData(os, myCuspangle);
540 saveData(os, myMethod);
541 saveData(os, myOrigIfZero);
542 saveData(os, myNormalize);
543 saveData(os, myReverse);
556 loadData(is, myGroup);
557 loadData(is, myGrouptype);
558 loadData(is, myOverrideNormal);
559 loadData(is, myAttribName);
560 loadData(is, myDoCompute);
561 loadData(is, myType);
562 loadData(is, myCuspangle);
563 loadData(is, myMethod);
564 loadData(is, myOrigIfZero);
565 loadData(is, myNormalize);
566 loadData(is, myReverse);
576 if (!thissop)
return getGroup();
578 OP_Utils::evalOpParm(result, thissop,
"group", cookparms.
getCookTime(), 0);
586 if (!thissop)
return getGrouptype();
588 OP_Utils::evalOpParm(result, thissop,
"grouptype", cookparms.
getCookTime(), 0);
596 if (!thissop)
return getOverrideNormal();
598 OP_Utils::evalOpParm(result, thissop,
"overridenormal", cookparms.
getCookTime(), 0);
606 if (!thissop)
return getAttribName();
608 OP_Utils::evalOpParm(result, thissop,
"normalattrib", cookparms.
getCookTime(), 0);
616 if (!thissop)
return getDoCompute();
618 OP_Utils::evalOpParm(result, thissop,
"docompute", cookparms.
getCookTime(), 0);
626 if (!thissop)
return getType();
628 OP_Utils::evalOpParm(result, thissop,
"type", cookparms.
getCookTime(), 0);
636 if (!thissop)
return getCuspangle();
638 OP_Utils::evalOpParm(result, thissop,
"cuspangle", cookparms.
getCookTime(), 0);
646 if (!thissop)
return getMethod();
648 OP_Utils::evalOpParm(result, thissop,
"method", cookparms.
getCookTime(), 0);
656 if (!thissop)
return getOrigIfZero();
658 OP_Utils::evalOpParm(result, thissop,
"origifzero", cookparms.
getCookTime(), 0);
666 if (!thissop)
return getNormalize();
668 OP_Utils::evalOpParm(result, thissop,
"normalize", cookparms.
getCookTime(), 0);
676 if (!thissop)
return getReverse();
678 OP_Utils::evalOpParm(result, thissop,
"reverse", cookparms.
getCookTime(), 0);
685 bool myOverrideNormal;
bool getDoCompute() const
void save(std::ostream &os) const
bool isParmColorRamp(exint idx) const override
static void saveData(std::ostream &os, UT_StringHolder s)
static void saveData(std::ostream &os, bool v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
SOP_Node * getNode() const
SYS_FORCE_INLINE UT_StringHolder getToken(Grouptype enum_value)
bool opNormalize(const SOP_NodeVerb::CookParms &cookparms) const
bool getOrigIfZero() const
exint bread(int32 *buffer, exint asize=1)
static void loadData(UT_IStream &is, UT_Vector3I &v)
void setNormalize(bool val)
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
static void loadData(UT_IStream &is, UT_Matrix4D &v)
const OP_Context & context() const
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
bool opReverse(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, bool &v)
An output stream object that owns its own string buffer storage.
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
void setGrouptype(Grouptype val)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void copyFrom(const OP_NodeParms *src) override
bool opDoCompute(const SOP_NodeVerb::CookParms &cookparms) const
**But if you need a result
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
bool operator==(const SOP_NormalParms &src) const
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, fpreal64 v)
void setCuspangle(fpreal64 val)
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void setReverse(bool val)
void setOverrideNormal(bool val)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
constexpr SYS_FORCE_INLINE T & x() noexcept
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
void setAttribName(const UT_StringHolder &val)
bool opOverrideNormal(const SOP_NodeVerb::CookParms &cookparms) const
constexpr SYS_FORCE_INLINE T & x() noexcept
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
bool opOrigIfZero(const SOP_NodeVerb::CookParms &cookparms) const
Method opMethod(const SOP_NodeVerb::CookParms &cookparms) const
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
void setGroup(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Vector3D &v)
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
constexpr SYS_FORCE_INLINE T & z() noexcept
static void loadData(UT_IStream &is, UT_Vector4D &v)
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
Type opType(const SOP_NodeVerb::CookParms &cookparms) const
const OP_GraphProxy * graph() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
Grouptype opGrouptype(const SOP_NodeVerb::CookParms &cookparms) const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
static void loadData(UT_IStream &is, int64 &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
bool getNormalize() const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
static void saveData(std::ostream &os, UT_Vector2D v)
static void loadData(UT_IStream &is, UT_StringHolder &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
void setOrigIfZero(bool val)
Grouptype getGrouptype() const
static void loadData(UT_IStream &is, UT_Vector2D &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void loadFromOpSubclass(const LoadParms &loadparms) override
void saveBinary(std::ostream &os) const
Save string to binary stream.
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
exint getNestNumParms(TempIndex idx) const override
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
static void saveData(std::ostream &os, int64 v)
bool getOverrideNormal() const
UT_StringHolder opAttribName(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, UT_Vector4D v)
void setMethod(Method val)
static void loadData(UT_IStream &is, fpreal64 &v)
DEP_MicroNode * depnode() const
void setDoCompute(bool val)
LeafData & operator=(const LeafData &)=delete
const char * getNestParmName(TempIndex fieldnum) const override
Utility class for containing a color ramp.
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
static void saveData(std::ostream &os, UT_Matrix2D v)
constexpr SYS_FORCE_INLINE T & w() noexcept
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
ParmType getNestParmType(TempIndex fieldnum) const override
bool load(UT_IStream &is)
fpreal getCookTime() const
static void saveData(std::ostream &os, UT_Matrix4D v)
const char * findChar(int c) const
static void saveData(std::ostream &os, UT_Matrix3D v)
static void loadData(UT_IStream &is, UT_Vector4I &v)
static void saveData(std::ostream &os, UT_Vector3D v)
constexpr SYS_FORCE_INLINE T & y() noexcept
fpreal64 opCuspangle(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
const UT_StringHolder & getAttribName() const
constexpr SYS_FORCE_INLINE T & y() noexcept
fpreal64 getCuspangle() const
SYS_FORCE_INLINE bool isstring() const
bool operator!=(const SOP_NormalParms &src) const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
const UT_StringHolder & getGroup() const
constexpr SYS_FORCE_INLINE T & x() noexcept