table of contents
other sections
SoField(3IV)() | SoField(3IV)() |
NAME¶
SoField — base class for all fieldsINHERITS FROM¶
SoFieldSYNOPSIS¶
#include <Inventor/fields/SoField.h>Methods from class SoField:
void setIgnored(SbBool ignore)
SbBool isIgnored() const
SbBool isDefault() const
static SoType getClassTypeId()
virtual SoType getTypeId() const
virtual SbBool isOfType(SoType type) const
SbBool set(const char *valueString)
void get(SbString &valueString)
int operator ==(const SoField &f) const
int operator !=(const SoField &f) const
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¶
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.
DEF node1 Transform { translation 1 1 1 } DEF node2 Scale { scaleFactor 1 1 1 = USE node1.translation }
GlobalField { type SoSFUInt32 FrameCounter 494 }
METHODS¶
void setIgnored(SbBool ignore)
SbBool isIgnored() const
Sets/gets the ignore flag for this field. When a field's ignore flag is set to TRUE, the field is not used during traversal for rendering and other actions. The default value for this flag is FALSE.
SbBool isDefault() const
Gets the state of default flag of the field. This flag will be TRUE for any field whose value is not modified after construction and will be FALSE for those that have changed (each node or engine determines what the default values for its fields are). Note: the state of this flag should not be set explicitly from within applications.
static SoType getClassTypeId()
Return the type identifier for this field class.
virtual SoType getTypeId() const
Return the type identifier for this field instance (SoField *).
virtual SbBool isOfType(SoType type) const
Returns TRUE if this field is the given type or derived from that type. This is typically used with the getClassTypeId() method to determine the type of an SoField * at run-time:
SoField *field = ....; if (field->isOfType(SoSFFloat::getClassTypeId())) { SoSFFloat *floatField = (SoSFFloat *)field); floatField->setValue(4.5); }
SbBool set(const char *valueString)
Sets the field to the given value, which is an ASCII string in the Inventor file format. Each field subclass defines its own file format; see their reference pages for information on their file format. The string should contain only the field's value, not the field's name (e.g., "1.0", not "width 1.0"). This method returns TRUE if the string is valid, FALSE if it is not.
void get(SbString &valueString)
Returns the value of the field in the Inventor file format, even if the field has its default value.
int operator ==(const SoField &f) const
int operator !=(const SoField &f) const
Return TRUE (FALSE) if this field is of the same type and has the same value as f.
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. Calling touch() on an instance of a derived field class is equivalent to calling setValue(getValue()) using the derived class's methods, except that the field's isDefault() status remains unchanged.
SbBool connectFrom(SoField *fromField)
SbBool connectFrom(SoEngineOutput *fromEngine)
Connects this field to another field or from an engine output. If the field was connected to something before, it will be automatically disconnected (a field may have only one connection writing into it at a time). Unless connections to the field are disabled (see enableConnection()), the field's value will be set to the value of the thing it is connected to.
void disconnect()
Disconnect the field from whatever it was connected to. This does nothing if the field was not connected.
SbBool isConnected() const
Returns TRUE if the field is connected to anything.
SbBool isConnectedFromField() const
Returns TRUE if the field is connected to another field.
SbBool getConnectedField(SoField *&writingField) const
Returns TRUE if this field is being written into by another field, and returns the field it is connected to in writingField. Returns FALSE and does not modify writingField if it is not connected to a field.
SbBool isConnectedFromEngine() const
Returns TRUE if the field is connected to an engine's output.
SbBool 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. Returns FALSE and does not modify engineOutput if it is not connected to an engine.
void enableConnection(SbBool flag)
Field connections may be enabled and disabled. Disabling a field's connection is almost exactly like disconnecting it; the only difference is that you can later re-enable the connection by calling enableConnection(TRUE). Note that disconnecting an engine output can cause the engine's reference count to be decremented and the engine to be deleted, but disabling the connection does not decrement its reference count.
SbBool isConnectionEnabled() const
Returns FALSE if connections to this field are disabled. Note that this may return FALSE even if the field is not connected to anything.
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 object that contains this field. The type of the object will be either SoNode, SoEngine, or will be a global field container (note that the global field container class is internal to Inventor; see the methods for creating and accessing global fields on SoDB). For example:
SoFieldContainer *f = field->getContainer(); if (f->isOfType(SoNode::getClassTypeId())) { ... do something ... } else if (f->isOfType(SoEngine::getClassTypeId())) { ... do someting else ... } else { ... it must be a global field. We can figure out its name, but that is about it: const SbName &globalFieldName = f->getName(); }