HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CL_SimpleChannel Class Reference

#include <CL_SimpleChannel.h>

Public Member Functions

 CL_SimpleChannel ()
 
 CL_SimpleChannel (fpreal start, int num_segments, fpreal length, CL_ChannelBehavior left_type, CL_ChannelBehavior right_type, fpreal default_value, fpreal default_slope)
 
 CL_SimpleChannel (fpreal start, int num_segments, fpreal length, CL_ChannelBehavior left_type, CL_ChannelBehavior right_type, fpreal default_value, fpreal default_slope, fpreal tolerance)
 
 ~CL_SimpleChannel ()=default
 
 CL_SimpleChannel (const CL_SimpleChannel &other)=default
 
 CL_SimpleChannel (CL_SimpleChannel &&other)=default
 
CL_SimpleChanneloperator= (const CL_SimpleChannel &other)=default
 
CL_SimpleChanneloperator= (CL_SimpleChannel &&other)=default
 
fpreal eval (fpreal gtime) const
 
fpreal eval (fpreal gtime, int &segment_idx_hint) const
 
fpreal eval (const CL_SimpleSegment &seg, fpreal ltime) const
 
fpreal evalSlope (const CL_SimpleSegment &seg, fpreal ltime) const
 
bool isAtHardKey (fpreal gtime) const
 
int getSegmentIdx (fpreal ltime) const
 
CL_SimpleSegmentgetSegment (int index)
 
const CL_SimpleSegmentgetSegment (int index) const
 
const UT_Array
< CL_SimpleSegment > & 
getSegments () const
 
UT_StringHolder getSegmentExpression (int index) const
 
const UT_Array< UT_StringHolder > & getSegmentExpressions () const
 
void setSegmentExpression (int index, const UT_StringHolder &expr)
 
int getSegmentInSlopeAuto (int index) const
 
int getSegmentOutSlopeAuto (int index) const
 
void setSegmentInSlopeAuto (int index, bool value)
 
void setSegmentOutSlopeAuto (int index, bool value)
 
void setSegmentInSlope (int index, fpreal slope)
 
void setSegmentOutSlope (int index, fpreal slope)
 
void setSegmentInAccel (int index, fpreal accel, bool ratio=false)
 
void setSegmentOutAccel (int index, fpreal accel, bool ratio=false)
 
void setSegmentType (int index, CL_SimpleSegmentType type)
 
CL_SimpleSegmentType getSegmentType (int index) const
 
bool insertKeyFrame (fpreal global_time, bool auto_slope=true)
 
bool destroyKeyFrame (fpreal global_time)
 
bool setKeyValue (fpreal gtime, fpreal value, CL_KeyHalf half=CL_KeyHalf::InOut)
 
bool setKeySlope (fpreal gtime, fpreal slope, CL_KeyHalf half=CL_KeyHalf::InOut)
 
bool setKeyAccel (fpreal gtime, fpreal accel, CL_KeyHalf half=CL_KeyHalf::InOut)
 
bool setKeyAutoSlope (fpreal gtime, bool auto_slope, CL_KeyHalf half=CL_KeyHalf::InOut)
 
bool setRawValues (fpreal from, fpreal to, fpreal *data, int num_samples, bool auto_slope=true)
 Sets data evenly spaced between from and to. More...
 
bool setRawValues (fpreal *times, fpreal *data, int num_samples)
 Sets data at the specified times. More...
 
void clear ()
 clears the channel, erasing all segments More...
 
void setDefaultValue (fpreal value)
 
void setPreValue (fpreal value)
 
void setPreSlope (fpreal slope)
 
void setPreType (CL_ChannelBehavior type)
 
void setPostValue (fpreal value)
 
void setPostSlope (fpreal slope)
 
void setPostType (CL_ChannelBehavior type)
 
fpreal getDefaultValue () const
 
fpreal getPreValue () const
 
fpreal getPreSlope () const
 
CL_ChannelBehavior getPreType () const
 
fpreal getPostValue () const
 
fpreal getPostSlope () const
 
CL_ChannelBehavior getPostType () const
 
fpreal getTolerance () const
 
void setTolerance (fpreal tolerance)
 
fpreal getStart () const
 
fpreal getEnd () const
 
fpreal getLength () const
 
void setStart (fpreal start)
 
int getNSegments () const
 Returns the number of segments including the end segment. More...
 
