SoField Class Reference
[Fields]

Base class for all fields. More...

#include <Inventor/fields/SoField.h>

Inheritance diagram for SoField:
SoTypedObject SoMField SoSField SoMFBool SoMFBufferObject SoMFColor SoMFColorRGBA SoMFDataMeasure SoMFDouble SoMFEngine SoMFEnum SoMFFieldContainer SoMFFloat SoMFImage SoMFInstanceParameter SoMFInt32 SoMFInt64 SoMFKernel2i32 SoMFKernel3i32 SoMFMatrix SoMFName SoMFNode SoMFPath SoMFPlane SoMFRotation SoMFShort SoMFString SoMFTime SoMFUByte SoMFUInt32 SoMFUniformShaderParameter SoMFUShort SoMFVec2d SoMFVec2f SoMFVec2i32 SoMFVec2s SoMFVec2String SoMFVec3d SoMFVec3f SoMFVec3i32 SoMFVec3s SoMFVec4b SoMFVec4f SoMFVec4i32 SoMFVec4s SoMFVec4ub SoMFVec4ui32 SoMFVec4us PoSFMesh SoSFArray SoSFBool SoSFBox2f SoSFBox3f SoSFBox3i32 SoSFBox3s SoSFBox4i32 SoSFBufferObject SoSFColor SoSFColorRGBA SoSFDouble SoSFEngine SoSFEnum SoSFFieldContainer SoSFFloat SoSFImage SoSFImage3 SoSFInt32 SoSFInt64 SoSFKernel2i32 SoSFKernel3i32 SoSFMatrix SoSFMemObj SoSFName SoSFNode SoSFPath SoSFPlane SoSFRotation SoSFShort SoSFString SoSFStructuredQuadrilateralMesh SoSFTime SoSFTrigger SoSFUByte SoSFUInt32 SoSFUShort SoSFVec2d SoSFVec2f SoSFVec2i32 SoSFVec2s SoSFVec3d SoSFVec3f SoSFVec3i32 SoSFVec4f SoSFVec4i32

List of all members.

Classes

struct  Flags
struct  MTstruct

Public Member Functions

void setIgnored (SbBool ig)
SbBool isIgnored () const
SbBool isDefault () const
void enableConnection (SbBool flag)
SbBool isConnectionEnabled () const
SbBool connectFrom (SoEngineOutput *engineOutput)
SbBool connectFrom (SoField *field)
SbBool connectFrom (SoVRMLInterpOutput *interpOutput)
SbBool appendConnection (SoEngineOutput *engineOutput)
SbBool appendConnection (SoField *field)
SbBool appendConnection (SoVRMLInterpOutput *interpOutput)
void disconnect (SoEngineOutput *engineOutput)
void disconnect (SoField *field)
void disconnect (SoVRMLInterpOutput *interpOutput)
int getNumConnections () const
int getConnections (SoFieldList &list)
void disconnect ()
SbBool isConnected () const
SbBool isConnectedFromVRMLInterp () const
SbBool isConnectedFromEngine () const
SbBool isConnectedFromField () const
SbBool getConnectedEngine (SoEngineOutput *&engineOutput) const
SbBool getConnectedField (SoField *&writingField) const
SbBool getConnectedVRMLInterp (SoVRMLInterpOutput *&interpOutput) const
int getForwardConnections (SoFieldList &list) const
SoFieldContainergetContainer () const
SoNONUNICODE SbBool set (const char *valueString)
SbBool set (const SbString &valueString)
void get (SbString &valueString)
virtual void touch ()
int operator== (const SoField &f) const
int operator!= (const SoField &f) const

Static Public Member Functions

static SoType getClassTypeId ()

Friends

class SoEngineOutput
class SoVRMLInterpOutput

Detailed Description

Base class for all fields.

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, Open Inventor will automatically try to insert a field converter engine between them to convert values from one type into the other. Open 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{
      type SoSFUInt32
      FrameCounter 494
      }
     

SEE ALSO

SoSField, SoMField, SoNode, SoDB

See related examples:

NonDuplicateMField


Member Function Documentation

SbBool SoField::appendConnection ( SoVRMLInterpOutput interpOutput  ) 

Appends this field to the list of connections from another interpOutput.

Previous connections remain unchanged. Unless connections to the field are disabled, the field value will be set to that of the interpOutput that was last touched.

