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 { return myScope; }
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  // SEGMENT MANAGEMENT
692  bool isEmpty() const;
693  int getNSegments() const;
694  int getNKeys() const;
695  int getNKeysBefore( fpreal gtime ) const;
696  int getNKeysBeforeOrAt( fpreal gtime ) const;
697 
698  fpreal getKeyTime( unsigned idx ) const;
699 
700  unsigned getSegmentIdx(fpreal local_time) const;
701  CH_Segment *getSegment(unsigned idx) const;
702  CH_Segment *getSegment(fpreal local_time) const;
703 
704  CH_Segment *getNextSegment(unsigned idx) const; // Depends on behavior
705  CH_Segment *getPrevSegment(unsigned idx) const; // Depends on behavior
706 
708  {
709  // empty means no keys in the channel if user delete them
710  // all
711  UT_ASSERT_P( isEmpty() || myEndSegment );
712  return isEmpty()
713  ? 0 : getSegment( (unsigned)0 );
714  }
716  {
717  // empty means no keys in the channel if user delete them
718  // all
719  UT_ASSERT_P( isEmpty() || myEndSegment );
720 
721  // old behaviour maintained (ie. don't use end segment)
722  return isEmpty()
723  ? 0 : getSegment( (unsigned)mySegments.entries()-1 );
724  }
725 
726  int64 getMemoryUsage(bool inclusive) const;
727 
728  // The first method takes global time, the second, segment local time.
729  void changeSegLength (CH_Segment *seg, fpreal gtime,
731  bool adjust_and_update = true);
732 
733  bool getHaveCompiledExpressions() const;
734 
735  bool verify();
736  bool verify(bool verify_tied_values);
737 
738  // Snapshots or buffer curves.
739  // Create a deep copy of the channel data for fast modifications and revert workflow.
740  // It's more intuitive than to have to do multiple undo to get back to the previous
741  // keyframes.
742  void saveSnapshot();
743  void undoSnapshot(CH_Channel *previous, bool previousSnapshotCleared);
744  bool loadSnapshot();
745  bool swapSnapshot();
746  bool clearSnapshot();
747  CH_Channel* getSnapshotChannel();
748 
749 
750  void smoothAutoSlopes( CH_Segment *seg=NULL );
751 
752 
753  // Layer Scope Flag
754  void setLayerScope(bool on_off);
755  bool isLayerScoped() const { return myLayerScope; }
756 
757  // Set an array pointer to capture the copyRange actions
758  void setCaptureCopiedKeys( UT_Array<fpreal> *capture_array );
759 
760  // chkey version of putFullKey() doesn't do the same validations as putFullKey()
761  void putChFullKey( fpreal gtime, CH_FullKey const& key, bool accel_ratios = true );
762 
763  fpreal evaluateSegment(CH_Segment &eval, fpreal localtime,
764  bool extend, int thread);
765 
766  fpreal evaluateSegment(CH_Segment &eval, fpreal localtime, int thread);
767  fpreal evaluateSegment(CH_Segment *eval, fpreal localtime, int thread);
768 
769  fpreal evaluateSegmentExtend(CH_Segment *eval, fpreal localtime, int thread);
770  fpreal evaluateSegmentExtend(CH_Segment &eval, fpreal localtime, int thread);
771 
772 private:
773  CH_Channel( CH_Channel const& other ); // unimplemented
774 
775  void ensureEndSegmentCreated();
776  void updateEndSegment();
777  void destroyEndSegment();
778 
779  bool isTwoSegChannelTimeDep() const;
780 
781  template <typename T>
782  bool isTimeDependentSlowImpl(int thread) const;
783 
784  // TODO: Remove this. It's abysmally slow, doing a binary search each time
785  bool nextTimeInRange(UT_SuperIntervalR const& range,
786  fpreal &t, bool first) const;
787 
788  friend class CH_BatchModifyScope;
789 
790  void moveKeyInternal(fpreal old_gtime, fpreal new_gtime,
791  CH_BatchModifyScope &scope);
792  void splitSegment(fpreal gtime, bool accel_ratio = true);
793  void destroyKeyInternal(unsigned seg_i, CH_BatchModifyScope &scope);
794 
795  // cuts out a portion of a channel. Returns an index at which the cut began
796  int cutOut( fpreal from_gtime, fpreal to_gtime );
797 
798  CH_Segment *appendSegment(CH_Segment *seg);
799 
800  // remove and delete the segment
801  void deleteSegment(unsigned idx);
802 
803  int getNDisableSegments() const
804  { return myDisableSegments.entries(); }
805  CH_Segment *getDisableSegment(unsigned idx) const
806  {
807  return (idx < myDisableSegments.entries()) ?
808  myDisableSegments(idx) : 0;
809  }
810 
811  CH_Segment *getDisableSegmentForLocalTime(fpreal local_time) const;
812  CH_Segment *getPrevDisableSegment(CH_Segment *) const;
813  CH_Segment *getNextDisableSegment(CH_Segment *) const;
814 
815  int getDisableSegmentIndex(fpreal ltime, bool closest_prev) const;
816 
817  CH_Segment *getFirstDisableSegment() const
818  {
819  return (myDisableSegments.entries() > 0) ?
820  myDisableSegments(0) : 0;
821  }
822  CH_Segment *getLastDisableSegment() const
823  {
824  return (myDisableSegments.entries() > 0)
825  ? myDisableSegments(myDisableSegments.entries()-1)
826  : 0;
827  }
828  CH_Segment *appendDisableSegment(CH_Segment *seg);
829 
830  CH_Segment *insertDisableSegment(CH_Segment *seg);
831  CH_Segment *insertDisableSegment(CH_Segment *seg, int idx);
832  CH_Segment *insertDisableSegment(CH_Segment *seg, CH_Segment *before);
833 
834  // Remove but don't delete
835  void removeDisableSegment(CH_Segment *seg);
836  void removeDisableSegment(int idx);
837 
838  void deleteDisableSegment(CH_Segment *);
839  void deleteDisableSegment(int idx);
840 
841  void setPending( bool on_off, fpreal ltime );
842  void updatePendingStateToManager();
843 
844  void deNormalize(fpreal scale);
845 
846  int isCooking() const
847  {
848  return (myFlags & CH_CHANNEL_COOKING) != 0;
849  }
850  void setCooking(bool on_off)
851  {
852  if (on_off) myFlags |= CH_CHANNEL_COOKING;
853  else myFlags &= ~CH_CHANNEL_COOKING;
854  }
855 
856  void adjustSegments(int begin_i, int end_i,
857  CH_CHANGE_TYPE event_type);
858 
859  // Get Segment methods that can return disabled segments.
860  CH_Segment *getFirstSegment(bool no_disabling ) const;
861  CH_Segment *getLastSegment(bool no_disabling ) const;
862  CH_Segment *getEndSegment(bool no_disabling ) const;
863  CH_Segment *getSegment(bool no_disabling, fpreal ltime ) const;
864 
865  enum chGetOrSampleReturn
866  {
867  Sampled, Get, FirstLast
868  };
869  chGetOrSampleReturn getOrSampleKey( fpreal ltime, CH_Key &key, bool accel_ratio, int thread );
870 
871 private: // data
872 
873  CH_Collection *myParent; // Who I belong to
874  UT_StringHolder myName;
875  UT_StringHolder myAlias;
876 
877  CH_ChannelBehavior myLeftType; // Type of channel
878  CH_ChannelBehavior myRightType; // Type of channel
879  CH_Segment *myEndSegment;
880 
881  fpreal myDefValue; // Default/Pending value
882  fpreal myStart; // Start time of channel
883  fpreal myLength; // Kept for efficiency (local)
884 
885  UT_StringHolder myDefString; // Default/Pending string value
886 
887  UT_ValArray<CH_Segment *> mySegments; // Array of segments
888  UT_ValArray<CH_Segment *> myDisableSegments;
889 
890  fpreal myPendingEvalTime;
891  CH_Channel *mySnapshot;
892  UT_Array<fpreal> *myCaptureCopiedKeys;
893 
894  unsigned char myFlags;
895  bool myPending;
896  bool myPendingHold;
897  bool myScope;
898  bool myLayerScope;
899  bool myIsTemporary;
900  bool myDoingChKey;
901  bool mySnapshotCleared;
902 
903 };
904 
906 
907 inline CH_Segment *
908 CH_Channel::getSegment(unsigned idx) const
909 {
910  if( idx<mySegments.entries() )
911  return mySegments(idx);
912  if( idx==(unsigned)-1 || idx==mySegments.entries() )
913  {
914  UT_ASSERT(myEndSegment || mySegments.entries() == 0);
915  return myEndSegment;
916  }
917  UT_ASSERT( false );
918  return NULL;
919 }
920 
921 inline int
923 {
924  return myEndSegment ? 1 + mySegments.entries() : 0;
925 }
926 
927 inline bool
929 {
930  return mySegments.isEmpty() && !myEndSegment;
931 }
932 
933 inline int
935 {
936  return getNSegments();
937 }
938 
939 inline fpreal
940 CH_Channel::getKeyTime( unsigned idx ) const
941 {
942  CH_Segment *segp;
943  if( idx == mySegments.entries() )
944  {
945  segp = myEndSegment;
946  UT_ASSERT( segp );
947  return globalTime( segp->getStart() );
948  }
949  segp = getSegment( idx );
950  UT_ASSERT( segp );
951  return globalTime( segp->getStart() );
952 }
953 
954 inline bool
956 {
957  return getNSegments() == 1;
958 }
959 
960 inline bool
962 {
963  // NB: This is actually slightly weaker than PRM_Float::isRotationParm()
964  return myName == "rx" || myName == "ry" || myName == "rz";
965 }
966 
967 
968 /// Const iterator over an interval
970 {
971 public:
973  : myChannel(NULL)
974  , myI(-1)
975  , myTol(0.0)
976  {
977  }
978 
980  {
981  ++myI;
982  return *this;
983  }
985  {
986  --myI;
987  return *this;
988  }
989 
990  bool atEnd() const
991  {
992  if (myI >= myChannel->getNSegments())
993  return true;
994  fpreal lt = localTime();
995  return !(myRange.myMaxInclusive ?
996  SYSisLessOrEqual(lt, myRange.max, myTol)
997  : SYSisLess(lt, myRange.max, myTol));
998  }
999  bool atPre() const
1000  {
1001  if (myI < 0)
1002  return true;
1003  fpreal lt = localTime();
1004  return !(myRange.myMinInclusive ?
1005  SYSisGreaterOrEqual(lt, myRange.min, myTol)
1006  : SYSisGreater(lt, myRange.min, myTol));
1007  }
1008 
1009  unsigned index() const
1010  {
1011  return (unsigned)myI;
1012  }
1013 
1014  const CH_Segment &segment() const
1015  {
1016  return *(myChannel->getSegment((unsigned)myI));
1017  }
1018 
1019  // Local time at start of segment
1021  {
1022  return myChannel->getSegment((unsigned)myI)->getStart();
1023  }
1024 
1025  fpreal operator*() const { return myChannel->globalTime(localTime()); }
1026 
1027 protected:
1029  const CH_Channel &ch, const UT_SuperIntervalR &range,
1030  const bool ascending)
1031  : myChannel(&ch)
1032  , myRange(range)
1033  , myTol(ch.getTolerance())
1034  {
1035  myRange.min = ch.localTime(myRange.min);
1036  myRange.max = ch.localTime(myRange.max);
1037  UT_ASSERT(myRange.min <= myRange.max);
1038  if (ascending)
1039  {
1040  // If myRange.min is less than the first segment's start time, then
1041  // the first segment is returned by getSegmentIdx().
1042  myI = ch.getSegmentIdx(myRange.min);
1043  CH_Segment *seg = ch.getSegment((unsigned)myI);
1044  if (seg)
1045  {
1046  fpreal lt = seg->getStart();
1047  if (range.myMinInclusive)
1048  {
1049  if (SYSisLess(lt, myRange.min, myTol))
1050  ++myI;
1051  }
1052  else
1053  {
1054  if (SYSisLessOrEqual(lt, myRange.min, myTol))
1055  ++myI;
1056  }
1057  }
1058  else
1059  {
1060  myI = ch.getNSegments();
1061  }
1062  UT_ASSERT(atEnd() || myRange.contains(localTime(), myTol));
1063  }
1064  else // descending
1065  {
1066  myI = ch.getSegmentIdx(myRange.max);
1067  CH_Segment *seg = ch.getSegment((unsigned)myI);
1068  if (seg)
1069  {
1070  fpreal lt = seg->getStart();
1071  if (range.myMaxInclusive)
1072  {
1073  if (SYSisGreater(lt, myRange.max, myTol))
1074  --myI;
1075  }
1076  else
1077  {
1078  if (SYSisGreaterOrEqual(lt, myRange.max, myTol))
1079  --myI;
1080  }
1081  }
1082  else
1083  {
1084  myI = -1;
1085  }
1086  UT_ASSERT(atPre() || myRange.contains(localTime(), myTol));
1087  }
1088  }
1089 
1090 private:
1091  const CH_Channel * myChannel;
1092  UT_SuperIntervalR myRange;
1093  int myI;
1094  fpreal myTol;
1095 
1096  friend class CH_Channel;
1097 };
1098 
1099 /// Iterator over an interval
1101 {
1102 public:
1104  : ConstIntervalIter()
1105  {
1106  }
1107 
1109  {
1110  return const_cast<CH_Segment &>(ConstIntervalIter::segment());
1111  }
1112 
1114  {
1116  return *this;
1117  }
1119  {
1121  return *this;
1122  }
1123 
1124 protected:
1126  const CH_Channel &ch, const UT_SuperIntervalR &range, bool reverse)
1127  : ConstIntervalIter(ch, range, reverse)
1128  {
1129  }
1130 
1131 private:
1132 
1133  friend class CH_Channel;
1134 };
1135 
1138  const UT_SuperIntervalR & range, const bool ascending) const
1139 {
1140  return IntervalIter(*this, range, ascending);
1141 }
1144  const UT_SuperIntervalR & range, const bool ascending) const
1145 {
1146  return ConstIntervalIter(*this, range, ascending);
1147 }
1148 
1149 /// This function stretches the modifies the given slope and accel values
1150 /// according to the given factors. If the accel value is given as a ratio,
1151 /// then accel_ratio should be true.
1152 CH_API extern void
1153 CHstretchSlopeAccel(fpreal xscale, fpreal yscale, fpreal &slope, fpreal &accel,
1154  bool accel_ratio);
1155 
1156 // this will move attempted_dt towards accepted_dt so that:
1157 // keys[i]+attempted_dt does not land on another key
1158 // attempted_dt stays on the same side of accepted_dt as it started
1159 // (so that if you're moving one way, they don't snap backwards before
1160 // where they started)
1161 // if snap_to_frame, attempted_dt+base_time will land on a frame
1162 CH_API extern void
1163 CHfindMoveKeysDelta( const CH_Channel *chp, bool snap_to_frame, fpreal base_time,
1164  const UT_FprealArray &sorted_orig_keys,
1165  fpreal accepted_dt, fpreal &attempted_dt );
1166 
1167 CH_API extern void
1168 CHmoveKeysWithDelta( CH_Channel *chp, const UT_FprealArray &orig_keys,
1169  fpreal old_accepted_dt, fpreal new_accepted_dt );
1170 
1171 // Move a list of keys using a list of time offset and value offsets.
1172 CH_API extern void
1173 CHmoveKeysWithDeltas( CH_Channel *chp, const UT_FprealArray &orig_keys,
1174  const UT_FprealArray &time_offsets,
1175  const UT_FprealArray &value_offsets );
1176 
1177 ///////////////////////////////////////////////////////////////////////////////
1178 //
1179 // Inline Implementations
1180 //
1181 
1182 /*static*/ inline fpreal
1184 {
1185  const CH_EvalContext & ctx = CHgetManager()->evalContext(thread);
1186  const CH_Channel * eval_channel = ctx.channel();
1187  const CH_Segment * segp = ctx.segment();
1188 
1189  if (segp)
1190  {
1191  if (eval_channel->isPending(ctx.time()))
1192  return eval_channel->getDefaultValue();
1193  else
1194  return segp->getInValue();
1195  }
1196 
1197  return 0.0f;
1198 }
1199 
1200 /*static*/ inline void
1202  fpreal &v0, fpreal &v1, int thread)
1203 {
1204  CH_Manager & mgr = *CHgetManager();
1205  CH_EvalContext & ctx = mgr.evalContext(thread);
1206  const CH_Channel * eval_channel = ctx.channel();
1207  const CH_Segment * segp = ctx.segment();
1208 
1209  if (eval_channel)
1210  {
1211  t = eval_channel->localTime(ctx.time());
1212  if (segp)
1213  {
1214  t0 = segp->getStart();
1215  t1 = segp->getEnd();
1216  if( eval_channel->isPendingLocal(t) )
1217  {
1218  v0 = v1 = eval_channel->getDefaultValue();
1219  t0 = t1 = t;
1220  }
1221  else
1222  {
1223  v0 = segp->getInValue();
1224  v1 = segp->getOutValue();
1225  if( segp->isEndSegment() )
1226  {
1227  // Since our segment length is zero, we want fake it so
1228  // that it uses either the in or out values because most
1229  // existing expression functions will take the average of
1230  // them when encountering a zero length segement.
1231  // NB: the in/out values are swapped on end segments.
1232  if (SYSisGreaterOrEqual(t, t0, mgr.getTolerance()))
1233  v1 = v0;
1234  else
1235  v0 = v1;
1236  }
1237  }
1238  }
1239  else
1240  {
1241  t0 = eval_channel->getStart();
1242  t1 = eval_channel->getEnd();
1243  v0 = v1 = 0;
1244  }
1245  }
1246  else
1247  {
1248  t = 0.0f;
1249  t0 = 0.0f;
1250  t1 = 0.0f;
1251  v0 = 0.0f;
1252  v1 = 0.0f;
1253  }
1254 }
1255 
1256 /*static*/ inline void
1258  int thread)
1259 {
1260  CH_EvalContext & ctx = CHgetManager()->evalContext(thread);
1261  const CH_Segment * segp = ctx.segment();
1262 
1263  if (segp)
1264  {
1265  if (m0) *m0 = segp->getInSlope();
1266  if (m1) *m1 = segp->getOutSlope();
1267  if (a0) *a0 = segp->getInAccel();
1268  if (a1) *a1 = segp->getOutAccel();
1269  }
1270  else
1271  {
1272  if (m0) *m0 = 0.0f;
1273  if (m1) *m1 = 0.0f;
1274  if (a0) *a0 = 0.0f;
1275  if (a1) *a1 = 0.0f;
1276  }
1277 }
1278 
1279 // this returns if the channel is time dependent without evaluating
1280 // the channel
1281 inline bool
1283 {
1284  const int nsegs = getNSegments();
1285 
1286  if (nsegs == 0)
1287  return false;
1288 
1289  if (nsegs == 1)
1290  return getSegment(0U)->isTimeDependent();
1291 
1292  if (nsegs == 2)
1293  return isTwoSegChannelTimeDep();
1294 
1295  // Else, assume time dependent when more than 1 segment
1296  UT_ASSERT_P(nsegs > 1);
1297  return true;
1298 }
1299 
1300 
1301 // UTformat support.
1302 static inline size_t
1303 format(char *buffer, size_t buffer_size, const CH_Channel &v)
1304 {
1305  UT_String s;
1306  v.getFullPath(s);
1307  if (!buffer)
1308  return s.length();
1309  else
1310  {
1311  size_t len = std::min(size_t(s.length()), buffer_size);
1312  ::memcpy(buffer, s.c_str(), len);
1313  return len;
1314  }
1315 }
1316 
1317 #endif // __CH_Channel_h__
const UT_StringHolder & getAlias() const
Definition: CH_Channel.h:247
Iterator over an interval.
Definition: CH_Channel.h:1100
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:1201
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:404
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:1137
GLint left
Definition: glcorearb.h:2004
CH_Key()
Definition: CH_Channel.h:112
Const iterator over an interval.
Definition: CH_Channel.h:969
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
fpreal globalTime(fpreal t) const
Definition: CH_Channel.h:567
const GLuint GLenum const void * binary
Definition: glcorearb.h:1923
void getFullPath(UT_StringHolder &path) const
Definition: CH_Channel.h:259
bool isRotationChannel() const
Definition: CH_Channel.h:961
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
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:928
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
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition: glew.h:12900
const CH_Segment & segment() const
Definition: CH_Channel.h:1014
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:785
CH_Segment & segment() const
Definition: CH_Channel.h:1108
GLenum src
Definition: glcorearb.h:1792
GLdouble GLdouble t
Definition: glew.h:1403
bool isLayerScoped() const
Definition: CH_Channel.h:755
GLuint buffer
Definition: glcorearb.h:659
fpreal getInSlope() const
Definition: CH_Segment.h:280
const CH_EvalContext & evalContext(int thread) const
Definition: CH_Manager.h:1206
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:955
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:1183
IntervalIter & operator--()
Definition: CH_Channel.h:1118
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:1143
ConstIntervalIter & operator--()
Definition: CH_Channel.h:984
GLuint64EXT * result
Definition: glew.h:14311
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
UT_String myRevExpression
Definition: CH_Channel.h:174
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
CH_ChannelBehavior
Definition: CH_Channel.h:55
CH_CHANGE_TYPE
CH_Manager * CHgetManager()
Definition: CH_Manager.h:1758
ConstIntervalIter & operator++()
Definition: CH_Channel.h:979
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:123
fpreal getLength() const
Definition: CH_Channel.h:572
GLenum GLsizei len
Definition: glew.h:7782
#define UT_ASSERT_P(ZZ)
Definition: UT_Assert.h:170
fpreal getStart() const
Definition: CH_Segment.h:315
bool getLocked() const
Definition: CH_Channel.h:545
const GLdouble * v
Definition: glcorearb.h:836
UT_String myExpression
Definition: CH_Channel.h:155
void display() const
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1221
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
fpreal getKeyTime(unsigned idx) const
Definition: CH_Channel.h:940
fpreal myTimeValue
Definition: CH_Channel.h:108
void setDefaultValue(fpreal dv)
Definition: CH_Channel.h:513
bool isScoped() const
Definition: CH_Channel.h:595
IntervalIter(const CH_Channel &ch, const UT_SuperIntervalR &range, bool reverse)
Definition: CH_Channel.h:1125
CH_Segment * getLastSegment() const
Definition: CH_Channel.h:715
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:908
GLfloat v0
Definition: glcorearb.h:815
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:1113
GLdouble n
Definition: glcorearb.h:2007
void setChangeActive(int state)
Definition: CH_Channel.h:536
exint entries() const
Alias of size(). size() is preferred.
Definition: UT_Array.h:481
GLubyte * pattern
Definition: glew.h:5741
SYS_FORCE_INLINE bool isPending() const
Definition: CH_Channel.h:492
GLboolean * data
Definition: glcorearb.h:130
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:107
GLuint GLfloat * val
Definition: glcorearb.h:1607
**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:922
void reverse()
CH_Segment * getFirstSegment() const
Definition: CH_Channel.h:707
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:1282
fpreal getOutSlope() const
Definition: CH_Segment.h:281
void setDefaultString(const UT_StringHolder &dv)
Definition: CH_Channel.h:516
GLsizei const GLfloat * value
Definition: glcorearb.h:823
int getChanged() const
Definition: CH_Channel.h:549
GLfloat f
Definition: glcorearb.h:1925
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:1924
fpreal getOutAccel() const
Definition: CH_Segment.h:283
fpreal getInAccel() const
Definition: CH_Segment.h:282
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:171
int getNKeys() const
Definition: CH_Channel.h:934
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:816
static void getGlueSlope(fpreal *m0, fpreal *m1, fpreal *a0, fpreal *a1, int thread)
Definition: CH_Channel.h:1257
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:1028
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:1011
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:483