SOMFBITMASK(3iv)

πŸ’… NAME

okay so, bestie, meet SoMFBitMask β€” a multiple-value field containing any number of masks of bit flags. yes, masks of bit flags. plural. any number. she's flexible like that ✨


🧬 INHERITS FROM

SoField > SoMField > SoMFEnum > SoMFBitMask

so like, she comes from a whole lineage of field girlies. generational wealth, honestly πŸ‘‘


✨ SYNOPSIS ✨

first things first, you gotta pull her in:

#include <Inventor/fields/SoMFBitMask.h>

πŸŽ€ Methods from class SoMFBitMask

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 SoMFBitMask &f) const
int                 operator !=(const SoMFBitMask &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 πŸ“–

so. SoMFBitMask is a multiple-value field that holds any number of masks of bit flags, and it stores them as ints. Nodes and engines that use this field class get to define mnemonic names for the bit flags β€” cute little nicknames for each flag, basically. and here's the thing: you should use those names when you're setting or testing the values of the field, even though underneath, the methods treat everything as integers. iykyk 🫢

when you're testing and setting flags inside a mask, you use the bit-wise "&" and "|" operators. those two. no others. slay.

SoMFBitMasks are written to file as one or more mnemonic enumerated type names, in this format:

( flag1 | flag2 | ... )

if only one flag is used in a mask, the parentheses are optional β€” she's chill like that πŸ™ˆ

⚠️ these names differ among uses of this field in various node or engine classes. so you gotta go check the reference pages for the specific nodes or engines to find the names. don't guess, bestie.

the field values may also be represented as integers, but this is not guaranteed to be portable. so like, technically allowed, spiritually risky πŸ’€

when more than one value is present, all of the values get enclosed in square brackets and separated by commas. periodt.


πŸ›  METHODS πŸ› 

🌈 The SoMFBitMask girlies

  • static SoType getClassTypeId()
  • virtual void getTypeId() const

β€” these two return the type for this class, or for a particular object of this class. type check, passed βœ…

  • int operator [](int i) const

β€” returns the i'th value of the field. but fair warning: indexing past the end of the field (like passing in an i greater than getNum()) will return garbage. not an error, not a nice message. garbage. you've been warned 🫠

  • const int * getValues(int start) const

β€” returns a pointer into the array of values in the field, starting at index start. these values are read-only, so don't get any ideas β€” if you wanna modify values in place, go look at the startEditing() / finishEditing() methods instead πŸ’–

  • int find(int targetValue, SbBool addIfNotFound = FALSE)

β€” hunts down the given value in the array and returns the index of that value. if the value is not found, -1 is returned. and if addIfNotFound is set, then targetValue gets added to the end of the array β€” but heads up, -1 is still returned. yes, she adds it and still tells you no. iconic behavior honestly πŸ’…

  • void setValues(int start, int num, const int *newValues)

β€” sets num values starting at index start to the values in newValues. the array will automatically be made larger to accomodate the new values, if necessary. she grows 🌱

  • void set1Value(int index, int newValue)

β€” sets the index'th value in the array to newValue. the array will automatically be expanded, if necessary. again: she grows.

  • int operator =(int newValue)
  • void setValue(int newValue)

β€” sets the first value in the array to newValue, and then deletes the second and subsequent values. ruthless. one and done. βœ‚οΈ

  • int operator ==(const SoMFBitMask &f) const
  • int operator !=(const SoMFBitMask &f) const

β€” returns TRUE if all of the values of this field equal (or do not equal, for !=) those of the given field. and here's the catch, bestie: if the fields are different types, FALSE will always be returned β€” even if one field is an SoMFFloat with one value of 1.0 and the other is an SoMFInt with a value of 1. like, same vibe, different type, still FALSE. no cap 🚫

  • int * startEditing()
  • void finishEditing()

β€” startEditing() returns a pointer to the internally-maintained array that can be modified. you may change the values in the array, but you cannot add or remove values. and it is illegal to call any other editing methods between startEditing() and finishEditing() β€” that means set1Value(), setValue(), etc. do not do it. i'm serious 😭

fields, engines or sensors connected to this field and sensors are not notified that this field has changed until finishEditing() is called. so the whole time you're editing, everyone else is just... unaware. living their lives. πŸ™ˆ

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 were changed. she announces it regardless. main character energy, truly πŸ‘‘


πŸ’œ a lil sign-off

that's the whole page, bestie. and just so we're official about it: this is the SoMFBitMask(3IV)() manual page β€” that's the manual name, version and date all wrapped up together, and yeah, the version/date slots are sitting there empty like an unread group chat. go forth and mask those bits responsibly. mwah πŸŽ€βœ¨πŸ¦‹