SOMFENUM(3iv)
π NAME π
SoMFEnum β a multiple-value field that holds any number of enumerated type values. Like, any number. Zero, one, forty. It's giving buffet. π
πΈ INHERITS FROM πΈ
SoField > SoMField > SoMFEnum
The family tree, bestie. It got the field genes from SoField, the "many values" energy from SoMField, and then SoMFEnum is the main character. π
β¨ SYNOPSIS β¨
Methods from class SoMFEnum:
void setValue(const SbName &name)
void set1Value(int index, const SbName &name)
static SoType getClassTypeId()
virtual void getTypeId() const
int operator [](int i) const
const int * getValues(int start) const
int find(int targetValue, SbBool addIfNotFound = FALSE)
void setValues(int start, int num, const int *newValues)
void set1Value(int index, int newValue)
int operator =(int newValue)
void setValue(int newValue)
int operator ==(const SoMFEnum &f) const
int operator !=(const SoMFEnum &f) const
int * startEditing()
void finishEditing()
Methods from class SoMField:
int getNum() const
void setNum(int num)
virtual void deleteValues(int start, int num = -1)
virtual void insertSpace(int start, int num)
SbBool set1(int index, const char *valueString)
void get1(int index, SbString &valueString)
Methods from class SoField:
void setIgnored(SbBool ignore)
SbBool isIgnored() const
SbBool isDefault() const
virtual SbBool isOfType(SoType type) const
SbBool set(const char *valueString)
void get(SbString &valueString)
void touch()
SbBool connectFrom(SoField *fromField)
SbBool connectFrom(SoEngineOutput *fromEngine)
void disconnect()
SbBool isConnected() const
SbBool isConnectedFromField() const
SbBool getConnectedField(SoField *&writingField) const
SbBool isConnectedFromEngine() const
SbBool getConnectedEngine(SoEngineOutput *&engineOutput)
const
void enableConnection(SbBool flag)
SbBool isConnectionEnabled() const
int getForwardConnections(SoFieldList &list) const
SoFieldContainer * getContainer() const
π¦ DESCRIPTION π¦
Okay so picture this: a multiple-value field that contains any number of enumerated type values, and underneath it all they're stored as ints. That's the whole vibe.
The nodes that use this field class define mnemonic names for the values. And bestie, use those names when you're setting or testing the values of the field β even though, lowkey, the methods treat the values as integers. The names are the moment. β¨
SoMFEnums get written to file as a set of mnemonic enumerated type names. Heads up though: those names differ depending on which node class is using the field. So if you need the actual names, go check the reference pages for your specific nodes. iykyk. π
And when more than one value is present? All of the values get wrapped in square brackets and separated by commas. Cute, tidy, iconic.
π METHODS π
π The SoMFEnum ones
void setValue(const SbName &name)β Sets this field to contain one and only one value, and that value is the mnemonic name, passed in as a string. One value. That's it. No plus-ones. πvoid set1Value(int index, const SbName &name)β Sets theindex'th value to be the integer that corresponds to the mnemonic name in the given string. Name in, number out, slay.static SoType getClassTypeId()virtual void getTypeId() constβ Returns the type for this class, or for a particular object of this class. Type check, but make it official. βint operator [](int i) constβ Returns thei'th value of the field. β οΈ But watch out: indexing past the end of the field (passing inigreater thangetNum()) will return garbage. Not a crash, not an error, just... garbage. Rude. πconst int * getValues(int start) constβ Returns a pointer into the array of values in the field, starting at indexstart. These values are read-only β so if you wanna modify values in place, go look atstartEditing()/finishEditing(). Read-only means read-only, bestie. π«Άint find(int targetValue, SbBool addIfNotFound = FALSE)β Hunts down the given value in the array and returns the index of that value in the array. Not found? You get-1. IfaddIfNotFoundis set, thentargetValuegets added to the end of the array β but you still get-1back. Yes, really. That's the deal. πvoid setValues(int start, int num, const int *newValues)β Setsnumvalues starting at indexstartto the values innewValues. The array gets automatically made larger to accommodate the new values, if it needs to. It grows for you. Growth mindset. π±void set1Value(int index, int newValue)β Sets theindex'th value in the array tonewValue. The array will be automatically expanded, if necessary. Same energy, one value at a time. β¨int operator =(int newValue)void setValue(int newValue)β Sets the first value in the array tonewValue, and then deletes the second and subsequent values. Just so you know. It's not adding, it's replacing-and-clearing. πint operator ==(const SoMFEnum &f) constint operator !=(const SoMFEnum &f) constβ ReturnsTRUEif all of the values of this field equal (or do not equal) those of the given field. And here's the caveat: if the fields are different types,FALSEwill always be returned β even if, say, one field is anSoMFFloatwith one value of1.0and the other is anSoMFIntwith a value of1. Different types, different worlds. No cap. πint * startEditing()void finishEditing()βstartEditing()returns a pointer to the internally-maintained array, and that array can be modified. You can change the values in the array, but you cannot add or remove values. And it is illegal to call any other editing methods betweenstartEditing()andfinishEditing()(things likeset1Value(),setValue(), etc.). Do not do it. Periodt. β
Also: fields, engines or sensors connected to this field and sensors are not notified that this field changed until finishEditing() is called. And calling finishEditing() always sets the isDefault() flag to FALSE and informs engines and sensors that the field changed β even if none of the values actually changed. It's telling on you regardless. π
Real talk bestie: don't index pastgetNum(), don't call editing methods mid-startEditing()/finishEditing(), and don't expect==to be chill across different field types. Those are the three little landmines. Watch your step. π
and that's the whole page, fr fr β the header up top and the footer down bottom both just say SoMFEnum(3IV)(), so consider this your cute little sign-off. Same name, top and bottom, like a matching set. πβ¨π¦ Go forth and set your enum values, you gorgeous genius. π
π¦ where this page comes from
- debian bookworm: inventor-doc 2.1.5-10+dfsg-2 Β· LGPL-2.0-or-later
- debian trixie: inventor-doc 2.1.6+ds-2 Β· LGPL-2.0-or-later
- ubuntu jammy: inventor-doc 2.1.5-10-24
- ubuntu noble: inventor-doc 2.1.5-10+dfsg-2.1build2 Β· LGPL-2.0-or-later
- ubuntu questing: inventor-doc 2.1.6+ds-2
- ubuntu resolute: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- ubuntu stonking: inventor-doc 2.1.6.1+ds-1 Β· LGPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms