Rumba C++ SDK
maquina::AnimCurveFloat Class Reference

An animation curve for floating point values. That type of curves contains tangents. More...

#include <AnimCurve.h>

Inheritance diagram for maquina::AnimCurveFloat:
maquina::AnimCurve maquina::Value

Classes

class  Iterator
 
class  Key
 An anim curve key. More...
 
class  Keys
 A key iteration. More...
 

Public Types

enum  CycleMode { CycleMode::constant =0, CycleMode::repeat, CycleMode::repeat_continuous, CycleMode::linear }
 

Public Member Functions

 AnimCurveFloat ()
 Create an empty curve. More...
 
 AnimCurveFloat (const Value &v)
 Cast a Value object in curve. More...
 
 AnimCurveFloat (const std::vector< Key > &keys, bool repeat)
 Create a curve using keys. More...
 
size_t size () const
 Return the number of keys. More...
 
const Key operator[] (size_t n) const
 Return the n-th key. More...
 
Iterator begin (bool only_selected=false)
 Begin iterator on keyframes. More...
 
Iterator end ()
 End iterator on keyframes. More...
 
Keys keys (bool only_selected=false)
 Return an iteration on the keys. More...
 
void set_key (size_t n, const Key &key)
 Set the n-th key. More...
 
size_t set_key (const Key &key)
 Add the key or replace the exisiting one at the same frame. More...
 
size_t insert_key (const Key &key, bool before=true)
 Insert a key and return its index. More...
 
void remove_key (size_t i)
 Remove the i-th key. More...
 
Value interpolate (float t, CycleMode left_mode=CycleMode::constant, CycleMode right_mode=CycleMode::constant) const
 Interpolate a value from the curve. More...
 
void normalize (bool repeat)
 Normalize the curve once it has been modified to re-apply the tangents modes. More...
 
- Public Member Functions inherited from maquina::AnimCurve
 AnimCurve (const Value &v)
 Cast a Value object in AnimCurve. More...
 
 AnimCurve (const char *key_type)
 Create an empty animation curve where the key value is of type key_type. More...
 
AnimCurve create_empty () const
 Return an empty curve of the same type than this. More...
 
size_t size () const
 Returns the number of keys. More...
 
AnimCurve copy_keys (const gsl::span< const int > &keys) const
 Duplicate a subset of the curve. More...
 
std::vector< int > selected_keys () const
 Return a vector of the selected key indices. More...
 
int key_index (float t) const
 Returns the key at t time or -1 if no such key. More...
 
int previous_key (float t) const
 Returns the key with the biggest but strictly lower than t time or -1 if no such key. More...
 
int next_key (float t) const
 Returns the key with the lowest but strictly higher than t time or -1 if no such key. More...
 
size_t set_value (float frame, const maquina::Value &value=Value::default_value)
 Add a key or replace the existing key at the same frame. More...
 
size_t insert_value (float frame, const maquina::Value &value=Value::default_value, bool before=true)
 
void remove_key (size_t i)
 Remove the i-th key. More...
 
const Key operator[] (size_t i) const
 Get a key. More...
 
Value interpolate (float t, CycleMode pre_cycle_mode, CycleMode post_cycle_mode) const
 This method is used by the curve editor to get a Y value. More...
 
void normalize (bool repeat)
 Normalize the curve once it has been modified to re-apply the tangents modes. More...
 
Iterator begin (bool only_selected=false)
 Begin iterator on keyframes. More...
 
Iterator end ()
 End iterator on keyframes. More...
 
Keys keys (bool only_selected=false)
 Return an iteration on the keys. More...
 
std::optional< Valueclip (float frame_in, float frame_out)
 Clip the curve in the frame range [frame_in, frame_out]. More...
 
Value time_wrap (const gsl::span< const WrapSlice > &wrap_slices, CycleMode pre_cycle_mode, CycleMode post_cycle_mode) const
 Return a copy of the curve 'time wrapped' using the wrap slices. Each slice is taken from the original curve and concatenated into a new curve. Custom keyframes are inserted to ensure accuracy. More...
 
- Public Member Functions inherited from maquina::Value
 Value ()
 
Value duplicate () const
 Duplicate the value. More...
 
bool as_bool () const
 Returns the value as a bool. More...
 
int as_int () const
 Returns the value as an integer. More...
 
float as_float () const
 Returns the value as a float. More...
 
double as_double () const
 Returns the value as a double. More...
 
const std::string & as_string () const
 Returns the value as a string. More...
 
std::wstring as_wstring () const
 Returns the value as a wstring. More...
 
Imath::V2f as_V2f () const
 Returns the value as a V2f. More...
 
Imath::V3f as_V3f () const
 Returns the value as a V3f. More...
 
Imath::V4f as_V4f () const
 Returns the value as a V4f. More...
 
const Imath::V2das_V2d () const
 Returns the value as a V2d. More...
 
const Imath::V3das_V3d () const
 Returns the value as a V3d. More...
 
const Imath::V4das_V4d () const
 Returns the value as a V4d. More...
 
const Imath::V2ias_V2i () const
 Returns the value as a V2i. More...
 
const Imath::V3ias_V3i () const
 Returns the value as a V3i. More...
 
const Imath::V4ias_V4i () const
 Returns the value as a V4i. More...
 
Imath::M44f as_M44f () const
 Returns the value as a M44f. More...
 
const Imath::M44das_M44d () const
 Returns the value as a M44d. More...
 
const Imath::Box3fas_Box3f () const
 Returns the value as a Box3f. More...
 
const Imath::Color4fas_Color4f () const
 Returns the value as a Color4f. More...
 
Imath::Quatf as_Quatf () const
 Returns the value as a Quatf. More...
 
