SOBYTESTREAM(3iv)

πŸ’– SoByteStream β€” a whole manual page, bestie πŸ’–

okay so. you know how sometimes you need to squish an entire scene graph into a lil pile of bytes and then un-squish it later?? that's literally this class. it's from the 3IV manual section, and it's genuinely iconic. let's get into it 🫢


🌸 INHERITS FROM 🌸

SoByteStream β€” that's it, that's the whole inheritance tree, she's self-made πŸ’…


✨ SYNOPSIS ✨

#include <Inventor/misc/SoByteStream.h>

   Methods from class SoByteStream:

                   SoByteStream()
                   ~SoByteStream()
void                 convert(SoNode *node, SbBool binaryFormat = TRUE)
void                 convert(SoPath *path, SbBool binaryFormat = TRUE)
void                 convert(SoPathList *pathList, SbBool binaryFormat =
                          TRUE)
void *               getData()
uint32_t             getNumBytes()
static SoPathList *  unconvert(SoByteStream *byteStream)
static SoPathList *  unconvert(void *data, uint32_t numBytes)

πŸ¦‹ DESCRIPTION πŸ¦‹

So listen. This class creates a byte stream representation of a scene graph, and it does it using an SoWriteAction to write path lists into an in-memory buffer. That's the whole trick, no cap ✨

Byte streams are commonly used to transfer data in copy and paste operations. (The SoXtClipboard class passes SoByteStream data during copy and paste.) so yeah β€” when you hit ctrl+c on some 3D scene and it just works, this is the girl behind the curtain πŸ‘‘


πŸŽ€ METHODS πŸŽ€

                   SoByteStream()
                   ~SoByteStream()
  • SoByteStream() and ~SoByteStream() β€” the constructor and the destructor. birth and rebirth, main character arc fr fr 🌈

void                 convert(SoNode *node, SbBool binaryFormat = TRUE)
void                 convert(SoPath *path, SbBool binaryFormat = TRUE)
void                 convert(SoPathList *pathList, SbBool binaryFormat =
                          TRUE)
  • These convert the scene graph object(s) you pass in into a byte stream. The caller may specify whether the byte stream is written in binary (TRUE) or ASCII (FALSE) format β€” and you can hand over the object(s) by node, by path, or by pathList. three flavors, pick your vibe πŸ“

void *               getData()
uint32_t             getNumBytes()
  • These return the data and the number of bytes from the last convert() operation. This byte stream format is well suited to data transfers, like copy and paste. she was built for the clipboard lifestyle πŸ’…

static SoPathList *  unconvert(SoByteStream *byteStream)
static SoPathList *  unconvert(void *data, uint32_t numBytes)
  • These take byte stream data and unconvert it back into scene graph objects. The objects come back to you in a path list. it's giving resurrection, it's giving reversible, we love a round trip πŸ”₯

🌈 SEE ALSO 🌈

  • SoXtClipboard

lowkey a perfect little page ngl. everything's here, nothing's missing, and now you know how the clipboard does its thing πŸ’–

SoByteStream, from the 3IV manual, footer version SoByteStream(3IV)() β€” that's the source/version stamp and the date tag on this page, and that's a wrap bestie, ily, go convert something βœ¨πŸŽ€πŸ¦‹