UT_Array< fprealgetKeyTimes () const
 
UT_Array< fprealgetKeyValues () const
 
bool getSurroundingSegs (fpreal gtime, CL_SimpleSegment *&left, CL_SimpleSegment *&right)
 
bool moveKeysWithDeltas (const UT_IntArray &indices, const UT_Array< fpreal > &time_offsets)
 
void smoothAutoSlopesForSegments (UT_RLEBitArray &slope_flags, bool force=false, fpreal max_delta=-1)
 
void smoothAutoSlopes (bool force=false)
 

Static Public Member Functions

static void setChannelTolerance (fpreal tol)
 
static void setDefaultSegmentType (CL_SimpleSegmentType type)
 Set the segment type used for the first key in a channel. More...
 
static void setDefaultSegmentSplitType (CL_SimpleSegmentType type)
 
static void setAutoSplit (bool onoff)
 
static fpreal getChannelTolerance ()
 
static CL_SimpleSegmentType getDefaultSegmentType ()
 
static CL_SimpleSegmentType getDefaultSegmentSplitType ()
 
static bool getAutoSplit ()
 

Detailed Description

A specialized channel for fast evaluation. Should be created from an existing CH_Channel using CH_Channel->asSimpleChannel(). Can be copied using the copy constructor. Doesn't store the in/out value/slope/accel directly. It stores precomputed bezier coefficient to avoid doing the conversion at each evaluation. Also uses UT_BezierRootFinder with precomputed coefficients to speed up CL_Cubic::reverseEvalP.

Definition at line 246 of file CL_SimpleChannel.h.

Constructor & Destructor Documentation

CL_SimpleChannel::CL_SimpleChannel ( )
CL_SimpleChannel::CL_SimpleChannel ( fpreal  start,
int  num_segments,
fpreal  length,
CL_ChannelBehavior  left_type,
CL_ChannelBehavior  right_type,
fpreal  default_value,
fpreal  default_slope 
)
CL_SimpleChannel::CL_SimpleChannel ( fpreal  start,
int  num_segments,
fpreal  length,
CL_ChannelBehavior  left_type,
CL_ChannelBehavior  right_type,
fpreal  default_value,
fpreal  default_slope,
fpreal  tolerance 
)
CL_SimpleChannel::~CL_SimpleChannel ( )
default
CL_SimpleChannel::CL_SimpleChannel ( const CL_SimpleChannel other)
default
CL_SimpleChannel::CL_SimpleChannel ( CL_SimpleChannel &&  other)
default

Member Function Documentation

void CL_SimpleChannel::clear ( )

clears the channel, erasing all segments

bool CL_SimpleChannel::destroyKeyFrame ( fpreal  global_time)

Destroy the key frame at the given global time Returns true if a key was deleted, or false if there was no key at this time

fpreal CL_SimpleChannel::eval ( fpreal  gtime) const
fpreal CL_SimpleChannel::eval ( fpreal  gtime,
int segment_idx_hint 
) const
fpreal CL_SimpleChannel::eval ( const CL_SimpleSegment seg,
fpreal  ltime 
) const
fpreal CL_SimpleChannel::evalSlope ( const CL_SimpleSegment seg,
fpreal  ltime 
) const
static bool CL_SimpleChannel::getAutoSplit ( )
inlinestatic

Definition at line 461 of file CL_SimpleChannel.h.

static fpreal CL_SimpleChannel::getChannelTolerance ( )
inlinestatic

Definition at line 453 of file CL_SimpleChannel.h.

static CL_SimpleSegmentType CL_SimpleChannel::getDefaultSegmentSplitType ( )
inlinestatic

Definition at line 458 of file CL_SimpleChannel.h.

static CL_SimpleSegmentType CL_SimpleChannel::getDefaultSegmentType ( )
inlinestatic

Definition at line 455 of file CL_SimpleChannel.h.

fpreal CL_SimpleChannel::getDefaultValue ( ) const
inline

Definition at line 396 of file CL_SimpleChannel.h.

fpreal CL_SimpleChannel::getEnd ( ) const
inline

Definition at line 413 of file CL_SimpleChannel.h.

UT_Array<fpreal> CL_SimpleChannel::getKeyTimes ( ) const
UT_Array<fpreal> CL_SimpleChannel::getKeyValues ( ) const
fpreal CL_SimpleChannel::getLength ( ) const
inline