SbBool SoField::appendConnection ( SoField field  ) 

Appends this field to the list of connections from another field.

Previous connections remain unchanged. Unless connections to the field are disabled, the field value will be set to that of the field that was last touched.

SbBool SoField::appendConnection ( SoEngineOutput engineOutput  ) 

Appends this field to the list of connections from another engineOutput.

Previous connections remain unchanged. Unless connections to the field are disabled, the field value will be set to that of the engineOutput that was last touched.

SbBool SoField::connectFrom ( SoVRMLInterpOutput interpOutput  ) 

Connects this field from an interpOutput.

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.

SbBool SoField::connectFrom ( SoField field  ) 

Connects this field to another field.

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.

SbBool SoField::connectFrom ( SoEngineOutput engineOutput  ) 

Connects this field 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 SoField::disconnect (  ) 

Disconnect the field from whatever it was connected to.

This does nothing if the field was not connected.

void SoField::disconnect ( SoVRMLInterpOutput interpOutput  ) 

Disconnect the field from the requested interpOutput.

All other connections remain.

void SoField::disconnect ( SoField field  ) 

Disconnect the field from the requested field.

All other connections remain.

void SoField::disconnect ( SoEngineOutput engineOutput  ) 

Disconnect the field from the requested engineOutput.

All other connections remain.

void SoField::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.

Re-enabling a connection will cause the value of the field to be changed to the engine output or field to which it is connected.

A field's connection-enabled status is maintained even if the field is disconnected or reconnected. By default, connections are enabled.

void SoField::get ( SbString valueString  ) 

Returns the value of the field in the Open Inventor file format, even if the field has its default value.

static SoType SoField::getClassTypeId (  )  [static]

Return the type identifier for this field class.

Reimplemented from SoTypedObject.

Reimplemented in SoMFDataMeasure, SoMFKernel2i32, SoMFKernel3i32, SoSFAnalysisResult, SoSFDataMeasure, SoSFDataMeasureAttributes, SoSFImageAnalysisResult, SoSFImageDataAdapter, SoSFKernel2i32, SoSFKernel3i32, SoSFLabelAnalysisResult, SoSFMorphoLut2D, SoSFMorphoLut3D, SoSFSegmentChain, SoSFStructuredQuadrilateralMesh, SoMFBitMask, SoMFBool, SoMFBufferObject, SoMFColor, SoMFColorRGBA, SoMFDouble, SoMFEngine, SoMFEnum, SoMFFieldContainer, SoMFFilePathString, SoMFFloat, SoMField, SoMFImage, SoMFInstanceParameter, SoMFInt32, SoMFInt64, SoMFMatrix, SoMFName, SoMFNode, SoMFPath, SoMFPlane, SoMFRotation, SoMFShort, SoMFString, SoMFTime, SoMFUByte, SoMFUInt32, SoMFUniformShaderParameter, SoMFUShort, SoMFVec2d, SoMFVec2f, SoMFVec2FilePathString, SoMFVec2i32, SoMFVec2s, SoMFVec2String, SoMFVec3d, SoMFVec3f, SoMFVec3i32, SoMFVec3s, SoMFVec4b, SoMFVec4f, SoMFVec4i32, SoMFVec4s, SoMFVec4ub, SoMFVec4ui32, SoMFVec4us, SoSFArray, SoSFArray2D, SoSFArray3D, SoSFBitMask, SoSFBool, SoSFBox2f, SoSFBox3f, SoSFBox3i32, SoSFBox3s, SoSFBox4i32, SoSFBufferObject, SoSFColor, SoSFColorRGBA, SoSFDouble, SoSFEngine, SoSFEnum, SoSFFieldContainer, SoSFFilePathString, SoSFFloat, SoSField, SoSFImage, SoSFImage3, SoSFInt32, SoSFInt64, SoSFMaterial, SoSFMatrix, SoSFMemObj, SoSFName, SoSFNode, SoSFPath, SoSFPlane, SoSFRotation, SoSFShort, SoSFString, SoSFTime, SoSFTrigger, SoSFUByte, SoSFUInt32, SoSFUShort, SoSFVec2d, SoSFVec2f, SoSFVec2i32, SoSFVec2s, SoSFVec3d, SoSFVec3f, SoSFVec3i32, SoSFVec4f, SoSFVec4i32, SoSFLDMDataTransform, SoSFLDMResourceParameters, PoSFCartesianGrid2D, PoSFCartesianGrid3D, PoSFHexahedronMesh3D, PoSFIndexedMesh2D, PoSFIndexedMesh3D, PoSFIrregularMesh1D, PoSFMesh, PoSFParalCartesianGrid2D, PoSFParalCartesianGrid3D, PoSFPolarGrid2D, PoSFQuadrangleMesh2D, PoSFRegularCartesianGrid2D, PoSFRegularCartesianGrid3D, PoSFRegularMesh1D, PoSFTetrahedronMesh3D, and PoSFTriangleMesh2D.

