HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_Options Class Reference

#include <OP_Options.h>

+ Inheritance diagram for OP_Options:

Public Member Functions

 OP_Options ()
 
virtual ~OP_Options ()
 
void interpolate (const OP_Options &source1, const OP_Options &source2, fpreal interp)
 
void setOptionFromTemplate (const OP_Node *node, const PRM_Template &tplate, int pi, fpreal time)
 
void setOptionFromTemplate (const OP_Node *node, const PRM_Parm &parm, const PRM_Template &tplate, fpreal time)
 
void setOptionFromParm (const OP_Node *node, int pi, int vi, fpreal time)
 
void setOptionFromTemplateDefault (const PRM_Template &tp)
 
bool setOptionFromCommand (const char *optionname, const char *optionvalue, fpreal optionvaluefloat, UT_OptionType optiontype)
 
UT_DMatrix4 getTransformFromOptions () const
 
const OP_Optionsoperator= (const UT_Options &src)
 Set one OP_Options equal to another. More...
 
- Public Member Functions inherited from UT_Options
 UT_Options ()
 
 UT_Options (const UT_Options &src)
 
virtual ~UT_Options ()
 
 UT_Options (const char *type_and_name,...)
 
void clear ()
 
bool load (const char *filename)
 
bool save (const char *filename) const
 
bool saveOrdered (const char *filename) const
 
bool load (const char *filename, UT_IStream &is)
 
bool save (const char *filename, std::ostream &os) const
 
bool saveOrdered (const char *filename, std::ostream &os) const
 
bool saveAsJSON (const char *filename, bool binary=true) const
 
bool saveAsJSON (const char *filename, std::ostream &os, bool binary=true) const
 
void removeOption (const UT_StringHolder &name)
 
bool getOptionString (const UT_StringHolder &name, UT_OptionFormat format, UT_WorkBuffer &result) const
 
bool getOptionString (const UT_StringHolder &name, UT_OptionFormat format, UT_String &result) const
 
bool appendPyDictionary (UT_WorkBuffer &result, bool sorted=false) const
 
bool setFromPyDictionary (const char *dict)
 
bool setPyOptionString (const UT_StringHolder &name, const char *value)
 
bool save (UT_JSONWriter &w) const
 Save a UT_Options to JSON format using UT_JSONWriter. More...
 
void save (UT_JSONValueMap &map) const
 Save a UT_Options to a UT_JSONValue. More...
 
bool load (UT_JSONParser &parser, bool do_clear, UT_IStream *is=0)
 
void dump (std::ostream &os) const
 Writes a JSON dump to ostream of the current options. More...
 
void dump () const
 Dump to stdout/cout. More...
 
bool hasOption (const UT_StringRef &name) const
 
UT_OptionType getOptionType (const UT_StringRef &name) const
 
const UT_OptionEntrygetOptionEntry (const UT_StringRef &name) const
 
int getNumOptions () const
 
iterator begin () const
 
iterator end () const
 
ordered_iterator obegin () const
 
ordered_iterator oend () const
 
int64 getOptionI (const UT_StringRef &name) const
 
bool getOptionB (const UT_StringRef &name) const
 
fpreal64 getOptionF (const UT_StringRef &name) const
 
const UT_Vector2DgetOptionV2 (const UT_StringRef &name) const
 
const UT_Vector3DgetOptionV3 (const UT_StringRef &name) const
 
const UT_Vector4DgetOptionV4 (const UT_StringRef &name) const
 
const UT_QuaternionDgetOptionQ (const UT_StringRef &name) const
 
const UT_Matrix2DgetOptionM2 (const UT_StringRef &name) const
 
const UT_Matrix3DgetOptionM3 (const UT_StringRef &name) const
 
const UT_Matrix4DgetOptionM4 (const UT_StringRef &name) const
 
const UT_Vector2DgetOptionUV (const UT_StringRef &name) const
 
const UT_Vector3DgetOptionUVW (const UT_StringRef &name) const
 
const UT_StringHoldergetOptionS (const UT_StringRef &name) const
 
void getOptionS (const UT_StringRef &name, std::string &value) const
 
void getOptionS (const UT_StringRef &name, UT_String &value) const
 
void getOptionS (const UT_StringRef &name, UT_StringHolder &value) const
 
void getOptionS (const UT_StringRef &, UT_WorkBuffer &value) const
 
const UT_Int64ArraygetOptionIArray (const UT_StringRef &) const
 
const UT_Fpreal64ArraygetOptionFArray (const UT_StringRef &) const
 
const UT_StringArraygetOptionSArray (const UT_StringRef &) const
 
fpreal64 getOptionNum (const UT_StringRef &) const
 