Definition at line 414 of file CL_SimpleChannel.h.

int CL_SimpleChannel::getNSegments ( ) const
inline

Returns the number of segments including the end segment.

Definition at line 418 of file CL_SimpleChannel.h.

fpreal CL_SimpleChannel::getPostSlope ( ) const
inline

Definition at line 403 of file CL_SimpleChannel.h.

CL_ChannelBehavior CL_SimpleChannel::getPostType ( ) const
inline

Definition at line 404 of file CL_SimpleChannel.h.

fpreal CL_SimpleChannel::getPostValue ( ) const
inline

Definition at line 402 of file CL_SimpleChannel.h.

fpreal CL_SimpleChannel::getPreSlope ( ) const
inline

Definition at line 399 of file CL_SimpleChannel.h.

CL_ChannelBehavior CL_SimpleChannel::getPreType ( ) const
inline

Definition at line 400 of file CL_SimpleChannel.h.

fpreal CL_SimpleChannel::getPreValue ( ) const
inline

Definition at line 398 of file CL_SimpleChannel.h.

CL_SimpleSegment& CL_SimpleChannel::getSegment ( int  index)
inline

Definition at line 297 of file CL_SimpleChannel.h.

const CL_SimpleSegment& CL_SimpleChannel::getSegment ( int  index) const
inline

Definition at line 298 of file CL_SimpleChannel.h.

UT_StringHolder CL_SimpleChannel::getSegmentExpression ( int  index) const
inline

Definition at line 301 of file CL_SimpleChannel.h.

const UT_Array<UT_StringHolder>& CL_SimpleChannel::getSegmentExpressions ( ) const
inline

Definition at line 302 of file CL_SimpleChannel.h.

int CL_SimpleChannel::getSegmentIdx ( fpreal  ltime) const
int CL_SimpleChannel::getSegmentInSlopeAuto ( int  index) const
inline

Definition at line 306 of file CL_SimpleChannel.h.

int CL_SimpleChannel::getSegmentOutSlopeAuto ( int  index) const
inline

Definition at line 308 of file CL_SimpleChannel.h.

const UT_Array<CL_SimpleSegment>& CL_SimpleChannel::getSegments ( ) const
inline

Definition at line 299 of file CL_SimpleChannel.h.

CL_SimpleSegmentType CL_SimpleChannel::getSegmentType ( int  index) const
fpreal CL_SimpleChannel::getStart ( ) const
inline

Definition at line 412 of file CL_SimpleChannel.h.

bool CL_SimpleChannel::getSurroundingSegs ( fpreal  gtime,
CL_SimpleSegment *&  left,
CL_SimpleSegment *&  right 
)
fpreal CL_SimpleChannel::getTolerance ( ) const
inline

Definition at line 406 of file CL_SimpleChannel.h.

bool CL_SimpleChannel::insertKeyFrame ( fpreal  global_time,
bool  auto_slope = true 
)

Insert a key frame at the given global time. Returns true if a key frame was added, or false if it failed, or if there was already a key frame at the given time.

bool CL_SimpleChannel::isAtHardKey ( fpreal  gtime) const
bool CL_SimpleChannel::moveKeysWithDeltas ( const UT_IntArray indices,
const UT_Array< fpreal > &  time_offsets 
)

Shift the specified keys by the given time offsets. Time offsets must either match the size of indices, or be an array of 1 element to shift all keys by the same offset.

CL_SimpleChannel& CL_SimpleChannel::operator= ( const CL_SimpleChannel other)
default
CL_SimpleChannel& CL_SimpleChannel::operator= ( CL_SimpleChannel &&  other)
default
static void CL_SimpleChannel::setAutoSplit ( bool  onoff)
static

Set the segment type behaviour when splitting a segment. If true, The type of the split segment will be applied to the new segment, otherwise, theDefaultSplitSegmentType will be used

static void CL_SimpleChannel::setChannelTolerance ( fpreal  tol)
inlinestatic

Definition at line 442 of file CL_SimpleChannel.h.

static void CL_SimpleChannel::setDefaultSegmentSplitType ( CL_SimpleSegmentType  type)
static

Set the segment type used when splitting a segment if auto split is false

static void CL_SimpleChannel::setDefaultSegmentType ( CL_SimpleSegmentType  type)
static

