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,
153 int index,
bool evaluate =
true,
154 bool rmchannel =
false);
167 bool isLanguageOldExprOrLiteral(
fpreal time,
int index)
const;
175 bool kill_expr =
false,
182 bool kill_expr =
false,
189 bool kill_expr =
false,
196 bool kill_expr =
false,
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);
357 int changePending(
int index);
362 virtual void hardenChanges(
fpreal time,
365 const char *patt =
nullptr,
369 void setKey(
fpreal time,
int index);
370 void setKey(
fpreal time,
int index,
const char *expr,
372 const char *patt =
nullptr,
375 void setFullKey(
fpreal gtime,
int index,
377 bool accel_ratios =
true);
380 {
return myBitField & BITFLAG_SAVE_MASK; }
382 { myBitField |= (f & BITFLAG_SAVE_MASK); }
385 {
return myBitField & BITFLAG_ACTIVETAKE; }
387 {
return myBitField & BITFLAG_TAKEALWAYSACTIVE; }
390 if (onoff) myBitField |= BITFLAG_ACTIVETAKE;
393 if (!(myBitField & BITFLAG_TAKEALWAYSACTIVE))
394 myBitField &= ~BITFLAG_ACTIVETAKE;
395 else myBitField |= BITFLAG_ACTIVETAKE;
400 {
return myBitField & BITFLAG_BYPASS; }
404 if (isSpareParm() && onoff)
405 myBitField |= BITFLAG_BYPASS;
407 myBitField &= ~BITFLAG_BYPASS;
410 bool getVisibleState(
int comp = -1)
const;
411 void setVisibleState(
bool f,
int comp = -1);
414 {
return myBitField & BITFLAG_UNDOSAVED; }
416 {
if (f) myBitField |= BITFLAG_UNDOSAVED;
417 else myBitField &= ~BITFLAG_UNDOSAVED;}
419 {
return myBitField & BITFLAG_AUTOTAKEUNDOSAVED; }
421 {
if (f) myBitField |= BITFLAG_AUTOTAKEUNDOSAVED;
422 else myBitField &= ~BITFLAG_AUTOTAKEUNDOSAVED;}
425 {
return myBitField & BITFLAG_SAVEAUTOSCOPE; }
428 {
return myBitField & BITFLAG_SAVEAUTOSELECT; }
430 void setSaveLabelFlag(
bool f);
432 {
return myBitField & BITFLAG_SAVELABEL; }
434 bool getLockedFlag(
int vec_idx)
const;
435 bool areAllComponentsLocked()
const;
436 void setLockedFlag(
int vec_idx,
bool f);
437 bool getAutoScopedFlag(
int vec_idx)
const;
438 void setAutoScopedFlag(
int vec_idx,
bool f);
441 {
return (myBitField & BITFLAG_DEFAULTSINIT) != 0; }
443 {
if (f) myBitField |= BITFLAG_DEFAULTSINIT;
444 else myBitField &= ~BITFLAG_DEFAULTSINIT;}
447 {
return myLockField; }
449 {
return myAutoScopeField; }
451 virtual int setOverride(
int index,
int data_idx,
454 virtual int setOverrideDisable(
int index,
int onoff);
455 virtual const char *getOverride(
int index)
const;
456 virtual bool getOverrideType(
int index,
458 virtual int getOverrideDataIndex(
int index)
const;
465 virtual int getIsOverrideActive(
int index)
const;
471 {
return getFieldBit(myDirtyParmFlags, vec_idx); }
473 {
return !myDirtyParmFlags; }
475 { myDirtyParmFlags = 0; }
478 setFieldBit(myDirtyParmFlags, vec_idx,
true);
479 setSendExtra(vec_idx);
485 {
return getFieldBit(mySendExtraFlags, vi); }
487 {
return (mySendExtraFlags != 0); }
490 if (!getFieldBit(mySendExtraFlags, vi))
492 setFieldBit(mySendExtraFlags, vi,
true);
493 getParmList()->bumpNumSendExtra(
494 vi < 0 ? getVectorSize() : +1);
503 void createInputNotifyValue();
508 {
return myTemplatePtr->getType(); }
510 {
return myTemplatePtr->getTypeExtended(); }
512 {
return myTemplatePtr->getMultiType(); }
514 {
return myTemplatePtr->getMultiSize(); }
516 {
return myTemplatePtr->getMultiStartOffset(); }
522 {
return myTemplatePtr->getToken(); }
524 {
return myTemplatePtr->getLabel(); }
526 {
return myTemplatePtr->getCallback(); }
528 {
return myTemplatePtr->getVectorSize(); }
530 {
return myTemplatePtr->getRangePtr(); }
532 { myTemplatePtr->getChannelToken(chname, i); }
534 {
return myTemplatePtr->getChannelToken(i); }
536 {
return myTemplatePtr->getChoiceListPtr(); }
545 bool hasChannelAlias(
int index)
const;
546 void getChannelAlias(
UT_String &strref,
int index)
const;
555 bool allow_alias)
const;
558 {
return myParm->getParmOwner(); }
560 {
return myParm->getOwner(); }
564 static bool isChanRefString(
const char *str,
bool is_expr,
566 static bool isObsoleteDirectChanRefString(
577 bool isActive(
const int index)
const;
578 void setActive(
const int index,
const bool active);
581 bool isSpareParm()
const;
582 void setSpareParm(
bool spare);
586 void setMultiParmOwner(
const PRM_Multi *multiparmowner);
604 bool instance_index=
true)
const;
606 bool validIndex(
int index)
const;
608 virtual int64 getMemoryUsage(
bool inclusive)
const;
626 {
return (myMicroNodes !=
nullptr); }
628 void clearMicroNodeInputs();
630 int getMicroNodeNumInputs()
const;
637 bool *dirtied_data =
nullptr);
641 int indent_level)
const;
642 int64 getMicroNodesMemoryUsage()
const;
645 bool hasChannelCustomColor(
int index)
const;
646 const UT_Color &getChannelCustomColor(
int index)
const;
647 void setChannelCustomColor(
int index,
const UT_Color &
c);
648 void resetChannelCustomColor(
int index);
650 bool getAutoSelectFlag(
int vec_idx)
const;
651 void setAutoSelectFlag(
int vec_idx,
bool f);
653 {
return myAutoSelectField; }
655 void setTimeDependentMicroNode(
int subindex,
bool timedep);
664 void clearAndDestroyChannels();
667 void indexError(
int index);
670 { myLockField = locks; }
673 myAutoScopeField = field;
674 myBitField |= BITFLAG_SAVEAUTOSCOPE;
679 myAutoSelectField = field;
680 myBitField |= BITFLAG_SAVEAUTOSELECT;
685 const PRM_ParmList *thelist,
int vector_index,
int thread)
const
688 err = ev_GetErrNo(thread);
690 evaluationError(thelist, vector_index, err, thread);
693 bool validateAccess();
698 void loadTokenAsChannelNameOrExpression(
710 bool loadBinaryOption(
UT_IStream &is,
short packet_id);
717 void saveAsciiOptions(std::ostream &os)
const;
718 bool saveBinaryOptions(
int class_packet_id,
720 std::ostream &os)
const;
741 static const char *getPacketIOToken(PRM_ParmIOToken token);
742 static int getPacketIOTokenLen(PRM_ParmIOToken token);
743 static int getPacketIOBinaryId(PRM_ParmIOToken token);
748 static bool comparePacketIOToken(PRM_ParmIOToken token,
754 bool shouldSaveData()
const;
758 inline bool getFieldBit(
unsigned int field,
int i)
const
763 return ((field & (1 << (
unsigned)i)) != 0);
765 inline void setFieldBit(
unsigned int &field,
int i,
bool f)
770 field = (1<<(unsigned)getVectorSize()) - 1;
777 field |= (1 << (unsigned)i);
779 field &= ~(1 << (unsigned)i);
789 void validateChannelName(
PRM_ParmList &list,
int subindex);
791 void evaluationError(
793 int vector_index,
int err,
int thread)
const;
810 BITFLAG_EXPRESSIONSTATE = 0x0008,
811 BITFLAG_UNDOSAVED = 0x0010,
812 BITFLAG_ACTIVETAKE = 0x0020,
813 BITFLAG_TAKEALWAYSACTIVE = 0x0040,
814 BITFLAG_SAVEAUTOSCOPE = 0x0080,
815 BITFLAG_SPAREPARM = 0x0100,
816 BITFLAG_AUTOTAKEUNDOSAVED = 0x0400,
817 BITFLAG_DEFAULTSINIT = 0x0800,
818 BITFLAG_VALUESTATE = 0x1000,
819 BITFLAG_BYPASS = 0x2000,
820 BITFLAG_SAVELABEL = 0x4000,
821 BITFLAG_SAVEAUTOSELECT = 0x8000,
824 BITFLAG_SAVE_MASK = (BITFLAG_EXPRESSIONSTATE)
827 unsigned int myBitField;
828 unsigned int myEnableField;
829 unsigned int myLockField;
830 unsigned int myAutoScopeField;
831 unsigned int myVisibleField;
832 unsigned int myAutoSelectField;
835 unsigned int myActiveField;
840 unsigned myDirtyParmFlags;
841 unsigned mySendExtraFlags;
847 struct ChannelCustomColor
850 { myHasCustomColor =
false; }
852 bool myHasCustomColor;
854 ChannelCustomColor *myChannelColors;
857 const PRM_Multi *myMultiParmOwner;
866 bool allow_alias)
const
868 int size = myTemplatePtr->getVectorSize();
872 if (allow_alias && myChannelAliases)
874 for (i = 0; i <
size; i++)
876 if (myChannelAliases[i] == thechannelname)
885 retval = myTemplatePtr->findSubIndex(thechannelname);
894 return myEnableField;
896 return ( myEnableField & (1<<comp) ) ? 1 : 0;
904 if (!getVectorSize())
905 return (myVisibleField != 0);
907 return getFieldBit(myVisibleField, comp);
914 setFieldBit(myVisibleField, comp, f);
CH_Manager * getManager() const
unsigned int getSaveFlags() const
bool getVisibleState(int comp=-1) const
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.
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
int getVectorSize() const
unsigned getEnableState(int comp=-1) const
__hostdev__ void setValue(uint32_t offset, bool v)
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
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