bool importOption (const UT_StringRef &name, int &value) const
 
bool importOption (const UT_StringRef &name, int64 &value) const
 
bool importOption (const UT_StringRef &name, bool &value) const
 
bool importOption (const UT_StringRef &name, fpreal32 &value) const
 
bool importOption (const UT_StringRef &name, fpreal64 &value) const
 
bool importOption (const UT_StringRef &name, std::string &value) const
 
bool importOption (const UT_StringRef &name, UT_String &value) const
 
bool importOption (const UT_StringRef &name, UT_StringHolder &value) const
 
bool importOption (const UT_StringRef &name, UT_Vector2F &value) const
 
bool importOption (const UT_StringRef &name, UT_Vector3F &value) const
 
bool importOption (const UT_StringRef &name, UT_Vector4F &value) const
 
bool importOption (const UT_StringRef &name, UT_QuaternionF &value) const
 
bool importOption (const UT_StringRef &name, UT_Matrix2F &value) const
 
bool importOption (const UT_StringRef &name, UT_Matrix3F &value) const
 
bool importOption (const UT_StringRef &name, UT_Matrix4F &value) const
 
bool importOption (const UT_StringRef &name, UT_Vector2D &value) const
 
bool importOption (const UT_StringRef &name, UT_Vector3D &value) const
 
bool importOption (const UT_StringRef &name, UT_Vector4D &value) const
 
bool importOption (const UT_StringRef &name, UT_QuaternionD &value) const
 
bool importOption (const UT_StringRef &name, UT_Matrix2D &value) const
 
bool importOption (const UT_StringRef &name, UT_Matrix3D &value) const
 
bool importOption (const UT_StringRef &name, UT_Matrix4D &value) const
 
bool importOption (const UT_StringRef &name, UT_Array< int32 > &value) const
 
bool importOption (const UT_StringRef &name, UT_Array< int64 > &value) const
 
bool importOption (const UT_StringRef &name, UT_Array< fpreal32 > &value) const
 
bool importOption (const UT_StringRef &name, UT_Array< fpreal64 > &value) const
 
bool importOption (const UT_StringRef &name, UT_StringArray &value) const
 
bool importElement (const UT_StringRef &name, fpreal &value, exint index=0) const
 
bool importElement (const UT_StringRef &name, int64 &value, exint index=0) const
 
UT_OptionssetOptionI (const UT_StringHolder &name, int64 value)
 
UT_OptionssetOptionB (const UT_StringHolder &name, bool value)
 
UT_OptionssetOptionF (const UT_StringHolder &name, fpreal64 value)
 
UT_OptionssetOptionS (const UT_StringHolder &name, const UT_StringHolder &value)
 
UT_OptionssetOptionSRaw (const UT_StringHolder &name, const UT_StringHolder &value)
 
UT_OptionssetOptionV2 (const UT_StringHolder &name, const UT_Vector2F &value)
 
UT_OptionssetOptionV2 (const UT_StringHolder &name, const UT_Vector2D &value)
 
UT_OptionssetOptionV2 (const UT_StringHolder &name, fpreal64 x, fpreal64 y)
 
UT_OptionssetOptionV3 (const UT_StringHolder &name, const UT_Vector3F &value)
 
UT_OptionssetOptionV3 (const UT_StringHolder &name, const UT_Vector3D &value)
 
UT_OptionssetOptionV3 (const UT_StringHolder &name, fpreal64 x, fpreal64 y, fpreal64 z)
 
UT_OptionssetOptionV4 (const UT_StringHolder &name, const UT_Vector4F &value)
 
UT_OptionssetOptionV4 (const UT_StringHolder &name, const UT_Vector4D &value)
 
UT_OptionssetOptionV4 (const UT_StringHolder &name, fpreal64 x, fpreal64 y, fpreal64 z, fpreal64 w)
 
UT_OptionssetOptionQ (const UT_StringHolder &name, const UT_QuaternionF &value)
 
UT_OptionssetOptionQ (const UT_StringHolder &name, const UT_QuaternionD &value)
 
UT_OptionssetOptionM2 (const UT_StringHolder &name, const UT_Matrix2F &value)
 
UT_OptionssetOptionM2 (const UT_StringHolder &name, const UT_Matrix2D &value)
 
UT_OptionssetOptionM3 (const UT_StringHolder &name, const UT_Matrix3F &value)
 
UT_OptionssetOptionM3 (const UT_StringHolder &name, const UT_Matrix3D &value)
 
UT_OptionssetOptionM4 (const UT_StringHolder &name, const UT_Matrix4F &value)
 
UT_OptionssetOptionM4 (const UT_StringHolder &name, const UT_Matrix4D &value)
 