const Imath::Quatdas_Quatd () const
 Returns the value as a Quatd. More...
 
std::shared_ptr< const UserDataas_user_data () const
 Returns the value as a user data. More...
 
StringView type_name () const
 Return the type name of the Value. More...
 
bool has_node_delegate () const
 Check if this value can produces a NodeDelegate. More...
 
std::shared_ptr< NodeDelegatenode_delegate (const std::shared_ptr< NodeDelegate > &parent, const StringView &name) const
 
bool operator== (const Value &o) const
 Compare the two values. More...
 
bool operator!= (const Value &o) const
 
bool is_instance (const char *value_type_name) const
 Check if this type derives from another value type. More...
 
bool is_interpolable () const
 Checks if the value is interpolable. More...
 
Value lerp (const Value &other, double weight) const
 Performs linear interpolation between this value and another value. More...
 
 Value (bool)
 Create a boolean value. More...
 
 Value (int)
 Create an integer value. More...
 
 Value (float)
 Create a float value. More...
 
 Value (double)
 Create a double value. More...
 
 Value (const char *string)
 Create a string value. More...
 
 Value (const wchar_t *string)
 Create a string value. More...
 
 Value (const std::string &string)
 Create a string value. More...
 
 Value (const std::wstring &string)
 Create a wide string value. More...
 
 Value (const Imath::V2f &)
 Create a Imath::V2f value. More...
 
 Value (const Imath::V3f &)
 Create a Imath::V3f value. More...
 
 Value (const Imath::V4f &)
 Create a Imath::V4f value. More...
 
 Value (const Imath::V2d &)
 Create a Imath::V2d value. More...
 
 Value (const Imath::V3d &)
 Create a Imath::V3d value. More...
 
 Value (const Imath::V4d &)
 Create a Imath::V4d value. More...
 
 Value (const Imath::V2i &)
 Create a Imath::V2i value. More...
 
 Value (const Imath::V3i &)
 Create a Imath::V3i value. More...
 
 Value (const Imath::V4i &)
 Create a Imath::V4i value. More...
 
 Value (const Imath::Color4f &)
 Create a Imath::Color4f value. More...
 
 Value (const Imath::M44f &)
 Create a Imath::M44f value. More...
 
 Value (const Imath::M44d &)
 Create a Imath::M44d value. More...
 
 Value (const Imath::Box3f &)
 Create a Imath::Box3f value. More...
 
 Value (const Imath::Quatf &)
 Create a Imath::Quatf value. More...
 
 Value (const Imath::Quatd &)
 Create a Imath::Quatd value. More...
 
 Value (const std::shared_ptr< const UserData > &user_data)
 Create a user data value. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from maquina::Value
static bool validate_type_name (const char *type_name)
 Return true if the name is a valid type name. More...
 
static Value get_default_value (const char *type_name)
 Return a default value for a given type. More...
 
- Static Public Attributes inherited from maquina::Value
static const Value default_value
 The default value. More...
 

Detailed Description

An animation curve for floating point values. That type of curves contains tangents.

Once a curve is modified, it has to be normalized by a call to AnimCurveFloat::normalize() or Channel::set_animation_curve().

Member Enumeration Documentation

◆ CycleMode

Enumerator
constant 
repeat 
repeat_continuous 
linear 

Constructor & Destructor Documentation

◆ AnimCurveFloat() [1/3]

maquina::AnimCurveFloat::AnimCurveFloat ( )

Create an empty curve.

◆ AnimCurveFloat() [2/3]

maquina::AnimCurveFloat::AnimCurveFloat ( const Value v)

Cast a Value object in curve.

If v has not the good type, a default value is constructed.

◆ AnimCurveFloat() [3/3]

maquina::AnimCurveFloat::AnimCurveFloat ( const std::vector< Key > &  keys,
bool  repeat 
)

Create a curve using keys.

Member Function Documentation

◆ begin()

Iterator maquina::AnimCurveFloat::begin ( bool  only_selected = false)
inline

Begin iterator on keyframes.

◆ end()

Iterator maquina::AnimCurveFloat::end ( )
inline

End iterator on keyframes.

◆ insert_key()

size_t maquina::AnimCurveFloat::insert_key ( const Key key,
bool  before = true 
)

Insert a key and return its index.

If the key is at the same time than another key, the key is inserted BEFORE the previous keys if before is true, AFTER if before is false. Return the index of the inserted key

◆ interpolate()

Value maquina::AnimCurveFloat::interpolate ( float  t,
CycleMode  left_mode = CycleMode::constant,
CycleMode  right_mode = CycleMode::constant 
) const

Interpolate a value from the curve.

◆ keys()

Keys maquina::AnimCurveFloat::keys ( bool  only_selected = false)
inline

Return an iteration on the keys.

Parameters
only_selectedIf true, iterate only on the keyframes selected in the curve editor

◆ normalize()

void maquina::AnimCurveFloat::normalize ( bool  repeat)

Normalize the curve once it has been modified to re-apply the tangents modes.

If the curve is set using Channel::set_animation_curve(), no need to normalize it, the method does the job.

◆ operator[]()

const Key maquina::AnimCurveFloat::operator[] ( size_t  n) const

Return the n-th key.

◆ remove_key()

void maquina::AnimCurveFloat::remove_key ( size_t  i)

Remove the i-th key.

◆ set_key() [1/2]

void maquina::AnimCurveFloat::set_key ( size_t  n,
const Key key 
)

Set the n-th key.

◆ set_key() [2/2]

size_t maquina::AnimCurveFloat::set_key ( const Key key)

Add the key or replace the exisiting one at the same frame.

Return the index of the new/modified key

◆ size()

size_t maquina::AnimCurveFloat::size ( ) const

Return the number of keys.


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