Set the segment type used for the first key in a channel.

void CL_SimpleChannel::setDefaultValue ( fpreal  value)
inline

Set the default value. This is the value returned when evaluating an empty channel.

Definition at line 386 of file CL_SimpleChannel.h.

bool CL_SimpleChannel::setKeyAccel ( fpreal  gtime,
fpreal  accel,
CL_KeyHalf  half = CL_KeyHalf::InOut 
)

Set the accel of the key at the given time

Parameters
gtimeGlobal time of the key to change
accelNew value to set for the key
halfWhich half of the key to set. Defaults to both (tied)
Returns
true if successful, or false if there is no key at the given time
bool CL_SimpleChannel::setKeyAutoSlope ( fpreal  gtime,
bool  auto_slope,
CL_KeyHalf  half = CL_KeyHalf::InOut 
)

Set the auto_slope property of the key at the given time

Parameters
gtimeGlobal time of the key to change
auto_slopeNew auto_slope to set for the key
halfWhich half of the key to set. Defaults to both (tied)
Returns
true if successful, or false if there is no key at the given time
bool CL_SimpleChannel::setKeySlope ( fpreal  gtime,
fpreal  slope,
CL_KeyHalf  half = CL_KeyHalf::InOut 
)

Set the slope of the key at the given time

Parameters
gtimeGlobal time of the key to change
slopeNew slope to set for the key
halfWhich half of the key to set. Defaults to both (tied)
Returns
true if successful, or false if there is no key at the given time
bool CL_SimpleChannel::setKeyValue ( fpreal  gtime,
fpreal  value,
CL_KeyHalf  half = CL_KeyHalf::InOut 
)

Set the value of the key at the given time

Parameters
gtimeGlobal time of the key to change
valueNew value to set for the key
halfWhich half of the key to set. Defaults to both (tied)
Returns
true if successful, or false if there is no key at the given time
void CL_SimpleChannel::setPostSlope ( fpreal  slope)
inline

Definition at line 393 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setPostType ( CL_ChannelBehavior  type)
inline

Definition at line 394 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setPostValue ( fpreal  value)
inline

Definition at line 392 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setPreSlope ( fpreal  slope)
inline

Definition at line 389 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setPreType ( CL_ChannelBehavior  type)
inline

Definition at line 390 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setPreValue ( fpreal  value)
inline

Definition at line 388 of file CL_SimpleChannel.h.

bool CL_SimpleChannel::setRawValues ( fpreal  from,
fpreal  to,
fpreal data,
int  num_samples,
bool  auto_slope = true 
)

Sets data evenly spaced between from and to.

bool CL_SimpleChannel::setRawValues ( fpreal times,
fpreal data,
int  num_samples 
)

Sets data at the specified times.

void CL_SimpleChannel::setSegmentExpression ( int  index,
const UT_StringHolder expr 
)
inline

Definition at line 303 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setSegmentInAccel ( int  index,
fpreal  accel,
bool  ratio = false 
)
void CL_SimpleChannel::setSegmentInSlope ( int  index,
fpreal  slope 
)
void CL_SimpleChannel::setSegmentInSlopeAuto ( int  index,
bool  value 
)
inline

Definition at line 311 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setSegmentOutAccel ( int  index,
fpreal  accel,
bool  ratio = false 
)
void CL_SimpleChannel::setSegmentOutSlope ( int  index,
fpreal  slope 
)
void CL_SimpleChannel::setSegmentOutSlopeAuto ( int  index,
bool  value 
)
inline

Definition at line 313 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setSegmentType ( int  index,
CL_SimpleSegmentType  type 
)

Set the type of the segment Note that this differs from the setSegmentExpression, which is used only for custom expressions.

Parameters
indexThe index of the segment to modify
typeThe type to change the segment to.
void CL_SimpleChannel::setStart ( fpreal  start)
inline

Definition at line 416 of file CL_SimpleChannel.h.

void CL_SimpleChannel::setTolerance ( fpreal  tolerance)
inline

Definition at line 410 of file CL_SimpleChannel.h.

void CL_SimpleChannel::smoothAutoSlopes ( bool  force = false)
void CL_SimpleChannel::smoothAutoSlopesForSegments ( UT_RLEBitArray slope_flags,
bool  force = false,
fpreal  max_delta = -1 
)

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