HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CH_Channel.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: Channel Library (C++)
7  *
8  * COMMENTS: Definition of a channel
9  *
10  */
11 
12 #ifndef __CH_Channel_h__
13 #define __CH_Channel_h__
14 
15 #include "CH_API.h"
16 #include "CH_Collection.h"
17 #include "CH_ExprLanguage.h"
18 #include "CH_EventManager.h"
19 #include "CH_Manager.h"
20 #include "CH_Segment.h"
21 #include "CH_Types.h"
22 
23 #include <UT/UT_Array.h>
24 #include <UT/UT_Assert.h>
25 #include <UT/UT_Debug.h>
26 #include <UT/UT_DeepString.h>
27 #include <UT/UT_IntArray.h>
28 #include <UT/UT_Interval.h>
29 #include <UT/UT_String.h>
30 #include <UT/UT_StringHolder.h>
31 #include <UT/UT_SuperInterval.h>
32 #include <UT/UT_Swap.h>
33 #include <UT/UT_ValArray.h>
34 #include <UT/UT_VectorTypes.h>
35 
36 #include <SYS/SYS_Inline.h>
37 #include <SYS/SYS_Math.h>
38 #include <SYS/SYS_StaticAssert.h>
39 #include <SYS/SYS_Types.h>
40 #include <iosfwd>
41 #include <stddef.h>
42 
43 
44 class UT_IStream;
45 
46 // CH_Node and CH_Parm are void pointer to cache OP_Node and PRM_Parm pointers
47 #define CH_Node void
48 #define CH_Parm void
49 
50 
51 CH_API extern char
53 
54 typedef enum {
55  CH_CHANNEL_DEFAULT, // Channel is default value beyond defined range
56  CH_CHANNEL_HOLD, // Channel is start/end value before/after
57  CH_CHANNEL_CYCLE, // Channel wraps to defined range
58  CH_CHANNEL_EXTEND, // Channel function continues outside start/end
59  CH_CHANNEL_SLOPE, // Channel extends at start/end slope
60  CH_CHANNEL_CYCLEOFF, // Channel warps tot defined range and offsets.
61  CH_CHANNEL_OSCILLATE, // Channel warps tot defined range and offsets.
64 
65 
66 // NB: This enum only has 8 bits.
67 // Do not change these values as they get saved.
68 typedef enum {
72  CH_CACHE_ENABLED = 0x04, // no longer used!
73  CH_CHANNEL_SPARE = 0x08, // no longer used!
75 
76  CH_CHANNEL_PENDING = 0x20, // only used for saving/loading
77  CH_CHANNEL_PENDINGHOLD = 0x40, // no longer used!
78 
80 
81  // We save/load CH_CHANNEL_PENDING via myPending
82  //CH_CHANNEL_SAVE_MASK = CH_CHANNEL_PENDING,
83 
84  CH_CHANNEL_FLAG_MASK = 0xFF // sentinel: we've only got 8 bits
86 
87 // Enum for the CH_Channel::getKey and getFullKey methods
88 typedef enum {
89  CH_GETKEY_EXTEND_NONE, // Don't extend the channel cycle.
90  CH_GETKEY_EXTEND_DEFAULT, // Extend the channel extrapolation, and returns keys in the middle.
91  CH_GETKEY_EXTEND_BOUNDARY, // Extend the channel extrapolation, but give a hint that the key is the last or the first.
93 
94 
96 {
97 public:
99  bool myVValid[ CH_NUM_VALUES ];
100  bool myVTied[ CH_NUM_VALUES ];
101  bool myVAuto[ CH_NUM_VALUES ];
102 };
103 
105 {
106 public:
110 
111  CH_Key() { clear(); }
112 
113  void display() const;
114 
115  void clear();
116 
117  // direction is one of -1, 0, 1
118  // -1 = tie using left value
119  // 0 = tie averaging both
120  // 1 = tie using right value
121  void tie( int direction, CH_ValueTypes t );
122 
123  void tie( int direction );
124 
125  void setAuto( CH_ValueTypes t );
126 
127  void set( CH_ValueTypes t, fpreal value );
128  bool isSet( CH_ValueTypes t ) const;
129 
130  void complete();
131 
132  void get( CH_Segment *left_seg, CH_Segment *right_seg,
133  bool accel_ratio = true );
134 
135  void put( CH_Segment *left_seg, CH_Segment *right_seg,
136  bool accel_ratio = true ) const;
137 
138  void stretch( fpreal xscale, fpreal yscale, bool accel_ratio );
139 
140  void changeAccelsToRatios( fpreal left_seg_len, fpreal right_seg_len );
141 
142  void reverse();
143 
144  void opscript( std::ostream &os, bool use_time,
145  bool only_valid=true ) const;
146 
147  bool verify( bool check_tied_slopes=true ) const;
148 };
149 
150 class CH_API CH_FullKey: public CH_Key
151 {
152 public:
156 
158  {
159  myUseExpression = false;
160  myExprLanguage = CH_OLD_EXPR_LANGUAGE;
161  }
162 
163  CH_FullKey( CH_FullKey const& other );
164  CH_FullKey &operator=( CH_FullKey const& other );
165 
166  void display() const;
167 };
168 
170 {
171 public:
175 
177  {
178  myUseRevExpression = false;
179  myRevExprLanguage = CH_OLD_EXPR_LANGUAGE;
180  }
181 
182  CH_ReversibleKey( CH_ReversibleKey const& other );
184 
185  void display() const;
186 
187  void stretch( fpreal xscale, fpreal yscale, bool accel_ratio );
188 
189  void reverse();
190 };
191 
192 //
193 // Iterator for going through .chn and .bchn files,
194 // channel by channel, until the end of channels for current collection is
195 // reached. The iterator can be restarted by calling begin() again.
196 //
198 {
199 // After using begin or nextChannel, the position in the stream
200 // will be proper for using CH_Channel::load or CH_Collection::loadChannelRange
201 public:
203  bool begin(UT_StringHolder &name, const UT_StringHolder *path=NULL);
204  bool end() { return noMoreChannels; }
205  bool nextChannel(UT_StringHolder &name);
206  int getLastError() { return lastError; }
207 
208 private:
209  UT_IStream *curr_is;
210  UT_StringRef curr_coll;
211  int is_binary;
212  int lastError;
213  bool noMoreChannels;
214 };
215 
216 
218 {
219 public:
220  typedef enum
221  {
225  SNAP_REPLACE_DOUBLE
226  } SnapType;
227 
229  fpreal default_value = 0,
230  const char *default_string = 0);
231  CH_Channel(CH_Collection *dad, const CH_Channel &from);
232  CH_Channel(CH_Collection *dad, const CH_Channel &from, bool temporary);
233  ~CH_Channel();
234 
235  void initializeFirstSegment(const char *expr,
236  CH_ExprLanguage language);
237 
238  // Initialize parents of mySegments and myDisableSegments to this
239  void initializeSegmentParents();
240 
241  // UTILITIES
242  void clear();
243  void swap( CH_Channel &other );
244 
245  const UT_StringHolder &getName() const { return myName; }
246  const UT_StringHolder &getAlias() const
247  {
248  if (myAlias.isstring())
249  return myAlias;
250  else
251  return myName;
252  }
253 
255  {
256  getCollection()->getFullPath(this, path);
257  }
259  {
260  getCollection()->getFullPath(this, path);
261  }
262 
263  // Used only by CH_Collection
264  void setName(const UT_StringHolder &s) { myName = s; }
265  void setAlias(const UT_StringHolder &s) { myAlias = s; }
266 
267  CH_Manager *getManager() const { return myParent->getManager(); }
268 
270  { return getManager()->getTolerance(); }
271 
272  // This returns if the channel is time dependent without evaluating
273  // the channel.
274  bool isTimeDependent() const;
275 
276  // These return if the channel is time dependent and will catch more cases
277  // than isTimeDependent() by evaluating the channel.
278  bool isTimeDependentSlow(int thread) const;
279  bool isStringTimeDependentSlow(int thread) const;
280 
281  bool hasNonIntegerKeys() const;
282  bool isDataDependent(fpreal gtime) const;
283 
284  // are we using a zero-length segment to represent one key?
285  bool hasOnlyOneSegment() const;
286 
287  bool isRotationChannel() const;
288 
289  // KEYS
290  bool getSurroundingSegs( fpreal gtime,
291  CH_Segment *&left, CH_Segment *&right ) const;
292 
293  CH_Segment *getSegmentAfterKey( fpreal gtime ) const;
294 
295  // isAtKey returns true if the channel is considered modifiable at
296  // the given time. This means there's either no segment there or the
297  // segment is constant or there's a timemark there (segment start|end).
298  bool isAtKey(fpreal gtime) const;
299 
300  // isAtHardKey returns true only if there's a timemark (segment start
301  // or end) at the given time.
302  bool isAtHardKey(fpreal gtime) const;
303  bool isAtHardKeyframe(int frame) const;
304 
305  fpreal findKey(fpreal gtime, fpreal direction) const;
306  int findKeyframe(int frame, int direction) const;
307 
310 
311  /// Return an iterator for keys within the given interval. If ascending is
312  /// false, then the iterator is initialized at the end of the range
313  /// instead of at the beginning of the range.
314  /// @{
315  IntervalIter intervalIter(
316  const UT_SuperIntervalR & range,
317  const bool ascending=true) const;
318  ConstIntervalIter constIntervalIter(
319  const UT_SuperIntervalR & range,
320  const bool ascending=true) const;
321  /// @}
322 
323  // sample functions evaluate the channel to find values
324  // getKey functions only evaluate if the time is not already at a hard key
325  void sampleValueSlope( CH_Segment *seg, fpreal gtime,
326  int thread, fpreal &v, fpreal &s );
327  bool sampleVSA( CH_Segment *seg, fpreal gtime, int thread,
328  fpreal &v, fpreal &s, fpreal a[2] );
329  void sampleKey( CH_Segment *seg, fpreal gtime, int thread,
330  CH_Key &key );
331  bool getKey( fpreal gtime, CH_Key &key,
332  bool accel_ratios = true,
334  bool getFullKey( fpreal gtime, CH_FullKey &key,
335  bool reverse = false,
336  bool accel_ratios = true,
338  bool getReversibleKey( fpreal gtime, CH_ReversibleKey &key );
339 
340  void putKey( fpreal gtime, CH_Key const& key,
341  bool accel_ratios = true );
342  void putFullKey( fpreal gtime, CH_FullKey const& key,
343  bool accel_ratios = true );
344 
345  void transferKey(fpreal to_time,
346  CH_Channel *from_chp, fpreal from_time);
347 
348  void applyPendingToKey( CH_Key &key, fpreal gtime );
349  void applyDefaultSlopeToKey( CH_Key &key );
350 
351  /// Insert key at given time
352  void insertKeyFrame(fpreal global_t, bool use_auto_slope_pref=true);
353 
354  /// Delete key at given time
355  void destroyKeyFrame(fpreal global_t);
356 
357  /// Move key from old time to new time. Requires that a key exists at
358  /// old_gtime and that there is no key at new_gtime.
359  void moveKeyFrame( fpreal old_gtime, fpreal new_gtime );
360 
361  void saveKeyFrameForUndo( fpreal global_t );
362 
363  // this function is a bit confusing
364  // Sets the in/out values for a segment to the val at a time specified
365  //The method returns 0 if it was successfull,
366  // -1 if there was no key at the time specified
367  // set_pending = if true,the pending value is set to val, unless commit_keys
368  // is true, and gtime falls on a key frame.
369  // commit_keys = if true and gtime falls on a key frame, the keyed value
370  // for that frame is set to val, pending is cleared if
371  // set_pending is true
372  int setKeyValue(fpreal val, fpreal gtime,
373  bool set_pending = false,
374  bool commit_keys = true,
375  bool propagate = true);
376  int setKeyString(const UT_String &str, fpreal gtime,
377  bool set_pending = false,
378  bool commit_keys = true,
379  bool propagate = true);
380  int setKeyString(const UT_String &str, fpreal gtime,
381  CH_ExprLanguage language,
382  bool set_pending = false,
383  bool commit_keys = true,
384  bool propagate = true);
385  void holdValue( fpreal gtime, int thread );
386 
387  // utility functions for getting keyframe numbers:
388  // they return array of keyframes in the channel
389  // the frames are unique and sorted in a ascending order.
390  void getKeyFrames( UT_SuperIntervalR const& range,
391  UT_IntArray &frames,
392  bool error_frames_only );
393 
394  /// Similar to the above, but gets times of all keys in the channel
395  /// in the specified range.
396  void getKeyTimes( UT_SuperIntervalR const& range,
397  UT_FprealArray &times,
398  bool error_frames_only );
399 
400  // the frames are unique and sorted in a descending order.
401  void getDisabledFrames(UT_IntArray &frames,
402  int minframe, int maxframe);
403 
404  // EXPRESSIONS
405  CH_Segment *getExpressionSegment( fpreal gtime ) const;
406  const char *getExpression( fpreal gtime ) const;
407  bool changeExpression( fpreal gtime,
408  const char *expr,
409  CH_ExprLanguage language,
410  bool convert_accels );
411  CH_ExprLanguage getCollectionExprLanguage() const;
412  CH_ExprLanguage getExprLanguageAtTime(fpreal time) const;
413  void setExprLanguage(CH_ExprLanguage language);
414  void setExprLanguageAtTime(CH_ExprLanguage language,
415  fpreal time);
416 
417  // If we were to ask for the value of the channel as a string at a
418  // particular time, this function returns what the meaning of that string
419  // would be (either a literal or expression in some language).
420  CH_StringMeaning getStringMeaning(fpreal time) const;
421 
422  // MULTI-SEGMENT MANIPULATION
423  void clearSegments();
424 
425  /// Delete keys in given range
426  void deleteKeys( UT_SuperIntervalR const& range );
427 
428  /// Delete keys at the given key indices.
429  /// @note Must be sorted in ascending order!
430  void deleteKeys(const UT_IntArray &ascending_sorted_key_indices);
431 
432  void moveFrames(const UT_IntArray &frames, int amount);
433 
434  bool copyRangeOverwritesKeys(const CH_Channel &src,
435  UT_SuperIntervalR const& range,
436  UT_IntervalR const& to_range);
437  bool copyRangeOverwritesFrames(const CH_Channel &src,
438  UT_SuperIntervalR const& range,
439  UT_IntervalR const& to_range);
440  bool copyRangeOverwrites(const CH_Channel &src,
441  UT_SuperIntervalR const& range,
442  UT_IntervalR const& to_range);
443 
444  void copyRange(const CH_Channel &src,
445  UT_SuperIntervalR const& range,
446  UT_IntervalR const& to_range);
447 
448  void copyRangeFrames(const CH_Channel &src,
449  UT_SuperIntervalR const& range,
450  UT_IntervalR const& to_range,
451  const UT_IntArray * frames = NULL);
452 
453  void deleteRangeFrames(UT_SuperIntervalR const& range,
454  const UT_IntArray * frames = NULL);
455 
456  // copyContents copies everything except name and parent
457  void copyContents(const CH_Channel &from);
458  void swapContents( CH_Channel &other );
459  // TODO remove this function:
460  // copy a range of keys. Assumes that we already have keys in the src
461  // channel at those times
462  // another way to do this is: (once we pass UT_SuperIntervalR by value)
463  // ch.clear();
464  // ch.copyRange( src, UT_SuperIntervalR( start, end ), 0.0f );
465  void copyRange(const CH_Channel &src,
466  fpreal global_start, fpreal global_end);
467 
468  // if os is provided, a verbose description of what's happening is printed
469  void snapKeysInRange( const UT_SuperIntervalR &range,
470  SnapType type=SNAP_SNAP,
471  std::ostream *os=0 );
472 
473  // ENTIRE CHANNEL MANIPULATION
474  void scroll (fpreal newStart, bool update = true);
475  void stretch(fpreal newStart, fpreal newEnd);
476  void reverse(fpreal gstart=0, fpreal gend=0, bool whole_chan = true);
477  // scroll on the y axis (returns success)
478  bool increaseKeyValues( fpreal delta );
479 
480  // DISABLING
481  bool isAllDisabled() const;
482  bool isAllEnabled() const;
483  bool isDisabled(fpreal gtime) const;
484  void disableAll(fpreal gtime);
485  void enableAll();
486  void disable(fpreal gstart, fpreal gend);
487  void enable(fpreal gstart, fpreal gend);
488 
489  // PENDING METHODS
491  bool isPending() const
492  { return myPending; }
493  bool isPending(fpreal gtime) const;
494  bool isPendingLocal(fpreal ltime) const;
495  void clearPending();
496  void updatePending( fpreal gtime );
498  { return globalTime(myPendingEvalTime); }
500  bool isPendingHold() const
501  { return myPendingHold; }
502  void setPendingHold( bool state );
503 
504  // SAVE and LOAD
505  void save(std::ostream &os, int binary, bool compiled) const;
506  template <typename FPREAL_TYPE>
507  bool load(UT_IStream &is);
508  void display() const;
509  void displayAsKeys() const;
510 
511  void setDefaultValue(fpreal dv) { myDefValue = dv; }
512  fpreal getDefaultValue() const { return myDefValue; }
513 
515  { myDefString = dv; }
516  const UT_StringHolder &
517  getDefaultString() const { return myDefString; }
518 
519  void setChannelLeftType(CH_ChannelBehavior t);
520  void setChannelRightType(CH_ChannelBehavior t);
521  CH_ChannelBehavior getChannelLeftType() const { return myLeftType; }
522  CH_ChannelBehavior getChannelRightType() const { return myRightType; }
523 
524  static const char *getChannelTypeName(CH_ChannelBehavior type);
525 
526  void setCollection(CH_Collection *chp){ myParent = chp; }
527  const CH_Collection *getCollection() const { return myParent; }
528  CH_Collection *getCollection() { return myParent; }
529 
530  void setIsTemporary( bool temp ) { myIsTemporary = temp; }
531  bool isTemporary() const { return myIsTemporary; }
532 
533  // FLAGS
534  void setChangeActive(int state)
535  {
536  if( state ) myFlags |= CH_CHANNEL_ACTIVE;
537  else myFlags &= ~CH_CHANNEL_ACTIVE;
538  }
539  bool isChangeActive() const
540  { return (myFlags & CH_CHANNEL_ACTIVE) ? 1 : 0; }
541 
542 
543  bool getLocked() const
544  { return ((myFlags & CH_CHANNEL_LOCKED) != 0); }
545  void setLocked(bool f);
546 
547  int getChanged() const
548  { return (myFlags & CH_CHANNEL_MODIFIED) ? 1 : 0; }
549  void setChanged(bool on,
551  void dirtyExprCache();
552 
553  int canAccess(uint mask) const
554  {
555  if( myParent )
556  return myParent->canAccessChannel(mask, this);
557  else
558  return 1;
559  }
560 
561  // map collection time to channel time...
562  inline fpreal localTime(fpreal t) const { return (t-myStart); }
563 
564  // map channel time to global time...
565  inline fpreal globalTime(fpreal t) const { return t + myStart; }
566 
567  // Returns collection global time...
568  fpreal getStart() const { return myStart; }
569  fpreal getEnd() const { return myStart + myLength;}
570  fpreal getLength() const { return myLength; }
571 
572  // Used to reset the local variables:
573  void unresolveLocalVars(int thread);
574 
575  // Op dependencies
576  void buildOpDependencies(void *ref_id, int thread);
577  void changeOpRef(const char *new_fullpath,
578  const char *old_fullpath,
579  const char *old_cwd,
580  const char *chan_name,
581  const char *old_chan_name,
582  int thread);
583 
584  // Enable or disable value caching in expression segments...
585  void cook(int state);
586 
587  // Load values as keys. Returns the number of samples actually loaded.
588  int setRawValues(fpreal from, fpreal to, fpreal *vals, int nsamples);
589  int setRawValues(fpreal *times, fpreal *vals, int n);
590 
591  // Channel Scope Flag
592  void setScope(bool on_off);
593  bool isScoped() const { return myScope; }
594 
595  // Does this channel have any segments with editable components (eg. value,
596  // slope, acceleration, etc.)?
597  bool isEditable();
598 
599  // Query methods. Used only by CH_Collection
600  fpreal evaluate(fpreal t, bool no_disabling, int thread);
601  void evaluate(fpreal from, fpreal to, fpreal *vals, int nsamples,
602  bool no_disabling, bool use_cache, int thread);
603  fpreal evaluateSegment(CH_Segment *eval, fpreal localtime,
604  bool extend, int thread);
605  void evaluateString(UT_String &result, fpreal t, int thread);
606  void evaluateStringSegment(UT_String &result, CH_Segment *eval,
607  fpreal localtime, bool extend,
608  int thread);
609 
610  int findString(const char *str, bool fullword,
611  bool usewildcards) const;
612  int changeString(const char *from, const char *to,
613  bool fullword, bool update /*= true*/,
614  int thread);
615 
616  //
617  // Methods used only in the channel library glue
618  //
619  static inline fpreal getGlueIV(int thread);
620  static inline void getGlueTime(
621  fpreal &t, fpreal &t0, fpreal &t1,
622  fpreal &v0, fpreal &v1, int thread);
623  static inline void getGlueSlope(
624  fpreal *m0, fpreal *m1,
625  fpreal *a0, fpreal *a1, int thread);
626 
627 // Used only by CH_Collection
628  inline const CH_Segment *getEvaluationSegment(int thread) const
629  {
630  return getManager()->evalContext(thread).segment();
631  }
633  {
634  return getManager()->evalContext(thread).segment();
635  }
636  const CH_Segment *getPrevEvaluationSegment(int thread) const;
637  CH_Segment *getPrevEvaluationSegment(int thread);
638  const CH_Segment *getNextEvaluationSegment(int thread) const;
639  CH_Segment *getNextEvaluationSegment(int thread);
640 
641  fpreal getInTime(int thread) const;
642  fpreal getOutTime(int thread) const;
643  fpreal getPrevInTime(int thread) const;
644  fpreal getNextOutTime(int thread) const;
645 
646  // This method will attempt to match the channel name with the pattern,
647  // searching as many parents as necessary regardless of the cwd
648  // eg. tx will match true with tx xform1/tx geo1/xform1/tx
649 
650  int match(const char *pattern) const;
651 
652 
653  // sets all keys to be 'value', and zeros all slopes & accels.
654  void setConstantValue(fpreal value);
655 
656  // sets the data and keys so that the channel approximates the
657  // raw data of samples within given error using cubic interpolation
658  // INPUTS:
659  // data - an array of pairs (time, value) to be fitted.
660  // n_pts - number of elements in data array
661  // error2 - the error to which the channel should approximate data
662  // delete_old_segments - if true, all old segments are cleared before
663  // new ones are generated from data. If false, the segments
664  // that fit the data replace old segments (thus, some
665  // old segments that are outside of the data range will
666  // remain unchanged)
667  // OUTPUTS:
668  // The clip will approximate the curve sampled by data.
669  // The clip will have its start time equal to
670  // the time component of the first pair in the data array,
671  // and the end time equal to the time of the last pair.
672  // RETURNS:
673  // True on success, false if failed.
674  bool fitToPointData( UT_Vector2R *data, int n_pts,
675  bool preserveExtrema,
676  fpreal error2 = 0.01f,
677  bool delete_old_segments = false);
678 
679  // refits the channel data (or portion of it) with cubic interpolation
680  // within given error tolerance. Inserts new keys, etc.
681  // delete_old_segments - if true, all segments are deleted before
682  // refitted range is inserted. Otherwise, old segments outside of the
683  // refitted range are not affected.
684  void refit( fpreal tolerance, bool preserveExtrema );
685  void refit( fpreal tolerance, bool preserveExtrema,
686  fpreal from_gtime, fpreal to_gtime,
687  bool delete_old_segments);
688 
689  // SEGMENT MANAGEMENT
690  bool isEmpty() const;
691  int getNSegments() const;
692  int getNKeys() const;
693  int getNKeysBefore( fpreal gtime ) const;
694  int getNKeysBeforeOrAt( fpreal gtime ) const;
695 
696  fpreal getKeyTime( unsigned idx ) const;
697 
698  unsigned getSegmentIdx(fpreal local_time) const;
699  CH_Segment *getSegment(unsigned idx) const;
700  CH_Segment *getSegment(fpreal local_time) const;
701 
702  CH_Segment *getNextSegment(unsigned idx) const; // Depends on behavior
703  CH_Segment *getPrevSegment(unsigned idx) const; // Depends on behavior
704 
706  {
707  // empty means no keys in the channel if user delete them
708  // all
709  UT_ASSERT_P( isEmpty() || myEndSegment );
710  return isEmpty()
711  ? 0 : getSegment( (unsigned)0 );
712  }
714  {
715  // empty means no keys in the channel if user delete them
716  // all
717  UT_ASSERT_P( isEmpty() || myEndSegment );
718 
719  // old behaviour maintained (ie. don't use end segment)
720  return isEmpty()
721  ? 0 : getSegment( (unsigned)mySegments.entries()-1 );
722  }
723 
724  int64 getMemoryUsage(bool inclusive) const;
725 
726  // The first method takes global time, the second, segment local time.
727  void changeSegLength (CH_Segment *seg, fpreal gtime,
729  bool adjust_and_update = true);
730 
731  bool getHaveCompiledExpressions() const;
732 
733  bool verify();
734  bool verify(bool verify_tied_values);
735 
736  // Snapshots or buffer curves.
737  // Create a deep copy of the channel data for fast modifications and revert workflow.
738  // It's more intuitive than to have to do multiple undo to get back to the previous
739  // keyframes.
740  void saveSnapshot();
741  void undoSnapshot(CH_Channel *previous, bool previousSnapshotCleared);
742  bool loadSnapshot();
743  bool swapSnapshot();
744  bool clearSnapshot();
745  CH_Channel* getSnapshotChannel();
746 
747 
748  void smoothAutoSlopes( CH_Segment *seg=NULL );
749 
750 
751  // Layer Scope Flag
752  void setLayerScope(bool on_off);
753  bool isLayerScoped() const { return myLayerScope; }
754 
755  // Set an array pointer to capture the copyRange actions
756  void setCaptureCopiedKeys( UT_Array<fpreal> *capture_array );
757 
758  // chkey version of putFullKey() doesn't do the same validations as putFullKey()
759  void putChFullKey( fpreal gtime, CH_FullKey const& key, bool accel_ratios = true );
760 
761  fpreal evaluateSegment(CH_Segment &eval, fpreal localtime,
762  bool extend, int thread);
763 
764  fpreal evaluateSegment(CH_Segment &eval, fpreal localtime, int thread);
765  fpreal evaluateSegment(CH_Segment *eval, fpreal localtime, int thread);
766 
767  fpreal evaluateSegmentExtend(CH_Segment *eval, fpreal localtime, int thread);
768  fpreal evaluateSegmentExtend(CH_Segment &eval, fpreal localtime, int thread);
769 
770 private:
771  CH_Channel( CH_Channel const& other ); // unimplemented
772 
773  void ensureEndSegmentCreated();
774  void updateEndSegment();
775  void destroyEndSegment();
776 
777  bool isTwoSegChannelTimeDep() const;
778 
779  template <typename T>
780  bool isTimeDependentSlowImpl(int thread) const;
781 
782  // TODO: Remove this. It's abysmally slow, doing a binary search each time
783  bool nextTimeInRange(UT_SuperIntervalR const& range,
784  fpreal &t, bool first) const;
785 
786  class BatchModifyScope;
787  friend class CH_Channel::BatchModifyScope;
788 
789  void moveKeyInternal(fpreal old_gtime, fpreal new_gtime,
790  BatchModifyScope &scope);
791  void splitSegment(fpreal gtime, bool accel_ratio = true);
792  void destroyKeyInternal(unsigned seg_i, BatchModifyScope &scope);
793 
794  // cuts out a portion of a channel. Returns an index at which the cut began
795  int cutOut( fpreal from_gtime, fpreal to_gtime );
796 
797  CH_Segment *appendSegment(CH_Segment *seg);
798 
799  // remove and delete the segment
800  void deleteSegment(unsigned idx);
801 
802  int getNDisableSegments() const
803  { return myDisableSegments.entries(); }
804  CH_Segment *getDisableSegment(unsigned idx) const
805  {
806  return (idx < myDisableSegments.entries()) ?
807  myDisableSegments(idx) : 0;
808  }
809 
810  CH_Segment *getDisableSegmentForLocalTime(fpreal local_time) const;
811  CH_Segment *getPrevDisableSegment(CH_Segment *) const;
812  CH_Segment *getNextDisableSegment(CH_Segment *) const;
813 
814  int getDisableSegmentIndex(fpreal ltime, bool closest_prev) const;
815 
816  CH_Segment *getFirstDisableSegment() const
817  {
818  return (myDisableSegments.entries() > 0) ?
819  myDisableSegments(0) : 0;
820  }
821  CH_Segment *getLastDisableSegment() const
822  {
823  return (myDisableSegments.entries() > 0)
824  ? myDisableSegments(myDisableSegments.entries()-1)
825  : 0;
826  }
827  CH_Segment *appendDisableSegment(CH_Segment *seg);
828 
829  CH_Segment *insertDisableSegment(CH_Segment *seg);
830  CH_Segment *insertDisableSegment(CH_Segment *seg, int idx);
831  CH_Segment *insertDisableSegment(CH_Segment *seg, CH_Segment *before);
832 
833  // Remove but don't delete
834  void removeDisableSegment(CH_Segment *seg);
835  void removeDisableSegment(int idx);
836 
837  void deleteDisableSegment(CH_Segment *);
838  void deleteDisableSegment(int idx);
839 
840  void setPending( bool on_off, fpreal ltime );
841  void updatePendingStateToManager();
842 
843  void deNormalize(fpreal scale);
844 
845  int isCooking() const
846  {
847  return (myFlags & CH_CHANNEL_COOKING) != 0;
848  }
849  void setCooking(bool on_off)
850  {
851  if (on_off) myFlags |= CH_CHANNEL_COOKING;
852  else myFlags &= ~CH_CHANNEL_COOKING;
853  }
854 
855  void adjustSegments(int begin_i, int end_i,
856  CH_CHANGE_TYPE event_type);
857 
858  // Get Segment methods that can return disabled segments.
859  CH_Segment *getFirstSegment(bool no_disabling ) const;
860  CH_Segment *getLastSegment(bool no_disabling ) const;
861  CH_Segment *getEndSegment(bool no_disabling ) const;
862  CH_Segment *getSegment(bool no_disabling, fpreal ltime ) const;
863 
864  enum chGetOrSampleReturn
865  {
866  Sampled, Get, FirstLast
867  };
868  chGetOrSampleReturn getOrSampleKey( fpreal ltime, CH_Key &key, bool accel_ratio, int thread );
869 
870 private: // data
871 
872  CH_Collection *myParent; // Who I belong to
873  UT_StringHolder myName;
874  UT_StringHolder myAlias;
875 
876  CH_ChannelBehavior myLeftType; // Type of channel
877  CH_ChannelBehavior myRightType; // Type of channel
878  CH_Segment *myEndSegment;
879 
880  fpreal myDefValue; // Default/Pending value
881  fpreal myStart; // Start time of channel
882  fpreal myLength; // Kept for efficiency (local)
883 
884  UT_StringHolder myDefString; // Default/Pending string value
885 
886  UT_ValArray<CH_Segment *> mySegments; // Array of segments
887  UT_ValArray<CH_Segment *> myDisableSegments;
888 
889  fpreal myPendingEvalTime;
890  CH_Channel *mySnapshot;
891  UT_Array<fpreal> *myCaptureCopiedKeys;
892 
893  unsigned char myFlags;
894  bool myPending;
895  bool myPendingHold;
896  bool myScope;
897  bool myLayerScope;
898  bool myIsTemporary;
899  bool myDoingChKey;
900  bool mySnapshotCleared;
901 
902 };
903 
905 
906 inline CH_Segment *
907 CH_Channel::getSegment(unsigned idx) const
908 {
909  if( idx<mySegments.entries() )
910  return mySegments(idx);
911  if( idx==(unsigned)-1 || idx==mySegments.entries() )
912  {
913  UT_ASSERT(myEndSegment || mySegments.entries() == 0);
914  return myEndSegment;
915  }
916  UT_ASSERT( false );
917  return NULL;
918 }
919 
920 inline int
922 {
923  return myEndSegment ? 1 + mySegments.entries() : 0;
924 }
925 
926 inline bool
928 {
929  return mySegments.isEmpty() && !myEndSegment;
930 }
931 
932 inline int
934 {
935  return getNSegments();
936 }
937 
938 inline fpreal
939 CH_Channel::getKeyTime( unsigned idx ) const
940 {
941  CH_Segment *segp;
942  if( idx == mySegments.entries() )
943  {
944  segp = myEndSegment;
945  UT_ASSERT( segp );
946  return globalTime( segp->getStart() );
947  }
948  segp = getSegment( idx );
949  UT_ASSERT( segp );
950  return globalTime( segp->getStart() );
951 }
952 
953 inline bool
955 {
956  return getNSegments() == 1;
957 }
958 
959 inline bool
961 {
962  // NB: This is actually slightly weaker than PRM_Float::isRotationParm()
963  return myName == "rx" || myName == "ry" || myName == "rz";
964 }
965 
966 
967 /// Const iterator over an interval
969 {
970 public:
972  : myChannel(NULL)
973  , myI(-1)
974  , myTol(0.0)
975  {
976  }
977 
979  {
980  ++myI;
981  return *this;
982  }
984  {
985  --myI;
986  return *this;
987  }
988 
989  bool atEnd() const
990  {
991  if (myI >= myChannel->getNSegments())
992  return true;
993  fpreal lt = localTime();
994  return !(myRange.myMaxInclusive ?
995  SYSisLessOrEqual(lt, myRange.max, myTol)
996  : SYSisLess(lt, myRange.max, myTol));
997  }
998  bool atPre() const
999  {
1000  if (myI < 0)
1001  return true;
1002  fpreal lt = localTime();
1003  return !(myRange.myMinInclusive ?
1004  SYSisGreaterOrEqual(lt, myRange.min, myTol)
1005  : SYSisGreater(lt, myRange.min, myTol));
1006  }
1007 
1008  unsigned index() const
1009  {
1010  return (unsigned)myI;
1011  }
1012 
1013  const CH_Segment &segment() const
1014  {
1015  return *(myChannel->getSegment((unsigned)myI));
1016  }
1017 
1018  // Local time at start of segment
1020  {
1021  return myChannel->getSegment((unsigned)myI)->getStart();
1022  }
1023 
1024  fpreal operator*() const { return myChannel->globalTime(localTime()); }
1025 
1026 protected:
1028  const CH_Channel &ch, const UT_SuperIntervalR &range,
1029  const bool ascending)
1030  : myChannel(&ch)
1031  , myRange(range)
1032  , myTol(ch.getTolerance())
1033  {
1034  myRange.min = ch.localTime(myRange.min);
1035  myRange.max = ch.localTime(myRange.max);
1036  UT_ASSERT(myRange.min <= myRange.max);
1037  if (ascending)
1038  {
1039  // If myRange.min is less than the first segment's start time, then
1040  // the first segment is returned by getSegmentIdx().
1041  myI = ch.getSegmentIdx(myRange.min);
1042  CH_Segment *seg = ch.getSegment((unsigned)myI);
1043  if (seg)
1044  {
1045  fpreal lt = seg->getStart();
1046  if (range.myMinInclusive)
1047  {
1048  if (SYSisLess(lt, myRange.min, myTol))
1049  ++myI;
1050  }
1051  else
1052  {
1053  if (SYSisLessOrEqual(lt, myRange.min, myTol))
1054  ++myI;
1055  }
1056  }
1057  else
1058  {
1059  myI = ch.getNSegments();
1060  }
1061  UT_ASSERT(atEnd() || myRange.contains(localTime(), myTol));
1062  }
1063  else // descending
1064  {
1065  myI = ch.getSegmentIdx(myRange.max);
1066  CH_Segment *seg = ch.getSegment((unsigned)myI);
1067  if (seg)
1068  {
1069  fpreal lt = seg->getStart();
1070  if (range.myMaxInclusive)
1071  {
1072  if (SYSisGreater(lt, myRange.max, myTol))
1073  --myI;
1074  }
1075  else
1076  {
1077  if (SYSisGreaterOrEqual(lt, myRange.max, myTol))
1078  --myI;
1079  }
1080  }
1081  else
1082  {
1083  myI = -1;
1084  }
1085  UT_ASSERT(atPre() || myRange.contains(localTime(), myTol));
1086  }
1087  }
1088 
1089 private:
1090  const CH_Channel * myChannel;
1091  UT_SuperIntervalR myRange;
1092  int myI;
1093  fpreal myTol;
1094 
1095  friend class CH_Channel;
1096 };
1097 
1098 /// Iterator over an interval
1100 {
1101 public:
1103  : ConstIntervalIter()
1104  {
1105  }
1106 
1108  {
1109  return const_cast<CH_Segment &>(ConstIntervalIter::segment());
1110  }
1111 
1113  {
1115  return *this;
1116  }
1118  {
1120  return *this;
1121  }
1122 
1123 protected:
1125  const CH_Channel &ch, const UT_SuperIntervalR &range, bool reverse)
1126  : ConstIntervalIter(ch, range, reverse)
1127  {
1128  }
1129 
1130 private:
1131 
1132  friend class CH_Channel;
1133 };
1134 
1137  const UT_SuperIntervalR & range, const bool ascending) const
1138 {
1139  return IntervalIter(*this, range, ascending);
1140 }
1143  const UT_SuperIntervalR & range, const bool ascending) const
1144 {
1145  return ConstIntervalIter(*this, range, ascending);
1146 }
1147 
1148 /// This function stretches the modifies the given slope and accel values
1149 /// according to the given factors. If the accel value is given as a ratio,
1150 /// then accel_ratio should be true.
1151 CH_API extern void
1152 CHstretchSlopeAccel(fpreal xscale, fpreal yscale, fpreal &slope, fpreal &accel,
1153  bool accel_ratio);
1154 
1155 // this will move attempted_dt towards accepted_dt so that:
1156 // keys[i]+attempted_dt does not land on another key
1157 // attempted_dt stays on the same side of accepted_dt as it started
1158 // (so that if you're moving one way, they don't snap backwards before
1159 // where they started)
1160 // if snap_to_frame, attempted_dt+base_time will land on a frame
1161 CH_API extern void
1162 CHfindMoveKeysDelta( const CH_Channel *chp, bool snap_to_frame, fpreal base_time,
1163  const UT_FprealArray &sorted_orig_keys,
1164  fpreal accepted_dt, fpreal &attempted_dt );
1165 
1166 CH_API extern void
1167 CHmoveKeysWithDelta( CH_Channel *chp, const UT_FprealArray &orig_keys,
1168  fpreal old_accepted_dt, fpreal new_accepted_dt );
1169 
1170 ///////////////////////////////////////////////////////////////////////////////
1171 //
1172 // Inline Implementations
1173 //
1174 
1175 /*static*/ inline fpreal
1177 {
1178  const CH_EvalContext & ctx = CHgetManager()->evalContext(thread);
1179  const CH_Channel * eval_channel = ctx.channel();
1180  const CH_Segment * segp = ctx.segment();
1181 
1182  if (segp)
1183  {
1184  if (eval_channel->isPending(ctx.time()))
1185  return eval_channel->getDefaultValue();
1186  else
1187  return segp->getInValue();
1188  }
1189 
1190  return 0.0f;
1191 }
1192 
1193 /*static*/ inline void
1195  fpreal &v0, fpreal &v1, int thread)
1196 {
1197  CH_Manager & mgr = *CHgetManager();
1198  CH_EvalContext & ctx = mgr.evalContext(thread);
1199  const CH_Channel * eval_channel = ctx.channel();
1200  const CH_Segment * segp = ctx.segment();
1201 
1202  if (eval_channel)
1203  {
1204  t = eval_channel->localTime(ctx.time());
1205  if (segp)
1206  {
1207  t0 = segp->getStart();
1208  t1 = segp->getEnd();
1209  if( eval_channel->isPendingLocal(t) )
1210  {
1211  v0 = v1 = eval_channel->getDefaultValue();
1212  t0 = t1 = t;
1213  }
1214  else
1215  {
1216  v0 = segp->getInValue();
1217  v1 = segp->getOutValue();
1218  if( segp->isEndSegment() )
1219  {
1220  // Since our segment length is zero, we want fake it so
1221  // that it uses either the in or out values because most
1222  // existing expression functions will take the average of
1223  // them when encountering a zero length segement.
1224  // NB: the in/out values are swapped on end segments.
1225  if (SYSisGreaterOrEqual(t, t0, mgr.getTolerance()))
1226  v1 = v0;
1227  else
1228  v0 = v1;
1229  }
1230  }
1231  }
1232  else
1233  {
1234  t0 = eval_channel->getStart();
1235  t1 = eval_channel->getEnd();
1236  v0 = v1 = 0;
1237  }
1238  }
1239  else
1240  {
1241  t = 0.0f;
1242  t0 = 0.0f;
1243  t1 = 0.0f;
1244  v0 = 0.0f;
1245  v1 = 0.0f;
1246  }
1247 }
1248 
1249 /*static*/ inline void
1251  int thread)
1252 {
1253  CH_EvalContext & ctx = CHgetManager()->evalContext(thread);
1254  const CH_Segment * segp = ctx.segment();
1255 
1256  if (segp)
1257  {
1258  if (m0) *m0 = segp->getInSlope();
1259  if (m1) *m1 = segp->getOutSlope();
1260  if (a0) *a0 = segp->getInAccel();
1261  if (a1) *a1 = segp->getOutAccel();
1262  }
1263  else
1264  {
1265  if (m0) *m0 = 0.0f;
1266  if (m1) *m1 = 0.0f;
1267  if (a0) *a0 = 0.0f;
1268  if (a1) *a1 = 0.0f;
1269  }
1270 }
1271 
1272 // this returns if the channel is time dependent without evaluating
1273 // the channel
1274 inline bool
1276 {
1277  const int nsegs = getNSegments();
1278 
1279  if (nsegs == 0)
1280  return false;
1281 
1282  if (nsegs == 1)
1283  return getSegment(0U)->isTimeDependent();
1284 
1285  if (nsegs == 2)
1286  return isTwoSegChannelTimeDep();
1287 
1288  // Else, assume time dependent when more than 1 segment
1289  UT_ASSERT_P(nsegs > 1);
1290  return true;
1291 }
1292 
1293 
1294 // UTformat support.
1295 static inline size_t
1296 format(char *buffer, size_t buffer_size, const CH_Channel &v)
1297 {
1298  UT_String s;
1299  v.getFullPath(s);
1300  if (!buffer)
1301  return s.length();
1302  else
1303  {
1304  size_t len = std::min(size_t(s.length()), buffer_size);
1305  ::memcpy(buffer, s.c_str(), len);
1306  return len;
1307  }
1308 }
1309 
1310 #endif // __CH_Channel_h__
GLdouble s
Definition: glew.h:1390
const UT_StringHolder & getAlias() const
Definition: CH_Channel.h:246
Iterator over an interval.
Definition: CH_Channel.h:1099
CH_ExprLanguage myRevExprLanguage
Definition: CH_Channel.h:174
fpreal localTime(fpreal t) const
Definition: CH_Channel.h:562
GLenum GLint * range
Definition: glew.h:3500
CH_ChannelBehavior getChannelRightType() const
Definition: CH_Channel.h:522
unsigned getSegmentIdx(fpreal local_time) const
bool myUseExpression
Definition: CH_Channel.h:153
GLenum src
Definition: glew.h:2410
GLuint const GLchar * name
Definition: glew.h:1814
bool myUseRevExpression
Definition: CH_Channel.h:172
static void getGlueTime(fpreal &t, fpreal &t0, fpreal &t1, fpreal &v0, fpreal &v1, int thread)
Definition: CH_Channel.h:1194
GA_API const UT_StringHolder accel
const UT_StringHolder & getDefaultString() const
Definition: CH_Channel.h:517
CH_Segment * getEvaluationSegment(int thread)
Definition: CH_Channel.h:632
bool isEndSegment() const
Definition: CH_Segment.h:274
CH_ExprLanguage
IntervalIter intervalIter(const UT_SuperIntervalR &range, const bool ascending=true) const
Definition: CH_Channel.h:1136
FMT_CONSTEXPR auto begin(const C &c) -> decltype(c.begin())
Definition: format.h:251
CH_Key()
Definition: CH_Channel.h:111
Const iterator over an interval.
Definition: CH_Channel.h:968
CH_StringMeaning
GT_API const UT_StringHolder time
GLint left
Definition: glew.h:8008
IMF_EXPORT IMATH_NAMESPACE::V3f direction(const IMATH_NAMESPACE::Box2i &dataWindow, const IMATH_NAMESPACE::V2f &pixelPosition)
CH_ChannelFlag
Definition: CH_Channel.h:68
GLuint const GLfloat * val
Definition: glew.h:2794
fpreal globalTime(fpreal t) const
Definition: CH_Channel.h:565
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:13880
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:9477
void getFullPath(UT_StringHolder &path) const
Definition: CH_Channel.h:258
bool isRotationChannel() const
Definition: CH_Channel.h:960
bool myEvaluatedSlopes
Definition: CH_Channel.h:108
const CH_Segment * segment() const
bool isTemporary() const
Definition: CH_Channel.h:531
bool isEmpty() const
Definition: CH_Channel.h:927
fpreal getEnd() const
Definition: CH_Channel.h:569
void reverse(I begin, I end)
Definition: pugixml.cpp:7190
void swap(T &lhs, T &rhs)
Definition: pugixml.cpp:7172
void setIsTemporary(bool temp)
Definition: CH_Channel.h:530
fpreal getInValue() const
Definition: CH_Segment.h:278
const GLint * first
Definition: glew.h:1528
CH_FullKey & operator=(CH_FullKey const &other)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glew.h:1254
CH_GetKeyExtend
Definition: CH_Channel.h:88
const CH_Segment & segment() const
Definition: CH_Channel.h:1013
const GLdouble * v
Definition: glew.h:1391
CH_API void CHfindMoveKeysDelta(const CH_Channel *chp, bool snap_to_frame, fpreal base_time, const UT_FprealArray &sorted_orig_keys, fpreal accepted_dt, fpreal &attempted_dt)
GLenum GLint GLuint mask
Definition: glew.h:1845
CH_Segment & segment() const
Definition: CH_Channel.h:1107
bool isLayerScoped() const
Definition: CH_Channel.h:753
fpreal getInSlope() const
Definition: CH_Segment.h:280
const CH_EvalContext & evalContext(int thread) const
Definition: CH_Manager.h:1206
fpreal getOutValue() const
Definition: CH_Segment.h:279
const char * c_str() const
Definition: UT_String.h:505
bool isChangeActive() const
Definition: CH_Channel.h:539
class CH_API IntervalIter
Definition: CH_Channel.h:309
bool hasOnlyOneSegment() const
Definition: CH_Channel.h:954
unsigned length() const
Return length of string.
Definition: UT_String.h:542
bool isTimeDependent() const
Definition: CH_Segment.h:236
int canAccess(uint mask) const
Definition: CH_Channel.h:553
fpreal64 time() const
static fpreal getGlueIV(int thread)
Definition: CH_Channel.h:1176
IntervalIter & operator--()
Definition: CH_Channel.h:1117
bool isPendingLocal(fpreal ltime) const
fpreal getDefaultValue() const
Definition: CH_Channel.h:512
class CH_API ConstIntervalIter
Definition: CH_Channel.h:308
ConstIntervalIter constIntervalIter(const UT_SuperIntervalR &range, const bool ascending=true) const
Definition: CH_Channel.h:1142
ConstIntervalIter & operator--()
Definition: CH_Channel.h:983
UT_String myRevExpression
Definition: CH_Channel.h:173
CH_ChannelBehavior
Definition: CH_Channel.h:54
CH_CHANGE_TYPE
CH_Manager * CHgetManager()
Definition: CH_Manager.h:1742
GLclampf f
Definition: glew.h:3499
ConstIntervalIter & operator++()
Definition: CH_Channel.h:978
void setCollection(CH_Collection *chp)
Definition: CH_Channel.h:526
const CH_Segment * getEvaluationSegment(int thread) const
Definition: CH_Channel.h:628
fpreal getLength() const
Definition: CH_Channel.h:570
GLuint buffer
Definition: glew.h:1680
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:134
const GLuint GLenum const void * binary
Definition: glew.h:3502
fpreal getStart() const
Definition: CH_Segment.h:315
bool getLocked() const
Definition: CH_Channel.h:543
UT_String myExpression
Definition: CH_Channel.h:154
void display() const
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
fpreal getKeyTime(unsigned idx) const
Definition: CH_Channel.h:939
fpreal myTimeValue
Definition: CH_Channel.h:107
void setDefaultValue(fpreal dv)
Definition: CH_Channel.h:511
GLsizei n
Definition: glew.h:4040
bool isScoped() const
Definition: CH_Channel.h:593
IntervalIter(const CH_Channel &ch, const UT_SuperIntervalR &range, bool reverse)
Definition: CH_Channel.h:1124
CH_Segment * getLastSegment() const
Definition: CH_Channel.h:713
long long int64
Definition: SYS_Types.h:116
HUSD_API bool eval(VtValue &val, T &ret_val)
*Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
GLfloat right
Definition: glew.h:15186
CH_Segment * getSegment(unsigned idx) const
Definition: CH_Channel.h:907
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
void reverse(fpreal gstart=0, fpreal gend=0, bool whole_chan=true)
void setName(const UT_StringHolder &s)
Definition: CH_Channel.h:264
IntervalIter & operator++()
Definition: CH_Channel.h:1112
void setChangeActive(int state)
Definition: CH_Channel.h:534
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:460
SYS_FORCE_INLINE bool isPending() const
Definition: CH_Channel.h:491
GLsizei const GLchar *const * path
Definition: glew.h:6461
CH_Collection * getCollection()
Definition: CH_Channel.h:528
CH_ExprLanguage myExprLanguage
Definition: CH_Channel.h:155
fpreal getStart() const
Definition: CH_Channel.h:568
CH_API void CHmoveKeysWithDelta(CH_Channel *chp, const UT_FprealArray &orig_keys, fpreal old_accepted_dt, fpreal new_accepted_dt)
void stretch(fpreal xscale, fpreal yscale, bool accel_ratio)
CH_ValueTypes
Definition: CH_Types.h:73
int getNSegments() const
Definition: CH_Channel.h:921
void reverse()
CH_Segment * getFirstSegment() const
Definition: CH_Channel.h:705
fpreal64 fpreal
Definition: SYS_Types.h:277
CH_Manager * getManager() const
Definition: CH_Channel.h:267
#define CH_API
Definition: CH_API.h:10
const UT_StringHolder & getName() const
Definition: CH_Channel.h:245
CH_API void CHstretchSlopeAccel(fpreal xscale, fpreal yscale, fpreal &slope, fpreal &accel, bool accel_ratio)
void setAlias(const UT_StringHolder &s)
Definition: CH_Channel.h:265
void display() const
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition: glew.h:12681
const CH_Collection * getCollection() const
Definition: CH_Channel.h:527
bool isTimeDependent() const
Definition: CH_Channel.h:1275
fpreal getOutSlope() const
Definition: CH_Segment.h:281
void setDefaultString(const UT_StringHolder &dv)
Definition: CH_Channel.h:514
GLfloat v0
Definition: glew.h:1848
int getChanged() const
Definition: CH_Channel.h:547
fpreal getPendingEvalTime() const
Definition: CH_Channel.h:497
CH_SegmentScale
Definition: CH_Types.h:67
#define UT_SWAPPER_CLASS(T)
Definition: UT_Swap.h:60
fpreal getTolerance() const
Definition: CH_Channel.h:269
fpreal getOutAccel() const
Definition: CH_Segment.h:283
GLuint64EXT * result
Definition: glew.h:14007
fpreal getInAccel() const
Definition: CH_Segment.h:282
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
int getNKeys() const
Definition: CH_Channel.h:933
void getFullPath(UT_String &path) const
Definition: CH_Channel.h:254
CH_API char CHvalueNames[2][CH_NUM_VALUES]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition: glew.h:12681
GLubyte * pattern
Definition: glew.h:5711
static void getGlueSlope(fpreal *m0, fpreal *m1, fpreal *a0, fpreal *a1, int thread)
Definition: CH_Channel.h:1250
CH_ChannelBehavior getChannelLeftType() const
Definition: CH_Channel.h:521
vint4 min(const vint4 &a, const vint4 &b)
Definition: simd.h:4694
ConstIntervalIter(const CH_Channel &ch, const UT_SuperIntervalR &range, const bool ascending)
Definition: CH_Channel.h:1027
SYS_FORCE_INLINE bool isPendingHold() const
Definition: CH_Channel.h:500
GLsizei const GLfloat * value
Definition: glew.h:1849
unsigned int uint
Definition: SYS_Types.h:45
GLboolean enable
Definition: glew.h:2745
GLdouble GLdouble t
Definition: glew.h:1398
bool contains(T arg, T tol=T(SYS_FTOLERANCE)) const
GLfloat GLfloat v1
Definition: glew.h:1852
fpreal getTolerance() const
Definition: CH_Manager.h:1011
const CH_Channel * channel() const
fpreal getEnd() const
Definition: CH_Segment.h:316
GLenum GLsizei len
Definition: glew.h:7752
bool isEmpty() const
Returns true iff there are no occupied elements in the array.
Definition: UT_Array.h:462