17 #ifndef __PRM_Instance_h__
18 #define __PRM_Instance_h__
71 UT_SMALLOBJECT_CLEANPAGES_DEFAULT,
72 UT_SMALLOBJECT_PAGESIZE_DEFAULT,
73 UT_SMALLOBJECT_THREADSAFE_OFF>
83 virtual void adoptOverrides(
PRM_Instance &thesrcinstance);
89 virtual void revertToDefault(
int index) = 0;
90 virtual void revertToDefaults(
bool clear_channels =
true) = 0;
91 virtual void restoreFactoryDefault(
int index) = 0;
92 virtual void overwriteDefault(
fpreal time,
int index) = 0;
93 virtual void overwriteDefaults(
fpreal time) = 0;
95 bool basiccheck =
true)
const;
98 virtual void save(std::ostream &os,
int binary,
bool compiled)
const=0;
104 virtual void saveCommand(std::ostream &os,
int values=0,
int index = -1)
106 virtual int loadCommand(
int argc,
const char *
const argv[],
116 int64 &value,
int index,
117 int thread)
const = 0;
120 int thread)
const = 0;
123 bool expand,
int thread)
const = 0;
126 int thread)
const = 0;
129 bool expand,
int thread)
const = 0;
135 int32 *theints,
int thread)
const;
137 int64 *theints,
int thread)
const;
138 virtual void getDefaultValue(
fpreal &value,
int index)
const;
139 virtual void getDefaultValue(
int32 &value,
int index)
const;
140 virtual void getDefaultValue(
int64 &value,
int index)
const;
141 virtual void getDefaultValue(
UT_String &value,
int index)
const;
143 virtual void getExpressionStringForUI(
fpreal time,
146 int thread)
const = 0;
148 int index,
bool allow_value,
149 int thread)
const = 0;
150 virtual void setExpression(
fpreal time,
154 bool rmchannel =
false);
167 bool isLanguageOldExprOrLiteral(
fpreal time,
int index)
const;
172 virtual void setValue(
fpreal time,
175 bool kill_expr =
false,
180 virtual void setValue(
fpreal time,
182 bool kill_expr =
false,
187 virtual void setValue(
fpreal time,
189 bool kill_expr =
false,
194 virtual void setValue(
fpreal time,
196 bool kill_expr =
false,
201 virtual void setValue(
fpreal time,
203 bool kill_expr =
false,
211 virtual void setValues(
fpreal time,
213 bool kill_expr =
false,
217 virtual void setValues(
fpreal time,
219 bool kill_expr =
false,
223 virtual void setDefaultChannelValue(
CH_Channel *channelptr,
226 virtual bool isMultiParm()
const;
227 virtual int getMultiParmNumItems()
const;
228 virtual int getMultiParmInstancesPerItem()
const;
229 virtual const char *getMultiParmToken(
int p,
int index)
const;
232 virtual void insertMultiParmItem(
int index);
233 virtual void removeMultiParmItem(
int index);
235 virtual void buildOpDependencies(
const PRM_RefId &
ref,
int thread);
236 virtual void changeOpRef(
const char *new_fullpath,
237 const char *old_fullpath,
239 const char *chan_name,
240 const char *old_chan_name,
241 void (*undo_callback)(
void *),
248 virtual int findString(
const char *str,
bool fullword,
249 bool usewildcards)
const;
250 virtual int changeString(
const char *from,
const char *to,
253 virtual bool notifyVarChange(
int subindex,
const char *varname);
257 fpreal t,
bool add_if_default ,
260 unsigned getEnableState(
int comp = -1)
const;
261 bool setEnableState(
bool f,
int comp = -1);
265 return myBitField & BITFLAG_EXPRESSIONSTATE;
270 myBitField |= BITFLAG_EXPRESSIONSTATE;
272 myBitField &= ~BITFLAG_EXPRESSIONSTATE;
276 return myBitField & BITFLAG_VALUESTATE;
281 myBitField |= BITFLAG_VALUESTATE;
283 myBitField &= ~BITFLAG_VALUESTATE;
287 int index)
const {
return true; }
289 int index)
const {
return true; }
294 ? getParmList()->getChannelGroupPtr()
316 && subindex < getVectorSize());
317 return myChannelPtrs[subindex];
321 myChannelPtrs[subindex] = chp;
324 void reloadChannelPtrs();
326 void internalAddChannel(
int index,
329 bool add_seg =
true);
330 void addChannel(
int index);
332 void addChannel(
int index,
const char *theexpr,
336 bool removeChannel(
int index);
337 int getChannelCount()
const;
341 virtual bool isTimeDependent(
int subindex)
const;
342 virtual bool isDataDependent(
fpreal gtime,
int subindex)
const;
344 virtual void setTimeDependent(
int subindex,
bool timedep);
349 bool hasContextOptionDeps(
int subindex)
const;
351 bool hasGlobalContextOptionDependency(
int subindex,
353 void addContextOptionDep(
int subindex,
355 bool set_dependency_on_global,
356 bool node_is_cooking);
358 int changePending(
int index);
363 virtual void hardenChanges(
fpreal time,
366 const char *patt =
nullptr,
370 void setKey(
fpreal time,
int index);
371 void setKey(
fpreal time,
int index,
const char *expr,
373 const char *patt =
nullptr,
376 void setFullKey(
fpreal gtime,
int index,
378 bool accel_ratios =
true);
381 {
return myBitField & BITFLAG_SAVE_MASK; }
383 { myBitField |= (f & BITFLAG_SAVE_MASK); }
386 {
return myBitField & BITFLAG_ACTIVETAKE; }
388 {
return myBitField & BITFLAG_TAKEALWAYSACTIVE; }
391 if (onoff) myBitField |= BITFLAG_ACTIVETAKE;
394 if (!(myBitField & BITFLAG_TAKEALWAYSACTIVE))
395 myBitField &= ~BITFLAG_ACTIVETAKE;
396 else myBitField |= BITFLAG_ACTIVETAKE;
401 {
return myBitField & BITFLAG_BYPASS; }
405 if (isSpareParm() && onoff)
406 myBitField |= BITFLAG_BYPASS;
408 myBitField &= ~BITFLAG_BYPASS;
411 bool getVisibleState(
int comp = -1)
const;
412 void setVisibleState(
bool f,
int comp = -1);
415 {
return myBitField & BITFLAG_UNDOSAVED; }
417 {
if (f) myBitField |= BITFLAG_UNDOSAVED;
418 else myBitField &= ~BITFLAG_UNDOSAVED;}
420 {
return myBitField & BITFLAG_AUTOTAKEUNDOSAVED; }
422 {
if (f) myBitField |= BITFLAG_AUTOTAKEUNDOSAVED;
423 else myBitField &= ~BITFLAG_AUTOTAKEUNDOSAVED;}
426 {
return myBitField & BITFLAG_SAVEAUTOSCOPE; }
429 {
return myBitField & BITFLAG_SAVEAUTOSELECT; }
431 void setSaveLabelFlag(
bool f);
433 {
return myBitField & BITFLAG_SAVELABEL; }
435 bool getLockedFlag(
int vec_idx)
const;
436 bool areAllComponentsLocked()
const;
437 void setLockedFlag(
int vec_idx,
bool f);
438 bool getAutoScopedFlag(
int vec_idx)
const;
439 void setAutoScopedFlag(
int vec_idx,
bool f);
442 {
return (myBitField & BITFLAG_DEFAULTSINIT) != 0; }
444 {
if (f) myBitField |= BITFLAG_DEFAULTSINIT;
445 else myBitField &= ~BITFLAG_DEFAULTSINIT;}
448 {
return myLockField; }
450 {
return myAutoScopeField; }
452 virtual int setOverride(
int index,
int data_idx,
455 virtual int setOverrideDisable(
int index,
int onoff);
456 virtual const char *getOverride(
int index)
const;
457 virtual bool getOverrideType(
int index,
459 virtual int getOverrideDataIndex(
int index)
const;
466 virtual int getIsOverrideActive(
int index)
const;
472 {
return getFieldBit(myDirtyParmFlags, vec_idx); }
474 {
return !myDirtyParmFlags; }
476 { myDirtyParmFlags = 0; }
479 setFieldBit(myDirtyParmFlags, vec_idx,
true);
480 setSendExtra(vec_idx);
486 {
return getFieldBit(mySendExtraFlags, vi); }
488 {
return (mySendExtraFlags != 0); }
491 if (!getFieldBit(mySendExtraFlags, vi))
493 setFieldBit(mySendExtraFlags, vi,
true);
494 getParmList()->bumpNumSendExtra(
495 vi < 0 ? getVectorSize() : +1);
504 void createInputNotifyValue();
509 {
return myTemplatePtr->getType(); }
511 {
return myTemplatePtr->getTypeExtended(); }
513 {
return myTemplatePtr->getMultiType(); }
515 {
return myTemplatePtr->getMultiSize(); }
517 {
return myTemplatePtr->getMultiStartOffset(); }
523 {
return myTemplatePtr->getToken(); }
525 {
return myTemplatePtr->getLabel(); }
527 {
return myTemplatePtr->getCallback(); }
529 {
return myTemplatePtr->getVectorSize(); }
536 return myRange.get();
538 return myTemplatePtr->getRangePtr();
548 bool isRangeDefault()
const;
551 void setRangeToDefault();
554 { myTemplatePtr->getChannelToken(chname, i); }
556 {
return myTemplatePtr->getChannelToken(i); }
558 {
return myTemplatePtr->getChoiceListPtr(); }
567 bool hasChannelAlias(
int index)
const;
568 void getChannelAlias(
UT_String &strref,
int index)
const;
577 bool allow_alias)
const;
580 {
return myParm->getParmOwner(); }
582 {
return myParm->getOwner(); }
586 static bool isChanRefString(
const char *str,
bool is_expr,
588 static bool isObsoleteDirectChanRefString(
599 bool isActive(
const int index)
const;
600 void setActive(
const int index,
const bool active);
603 bool isSpareParm()
const;
604 void setSpareParm(
bool spare);
608 void setMultiParmOwner(
const PRM_Multi *multiparmowner);
626 bool instance_index=
true)
const;
628 bool validIndex(
int index)
const;
630 virtual int64 getMemoryUsage(
bool inclusive)
const;
648 {
return (myMicroNodes !=
nullptr); }
650 void clearMicroNodeInputs();
652 int getMicroNodeNumInputs()
const;
659 bool *dirtied_data =
nullptr);
663 int indent_level)
const;
664 int64 getMicroNodesMemoryUsage()
const;
667 bool hasChannelCustomColor(
int index)
const;
668 const UT_Color &getChannelCustomColor(
int index)
const;
669 void setChannelCustomColor(
int index,
const UT_Color &
c);
670 void resetChannelCustomColor(
int index);
672 bool getAutoSelectFlag(
int vec_idx)
const;
673 void setAutoSelectFlag(
int vec_idx,
bool f);
675 {
return myAutoSelectField; }
677 void setTimeDependentMicroNode(
int subindex,
bool timedep);
686 void clearAndDestroyChannels();
689 void indexError(
int index);
692 { myLockField = locks; }
695 myAutoScopeField = field;
696 myBitField |= BITFLAG_SAVEAUTOSCOPE;
701 myAutoSelectField = field;
702 myBitField |= BITFLAG_SAVEAUTOSELECT;
707 const PRM_ParmList *thelist,
int vector_index,
int thread)
const
710 err = ev_GetErrNo(thread);
712 evaluationError(thelist, vector_index, err, thread);
715 bool validateAccess();
720 void loadTokenAsChannelNameOrExpression(
732 bool loadBinaryOption(
UT_IStream &is,
short packet_id);
739 void saveAsciiOptions(std::ostream &os)
const;
740 bool saveBinaryOptions(
int class_packet_id,
742 std::ostream &os)
const;
765 static const char *getPacketIOToken(PRM_ParmIOToken token);
766 static int getPacketIOTokenLen(PRM_ParmIOToken token);
767 static int getPacketIOBinaryId(PRM_ParmIOToken token);
772 static bool comparePacketIOToken(PRM_ParmIOToken token,
778 bool shouldSaveData()
const;
782 inline bool getFieldBit(
unsigned int field,
int i)
const
787 return ((field & (1 << (
unsigned)i)) != 0);
789 inline void setFieldBit(
unsigned int &field,
int i,
bool f)
794 field = (1<<(unsigned)getVectorSize()) - 1;
801 field |= (1 << (unsigned)i);
803 field &= ~(1 << (unsigned)i);
813 void validateChannelName(
PRM_ParmList &list,
int subindex);
815 void evaluationError(
817 int vector_index,
int err,
int thread)
const;
834 BITFLAG_EXPRESSIONSTATE = 0x0008,
835 BITFLAG_UNDOSAVED = 0x0010,
836 BITFLAG_ACTIVETAKE = 0x0020,
837 BITFLAG_TAKEALWAYSACTIVE = 0x0040,
838 BITFLAG_SAVEAUTOSCOPE = 0x0080,
839 BITFLAG_SPAREPARM = 0x0100,
840 BITFLAG_AUTOTAKEUNDOSAVED = 0x0400,
841 BITFLAG_DEFAULTSINIT = 0x0800,
842 BITFLAG_VALUESTATE = 0x1000,
843 BITFLAG_BYPASS = 0x2000,
844 BITFLAG_SAVELABEL = 0x4000,
845 BITFLAG_SAVEAUTOSELECT = 0x8000,
848 BITFLAG_SAVE_MASK = (BITFLAG_EXPRESSIONSTATE)
851 unsigned int myBitField;
852 unsigned int myEnableField;
853 unsigned int myLockField;
854 unsigned int myAutoScopeField;
855 unsigned int myVisibleField;
856 unsigned int myAutoSelectField;
859 unsigned int myActiveField;
864 unsigned myDirtyParmFlags;
865 unsigned mySendExtraFlags;
871 struct ChannelCustomColor
874 { myHasCustomColor =
false; }
876 bool myHasCustomColor;
878 ChannelCustomColor *myChannelColors;
881 const PRM_Multi *myMultiParmOwner;
892 bool allow_alias)
const
894 int size = myTemplatePtr->getVectorSize();
898 if (allow_alias && myChannelAliases)
900 for (i = 0; i <
size; i++)
902 if (myChannelAliases[i] == thechannelname)
911 retval = myTemplatePtr->findSubIndex(thechannelname);
920 return myEnableField;
922 return ( myEnableField & (1<<comp) ) ? 1 : 0;
930 if (!getVectorSize())
931 return (myVisibleField != 0);
933 return getFieldBit(myVisibleField, comp);
940 setFieldBit(myVisibleField, comp, f);
CH_Manager * getManager() const
unsigned int getSaveFlags() const
bool getVisibleState(int comp=-1) const
CE_API bool evaluate(const CE_OSDRefinement &topo, const CE_OSDEvaluator &eval, const cl::Buffer &coarse, const CE_OSDPatchCoords &patch_coords, const CE_FloatArray *refined_data, cl::Buffer &out, cl::Buffer *du, cl::Buffer *dv)
bool isSendExtra(int vi) const
void setUndoSavedFlag(bool f)
GLsizei GLenum const void * indices
const PRM_Template * getTemplatePtr() const
UT_JSONValueMap stores a map/dictionary of UT_JSONValue objects.
bool isDefault(const cgltf_texture_view &tv)
void setAutoScopeField(unsigned int field)
void setSaveFlags(unsigned int f)
const UT_StringHolder & getChannelToken(int i) const
GT_API const UT_StringHolder time
UT_SharedPtr< PRM_UndoData > PRM_UndoDataHandle
const PRM_Template * getMultiParmTemplate() const
bool isDirty(int vec_idx) const
const PRM_ChoiceList * getChoiceListPtr() const
GLsizei const GLfloat * value
const GLuint GLenum const void * binary
UT_ConcurrentSet< UT_StringHolder > DEP_ContextOptionDeps
GLsizei const GLchar *const * path
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
int getExpressionState() const
bool getSaveAutoSelectFlag() const
const char * getToken() const
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int getVectorSize() const
unsigned getEnableState(int comp=-1) const
const PRM_Value * inputNotifyValue() const
bool getSaveLabelFlag() const
bool hasAnySendExtraFlags() const
void setChannel(int subindex, CH_Channel *chp)
void setDefaultsInitFlag(bool f)
__hostdev__ float getValue(uint32_t i) const
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
virtual bool isRotationParm() const
UT_SharedPtr< const PRM_DataItem > PRM_DataItemHandle
PRM_TypeExtended getTypeExtended() const
CH_Channel * getChannel(int subindex) const
void clearAllDirtyFlags()
PRM_Template * getTemplatePtr()
int findSubIndex(const UT_StringRef &thechannelname, bool allow_alias) const
void setDirtyFlags(int vec_idx)
GLint GLint GLsizei GLint GLenum GLenum type
bool getDefaultsInitFlag() const
virtual bool isEditable(PRM_ParmList *thelist, fpreal time, int index) const
bool getBypassFlag() const
fpreal getGlobalStart() const
void setVisibleState(bool f, int comp=-1)
SYS_FORCE_INLINE void checkForExpressionErrors(const PRM_ParmList *thelist, int vector_index, int thread) const
PRM_Template * getMultiParmTemplate()
UT_Function< void(DEP_MicroNode &, DEP_MicroNode &) > Visitor
fpreal getMultiSize() const
GLsizei GLsizei GLchar * source
void setLockField(unsigned int locks)
void setActiveTakeFlag(int onoff)
const char * getLabel() const
void setBypassFlag(bool onoff)
GLuint const GLchar * name
bool getAlwaysTakeFlag() const
unsigned int getAutoScopeField() const
const PRM_Type & getType() const
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
virtual void destroyChildParms()
unsigned int getLockField() const
PRM_Callback getCallback() const
fpreal getEvaluateTime(int thread) const
Functions for obtaining and setting the current evaluation time.
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
PRM_MultiType getMultiType() const
bool getSaveAutoScopeFlag() const
const PRM_Template * getMultiParmTemplate() const
virtual bool isEditableByUI(PRM_ParmList *thelist, fpreal time, int index) const
const PRM_Range * getRangePtr() const
SIM_API const UT_StringHolder force
GLenum GLsizei GLsizei GLint * values
PRM_ParmOwner * getParmOwner() const
bool areAllFlagsClean() const
PRM_Parm * getParm() const
int getValueState() const
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void setExpressionState(int state)
bool getAutoTakeUndoSavedFlag()
fpreal getGlobalStartTime() const
void getChannelToken(UT_String &chname, int i) const
void setTimeDependentForEval(int vi, bool timedep) const
void setSendExtra(int vi)
unsigned int getAutoSelectField() const
bool hasMicroNodes() const
Return true if this parameter has micronodes, NOT thread-safe.
CH_Collection * getChannelGroupPtr() const
void setAutoTakeUndoSavedFlag(bool f)
int getMultiStartOffset() const
void setAutoSelectField(unsigned int field)
void setValueState(int state)
PRM_Value * inputNotifyValue()
PRM_MultiType
This type enum defines the different types of multi (dynamic) parameters.
bool getActiveTakeFlag() const
fpreal getEvalTime(int thread) const
PRM_ParmList * getParmList() const