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