UT_OptionssetOptionUV (const UT_StringHolder &name, const UT_Vector2F &value)
 
UT_OptionssetOptionUV (const UT_StringHolder &name, const UT_Vector2D &value)
 
UT_OptionssetOptionUVW (const UT_StringHolder &name, const UT_Vector3F &value)
 
UT_OptionssetOptionUVW (const UT_StringHolder &name, const UT_Vector3D &value)
 
UT_OptionssetOptionSArray (const UT_StringHolder &name, const UT_StringHolder *values, size_t size)
 Set string array options. More...
 
UT_OptionssetOptionSArray (const UT_StringHolder &name, const char *const *values, size_t size)
 
UT_OptionssetOptionSArray (const UT_StringHolder &name, const UT_StringArray &value)
 
unsigned hash () const
 Get a hash code for the options. More...
 
bool operator== (const UT_Options &src) const
 Comparison operator. More...
 
bool operator!= (const UT_Options &src) const
 
const UT_Optionsoperator= (const UT_Options &src)
 Assignment operator. More...
 
void merge (const UT_Options &src)
 
void merge (const UT_Options &src, bool(*match)(const UT_StringHolder &name, const UT_OptionEntry *, void *), void *data)
 
virtual int64 getMemoryUsage (bool inclusive) const
 
void setOption (const UT_StringHolder &name, UT_OptionEntry *value)
 The map will take ownership of the UT_OptionEntry. More...
 
UT_OptionssetOptionIArray (const UT_StringHolder &name, const int32 *values, size_t size)
 
UT_OptionssetOptionIArray (const UT_StringHolder &name, const int64 *values, size_t size)
 
UT_OptionssetOptionIArray (const UT_StringHolder &name, const UT_Array< int64 > &value)
 
UT_OptionssetOptionFArray (const UT_StringHolder &name, const fpreal32 *values, size_t size)
 
UT_OptionssetOptionFArray (const UT_StringHolder &name, const fpreal64 *values, size_t size)
 
UT_OptionssetOptionFArray (const UT_StringHolder &name, const UT_Array< fpreal64 > &value)
 

Protected Member Functions

virtual void optionChanged (const char *name)
 
void getInterpolatedInt (int64 &value, int source1, int source2, fpreal interp) const
 These functions perform the actual interpolation of each data type. More...
 
void getInterpolatedBool (bool &value, bool source1, bool source2, fpreal interp) const
 
void getInterpolatedFpreal (fpreal64 &value, fpreal source1, fpreal source2, fpreal interp) const
 
void getInterpolatedString (UT_StringHolder &value, const UT_StringHolder &source1, const UT_StringHolder &source2, fpreal interp) const
 
void getInterpolatedVector2 (UT_Vector2D &value, const UT_Vector2D &source1, const UT_Vector2D &source2, fpreal interp) const
 
void getInterpolatedVector3 (UT_Vector3D &value, const UT_Vector3D &source1, const UT_Vector3D &source2, fpreal interp) const
 
void getInterpolatedVector4 (UT_Vector4D &value, const UT_Vector4D &source1, const UT_Vector4D &source2, fpreal interp) const
 
void getInterpolatedQuaternion (UT_QuaternionD &value, const UT_QuaternionD &source1, const UT_QuaternionD &source2, fpreal interp) const
 
void getInterpolatedMatrix2 (UT_Matrix2D &value, const UT_Matrix2D &source1, const UT_Matrix2D &source2, fpreal interp) const
 
void getInterpolatedMatrix3 (UT_Matrix3D &value, const UT_Matrix3D &source1, const UT_Matrix3D &source2, fpreal interp) const
 
void getInterpolatedMatrix4 (UT_Matrix4D &value, const UT_Matrix4D &source1, const UT_Matrix4D &source2, fpreal interp) const
 
void getInterpolatedIntArray (UT_Int64Array &value, const UT_Int64Array &source1, const UT_Int64Array &source2, fpreal interp)
 
void getInterpolatedFprealArray (UT_Fpreal64Array &value, const UT_Fpreal64Array &source1, const UT_Fpreal64Array &source2, fpreal interp)
 
void getInterpolatedStringArray (UT_StringArray &value, const UT_StringArray &source1, const UT_StringArray &source2, fpreal interp)
 
- Protected Member Functions inherited from UT_Options
const UT_StringHolderfindOptionS (const UT_StringRef &name) const
 
void addError (const char *filename, int linecount, const char *error_str) const
 
bool sendOptionChanges () const
 
void setSendOptionChanges (bool f)
 
UT_OptionEntryparsePyValue (const char *&value, char sep_delim, char close_delim= '\0')
 

Detailed Description

