23 namespace SOP_ExtractCentroidEnums
35 using namespace UT::Literal;
53 using namespace UT::Literal;
71 using namespace UT::Literal;
89 using namespace UT::Literal;
108 myPieceAttrib =
"name"_UTsh;
112 myCentroidAttrib =
"centroid"_UTsh;
113 myTransferAttributes =
""_UTsh;
114 myTransferGroups =
""_UTsh;
127 if (myPartitionType != src.myPartitionType)
return false;
128 if (myPieceAttrib != src.myPieceAttrib)
return false;
129 if (myAttribClass != src.myAttribClass)
return false;
130 if (myMethod != src.myMethod)
return false;
131 if (myOutput != src.myOutput)
return false;
132 if (myCentroidAttrib != src.myCentroidAttrib)
return false;
133 if (myTransferAttributes != src.myTransferAttributes)
return false;
134 if (myTransferGroups != src.myTransferGroups)
return false;
156 graph->
evalOpParm(myPartitionType, nodeidx,
"partitiontype", time, graph->
isDirect()?
nullptr:depnode);
157 myPieceAttrib =
"name"_UTsh;
158 if (
true && ( (
true&&!(((
int64(getPartitionType())!=1))||((
int64(getPartitionType())!=1)))) ) )
159 graph->
evalOpParm(myPieceAttrib, nodeidx,
"pieceattrib", time, graph->
isDirect()?
nullptr:depnode);
161 if (
true && ( (
true&&!(((
int64(getPartitionType())!=1))||((
int64(getPartitionType())!=1)))) ) )
162 graph->
evalOpParm(myAttribClass, nodeidx,
"class", time, graph->
isDirect()?
nullptr:depnode);
165 graph->
evalOpParm(myMethod, nodeidx,
"method", time, graph->
isDirect()?
nullptr:depnode);
168 graph->
evalOpParm(myOutput, nodeidx,
"output", time, graph->
isDirect()?
nullptr:depnode);
169 myCentroidAttrib =
"centroid"_UTsh;
170 if (
true && ( (
true&&!(((
int64(getOutput())!=1))||((
int64(getOutput())!=1)))) ) )
171 graph->
evalOpParm(myCentroidAttrib, nodeidx,
"centroidattrib", time, graph->
isDirect()?
nullptr:depnode);
172 myTransferAttributes =
""_UTsh;
173 if (
true && ( (
true&&!(((
int64(getOutput())!=0))||((
int64(getOutput())!=0)))) ) )
174 graph->
evalOpParm(myTransferAttributes, nodeidx,
"transferattributes", time, graph->
isDirect()?
nullptr:depnode);
175 myTransferGroups =
""_UTsh;
176 if (
true && ( (
true&&!(((
int64(getOutput())!=0))||((
int64(getOutput())!=0)))) ) )
177 graph->
evalOpParm(myTransferGroups, nodeidx,
"transfergroups", time, graph->
isDirect()?
nullptr:depnode);
193 template <
typename T>
200 if (idx.
size() != instance.
size()+1)
205 coerceValue(value, myPartitionType);
208 coerceValue(value, myPieceAttrib);
211 coerceValue(value, myAttribClass);
214 coerceValue(value, myMethod);
217 coerceValue(value, myOutput);
220 coerceValue(value, myCentroidAttrib);
223 coerceValue(value, myTransferAttributes);
226 coerceValue(value, myTransferGroups);
242 { doGetParmValue(idx, instance, value); }
244 { doGetParmValue(idx, instance, value); }
246 { doGetParmValue(idx, instance, value); }
248 { doGetParmValue(idx, instance, value); }
250 { doGetParmValue(idx, instance, value); }
252 { doGetParmValue(idx, instance, value); }
254 { doGetParmValue(idx, instance, value); }
256 { doGetParmValue(idx, instance, value); }
258 { doGetParmValue(idx, instance, value); }
260 { doGetParmValue(idx, instance, value); }
262 { doGetParmValue(idx, instance, value); }
264 template <
typename T>
271 if (idx.
size() != instance.
size()+1)
276 coerceValue(myPartitionType, clampMinValue(0, clampMaxValue(2, value ) ));
279 coerceValue(myPieceAttrib, ( ( value ) ));
282 coerceValue(myAttribClass, clampMinValue(0, clampMaxValue(1, value ) ));
285 coerceValue(myMethod, clampMinValue(0, clampMaxValue(2, value ) ));
288 coerceValue(myOutput, clampMinValue(0, clampMaxValue(1, value ) ));
291 coerceValue(myCentroidAttrib, ( ( value ) ));
294 coerceValue(myTransferAttributes, ( ( value ) ));
297 coerceValue(myTransferGroups, ( ( value ) ));
304 { doSetParmValue(idx, instance, value); }
306 { doSetParmValue(idx, instance, value); }
308 { doSetParmValue(idx, instance, value); }
310 { doSetParmValue(idx, instance, value); }
312 { doSetParmValue(idx, instance, value); }
314 { doSetParmValue(idx, instance, value); }
316 { doSetParmValue(idx, instance, value); }
318 { doSetParmValue(idx, instance, value); }
320 { doSetParmValue(idx, instance, value); }
322 { doSetParmValue(idx, instance, value); }
324 { doSetParmValue(idx, instance, value); }
340 if (fieldnum.
size() < 1)
345 return "partitiontype";
347 return "pieceattrib";
355 return "centroidattrib";
357 return "transferattributes";
359 return "transfergroups";
367 if (fieldnum.
size() < 1)
368 return PARM_UNSUPPORTED;
389 return PARM_UNSUPPORTED;
425 loadData(is, rampdata);
443 int typelen = colon - data.
buffer();
457 {
int64 iv =
v; UTwrite(os, &iv); }
459 { UTwrite<fpreal64>(os, &
v); }
461 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
463 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
464 UTwrite<fpreal64>(os, &v.
z()); }
466 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
467 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
479 if (s) s->save(ostr);
481 saveData(os, result);
488 ostr << s->getDataTypeToken();
493 saveData(os, result);
497 void save(std::ostream &os)
const
501 saveData(os, myPartitionType);
502 saveData(os, myPieceAttrib);
503 saveData(os, myAttribClass);
504 saveData(os, myMethod);
505 saveData(os, myOutput);
506 saveData(os, myCentroidAttrib);
507 saveData(os, myTransferAttributes);
508 saveData(os, myTransferGroups);
521 loadData(is, myPartitionType);
522 loadData(is, myPieceAttrib);
523 loadData(is, myAttribClass);
524 loadData(is, myMethod);
525 loadData(is, myOutput);
526 loadData(is, myCentroidAttrib);
527 loadData(is, myTransferAttributes);
528 loadData(is, myTransferGroups);
538 if (!thissop)
return getPartitionType();
540 OP_Utils::evalOpParm(result, thissop,
"partitiontype", cookparms.
getCookTime(), 0);
548 if (!thissop)
return getPieceAttrib();
550 OP_Utils::evalOpParm(result, thissop,
"pieceattrib", cookparms.
getCookTime(), 0);
558 if (!thissop)
return getAttribClass();
560 OP_Utils::evalOpParm(result, thissop,
"class", cookparms.
getCookTime(), 0);
568 if (!thissop)
return getMethod();
570 OP_Utils::evalOpParm(result, thissop,
"method", cookparms.
getCookTime(), 0);
578 if (!thissop)
return getOutput();
580 OP_Utils::evalOpParm(result, thissop,
"output", cookparms.
getCookTime(), 0);
588 if (!thissop)
return getCentroidAttrib();
590 OP_Utils::evalOpParm(result, thissop,
"centroidattrib", cookparms.
getCookTime(), 0);
598 if (!thissop)
return getTransferAttributes();
600 OP_Utils::evalOpParm(result, thissop,
"transferattributes", cookparms.
getCookTime(), 0);
608 if (!thissop)
return getTransferGroups();
610 OP_Utils::evalOpParm(result, thissop,
"transfergroups", cookparms.
getCookTime(), 0);
615 int64 myPartitionType;
SOP_Node * getNode() const
exint bread(int32 *buffer, exint asize=1)
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
GLsizei const GLfloat * value
const OP_Context & context() const
constexpr SYS_FORCE_INLINE T & z() noexcept
SYS_FORCE_INLINE const char * buffer() const
An output stream object that owns its own string buffer storage.
**But if you need a result
static PRM_DataItemHandle parseBinary(const char *type, UT_IStream &is)
const UT_WorkBuffer & str()
Returns a read-only reference to the underlying UT_WorkBuffer.
constexpr SYS_FORCE_INLINE T & x() noexcept
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
constexpr SYS_FORCE_INLINE T & x() noexcept
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
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
const OP_GraphProxy * graph() const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
void saveBinary(std::ostream &os) const
Save string to binary stream.
GT_API const UT_StringHolder version
DEP_MicroNode * depnode() const
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
constexpr SYS_FORCE_INLINE T & w() noexcept
virtual UT_StringHolder baseGetSignature() const
fpreal getCookTime() const
const char * findChar(int c) const
constexpr SYS_FORCE_INLINE T & y() noexcept
virtual bool isDirect() const =0
Direct proxies mirror actual nodes:
constexpr SYS_FORCE_INLINE T & y() noexcept
SYS_FORCE_INLINE bool isstring() const
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
constexpr SYS_FORCE_INLINE T & x() noexcept