SOONESHOT(3iv)

✨ SoOneShot ✨

okay bestie, so this one is from the SoOneShot(3IV) manual and it's literally a timer that runs for a pre-set amount of time and then, like, stops. no cap. πŸ’–


🌸 INHERITS FROM

SoBase > SoFieldContainer > SoEngine > SoOneShot

she comes from a long line of iconic ancestors, we love a lineage πŸ‘‘


πŸŽ€ SYNOPSIS

#include <Inventor/engines/SoOneShot.h>
enum Flags {
     SoOneShot::RETRIGGERABLE  Can start over during the cycle
     SoOneShot::HOLD_FINAL     Output values stay high after cycle
}

Inputs from class SoOneShot:

SoSFTime            timeIn
SoSFTime            duration
SoSFTrigger         trigger
SoSFBitMask         flags
SoSFBool            disable

Outputs from class SoOneShot:

(SoSFTime)          timeOut
(SoSFBool)          isActive
(SoSFFloat)         ramp

Methods from class SoOneShot:

                    SoOneShot()

Methods from class SoEngine:

static SoType       getClassTypeId()
virtual int         getOutputs(SoEngineOutputList &list) const
SoEngineOutput *    getOutput(const SbName &outputName) const
SbBool              getOutputName(const SoEngineOutput *output, SbName &outputName) const
SoEngine *          copy() const
static SoEngine *   getByName(const SbName &name)
static int          getByName(const SbName &name, SoEngineList &list)

Methods from class SoFieldContainer:

void                setToDefaults()
SbBool              hasDefaultValues() const
SbBool              fieldsAreEqual(const SoFieldContainer *fc) const
void                copyFieldValues(const SoFieldContainer *fc, SbBool copyConnections = FALSE)
SbBool              set(const char *fieldDataString)
void                get(SbString &fieldDataString)
virtual int         getFields(SoFieldList &resultList) const
virtual SoField *   getField(const SbName &fieldName) const
SbBool              getFieldName(const SoField *field, SbName &fieldName) const
SbBool              isNotifyEnabled() const
SbBool              enableNotify(SbBool flag)

Methods from class SoBase:

void                ref()
void                unref() const
void                unrefNoDelete() const
void                touch()
virtual SoType      getTypeId() const
SbBool              isOfType(SoType type) const
virtual void        setName(const SbName &name)
virtual SbName      getName() const

πŸ’… DESCRIPTION

okay so this engine is a timer that runs for a pre-set amount of time and then stops, periodt. by default the timeIn input is connected to the realTime global field β€” iconic default behaviour honestly. but lowkey you can hook it up to any other time source you want. πŸ•°οΈ

the timer starts when the trigger input gets touched. then it runs for the specified duration and updates the timeOut output with the time that has elapsed. during that time the ramp output is also getting updated. and the ramp output? it starts at 0.0 at the beginning of the cycle and linearly increases until it reaches 1.0 at the end of the cycle. it's giving very linear, very demure πŸ“ˆ

you can disable the timer by setting the disable input to TRUE. while the timer is disabled the output value remains 0.0. and heads up β€” if the timer gets disabled in the middle of a cycle, the output values will be set to 0.0. just like that. gone. πŸ’€

the flags input holds the control flags. using the flags you can set the timer to be retriggerable in the middle of a cycle, and set the output values to stay high after the cycle has been completed. by default these flags are not set. 🚩


⭐ INPUTS

  • SoSFTime timeIn β€” running time. the clock, the vibe, the whole timeline bestie ⏳
  • SoSFTime duration β€” duration of the active cycle. how long the whole thing goes for.
  • SoSFTrigger trigger β€” start the cycle. important: the trigger will be ignored if it is touched in the middle of a cycle and the RETRIGGERABLE flag is not set. so don't come for her mid-cycle unless you set the flag, iykyk πŸ™ˆ
  • SoSFBitMask flags β€” control flags. the little switches that change the whole personality.
  • SoSFBool disable β€” if TRUE, the timer is disabled. naptime fr 😴

πŸ”₯ OUTPUTS

  • (SoSFTime) timeOut β€” elapsed time from the start.
  • (SoSFBool) isActive β€” is TRUE during the active cycle. main character energy while it's running πŸ‘‘
  • (SoSFFloat) ramp β€” ramps linearly from 0.0 to 1.0. the glow-up arc, literally.

πŸ¦‹ METHODS

  • SoOneShot() β€” constructor. hey bestie, you made one ✨

🌈 FILE FORMAT/DEFAULTS

OneShot {
    duration  1
    trigger
    flags     ()
    disable   FALSE
    timeIn    <current time>
}

look at those defaults, so clean, so untouched, we love to see it πŸŽ€


πŸ’œ SEE ALSO

SoElapsedTime, SoEngineOutput


no cap: if something's retriggerable, the trigger has to actually be allowed to fire mid-cycle. otherwise it's ignored. don't @ me, that's just the rules πŸ™

and that's the whole page babes πŸ’– this was the SoOneShot(3IV) manual β€” source/version SoOneShot(3IV)(), no date on it because she's timeless like that πŸ’… slay, go build your timers, ily, bye 🫢🌸