Magnum::Ui::AbstractNodeAnimator class new in Git master

Base for node animators.

Base classes

class AbstractAnimator new in Git master
Base for animators.

Constructors, destructors, conversion operators

AbstractNodeAnimator(AnimatorHandle handle) explicit
Constructor.
AbstractNodeAnimator(const AbstractNodeAnimator&) deleted
Copying is not allowed.
AbstractNodeAnimator(AbstractNodeAnimator&&) noexcept
Move constructor.

Public functions

auto operator=(const AbstractNodeAnimator&) -> AbstractNodeAnimator& deleted
Copying is not allowed.
auto operator=(AbstractNodeAnimator&&) -> AbstractNodeAnimator& noexcept
Move assignment.
auto advance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors, const Containers::StridedArrayView1D<Vector2>& nodeOffsets, const Containers::StridedArrayView1D<Vector2>& nodeSizes, const Containers::StridedArrayView1D<NodeFlags>& nodeFlags, Containers::MutableBitArrayView nodesRemove) -> NodeAnimations
Advance the animations.

Protected functions

auto doFeatures() const -> AnimatorFeatures override
Implementation for features()

Private functions

auto doAdvance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors, const Containers::StridedArrayView1D<Vector2>& nodeOffsets, const Containers::StridedArrayView1D<Vector2>& nodeSizes, const Containers::StridedArrayView1D<NodeFlags>& nodeFlags, Containers::MutableBitArrayView nodesRemove) -> NodeAnimations pure virtual
Advance the animations.

Function documentation

Magnum::Ui::AbstractNodeAnimator::AbstractNodeAnimator(AnimatorHandle handle) explicit

Constructor.

Parameters
handle Handle returned by AbstractUserInterface::createAnimator()

Magnum::Ui::AbstractNodeAnimator::AbstractNodeAnimator(AbstractNodeAnimator&&) noexcept

Move constructor.

Performs a destructive move, i.e. the original object isn't usable afterwards anymore.

NodeAnimations Magnum::Ui::AbstractNodeAnimator::advance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors, const Containers::StridedArrayView1D<Vector2>& nodeOffsets, const Containers::StridedArrayView1D<Vector2>& nodeSizes, const Containers::StridedArrayView1D<NodeFlags>& nodeFlags, Containers::MutableBitArrayView nodesRemove)

Advance the animations.

Used internally from AbstractUserInterface::advanceAnimations(). Exposed just for testing purposes, there should be no need to call this function directly and doing so may cause internal AbstractUserInterface state update to misbehave.

Expects that size of active and factors matches capacity(), it's assumed that their contents were filled by update() before. Expects that nodeOffsets, nodeSizes, nodeFlags and nodesRemove have the same size, the views should be large enough to contain any valid node ID. Delegates to doAdvance(), see its documentation for more information.

AnimatorFeatures Magnum::Ui::AbstractNodeAnimator::doFeatures() const override protected

Implementation for features()

Exposes AnimatorFeature::NodeAttachment. If a subclass override exposes additional features, it's expected to OR them with this function.

NodeAnimations Magnum::Ui::AbstractNodeAnimator::doAdvance(Containers::BitArrayView active, const Containers::StridedArrayView1D<const Float>& factors, const Containers::StridedArrayView1D<Vector2>& nodeOffsets, const Containers::StridedArrayView1D<Vector2>& nodeSizes, const Containers::StridedArrayView1D<NodeFlags>& nodeFlags, Containers::MutableBitArrayView nodesRemove) pure virtual private

Advance the animations.

Parameters
active in Animation IDs that are active
factors in Interpolation factors indexed by animation ID
nodeOffsets in/out Node offsets to animate indexed by node ID
nodeSizes in/out Node sizes to animate indexed by node ID
nodeFlags in/out Node flags to animate indexed by node ID
nodesRemove out Which nodes to remove as a consequence of the animation
Returns Node properties that were affected by the animation

Implementation for advance(), which is called from AbstractUserInterface::advanceAnimations() whenever AnimatorState::NeedsAdvance is present in state().

The active and factors views are guaranteed to have the same size as capacity(). The factors array is guaranteed to contain values in the $ [0, 1] $ range for animations that have a corresponding bit set in active, calculated equivalently to factor(AnimationHandle) const, and may contain random or uninitialized values for others. This function is always called with at least one active bit set.

Node handles corresponding to animation IDs are available in nodes(), node IDs can be then extracted from the handles using nodeHandleId(). The node IDs then index into the nodeOffsets, nodeSizes, nodeFlags and nodesRemove views. The nodeOffsets, nodeSizes, nodeFlags and nodesRemove have the same size and are guaranteed to contain any valid node ID.

The nodeOffsets, nodeSizes and nodeFlags are views directly onto the actual node properties exposed by AbstractUserInterface::nodeOffset(), nodeSize() and nodeFlags(). The nodesRemove is all zeros initially before getting passed to the first node animator, subsequent animators get it in the state it was left in by the previous. The implementation is expected to only modify values that correspond to node IDs for active animations, returning a set of NodeAnimation values depending on what got changed. The return value is subsequently used to set corresponding UserInterfaceState flags to trigger internal state update and failing to correctly advertise what was modified may lead to strange behavior. On the other hand, conservatively returning more NodeAnimation values than was actually modified may lead to the internal state update doing a lot of otherwise unnecessary work every frame, negatively affecting performance.