Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
Override Flag (Advanced)

Every node has an Override flag associated with it. The Override flag is a powerful mechanism typically used (sparingly) near the top of a scene graph. When this flag is set, any nodes of the same type encountered later in the graph are ignored even if they also have their Override flag set. For example, you might insert a line-style SoDrawStyle node at the top of a graph to ensure that the whole scene is drawn as wireframe objects, regardless of drawing styles specified lower in the scene graph. Use the setOverride() method to set and reset the Override flag. The isOverride() method returns the state of the Override flag.

For example:

C++ :

// This function toggles the given draw-style node between
// overriding any other draw-style nodes below it in the scene
// graph, and not having any effect at all on the scene graph.
//
void
toggleWireframe( SoDrawStyle* myDrawStyle )
{
if ( myDrawStyle->isOverride() )
{
myDrawStyle->style.setIgnored( TRUE );
myDrawStyle->setOverride( FALSE );
}
else
{
myDrawStyle->style = SoDrawStyle::LINES;
myDrawStyle->style.setIgnored( FALSE );
myDrawStyle->setOverride( TRUE );
}
}

C# :

// This function toggles the given draw-style node between
// overriding any other draw-style nodes below it in the scene
// graph, and not having any effect at all on the scene graph.
//
void
toggleWireframe( SoDrawStyle myDrawStyle )
{
if ( myDrawStyle.IsOverride() )
{
myDrawStyle.style.SetIgnored( true );
myDrawStyle.SetOverride( false );
}
else
{
myDrawStyle.style.Value = SoDrawStyle.Styles.LINES;
myDrawStyle.style.SetIgnored( false );
myDrawStyle.SetOverride( true );
}

Java :

// This function toggles the given draw-style node between
// overriding any other draw-style nodes below it in the scene
// graph, and not having any effect at all on the scene graph.
//
void
toggleWireframe( SoDrawStyle myDrawStyle )
{
if ( myDrawStyle.isOverride() )
{
myDrawStyle.style.setIgnored( true );
myDrawStyle.setOverride( false );
}
else
{
myDrawStyle.style.setValue( SoDrawStyle.Styles.LINES );
myDrawStyle.style.setIgnored( false );
myDrawStyle.setOverride( true );
}
}

Normally, the Override flag is not used within a scene graph for modeling. Use it in applications where you need to specify a temporary change to the whole graph.

The Override flag is not written to a file (see Importing data).

Setting the Override flag on a node whose field values are not inherited (for example, on a sphere with a radius of 7) has no effect on other nodes in the graph of that type.