SOFIELDCONTAINER(3iv)

πŸ’– SoFieldContainer β€” the abstract base class for stuff that holds fields πŸ’–

okay bestie, we're in SoFieldContainer(3IV) territory and it's literally the blueprint era. this is the abstract base class for objects that contain fields. she's not out here doing the work herself, she's the template, the main character archetype that engines and nodes are built from. periodt.


🌸 INHERITS FROM 🌸

SoBase > SoFieldContainer

so she got everything from SoBase and then added her own little field-having situation on top. generational wealth of methods, honestly.


✨ SYNOPSIS ✨

#include <Inventor/fields/SoFieldContainer.h>

Methods from class SoFieldContainer:

static SoType       getClassTypeId()
void                setToDefaults()
SbBool              hasDefaultValues() const
SbBool              fieldsAreEqual(const SoFieldContainer *fc) const
void                copyFieldValues(const SoFieldContainer *fc, SbBool
                         copyConnections = FALSE)
SbBool              set(const char *fieldDataString)
void                get(SbString &fieldDataString)
virtual int         getFields(SoFieldList &resultList) const
virtual SoField *   getField(const SbName &fieldName) const
SbBool              getFieldName(const SoField *field, SbName &fieldName)
                         const
SbBool              isNotifyEnabled() const
SbBool              enableNotify(SbBool flag)

Methods from class SoBase:

void                ref()
void                unref() const
void                unrefNoDelete() const
void                touch()
virtual SoType      getTypeId() const
SbBool              isOfType(SbType type) const
virtual void        setName(const SbName &name)
virtual SbName      getName() const
🫢 note the copyConnections = FALSE default in copyFieldValues β€” she defaults to NOT dragging the connections along. keep that in your notes, bestie.

πŸ¦‹ DESCRIPTION πŸ¦‹

SoFieldContainer is the abstract base class for engines and nodes. it's giving "I contain multitudes, and also fields." she's got methods for finding out what fields an object has, controlling notification, and for dealing with all of an object's fields at once β€” like a group chat admin for fields. πŸ’…

the fields of an engine are its inputs. and here's the tea: even though an engine's output corresponds to a specific type of field, an engine output is not a field. it's giving field-adjacent, not field. iykyk. πŸ™ˆ


πŸ‘‘ METHODS πŸ‘‘

  • static SoType getClassTypeId() β€” returns the type of this class. simple, iconic, no notes. ✨
  • void setToDefaults() β€” sets all fields in this object back to their default values. factory reset her. πŸŽ€
  • SbBool hasDefaultValues() const β€” returns TRUE if all of the object's fields have their default values. but β€” and this is the plot twist β€” it will return TRUE even if a field's isDefault() method returns FALSE. example: if a field's default value is 0.0 and you setValue(0.0) that field, the default flag gets set to FALSE (because comparing the field against its default value every single time setValue is called would be way too slow, and we're not doing that). however, hasDefaultValues() would still return TRUE in this case. she's doing her own math. 😭
  • SbBool fieldsAreEqual(const SoFieldContainer *fc) const β€” returns TRUE if this object's fields are exactly equal to fc's fields. if fc is not exactly the same type as this object, FALSE is returned. no type-match, no equality. it's giving strict. πŸ’€
  • void copyFieldValues(const SoFieldContainer *fc, SbBool copyConnections = FALSE) β€” copies the contents of fc's fields into this object's fields. fc must be the same type as this object. if copyConnections is TRUE, then if any of fc's fields are connected, this object's fields will also be connected to the same source. matching types only, bestie β€” she does not do mixed friend groups. 🫢
  • SbBool set(const char *fieldDataString) β€” sets one or more fields in this object to the values specified in the given string, which should be a string in the Inventor file format. TRUE is returned if the string was valid Inventor file format. for example, you could set the fields of an SoCube by doing:
SoCube *cube = ....
cube->set("width 1.0 height 2.0 depth 3.2");

look at that syntax slay. πŸ”₯

  • void get(SbString &fieldDataString) β€” returns the values of the fields of this object in the Inventor ASCII file format in the given string. fields whose isDefault() bit is set will not be part of the string. you can use the field->get() method to get a field's value as a string even if it has its default value. so if you're like "where did that field go", she's just being default-shy. πŸ™ˆ
  • virtual int getFields(SoFieldList &resultList) const β€” appends pointers to all of this object's fields to resultList, and returns the number of fields appended. the types of the fields can be determined using field->isOfType() and field->getTypeId(), and their names can be determined by passing the field pointers to the getFieldName() method (see below, bestie, she's right there). πŸ“‹
  • virtual SoField *getField(const SbName &fieldName) const β€” returns a pointer to the field of this object whose name is fieldName. returns NULL if there is no field with the given name. not found? she said NULL, respectfully. πŸ’€
  • SbBool getFieldName(const SoField *field, SbName &fieldName) const β€” returns the name of the given field in the fieldName argument. returns FALSE if field is not a member of this object. if she doesn't claim them, she doesn't name them. 🚫
  • SbBool isNotifyEnabled() const β€” notification is the process of telling interested objects that this object has changed. notification is needed to make engines and sensors function, is used to keep SoPaths up to date when the scene graph's topology changes, and is also used to invalidate rendering or bounding box caches.

notification is normally enabled, but can be disabled on a node by node (or engine by engine) basis. if you are making extensive changes to a large part of the scene graph then disabling notification can increase performance β€” at the expense of increased responsibility for making sure that any interested engines, sensors or paths are kept up to date. it's giving "you wanted the speed, now you own the consequences." 😭

for example, if you will be making a lot of changes to a small part of your scene graph and you know that there are no engines or sensors attached to nodes in that part of the scene graph, you might disable notification on the nodes you are changing, modify them, re-enable notification, and then touch() one of the nodes to cause a redraw.

however β€” and she said this with her whole chest β€” you should profile your application and make sure that notification is actually taking a significant amount of time before going to the trouble of manually controlling notification. do not optimize vibes you haven't measured. 🫢

  • SbBool enableNotify(SbBool flag) β€” notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE). the returned boolean value indicates whether notification was enabled immediately prior to applying this method. she tells you what the situation was before she changed it. receipts. πŸŽ€

🌈 SEE ALSO 🌈

SoSField, SoMField, SoNode, SoDB

go read those too, they're all in the same friend group. ✨


and that's the whole page, bestie πŸ’– this was SoFieldContainer(3IV), same name up top and same name down at the bottom, no date drama, just the title and the manual name doing their little matching thing. you ate this. periodt. πŸ’