13 #ifndef __OP_NodeParms_h__
14 #define __OP_NodeParms_h__
34 #include <initializer_list>
57 virtual int64 getMemoryUsage(
bool inclusive)
const;
82 : myCookEngine(cookengine)
103 {
if (myDepNode) myDepNode->addExplicitInput(inp, check_dup); }
105 { addExplicitInput(inp,
true); }
110 {
if (myError)
return myError->addMessage(type, code, formatError(msg), loc);
114 {
if (myError)
return myError->addWarning(type, code, formatError(msg), loc);
118 {
if (myError)
return myError->addError(type, code, formatError(msg), loc);
123 {
return addMessage(
"SOP", code, msg, loc); }
126 {
return addWarning(
"SOP", code, msg, loc); }
129 {
return addError(
"SOP", code, msg, loc); }
132 bool borrow_only =
false)
const
133 {
if (myError) myError->stealErrors(src,0, -1,
UT_ERROR_NONE, borrow_only); }
148 void loadFromOp(
const LoadParms &loadparms);
153 bool applyOptionsOverride(
const UT_Options *options);
184 { getNestParmValue( {idx}, {},
value ); }
186 { getNestParmValue( {idx}, {},
value ); }
188 { getNestParmValue( {idx}, {},
value ); }
190 { getNestParmValue( {idx}, {},
value ); }
192 { getNestParmValue( {idx}, {},
value ); }
194 { getNestParmValue( {idx}, {},
value ); }
196 { getNestParmValue( {idx}, {},
value ); }
198 { getNestParmValue( {idx}, {},
value ); }
200 { getNestParmValue( {idx}, {},
value ); }
202 { getNestParmValue( {idx}, {},
value ); }
204 { getNestParmValue( {idx}, {},
value ); }
207 { setNestParmValue( {idx}, {},
value ); }
209 { setNestParmValue( {idx}, {},
value ); }
211 { setNestParmValue( {idx}, {},
value ); }
213 { setNestParmValue( {idx}, {},
value ); }
215 { setNestParmValue( {idx}, {},
value ); }
217 { setNestParmValue( {idx}, {},
value ); }
219 { setNestParmValue( {idx}, {},
value ); }
221 { setNestParmValue( {idx}, {},
value ); }
223 { setNestParmValue( {idx}, {},
value ); }
225 { setNestParmValue( {idx}, {},
value ); }
227 { setNestParmValue( {idx}, {},
value ); }
238 myVec = &*list.begin();
241 mySize = list.size();
246 mySize = list.
size();
290 {
return inclusive ?
sizeof(*this) : 0; }
293 virtual void loadFromOpSubclass(
const LoadParms &loadparms) = 0;
300 template <
typename T,
typename S>
303 UT_ASSERT(!
"Unimplemented OP_NodeParms::coerceValue() called!");
307 template <
typename T>
310 UT_ASSERT(!
"Unimplemented OP_NodeParms::clampMinValue() called!");
314 template <
typename T>
317 UT_ASSERT(!
"Unimplemented OP_NodeParms::clampMaxValue() called!");
392 {
return SYSmax(clamp, src); }
407 {
return SYSmax(
UT_Matrix3D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
410 {
return SYSmax(
UT_Matrix4D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
425 const int number_of_new_nodes_needed =
static_cast<int>(
clamp) - src->getNodeCount();
426 if (number_of_new_nodes_needed <= 0)
431 const fpreal spacing_between_new_nodes
432 = 0.5f /
static_cast<fpreal>(number_of_new_nodes_needed);
433 const auto *last_node = src->getClosestNode(1);
434 fpreal last_node_pos = last_node ? last_node->t : 0;
437 if (last_node_pos > 0.5
f)
439 fpreal scaler = 0.5f / last_node_pos;
440 for (
int i = 0,
n = src->getNodeCount(); i <
n; ++i)
442 src->moveNode(i, src->getNode(i)->t * scaler);
447 fpreal current_position = 0.5f + spacing_between_new_nodes;
448 for (
int i = 0; i < number_of_new_nodes_needed; ++i)
450 src->addNode(current_position);
451 current_position += spacing_between_new_nodes;
464 {
return SYSmin(clamp, src); }
479 {
return SYSmin(
UT_Matrix3D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
482 {
return SYSmin(
UT_Matrix4D(clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp, clamp), src); }
UT_Vector2T< int64 > UT_Vector2I
virtual void setParmValue(exint idx, const UT_Vector4D &value)
virtual void setParmValue(exint idx, const UT_StringHolder &value)
TempIndex(const UT_ExintArray &list)
UT_Matrix4T< fpreal64 > UT_Matrix4D
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix2D &value)
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix3D &value) const
virtual void setParmValue(exint idx, const UT_Vector2D &value)
UT_ErrorManager * error() const
OP_NodeCache * cache() const
UT_ErrorSeverity sopAddWarning(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
virtual void getParmValue(exint idx, UT_Matrix3D &value) const
virtual void getParmValue(exint idx, PRM_DataItemHandle &value) const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector3D &value) const
UT_ErrorSeverity sopAddError(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
T clampMaxValue(fpreal maxvalue, const T &src) const
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const fpreal &value)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix3D &value)
virtual void setParmValue(exint idx, const exint &value)
UT_ErrorManager * myError
UT_Vector2T< fpreal64 > UT_Vector2D
GLsizei const GLfloat * value
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Matrix4D &value)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const exint &value)
const OP_Context & context() const
LoadParms(OP_CookEngine cookengine, const OP_GraphProxy *graph, exint nodeidx, const OP_Context &context, OP_NodeCache *cache, UT_ErrorManager *error, DEP_MicroNode *depnode)
UT_Vector4T< int64 > UT_Vector4I
**But if you need a result
exint operator[](const exint off) const
UT_Vector3T< int64 > UT_Vector3I
virtual ParmType getNestParmType(TempIndex idx) const
T clampMinValue(fpreal minvalue, const T &src) const
virtual void setParmValue(exint idx, const UT_Vector3D &value)
virtual void getNestParmValue(TempIndex idx, TempIndex instance, fpreal &value) const
virtual void setParmValue(exint idx, const PRM_DataItemHandle &value)
const OP_Context & myContext
UT_ErrorSeverity sopAddMessage(int code, const char *msg=0, const UT_SourceLocation *loc=0) const
virtual exint getNestNumParms(TempIndex idx) const
const exint * begin() const
const OP_GraphProxy * myGraph
UT_ErrorSeverity addMessage(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
Methods to add directly to any present error manager.
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector3D &value)
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
virtual ParmType getParmType(exint idx) const
const OP_GraphProxy * graph() const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_StringHolder &value) const
virtual void setParmValue(exint idx, const UT_Matrix4D &value)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector2D &value)
void addExplicitInput(DEP_MicroNode &inp)
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector2D &value) const
virtual int64 getMemoryUsage(bool inclusive) const
virtual void getParmValue(exint idx, UT_Vector2D &value) const
virtual void setParmValue(exint idx, const UT_SharedPtr< UT_Ramp > &value)
virtual void setParmValue(exint idx, const UT_Matrix3D &value)
UT_Vector3T< fpreal64 > UT_Vector3D
TempIndex(std::initializer_list< exint > list)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_SharedPtr< UT_Ramp > &value)
virtual void getParmValue(exint idx, UT_Matrix2D &value) const
virtual bool isParmColorRamp(exint idx) const
void addExplicitInput(DEP_MicroNode &inp, bool check_dup)
Methods to wire directly to the optional depnode.
UT_ErrorSeverity addWarning(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
UT_Matrix2T< fpreal64 > UT_Matrix2D
virtual void getParmValue(exint idx, exint &value) const
virtual void getParmValue(exint idx, UT_SharedPtr< UT_Ramp > &value) const
A map of string to various well defined value types.
virtual exint getNumParms() const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix4D &value) const
virtual void copyFrom(const OP_NodeParms *src)
void coerceValue(T &result, const S &src) const
virtual const char * getParmName(exint idx) const
DEP_MicroNode * myDepNode
DEP_MicroNode * depnode() const
LeafData & operator=(const LeafData &)=delete
void stealErrors(UT_ErrorManager &src, bool borrow_only=false) const
virtual void getParmValue(exint idx, fpreal &value) const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Vector4D &value) const
UT_ErrorSeverity addError(const char *type, int code, const char *msg=0, const UT_SourceLocation *loc=0) const
virtual void getParmValue(exint idx, UT_StringHolder &value) const
A global error manager scope.
virtual void getNestParmValue(TempIndex idx, TempIndex instance, PRM_DataItemHandle &value) const
virtual void getParmValue(exint idx, UT_Vector4D &value) const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_SharedPtr< UT_Ramp > &value) const
virtual void setParmValue(exint idx, const UT_Matrix2D &value)
virtual void getNestParmValue(TempIndex idx, TempIndex instance, UT_Matrix2D &value) const
virtual void getNestParmValue(TempIndex idx, TempIndex instance, exint &value) const
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const PRM_DataItemHandle &value)
virtual void setParmValue(exint idx, const fpreal &value)
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_Vector4D &value)
UT_Vector4T< fpreal64 > UT_Vector4D
virtual const char * getNestParmName(TempIndex idx) const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
UT_Matrix3T< fpreal64 > UT_Matrix3D
virtual void setNestParmValue(TempIndex idx, TempIndex instance, const UT_StringHolder &value)
virtual void getParmValue(exint idx, UT_Vector3D &value) const
virtual void getParmValue(exint idx, UT_Matrix4D &value) const