|
virtual | ~SoField () |
| Destructor.
|
|
void | setIgnored (bool ig) |
| Sets the ignore flag for this field.
|
|
bool | isIgnored () const |
| Gets the ignore flag for this field.
|
|
bool | isDefault () const |
| Gets the state of default flag of the field.
|
|
virtual SoType | getTypeId () const =0 |
| Return the type identifier for this field instance (SoField *).
|
|
bool | isOfType (SoType type) const |
| Returns TRUE if this field is the given type or derived from that type.
|
|
void | enableConnection (bool flag) |
| Field connections may be enabled and disabled.
|
|
bool | isConnectionEnabled () const |
| Returns FALSE if connections to this field are disabled.
|
|
bool | connectFrom (SoEngineOutput *engineOutput) |
| Connects the field to the given output of an engine or to another field.
|
|
bool | connectFrom (SoField *field) |
|
void | disconnect () |
| Disconnect the field from whatever it was connected to.
|
|
bool | isConnected () const |
| Returns TRUE if the field is connected to anything.
|
|
bool | isConnectedFromEngine () const |
| Returns TRUE if the field is connected to an engine's output.
|
|
bool | isConnectedFromField () const |
| Returns TRUE if the field is connected to another field.
|
|
bool | getConnectedEngine (SoEngineOutput *&engineOutput) const |
| Returns TRUE if this field is being written into by an engine, and returns the engine output it is connected to in engineOutput .
|
|
bool | getConnectedField (SoField *&field) const |
| Returns TRUE if this field is being written into by another field, and returns the field it is connected to in writingField .
|
|
int | getForwardConnections (SoFieldList &list) const |
| Adds pointers to all of the fields that this field is writing into (either fields in nodes, global fields or engine inputs) to the given field list, and returns the number of forward connections.
|
|
SoFieldContainer * | getContainer () const |
| Returns the containing node or engine.
|
|
bool | set (const char *valueString) |
| Sets the field to the given value, which is an ASCII string in the Inventor file format.
|
|
void | get (SbString &valueString) |
| Returns the value of the field in the Inventor file format, even if the field has its default value.
|
|
virtual void | touch () |
| Simulates a change to the field, causing attached sensors to fire, connected fields and engines to be marked as needing evaluation, and so forth.
|
|
bool | operator== (const SoField &f) const |
| Return TRUE (FALSE) if this field is of the same type and has the same value as f .
|
|
bool | operator!= (const SoField &f) const |
| Return TRUE (FALSE) if this field is of the same type and has the same value as f .
|
|
void | setDefault (bool def) |
| Sets default flag.
|
|
virtual void | startNotify () |
| Initiates or propagates notification through container.
|
|
virtual void | notify (SoNotList *list) |
|
void | setContainer (SoFieldContainer *cont) |
| Sets the containing node.
|
|
bool | shouldWrite () const |
| Returns TRUE if the field really needs to be written out.
|
|
void | addAuditor (void *auditor, SoNotRec::Type type) |
| Adds/removes an auditor to/from list.
|
|
void | removeAuditor (void *auditor, SoNotRec::Type type) |
|
bool | enableNotify (bool flag) |
| Indicates whether notification will propagate as the result of setting the field value.
|
|
bool | isNotifyEnabled () const |
|
bool | enableContainerNotify (bool flag) |
| Indicates whether notification will propagate to the SoFieldContainer that owns the field.
|
|
bool | isContainerNotifyEnabled () const |
|
virtual void | connectionStatusChanged (int numConnections) |
| Indicates to a field that a change has been made involving a connection from it (as source) to another field.
|
|
bool | isReadOnly () const |
| If this returns TRUE, it means we're in the middle of doing a setValue()+valueChanged() and values from an upstream connection shouldn't write into this field.
|
|
virtual bool | isSame (const SoField &f) const =0 |
| Returns TRUE if the given field is of the same type and has the same value(s) as this.
|
|
virtual void | copyFrom (const SoField &f)=0 |
| Copies the value from one field to another, assuming same subclass.
|
|
virtual void | fixCopy (bool copyConnections) |
| After a field value has been copied using copyFrom(), this is called to allow fields to update the copy.
|
|
virtual bool | referencesCopy () const |
| This returns TRUE if this field contains a reference to a node or engine that is copied during a copy operation (i.e., it is "inside").
|
|
void | copyConnection (const SoField *fromField) |
| Copies connection from one field to another.
|
|
virtual bool | read (SoInput *in, const SbName &name) |
| Reads value of field (with given name) from file as defined by SoInput.
|
|
virtual void | write (SoOutput *out, const SbName &name) const |
| Writes field (with given name) to file as defined by SoOutput.
|
|
virtual void | countWriteRefs (SoOutput *out) const |
| Counts write-references on field to prepare for writing.
|
|
void | evaluate () const |
| Evaluates the field from whatever it's connected to.
|
|
SoField is the abstract base class for all fields. Fields are the data elements contained within nodes and are the input values for engines. Each node or engine class specifies a set of fields and associates a name with each. These names define the semantics of the field (e.g., the SoCube node contains three float fields named width, height, and depth). Field classes provide the access methods that indirectly allow editing and querying of data within nodes.
There are two abstract subclasses of SoField: SoSField is the base class for all single-valued field classes and SoMField is the base class for all multiple-valued fields, which contain dynamic arrays of values. Subclasses of SoSField have an SoSF prefix, and subclasses of SoMField have an SoMF prefix. See the reference pages for SoSField and SoMField for additional methods.
Fields are typically constructed only within node or engine instances; if you need a field that is not part of a node or engine, you can create a GlobalField; see the methods on SoDB for creating global fields.
Fields can be connected either directly to another field, or can be connected to the output of an engine. The value of a field with a connection will change when the thing it is connected to changes. For example, consider a field "A" that is connected from "B" (by A->connectFrom(B)). When B's value is changed, A's value will also change. Note that A and B may have different values, even if they are connected: if A's value is set after B's value, A's value will be different from B's until B's value is set.
A field can be connected to several other fields, but can be connected from only one source.
It is possible (and often useful) to create loops of field connections (for example, A connected from B and B connected from A). If there are loops, then the rule is that the last setValue() done overrides any connections in to that value. You can think of setting the value of a field as immediately propagating that value forward into all the fields it is connected to, with the propagation stopping at the place where the original setValue() occurred if there is a connection loop. (Actually, a more efficient mechanism than this is used, but the semantics are the same.)
If you try to connect two fields of differing types, Inventor will automatically try to insert a field converter engine between them to convert values from one type into the other. Inventor has most reasonable conversions built-in (multiple-valued field to single-valued and vice versa, anything to SoSFString, anything to SoSFTrigger, float/short/unsigned short/int32_t/uint32_t/etc numeric conversions, etc). You can add field converters using SoDB's extender method addConverter(); see the SoDB.h header file for details. You can also find out if a converter is available with the SoDB::getConverter() method.
Fields each define their own file format for reading and being written to files, but all fields follow the same conventions:
Fields in a node or engine are written as the name of the field followed by the field's value; fields are not written if they have not been modified since they were created (if they have their default value).
The ignored flag is written as a "~" character after the field's value (if the field's value is its default value, just the "~" is written).
Field connections are written as an "=" followed by the container of the field or engine output that the field is connected to, followed by a "." and the name of the field or engine output. For example:
DEF node1 Transform { translation 1 1 1 }
DEF node2 Scale { scaleFactor 1 1 1 = USE node1.translation }
Global fields are written as part of an internal SoFieldContainer class called GlobalField, which writes out an SoSFName field named type whose value is the type of the global field, followed by a field of that type whose name is the name of the global field. For example, a global uint32_t field called "FrameCounter" whose value is 494 would be written as:
GlobalField {
FrameCounter 494
}
Field containing an unsinged int32_t integer.
- See Also
- SoSField, SoMField, SoNode, SoDB
Definition at line 185 of file SoField.h.