This class stores a set of name/value pairs. Each value can be one of several different data types. No automatic conversion between data types is provided, so accessing existing data requires knowledge of both the data name and the data type.

Definition at line 29 of file OP_Options.h.

Constructor & Destructor Documentation

OP_Options::OP_Options ( )
explicit
virtual OP_Options::~OP_Options ( )
virtual

Member Function Documentation

void OP_Options::getInterpolatedBool ( bool &  value,
bool  source1,
bool  source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedFpreal ( fpreal64 value,
fpreal  source1,
fpreal  source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedFprealArray ( UT_Fpreal64Array value,
const UT_Fpreal64Array source1,
const UT_Fpreal64Array source2,
fpreal  interp 
)
protected
void OP_Options::getInterpolatedInt ( int64 value,
int  source1,
int  source2,
fpreal  interp 
) const
protected

These functions perform the actual interpolation of each data type.

void OP_Options::getInterpolatedIntArray ( UT_Int64Array value,
const UT_Int64Array source1,
const UT_Int64Array source2,
fpreal  interp 
)
protected
void OP_Options::getInterpolatedMatrix2 ( UT_Matrix2D value,
const UT_Matrix2D source1,
const UT_Matrix2D source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedMatrix3 ( UT_Matrix3D value,
const UT_Matrix3D source1,
const UT_Matrix3D source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedMatrix4 ( UT_Matrix4D value,
const UT_Matrix4D source1,
const UT_Matrix4D source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedQuaternion ( UT_QuaternionD value,
const UT_QuaternionD source1,
const UT_QuaternionD source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedString ( UT_StringHolder value,
const UT_StringHolder source1,
const UT_StringHolder source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedStringArray ( UT_StringArray value,
const UT_StringArray source1,
const UT_StringArray source2,
fpreal  interp 
)
protected
void OP_Options::getInterpolatedVector2 ( UT_Vector2D value,
const UT_Vector2D source1,
const UT_Vector2D source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedVector3 ( UT_Vector3D value,
const UT_Vector3D source1,
const UT_Vector3D source2,
fpreal  interp 
) const
protected
void OP_Options::getInterpolatedVector4 ( UT_Vector4D value,
const UT_Vector4D source1,
const UT_Vector4D source2,
fpreal  interp 
) const
protected
UT_DMatrix4 OP_Options::getTransformFromOptions ( ) const

Calculates a transform matrix based on standard transform options like t, r, s, etc.

void OP_Options::interpolate ( const OP_Options source1,
const OP_Options source2,
fpreal  interp 
)

Set the data in this OP_Options to be an interpolation of the data in two other OP_Options. The actual interpolation of each piece of data is performed by the OP_OptionInterpolator, which allows the interpolation behavior to be customized.

const OP_Options& OP_Options::operator= ( const UT_Options src)

Set one OP_Options equal to another.

virtual void OP_Options::optionChanged ( const char *  name)
protectedvirtual

This function is called whenever data is added, removed, or changed. If the name parameter is null, then multiple pieces of data were changed simultaneously (probably through a load or assignment operation). This function just calls OP_OptionsUser::optionChanged() on each user of this data.

Reimplemented from UT_Options.

Reimplemented in SIM_Options.

bool OP_Options::setOptionFromCommand ( const char *  optionname,
const char *  optionvalue,
fpreal  optionvaluefloat,
UT_OptionType  optiontype 
)

Sets an option based on strings coming from a command. This is used by the dopsolvesetoption command. This funtion returns true if the parameters make sense together and result in setting an option. Otherwise false is returned.

void OP_Options::setOptionFromParm ( const OP_Node node,
int  pi,
int  vi,
fpreal  time 
)

Utility function for setting options based on channel names of a parameter. This splits up a single parameter tuple into multiple scalar options.

void OP_Options::setOptionFromTemplate ( const OP_Node node,
const PRM_Template tplate,
int  pi,
fpreal  time 
)

Utility function for setting an option based on a parm template. This is useful for gathering information from operator parameters to be passed on to OP_Data::setParameters(). This will harden op references to full paths, add parameter tuples as vector2/vector3/etc options, and also build ramp and multiparms. Ramps become strings and multiparms are recursed and all their implied parms added.

void OP_Options::setOptionFromTemplate ( const OP_Node node,
const PRM_Parm parm,
const PRM_Template tplate,
fpreal  time 
)
void OP_Options::setOptionFromTemplateDefault ( const PRM_Template tp)

Utility function for setting an options based on the default value stored in a parm template. This is used to gather default values for initializing a OP_Data type. The parameter defaults are gethered into a OP_Options data structure which is passed to OP_Data::setParameters().


The documentation for this class was generated from the following file: