SOMFNODE(3iv)
π SoMFNode(3IV) β the field that's basically a whole group chat of node pointers π
okay bestie, sit down, hydrate, because we're talking about SoMFNode β a multiple-value field containing any number of pointers to nodes. yes, any number. she's flexible like that. π¦
π INHERITS FROM
SoField > SoMField > SoMFNode
the family tree is giving legacy, but honestly? iconic lineage. π
β¨ SYNOPSIS β¨
#include <Inventor/fields/SoMFNode.h>
π Methods from class SoMFNode:
static SoType getClassTypeId()
virtual void getTypeId() const
SoNode * operator [](int i) const
const SoNode * * getValues(int start) const
int find(SoNode * targetValue, SbBool addIfNotFound =
FALSE)
void setValues(int start, int num, const SoNode *
*newValues)
void set1Value(int index, SoNode * newValue)
SoNode * operator =(SoNode * newValue)
void setValue(SoNode * newValue)
int operator ==(const SoMFNode &f) const
int operator !=(const SoMFNode &f) const
SoNode * * 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 what does she do? this field maintains a set of pointers to SoNode instances, and β this is the important part, don't skip it β it's correctly maintaining their reference counts. no leaks, no premature deletes, no chaos. she's responsible. she's the friend who actually remembers everyone's birthday. π«Ά
when SoMFNodes get written to file, they show up as one or more nodes. and when there's more than one value in there? all the values get wrapped in square brackets and separated by commas, like so:
[ Cube { }, Sphere { radius 2.0 }, USE myTranslation ]
periodt. that's the whole format. π
π₯ METHODS π₯
static SoType getClassTypeId()virtual void getTypeId() const
returns the type for this class, or for a particular object of this class. type check moment. β
SoNode * operator [](int i) const
returns the i'th value of the field. β οΈ but listen β indexing past the end of the field (aka passing in an i greater than getNum()) will return garbage. actual garbage. not an error, not a warning, just vibes and nonsense memory. do not do this. π
const SoNode * * 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 if you were planning to mess with them, no ma'am. check out the startEditing()/finishEditing() methods for a way of modifying values in place instead. π
int find(SoNode * targetValue, SbBool addIfNotFound = FALSE)
finds the given value in the array and returns the index of that value in the array. if it's not found, you get -1 back β she's not mad, she's just honest. if addIfNotFound is set, then targetValue is added to the end of the arrayβ¦ but -1 is still returned. yes, really. she added it and still said "not found." that's just the rules. π
void setValues(int start, int num, const SoNode * *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 β yes, the original says "accomodate," we respect the typo, it's part of her now. π¦
void set1Value(int index, SoNode * newValue)
sets the index'th value in the array to newValue. the array will be automatically expanded, if necessary. growth mindset fr fr. π±
SoNode * operator =(SoNode * newValue)void setValue(SoNode * newValue)
sets the first value in the array to newValue, and deletes the second and subsequent values. yes bestie, everyone after slot one is getting unfollowed. π
int operator ==(const SoMFNode &f) constint operator !=(const SoMFNode &f) const
returns TRUE if all of the values of this field equal (do not equal) those of the given field. but here's the tea: 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, for example. like, we see the resemblance, but they're not the same and she will not pretend. π
SoNode * * startEditing()void finishEditing()
startEditing() returns a pointer to the internally-maintained array that can be modified. the values in the array may be changed, but values cannot be added or removed. and it is illegal to call any other editing methods between startEditing() and finishEditing() (e.g. set1Value(), setValue(), etc). do not test her. π«
fields, engines or sensors connected to this field and sensors are not notified that this field has changed until finishEditing() is called. and heads up β 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's dramatic like that. announcing a change that didn't happen? main character energy. π
β οΈ quick vibe check, bestie: out-of-rangeoperator []= garbage, and calling other editing methods mid-startEditing()/finishEditing()= illegal. those are the two spots where she bites. everything else is smooth. π
that's the whole page, angel β brought to you straight from the SoMFNode(3IV) manual, section 3IV, and we're closing it out with her signature footer: SoMFNode(3IV)() π go forth and maintain those reference counts correctly. mwah. πβ¨
π¦ 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