Blender V5.0
blender::animrig::Strip Class Reference

#include <ANIM_action.hh>

Inherits ActionStrip.

Public Types

enum class  Type : int8_t { Keyframe = 0 }

Public Member Functions

 Strip ()=delete
 Strip (const Strip &other)=default
Type type () const
bool is_infinite () const
bool contains_frame (float frame_time) const
bool is_last_frame (float frame_time) const
void resize (float frame_start, float frame_end)
template<typename T>
const Tdata (const Action &owning_action) const
template<typename T>
Tdata (Action &owning_action)
template<>
const StripKeyframeDatadata (const Action &owning_action) const
template<>
StripKeyframeDatadata (Action &owning_action)

Static Public Member Functions

static Stripcreate (Action &owning_action, const Strip::Type type)

Additional Inherited Members

Public Attributes inherited from ActionStrip
int8_t strip_type
uint8_t _pad0 [3]
int data_index
float frame_start
float frame_end
float frame_offset
uint8_t _pad1 [4]

Detailed Description

Strips define how the actual animation data is mapped onto the layers.

Strips do not technically own their own data, but instead refer to data that's stored in arrays directly on the action itself, and specify how that data is mapped onto a layer.

Different strips can refer to different types of data, although at the moment only one type of strip data is implemented: keyframe animation data.

Definition at line 551 of file ANIM_action.hh.

Member Enumeration Documentation

◆ Type

enum class blender::animrig::Strip::Type : int8_t
strong

The possible types of strip data.

Each enum value here corresponds to one data type. It is used to record which type of data a strip refers to in the strip's data_type field (also returned by Strip::type()). Each data type also knows which enum value it corresponds to, stored in the type's static TYPE field.

Enumerator
Keyframe 

Definition at line 561 of file ANIM_action.hh.

Constructor & Destructor Documentation

◆ Strip() [1/2]

blender::animrig::Strip::Strip ( )
delete

Referenced by create(), and Strip().

◆ Strip() [2/2]

blender::animrig::Strip::Strip ( const Strip & other)
explicitdefault

Make a shallow copy, effectively creating an instance of a strip.

Does not make a copy of the strip's data, which is stored in an array on the owning action.

References create(), Strip(), and type().

Member Function Documentation

◆ contains_frame()

bool Strip::contains_frame ( float frame_time) const

Return whether the given frame is within the strip's frame range.

Note
Strip frame ranges are inclusive on both sides.

Definition at line 1659 of file animrig/intern/action.cc.

References ActionStrip::frame_end, and ActionStrip::frame_start.

Referenced by blender::animrig::tests::TEST_F().

◆ create()

Strip & Strip::create ( Action & owning_action,
const Strip::Type type )
static

Creates a new strip of type type for owning_action, with the strip's data created on the relevant data array on owning_action.

NOTE: strongly prefer using Layer::strip_add(), which creates a strip directly on a layer and sidesteps any ambiguities about ownership.

This method does not add the strip to a layer. That is the responsibility of the caller.

The strip is heap-allocated, and the caller is responsible for ensuring that it gets freed or is given an owner (such as a layer) that will later free it.

The new strip is initialized to have infinite extent and zero time offset.

See also
Layer::strip_add()

Definition at line 1629 of file animrig/intern/action.cc.

References BLI_assert_msg, ActionStrip::data_index, DNA_struct_default_get, MEM_callocN(), Strip(), blender::animrig::Action::strip_keyframe_data_append(), ActionStrip::strip_type, and type().

Referenced by Strip().

◆ data() [1/4]

template<typename T>
T & blender::animrig::Strip::data ( Action & owning_action)

References T.

◆ data() [2/4]

◆ data() [3/4]

template<typename T>
const T & blender::animrig::Strip::data ( const Action & owning_action) const

Fetch the strip's data from its owning action.

T must correspond to the strip's data type. In other words, this must hold true: T::TYPE == strip.type().

For example, to get a keyframe strip's data:

References T.

Referenced by blender::animrig::tests::add_fcurve_to_action(), blender::animrig::legacy::channelbag_ensure(), blender::animrig::legacy::channelbag_get(), blender::animrig::versioning::convert_legacy_animato_action(), blender::animrig::convert_to_layered_action(), blender::animrig::evaluate_strip(), blender::animrig::fcurve_find_in_action(), blender::io::fbx::import_animations(), blender::animrig::insert_key_layer(), blender::animrig::tests::PoseTest::SetUp(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ data() [4/4]

◆ is_infinite()

bool Strip::is_infinite ( ) const

Return whether the strip's frame range extends from -infinity to +infinity.

Definition at line 1653 of file animrig/intern/action.cc.

References ActionStrip::frame_end, and ActionStrip::frame_start.

Referenced by blender::animrig::assert_baklava_phase_1_invariants(), and blender::animrig::tests::TEST_F().

◆ is_last_frame()

bool Strip::is_last_frame ( float frame_time) const

Return whether the end of the strip's frame range matches the given frame time.

Definition at line 1664 of file animrig/intern/action.cc.

References ActionStrip::frame_end.

Referenced by blender::animrig::tests::TEST_F().

◆ resize()

void Strip::resize ( float frame_start,
float frame_end )

Set the start and end frame.

This directly sets the start/end frames to the values given. It is up to the caller to ensure the invariants of the strip itself and of the layer it belongs to.

frame_start must be less than or equal to frame_end. Infinite values (negative for frame_start, positive for frame_end) are supported.

Definition at line 1671 of file animrig/intern/action.cc.

References BLI_assert, BLI_assert_msg, ActionStrip::frame_end, and ActionStrip::frame_start.

Referenced by blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), blender::animrig::tests::TEST_F(), and blender::animrig::tests::TEST_F().

◆ type()

Strip type.

Convenience wrapper to avoid having to do the cast from int to Strip::Type everywhere.

Definition at line 601 of file ANIM_action.hh.

References ActionStrip::strip_type.

Referenced by blender::animrig::assert_baklava_phase_1_invariants(), create(), data(), data(), blender::animrig::evaluate_strip(), Strip(), and blender::animrig::tests::TEST_F().


The documentation for this class was generated from the following files: