Inviwo 0.9.12-pre
Inviwo documentation
|
#include <animation.h>
Public Types | |
using | iterator = util::IndirectIterator<typename std::vector<std::unique_ptr<Track>>::iterator> |
using | const_iterator |
Public Member Functions | |
Animation (AnimationManager *animationManager=nullptr, std::string_view name="Animation") | |
Animation (const Animation &) | |
Animation (Animation &&)=default | |
Animation & | operator= (const Animation &that) |
Animation & | operator= (Animation &&that)=default |
AnimationTimeState | operator() (Seconds from, Seconds to, AnimationState state) const |
bool | empty () const |
size_t | size () const |
Track & | operator[] (size_t i) |
const Track & | operator[] (size_t i) const |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
void | add (std::unique_ptr< Track > track) |
BasePropertyTrack * | add (Property *property) |
Keyframe * | addKeyframe (Property *property, Seconds time) |
KeyframeSequence * | addKeyframeSequence (Property *property, Seconds time) |
std::unique_ptr< Track > | remove (size_t i) |
std::unique_ptr< Track > | remove (Track *track) |
std::unique_ptr< Keyframe > | remove (Keyframe *key) |
std::unique_ptr< KeyframeSequence > | remove (KeyframeSequence *seq) |
iterator | findTrack (Property *withMe) |
void | clear () |
std::vector< Seconds > | getAllTimes () const |
Seconds | getFirstTime () const |
Seconds | getLastTime () const |
const std::string & | getName () const |
void | setName (std::string_view name) |
virtual void | serialize (Serializer &s) const override |
virtual void | deserialize (Deserializer &d) override |
virtual void | onWillRemoveProperty (Property *property, size_t index) override |
Public Member Functions inherited from inviwo::Observable< AnimationObserver > | |
Observable (const Observable< AnimationObserver > &other) | |
Observable (Observable< AnimationObserver > &&other) noexcept | |
Observable< AnimationObserver > & | operator= (const Observable< AnimationObserver > &other) |
Observable< AnimationObserver > & | operator= (Observable< AnimationObserver > &&other) noexcept |
void | addObserver (AnimationObserver *observer) |
void | removeObserver (AnimationObserver *observer) |
virtual void | startBlockingNotifications () override final |
virtual void | stopBlockingNotifications () override final |
Public Member Functions inherited from inviwo::ObservableInterface | |
Public Member Functions inherited from inviwo::Serializable | |
Public Member Functions inherited from inviwo::animation::TrackObserver | |
virtual void | onKeyframeSequenceAdded (Track *, KeyframeSequence *) |
virtual void | onKeyframeSequenceRemoved (Track *, KeyframeSequence *) |
virtual void | onEnabledChanged (Track *) |
virtual void | onNameChanged (Track *) |
Public Member Functions inherited from inviwo::Observer | |
Observer (const Observer &other) | |
Observer (Observer &&other) | |
Observer & | operator= (Observer &&other) |
Observer & | operator= (const Observer &other) |
virtual | ~Observer () |
void | removeObservation (ObservableInterface *observable) |
void | removeObservations () |
Public Member Functions inherited from inviwo::PropertyOwnerObserver | |
virtual void | onWillAddProperty (PropertyOwner *owner, Property *property, size_t index) |
virtual void | onDidAddProperty (Property *property, size_t index) |
virtual void | onDidRemoveProperty (PropertyOwner *owner, Property *property, size_t index) |
Additional Inherited Members | |
Public Attributes inherited from inviwo::PropertyOwnerObserver | |
friend | PropertyOwnerObservable |
Protected Member Functions inherited from inviwo::animation::AnimationObservable | |
void | notifyTrackAdded (Track *track) |
void | notifyTrackRemoved (Track *track) |
void | notifyFirstMoved () |
void | notifyLastMoved () |
void | notifyNameChanged (Animation *anim) |
Protected Member Functions inherited from inviwo::Observable< AnimationObserver > | |
void | forEachObserver (C callback) |
Protected Member Functions inherited from inviwo::ObservableInterface | |
void | addObservationHelper (Observer *observer) |
void | removeObservationHelper (Observer *observer) |
Protected Member Functions inherited from inviwo::Observer | |
void | addObservation (ObservableInterface *observable) |
Protected Attributes inherited from inviwo::Observer | |
std::unordered_set< ObservableInterface * > | observables_ |
Animation data structure, owns a list of tracks. Each Track usually represents a value to be animated.
inviwo::animation::Animation::Animation | ( | AnimationManager * | animationManager = nullptr, |
std::string_view | name = "Animation" ) |
Creates an empty Animation. AnimationManager is required only for the Property-based adding convenience functions: add(Property* property) addKeyframe(Property* property, Seconds time) addKeyframeSequence(Property* property, Seconds time) Trying to use these functions with an invalid AnimationManager will throw Exceptions.
animationManager | used for creating PropertyTrack/KeyframeSequence/Keyframe. |
name | default Animation |
BasePropertyTrack * inviwo::animation::Animation::add | ( | Property * | property | ) |
Adds a PropertyTrack, or returns an existing it has one for the property. The added PropertyTrack will be removed if the property is removed.
Exception | if no AnimationManager has been supplied. |
Add keyframe at specified time. Creates a new track if no track with the supplied property exists. The PropertyTrack will be removed if the property is removed.
Exception | if no AnimationManager has been supplied. |
KeyframeSequence * inviwo::animation::Animation::addKeyframeSequence | ( | Property * | property, |
Seconds | time ) |
Add sequence at specified time. Creates a new track if no track with the supplied property exists. The PropertyTrack will be removed if the property is removed.
Exception | if no AnimationManager has been supplied. |
void inviwo::animation::Animation::clear | ( | ) |
Remove all tracks. Calls TrackObserver::notifyTrackRemoved for each removed track.
|
overridevirtual |
Implements inviwo::Serializable.
Find PropertyTrack containing the property.
std::vector< Seconds > inviwo::animation::Animation::getAllTimes | ( | ) | const |
Return a sorted list, in ascending order, of all Keyframe times existing in the animation.
Seconds inviwo::animation::Animation::getFirstTime | ( | ) | const |
Return time of first Keyframe in all tracks, or 0 if no track exist.
Seconds inviwo::animation::Animation::getLastTime | ( | ) | const |
Return time of last Keyframe in all tracks, or 0 if no track exist.
const std::string & inviwo::animation::Animation::getName | ( | ) | const |
Return the name of the Animation. Used for display in the GUI.
|
overridevirtual |
Reimplemented from inviwo::PropertyOwnerObserver.
Remove Keyframe if matching any of the Keyframes in the tracks. Calls TrackObserver::notifyKeyframeRemoved after removing Keyframe. Removes the KeyFrameSequence owning the Keyframe if it does not contain any Keyframe after removal, thereby calling KeyFrameSequenceObserver::notifyKeyframeSequenceRemoved Does nothing if no match was found.
std::unique_ptr< KeyframeSequence > inviwo::animation::Animation::remove | ( | KeyframeSequence * | seq | ) |
Remove KeyframeSequence if matching any of the Sequences in the tracks. Calls KeyFrameSequenceObserver::notifyKeyframeSequenceRemoved for the sequence removed and TrackObserver::notifyKeyframeRemoved for every removed keyframe. Does nothing if no match was found.
std::unique_ptr< Track > inviwo::animation::Animation::remove | ( | size_t | i | ) |
Remove tracks at index i, indicating the order in which the track was added, not the order in which they are sorted by Track priority. No range check is done. Calls TrackObserver::notifyTrackRemoved after removing track.
|
overridevirtual |
Implements inviwo::Serializable.
void inviwo::animation::Animation::setName | ( | std::string_view | name | ) |
Set new name and notify observers if different from old name.