SbBool SoField::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.

SbBool SoField::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 SoField::getConnectedVRMLInterp ( SoVRMLInterpOutput *&  interpOutput  )  const

Returns the VRMLInterpolator output field is connected to.

Returns FALSE if there is no connection of the appropriate type.

int SoField::getConnections ( SoFieldList list  ) 

Returns a list of the connections to this field.

SoFieldContainer* SoField::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 Open 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 something else ...
  } else {
    ... it must be a global field. We can figure out its name, but that is about it:
    const SbName &globalFieldName = f->getName();
  }
int SoField::getForwardConnections ( SoFieldList list  )  const

Adds references 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.

int SoField::getNumConnections (  )  const [inline]

Returns the number of connections to this field.

SbBool SoField::isConnected (  )  const [inline]

Returns TRUE if the field is connected to anything.

SbBool SoField::isConnectedFromEngine (  )  const

Returns TRUE if the field is connected to an engine's output.

SbBool SoField::isConnectedFromField (  )  const

Returns TRUE if the field is connected to another field.

SbBool SoField::isConnectedFromVRMLInterp (  )  const

Returns TRUE if the field is connected to a VRML interpOutput.

SbBool SoField::isConnectionEnabled (  )  const [inline]

Returns FALSE if connections to this field are disabled.

Note that this may return FALSE even if the field is not connected to anything.

SbBool SoField::isDefault (  )  const [inline]

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.

SbBool SoField::isIgnored (  )  const [inline]

Gets the ignore flag for this field.

int SoField::operator!= ( const SoField f  )  const [inline]

Return FALSE if this field is of the same type and has the same value as f.

Reimplemented in SoMFDataMeasure, SoMFKernel2i32, SoMFKernel3i32, SoSFKernel2i32, SoSFKernel3i32, SoSFStructuredQuadrilateralMesh, SoMFBool, SoMFBufferObject, SoMFColor, SoMFColorRGBA, SoMFDouble, SoMFEngine, SoMFEnum, SoMFFieldContainer, SoMFFloat, SoMFInstanceParameter, SoMFInt32, SoMFInt64, SoMFMatrix, SoMFName, SoMFNode, SoMFPath, SoMFPlane, SoMFRotation, SoMFShort, SoMFString, SoMFTime, SoMFUByte, SoMFUInt32, SoMFUniformShaderParameter, SoMFUShort, SoMFVec2d, SoMFVec2f, SoMFVec2i32, SoMFVec2s, SoMFVec2String, SoMFVec3d, SoMFVec3f, SoMFVec3i32, SoMFVec3s, SoMFVec4b, SoMFVec4f, SoMFVec4i32, SoMFVec4s, SoMFVec4ub, SoMFVec4ui32, SoMFVec4us, SoSFArray, SoSFBool, SoSFBox2f, SoSFBox3f, SoSFBox3i32, SoSFBox3s, SoSFBox4i32, SoSFBufferObject, SoSFColor, SoSFColorRGBA, SoSFDouble, SoSFEngine, SoSFEnum, SoSFFieldContainer, SoSFFloat, SoSFImage, SoSFImage3, SoSFInt32, SoSFInt64, SoSFMatrix, SoSFMemObj, SoSFName, SoSFNode, SoSFPath, SoSFPlane, SoSFRotation, SoSFShort, SoSFString, SoSFTime, SoSFTrigger, SoSFUByte, SoSFUInt32, SoSFUShort, SoSFVec2d, SoSFVec2f, SoSFVec2i32, SoSFVec2s, SoSFVec3d, SoSFVec3f, SoSFVec3i32, SoSFVec4f, SoSFVec4i32, PoSFCartesianGrid2D, PoSFCartesianGrid3D, PoSFHexahedronMesh3D, PoSFIndexedMesh2D, PoSFIndexedMesh3D, PoSFIrregularMesh1D, PoSFParalCartesianGrid2D, PoSFParalCartesianGrid3D, PoSFPolarGrid2D, PoSFQuadrangleMesh2D, PoSFRegularCartesianGrid2D, PoSFRegularCartesianGrid3D, PoSFRegularMesh1D, PoSFTetrahedronMesh3D, and PoSFTriangleMesh2D.

