23 namespace SOP_VolumeRasterizeParticlesEnums
36 using namespace UT::Literal;
69 if (rule != src.
rule)
return false;
85 for (
int i = 0; i < list.
entries(); i++)
107 myFilter =
"gauss"_UTsh;
108 myDensityattrib =
"density"_UTsh;
112 myVelocityblur =
false;
117 myAttribrules.setSize(0);
130 if (myGroup != src.myGroup)
return false;
131 if (myPoints != src.myPoints)
return false;
132 if (myFilter != src.myFilter)
return false;
133 if (myDensityattrib != src.myDensityattrib)
return false;
134 if (myDensityscale != src.myDensityscale)
return false;
135 if (myParticlescale != src.myParticlescale)
return false;
136 if (myMinfilter != src.myMinfilter)
return false;
137 if (myVelocityblur != src.myVelocityblur)
return false;
138 if (myShutter != src.myShutter)
return false;
139 if (myShutteroffset != src.myShutteroffset)
return false;
140 if (myBlursamples != src.myBlursamples)
return false;
141 if (myNormalize != src.myNormalize)
return false;
142 if (myAttribrules != src.myAttribrules)
return false;
158 graph->
evalOpParm(myGroup, nodeidx,
"group", time, 0);
161 graph->
evalOpParm(myPoints, nodeidx,
"points", time, 0);
162 myFilter =
"gauss"_UTsh;
164 graph->
evalOpParm(myFilter, nodeidx,
"filter", time, 0);
165 myDensityattrib =
"density"_UTsh;
167 graph->
evalOpParm(myDensityattrib, nodeidx,
"densityattrib", time, 0);
170 graph->
evalOpParm(myDensityscale, nodeidx,
"densityscale", time, 0);
173 graph->
evalOpParm(myParticlescale, nodeidx,
"particlescale", time, 0);
176 graph->
evalOpParm(myMinfilter, nodeidx,
"minfilter", time, 0);
177 myVelocityblur =
false;
179 graph->
evalOpParm(myVelocityblur, nodeidx,
"velocityblur", time, 0);
181 if (
true && ( (
true&&!(((getVelocityblur()==0)))) ) )
182 graph->
evalOpParm(myShutter, nodeidx,
"shutter", time, 0);
184 if (
true && ( (
true&&!(((getVelocityblur()==0)))) ) )
185 graph->
evalOpParm(myShutteroffset, nodeidx,
"shutteroffset", time, 0);
187 if (
true && ( (
true&&!(((getVelocityblur()==0)))) ) )
188 graph->
evalOpParm(myBlursamples, nodeidx,
"blursamples", time, 0);
191 graph->
evalOpParm(myNormalize, nodeidx,
"normalize", time, 0);
195 graph->
evalOpParm(length, nodeidx,
"attribrules", time, 0);
196 if (length < 0) length = 0;
197 myAttribrules.setSize(length);
204 auto && _curentry = myAttribrules(i);
206 _curentry.attribute =
""_UTsh;
208 graph->
evalOpParmInst(_curentry.attribute, nodeidx,
"attribute#", parmidx, offsets, time, 0, 2-1);
211 graph->
evalOpParmInst(_curentry.rule, nodeidx,
"rule#", parmidx, offsets, time, 0, 2-1);
216 myAttribrules.clear();
232 template <
typename T>
239 if (idx.
size() != instance.
size()+1)
244 coerceValue(value, myGroup);
247 coerceValue(value, myPoints);
250 coerceValue(value, myFilter);
253 coerceValue(value, myDensityattrib);
256 coerceValue(value, myDensityscale);
259 coerceValue(value, myParticlescale);
262 coerceValue(value, myMinfilter);
265 coerceValue(value, myVelocityblur);
268 coerceValue(value, myShutter);
271 coerceValue(value, myShutteroffset);
274 coerceValue(value, myBlursamples);
277 coerceValue(value, myNormalize);
281 coerceValue(value, myAttribrules.entries());
282 else if (instance[0] < myAttribrules.entries())
284 auto && _data = myAttribrules(instance[0]);
288 coerceValue(value, _data.attribute);
291 coerceValue(value, _data.rule);
311 { doGetParmValue(idx, instance, value); }
313 { doGetParmValue(idx, instance, value); }
315 { doGetParmValue(idx, instance, value); }
317 { doGetParmValue(idx, instance, value); }
319 { doGetParmValue(idx, instance, value); }
321 { doGetParmValue(idx, instance, value); }
323 { doGetParmValue(idx, instance, value); }
325 { doGetParmValue(idx, instance, value); }
327 { doGetParmValue(idx, instance, value); }
329 { doGetParmValue(idx, instance, value); }
331 { doGetParmValue(idx, instance, value); }
333 template <
typename T>
340 if (idx.
size() != instance.
size()+1)
345 coerceValue(myGroup, ( ( value ) ));
348 coerceValue(myPoints, ( ( value ) ));
351 coerceValue(myFilter, ( ( value ) ));
354 coerceValue(myDensityattrib, ( ( value ) ));
357 coerceValue(myDensityscale, clampMinValue(0, ( value ) ));
360 coerceValue(myParticlescale, clampMinValue(0, ( value ) ));
363 coerceValue(myMinfilter, ( ( value ) ));
366 coerceValue(myVelocityblur, ( ( value ) ));
369 coerceValue(myShutter, clampMinValue(0, ( value ) ));
372 coerceValue(myShutteroffset, ( ( value ) ));
375 coerceValue(myBlursamples, clampMinValue(1, ( value ) ));
378 coerceValue(myNormalize, ( ( value ) ));
384 coerceValue(newsize, value);
385 if (newsize < 0) newsize = 0;
386 myAttribrules.setSize(newsize);
392 myAttribrules.setSizeIfNeeded(instance[0]+1);
393 auto && _data = myAttribrules(instance[0]);
397 coerceValue(_data.attribute, value);
400 coerceValue(_data.rule, value);
411 { doSetParmValue(idx, instance, value); }
413 { doSetParmValue(idx, instance, value); }
415 { doSetParmValue(idx, instance, value); }
417 { doSetParmValue(idx, instance, value); }
419 { doSetParmValue(idx, instance, value); }
421 { doSetParmValue(idx, instance, value); }
423 { doSetParmValue(idx, instance, value); }
425 { doSetParmValue(idx, instance, value); }
427 { doSetParmValue(idx, instance, value); }
429 { doSetParmValue(idx, instance, value); }
431 { doSetParmValue(idx, instance, value); }
449 if (fieldnum.
size() < 1)
460 return "densityattrib";
462 return "densityscale";
464 return "particlescale";
468 return "velocityblur";
472 return "shutteroffset";
474 return "blursamples";
478 if (fieldnum.
size() == 1)
479 return "attribrules";
496 if (fieldnum.
size() < 1)
497 return PARM_UNSUPPORTED;
525 if (fieldnum.
size() == 1)
526 return PARM_MULTIPARM;
535 return PARM_UNSUPPORTED;
538 return PARM_UNSUPPORTED;
574 loadData(is, rampdata);
592 int typelen = colon - data.
buffer();
606 {
int64 iv =
v; UTwrite(os, &iv); }
608 { UTwrite<fpreal64>(os, &
v); }
610 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y()); }
612 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
613 UTwrite<fpreal64>(os, &v.
z()); }
615 { UTwrite<fpreal64>(os, &v.
x()); UTwrite<fpreal64>(os, &v.
y());
616 UTwrite<fpreal64>(os, &v.
z()); UTwrite<fpreal64>(os, &v.
w()); }
628 if (s) s->save(ostr);
630 saveData(os, result);
637 ostr << s->getDataTypeToken();
642 saveData(os, result);
646 void save(std::ostream &os)
const
650 saveData(os, myGroup);
651 saveData(os, myPoints);
652 saveData(os, myFilter);
653 saveData(os, myDensityattrib);
654 saveData(os, myDensityscale);
655 saveData(os, myParticlescale);
656 saveData(os, myMinfilter);
657 saveData(os, myVelocityblur);
658 saveData(os, myShutter);
659 saveData(os, myShutteroffset);
660 saveData(os, myBlursamples);
661 saveData(os, myNormalize);
664 UTwrite(os, &length);
667 auto && _curentry = myAttribrules(i);
669 saveData(os, _curentry.attribute);
670 saveData(os, _curentry.rule);
686 loadData(is, myGroup);
687 loadData(is, myPoints);
688 loadData(is, myFilter);
689 loadData(is, myDensityattrib);
690 loadData(is, myDensityscale);
691 loadData(is, myParticlescale);
692 loadData(is, myMinfilter);
693 loadData(is, myVelocityblur);
694 loadData(is, myShutter);
695 loadData(is, myShutteroffset);
696 loadData(is, myBlursamples);
697 loadData(is, myNormalize);
701 myAttribrules.setSize(length);
704 auto && _curentry = myAttribrules(i);
706 loadData(is, _curentry.attribute);
707 loadData(is, _curentry.rule);
720 if (!thissop)
return getGroup();
722 OP_Utils::evalOpParm(result, thissop,
"group", cookparms.
getCookTime(), 0);
730 if (!thissop)
return getPoints();
732 OP_Utils::evalOpParm(result, thissop,
"points", cookparms.
getCookTime(), 0);
740 if (!thissop)
return getFilter();
742 OP_Utils::evalOpParm(result, thissop,
"filter", cookparms.
getCookTime(), 0);
750 if (!thissop)
return getDensityattrib();
752 OP_Utils::evalOpParm(result, thissop,
"densityattrib", cookparms.
getCookTime(), 0);
760 if (!thissop)
return getDensityscale();
762 OP_Utils::evalOpParm(result, thissop,
"densityscale", cookparms.
getCookTime(), 0);
770 if (!thissop)
return getParticlescale();
772 OP_Utils::evalOpParm(result, thissop,
"particlescale", cookparms.
getCookTime(), 0);
780 if (!thissop)
return getMinfilter();
782 OP_Utils::evalOpParm(result, thissop,
"minfilter", cookparms.
getCookTime(), 0);
790 if (!thissop)
return getVelocityblur();
792 OP_Utils::evalOpParm(result, thissop,
"velocityblur", cookparms.
getCookTime(), 0);
800 if (!thissop)
return getShutter();
802 OP_Utils::evalOpParm(result, thissop,
"shutter", cookparms.
getCookTime(), 0);
810 if (!thissop)
return getShutteroffset();
812 OP_Utils::evalOpParm(result, thissop,
"shutteroffset", cookparms.
getCookTime(), 0);
820 if (!thissop)
return getBlursamples();
822 OP_Utils::evalOpParm(result, thissop,
"blursamples", cookparms.
getCookTime(), 0);
830 if (!thissop)
return getNormalize();
832 OP_Utils::evalOpParm(result, thissop,
"normalize", cookparms.
getCookTime(), 0);
840 if (!thissop)
return getAttribrules().entries();
842 OP_Utils::evalOpParm(result, thissop,
"attribrules", cookparms.
getCookTime(), 0);
846 {
return opinstAttribrules_attribute(cookparms, &_idx); }
850 if (!thissop)
return (myAttribrules(_idx[0]).
attribute);
852 _parmidx[1-1] = _idx[1-1] + 1;
855 OP_Utils::evalOpParmInst(result, thissop,
"attribute#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
859 {
return opinstAttribrules_rule(cookparms, &_idx); }
863 if (!thissop)
return (myAttribrules(_idx[0]).rule);
865 _parmidx[1-1] = _idx[1-1] + 1;
868 OP_Utils::evalOpParmInst(result, thissop,
"rule#", _parmidx, cookparms.
getCookTime(), 0, 2-1);
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value) override
void save(std::ostream &os) const
static void saveData(std::ostream &os, bool v)
void setFilter(const UT_StringHolder &val)
static void loadData(UT_IStream &is, UT_Vector2D &v)
UT_StringHolder opDensityattrib(const SOP_NodeVerb::CookParms &cookparms) const
bool opNormalize(const SOP_NodeVerb::CookParms &cookparms) const
const UT_Array< Attribrules > & getAttribrules() const
GLenum GLuint GLenum GLsizei const GLchar * buf
const UT_StringHolder & getPoints() const
static void loadData(UT_IStream &is, bool &v)
SOP_VolumeRasterizeParticlesParms()
SOP_Node * getNode() const
const char * getNestParmName(TempIndex fieldnum) const override
void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const override
void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value) override
static void saveData(std::ostream &os, UT_Matrix2D v)
void setParticlescale(fpreal64 val)
static void saveData(std::ostream &os, UT_Vector4D v)
exint bread(int32 *buffer, exint asize=1)
const UT_StringHolder & getDensityattrib() const
GT_API const UT_StringHolder time
constexpr SYS_FORCE_INLINE T & y() noexcept
bool isParmColorRamp(exint idx) const override
static void loadData(UT_IStream &is, UT_Vector4I &v)
UT_String makeQuotedString(char delimiter='\'', bool escape_nonprinting=false) const
const OP_Context & context() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value) override
constexpr SYS_FORCE_INLINE T & z() noexcept
void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value) override
SYS_FORCE_INLINE const char * buffer() const
static void saveData(std::ostream &os, UT_Matrix4D v)
GLuint GLsizei GLsizei * length
An output stream object that owns its own string buffer storage.
void buildFromOp(const OP_GraphProxy *graph, exint nodeidx, fpreal time, DEP_MicroNode *depnode)
static void loadData(UT_IStream &is, UT_Matrix3D &v)
int64 getBlursamples() const
**But if you need a result
UT_StringHolder attribute
fpreal64 opDensityscale(const SOP_NodeVerb::CookParms &cookparms) 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.
bool load(UT_IStream &is)
bool getVelocityblur() const
constexpr SYS_FORCE_INLINE T & x() noexcept
void copyFrom(const OP_NodeParms *src) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const override
void setDensityattrib(const UT_StringHolder &val)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value) override
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const override
UT_StringHolder opinstAttribrules_attribute(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
void setDensityscale(fpreal64 val)
GLuint GLsizei const GLuint const GLintptr * offsets
UT_StringHolder opAttribrules_attribute(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
exint getNestNumParms(TempIndex idx) const override
constexpr SYS_FORCE_INLINE T & x() noexcept
fpreal64 opShutteroffset(const SOP_NodeVerb::CookParms &cookparms) const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
void loadFromOpSubclass(const LoadParms &loadparms) override
bool operator==(const SOP_VolumeRasterizeParticlesParms &src) const
static void loadData(UT_IStream &is, UT_Matrix4D &v)
static void loadData(UT_IStream &is, UT_Vector2I &v)
int64 opBlursamples(const SOP_NodeVerb::CookParms &cookparms) const
ParmType getNestParmType(TempIndex fieldnum) const override
SYS_FORCE_INLINE const char * buffer() const
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
static void loadData(UT_IStream &is, UT_SharedPtr< UT_Ramp > &v)
constexpr SYS_FORCE_INLINE T & z() noexcept
fpreal64 getShutteroffset() const
exint read(bool *array, exint sz=1)
const OP_GraphProxy * graph() const
static void saveData(std::ostream &os, UT_StringHolder s)
static void saveData(std::ostream &os, UT_Vector3D v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const override
static void saveData(std::ostream &os, int64 v)
bool operator==(const Attribrules &src) const
static void loadData(UT_IStream &is, UT_Matrix2D &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const override
fpreal64 getParticlescale() const
static void saveData(std::ostream &os, UT_Matrix3D 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
static void loadData(UT_IStream &is, fpreal64 &v)
static void loadData(UT_IStream &is, PRM_DataItemHandle &v)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const override
static void saveData(std::ostream &os, UT_SharedPtr< UT_Ramp > s)
fpreal64 getDensityscale() const
UT_StringHolder opGroup(const SOP_NodeVerb::CookParms &cookparms) const
void setGroup(const UT_StringHolder &val)
fpreal64 opShutter(const SOP_NodeVerb::CookParms &cookparms) const
static void saveData(std::ostream &os, fpreal64 v)
static void loadData(UT_IStream &is, UT_Vector3D &v)
fpreal64 opMinfilter(const SOP_NodeVerb::CookParms &cookparms) const
virtual void evalOpParm(int64 &v, NodeIdx node, const char *parmname, fpreal time, DEP_MicroNode *depnode) const =0
fpreal64 getShutter() const
static void loadData(UT_IStream &is, UT_Vector4D &v)
void setVelocityblur(bool val)
bool operator!=(const SOP_VolumeRasterizeParticlesParms &src) const
SYS_FORCE_INLINE void strcat(const char *src)
void saveBinary(std::ostream &os) const
Save string to binary stream.
fpreal64 opParticlescale(const SOP_NodeVerb::CookParms &cookparms) const
GT_API const UT_StringHolder version
exint entries() const
Alias of size(). size() is preferred.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value) override
void setNormalize(bool val)
int int appendSprintf(const char *fmt,...) SYS_PRINTF_CHECK_ATTRIBUTE(2
void setShutter(fpreal64 val)
static void saveData(std::ostream &os, UT_Vector2D v)
bool opVelocityblur(const SOP_NodeVerb::CookParms &cookparms) const
static void loadData(UT_IStream &is, UT_Vector3I &v)
static void loadData(UT_IStream &is, int64 &v)
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value) override
const UT_StringHolder & getFilter() const
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value) override
DEP_MicroNode * depnode() const
LeafData & operator=(const LeafData &)=delete
Utility class for containing a color ramp.
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value) override
const UT_StringHolder & getGroup() const
static void saveData(std::ostream &os, PRM_DataItemHandle s)
constexpr SYS_FORCE_INLINE T & w() noexcept
SYS_FORCE_INLINE void append(char character)
fpreal64 getMinfilter() const
UT_StringHolder createString(const UT_Array< Attribrules > &list) const
void setPoints(const UT_StringHolder &val)
OIIO_API bool attribute(string_view name, TypeDesc type, const void *val)
fpreal getCookTime() const
UT_StringHolder opFilter(const SOP_NodeVerb::CookParms &cookparms) const
void setAttribrules(const UT_Array< Attribrules > &val)
int64 opAttribrules_rule(const SOP_NodeVerb::CookParms &cookparms, int _idx) const
void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const override
const char * findChar(int c) const
UT_StringHolder opPoints(const SOP_NodeVerb::CookParms &cookparms) const
bool getNormalize() const
void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value) override
int64 opinstAttribrules_rule(const SOP_NodeVerb::CookParms &cookparms, const int *_idx) const
bool operator!=(const Attribrules &src) const
void doGetParmValue(TempIndex idx, TempIndex instance, T &value) const
constexpr SYS_FORCE_INLINE T & y() noexcept
void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const override
void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value) override
void doSetParmValue(TempIndex idx, TempIndex instance, const T &value)
exint opAttribrules(const SOP_NodeVerb::CookParms &cookparms) const
SYS_FORCE_INLINE UT_StringHolder getToken(Rule enum_value)
void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const override
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
static void loadData(UT_IStream &is, UT_StringHolder &v)
constexpr SYS_FORCE_INLINE T & y() noexcept
void setBlursamples(int64 val)
SYS_FORCE_INLINE bool isstring() const
void setMinfilter(fpreal64 val)
SYS_FORCE_INLINE void strncpy(const char *src, exint maxlen)
void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const override
constexpr SYS_FORCE_INLINE T & x() noexcept
void setShutteroffset(fpreal64 val)