SoState(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

🌸 SoState 🌸

okay so bestie, welcome to the SoState(3) page from the Coin manual πŸ’– this one's all about the class that manages the Coin scene graph traversal state data. let's get into it, no cap ✨


✨ NAME ✨

SoState β€” the SoState class manages the Coin scene graph traversal state data. periodt πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <Inventor/misc/SoState.h>

πŸ’« Public Member Functions πŸ’«

SoState (SoAction *action, const SoTypeList &enabledelements)
~SoState (void)
SoAction * getAction (void) const
SoElement * getElement (const int stackindex)
const SoElement * getConstElement (const int stackindex) const
void push (void)
void pop (void)
void print (FILE *const file=stdout) const
SbBool isElementEnabled (const int stackindex) const
int getDepth (void) const
void setCacheOpen (const SbBool flag)
SbBool isCacheOpen (void) const
SoElement * getElementNoPush (const int stackindex) const

πŸ‘‘ DESCRIPTION πŸ‘‘

The SoState class manages the Coin scene graph traversal state data. like, that's its whole job, and it ate πŸ”₯

SoState is used by actions derived from the SoAction class. It manages the scene graph state as stacks of elements β€” meaning instances of classes derived from SoElement. stacks on stacks on stacks πŸ₯ž

and if you wanna go deep into the inner workings of traversal states in Coin, the docs are literally recommending a book: The Inventor Toolmaker (ISBN 0-201-62493-1), also available at SGI's online library. Search for "Toolmaker" 🫢 iykyk


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

✨ SoState::SoState (SoAction * theAction, const SoTypeList & enabledelements) ✨

The constructor πŸ’– the theAction argument is the action object the state is part of, and the enabledElements argument is an SoTypeList of the elements that are enabled for this action.

The constructor pushes a default element onto the indexes of all the enabled element stacks. important detail bestie: SoElement::push() is not called on the initial elements in the SoState stacks, but SoElement::init() is.

🌈 SoState::~SoState (void ) 🌈

The destructor. bye babe πŸ‘‹

heads up tho: when destruction happens, lagging events caused by lazy evaluation won't be performed. like they just don't show up. that's just how it is 😭

πŸ’– Member Function Documentation πŸ’–

πŸ¦‹ SoAction * SoState::getAction (void ) const πŸ¦‹

This method returns the pointer to the action instance given to the constructor. simple as that, slay ✨

πŸ’… SoElement * SoState::getElement (const int stackindex) πŸ’…

This method returns a modifiable instance of the element on the top of the stack with the given stackindex. Because of lazy programming, this function may need to do some work, so SoState::getConstElement() should be used instead whenever possible. be lazy about the lazy stuff, bestie.

🧚 const SoElement * SoState::getConstElement (const int stackIndex) const 🧚

[inline]

This method returns a pointer to the top element of the given element stack. The element is read-only and must not be changed under any circumstances or strange side-effects will occur. like, do not touch. hands off. πŸ™ˆ

also: this function will assert if the element with the given stack identity value is not presently on the state stack. To check whether or not an element is present in the stack, use SoState::isElementEnabled().

⭐ void SoState::push (void ) ⭐

This method pushes the state one level down. This saves the state so it can be changed and later restored to this state by calling SoState::pop().

The push and pop mechanism is performed lazily for efficiency reasons (avoids a lot of memory allocation and copying). Only when a state element is actually going to be changed, that element will be pushed for real. efficiency queen behavior, honestly. πŸ‘‘

πŸ“ void SoState::pop (void ) πŸ“

This method pops the state to restore it to a previous state. Pops are performed eagerly but the code is very tight so there is no reason to worry about efficiency. she's fast, don't stress it. πŸ’š

🌸 void SoState::print (FILE *const file = stdout) const 🌸

This method is just for debugging purposes. that's it, that's the whole vibe 🩷

πŸ’œ SbBool SoState::isElementEnabled (const int stackindex) const πŸ’œ

[inline]

This method returns TRUE if the element with the given element stack index is enabled, and FALSE otherwise. yes/no, iconically πŸ’…

πŸŽ€ int SoState::getDepth (void ) const πŸŽ€

This method returns the current depth of the state stack.

The depth is "virtual", not necessarily physical. iykyk, don't come for her about the physical thing.

✨ void SoState::setCacheOpen (const SbBool open) ✨

Controls whether a cache is open. πŸšͺ✨

🌈 SbBool SoState::isCacheOpen (void ) const 🌈

[inline]

Returns whether a cache is open. simple, clean, done 🫢


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for Coin from the source code. (so if the prose is a lil funky, blame the robot, not me πŸ’€)


and that's the whole page bestie, you made it to the end, so proud πŸ₯ΉπŸ’– this was Version 4.0.10, dated Thu Jun 25 2026 00:00:00, and yes this is still the SoState(3) manual page β€” now go forth and traverse that scene graph, you absolute main character πŸŒŸπŸ’…

πŸ“¦ where this page comes from