int SoField::operator== ( const SoField f  )  const [inline]

Return TRUE if this field is of the same type and has the same value as f.

Reimplemented in SoMFDataMeasure, SoMFKernel2i32, SoMFKernel3i32, SoSFKernel2i32, SoSFKernel3i32, SoSFStructuredQuadrilateralMesh, SoMFBool, SoMFBufferObject, SoMFColor, SoMFColorRGBA, SoMFDouble, SoMFEngine, SoMFEnum, SoMFFieldContainer, SoMFFloat, SoMFInstanceParameter, SoMFInt32, SoMFInt64, SoMFMatrix, SoMFName, SoMFNode, SoMFPath, SoMFPlane, SoMFRotation, SoMFShort, SoMFString, SoMFTime, SoMFUByte, SoMFUInt32, SoMFUniformShaderParameter, SoMFUShort, SoMFVec2d, SoMFVec2f, SoMFVec2i32, SoMFVec2s, SoMFVec2String, SoMFVec3d, SoMFVec3f, SoMFVec3i32, SoMFVec3s, SoMFVec4b, SoMFVec4f, SoMFVec4i32, SoMFVec4s, SoMFVec4ub, SoMFVec4ui32, SoMFVec4us, SoSFArray, SoSFArray3D, SoSFBool, SoSFBox2f, SoSFBox3f, SoSFBox3i32, SoSFBox3s, SoSFBox4i32, SoSFBufferObject, SoSFColor, SoSFColorRGBA, SoSFDouble, SoSFEngine, SoSFEnum, SoSFFieldContainer, SoSFFloat, SoSFImage, SoSFImage3, SoSFInt32, SoSFInt64, SoSFMatrix, SoSFMemObj, SoSFName, SoSFNode, SoSFPath, SoSFPlane, SoSFRotation, SoSFShort, SoSFString, SoSFTime, SoSFTrigger, SoSFUByte, SoSFUInt32, SoSFUShort, SoSFVec2d, SoSFVec2f, SoSFVec2i32, SoSFVec2s, SoSFVec3d, SoSFVec3f, SoSFVec3i32, SoSFVec4f, SoSFVec4i32, PoSFCartesianGrid2D, PoSFCartesianGrid3D, PoSFHexahedronMesh3D, PoSFIndexedMesh2D, PoSFIndexedMesh3D, PoSFIrregularMesh1D, PoSFParalCartesianGrid2D, PoSFParalCartesianGrid3D, PoSFPolarGrid2D, PoSFQuadrangleMesh2D, PoSFRegularCartesianGrid2D, PoSFRegularCartesianGrid3D, PoSFRegularMesh1D, PoSFTetrahedronMesh3D, and PoSFTriangleMesh2D.

SbBool SoField::set ( const SbString valueString  ) 

Sets the field to the given value, which is an ASCII string in the Open 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.

SoNONUNICODE SbBool SoField::set ( const char *  valueString  ) 

Sets the field to the given value, which is an ASCII string in the Open 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.

Non Unicode List:
This function should not be used in a Unicode application.
void SoField::setIgnored ( SbBool  ig  ) 

Sets 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. This flag enables you to ignore certain fields in a node and to use others. For example, to ignore the specular color in a material node so the value is inherited from the previous material. Some fields are not inherited and are thus not affected by the Ignore flag.

Examples of fields that are not inherited are the fields of shape nodes, light-source nodes, some groups, and cameras, as well as the fields in the SoEnvironment node. If you set the Ignore flag for a field whose values are not inherited, Open Inventor simply uses the field's default values.

The default value for this flag is FALSE.

virtual void SoField::touch (  )  [virtual]

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.

Reimplemented in SoSFTrigger.


Friends And Related Function Documentation

friend class SoEngineOutput [friend]
friend class SoVRMLInterpOutput [friend]

Member Data Documentation

SoFieldAuditorInfo* SoField::auditorInfo

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 11 Nov 2019
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/