12 #ifndef __CH_Channel_h__
13 #define __CH_Channel_h__
45 class CH_BatchModifyScope;
114 void display()
const;
134 bool accel_ratio = true );
137 bool accel_ratio =
true )
const;
139 void stretch(
fpreal xscale,
fpreal yscale,
bool accel_ratio );
141 void changeAccelsToRatios(
fpreal left_seg_len,
fpreal right_seg_len );
145 void opscript( std::ostream &os,
bool use_time,
146 bool only_valid=
true )
const;
148 bool verify(
bool check_tied_slopes=
true )
const;
160 myUseExpression =
false;
179 myUseRevExpression =
false;
205 bool end() {
return noMoreChannels; }
231 const char *default_string = 0);
236 void initializeFirstSegment(
const char *expr,
240 void initializeSegmentParents();
249 if (myAlias.isstring())
257 getCollection()->getFullPath(
this, path);
261 getCollection()->getFullPath(
this, path);
271 {
return getManager()->getTolerance(); }
275 bool isTimeDependent()
const;
279 bool isTimeDependentSlow(
int thread)
const;
280 bool isStringTimeDependentSlow(
int thread)
const;
282 bool hasNonIntegerKeys()
const;
283 bool isDataDependent(
fpreal gtime)
const;
286 bool hasOnlyOneSegment()
const;
288 bool isRotationChannel()
const;
291 bool getSurroundingSegs(
fpreal gtime,
299 bool isAtKey(
fpreal gtime)
const;
303 bool isAtHardKey(
fpreal gtime)
const;
304 bool isAtHardKeyframe(
int frame)
const;
307 int findKeyframe(
int frame,
int direction)
const;
318 const bool ascending=
true)
const;
321 const bool ascending=
true)
const;
333 bool accel_ratios =
true,
337 bool accel_ratios =
true,
342 bool accel_ratios =
true );
344 bool accel_ratios =
true );
346 void transferKey(
fpreal to_time,
350 void applyDefaultSlopeToKey(
CH_Key &key );
353 void insertKeyFrame(
fpreal global_t,
bool use_auto_slope_pref=
true);
356 void destroyKeyFrame(
fpreal global_t);
360 void moveKeyFrame(
fpreal old_gtime,
fpreal new_gtime );
362 void saveKeyFrameForUndo(
fpreal global_t );
374 bool set_pending =
false,
375 bool commit_keys =
true,
376 bool propagate =
true);
378 bool set_pending =
false,
379 bool commit_keys =
true,
380 bool propagate =
true);
383 bool set_pending =
false,
384 bool commit_keys =
true,
385 bool propagate =
true);
393 bool error_frames_only );
399 bool error_frames_only );
403 int minframe,
int maxframe);
407 const char *getExpression(
fpreal gtime )
const;
408 bool changeExpression(
fpreal gtime,
411 bool convert_accels );
424 void clearSegments();
431 void deleteKeys(
const UT_IntArray &ascending_sorted_key_indices);
433 void moveFrames(
const UT_IntArray &frames,
int amount);
472 std::ostream *os=0 );
475 void scroll (
fpreal newStart,
bool update =
true);
479 bool increaseKeyValues(
fpreal delta );
482 bool isAllDisabled()
const;
483 bool isAllEnabled()
const;
484 bool isDisabled(
fpreal gtime)
const;
485 void disableAll(
fpreal gtime);
493 {
return myPending; }
494 bool isPending(
fpreal gtime)
const;
495 bool isPendingLocal(
fpreal ltime)
const;
497 void updatePending(
fpreal gtime );
499 {
return globalTime(myPendingEvalTime); }
502 {
return myPendingHold; }
503 void setPendingHold(
bool state );
506 void save(std::ostream &os,
bool binary,
bool compiled,
507 bool pending_state)
const;
508 template <
typename FPREAL_TYPE>
510 void display()
const;
511 void displayAsKeys()
const;
517 { myDefString = dv; }
547 void setLocked(
bool f);
551 void setChanged(
bool on,
553 void dirtyExprCache();
558 return myParent->canAccessChannel(mask,
this);
575 void unresolveLocalVars(
int thread);
578 void buildOpDependencies(
void *ref_id,
int thread);
579 void changeOpRef(
const char *new_fullpath,
580 const char *old_fullpath,
582 const char *chan_name,
583 const char *old_chan_name,
587 void cook(
int state);
594 void setScope(
bool on_off);
595 bool isScoped()
const;
604 bool no_disabling,
bool use_cache,
int thread);
609 fpreal localtime,
bool extend,
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 ,
622 static inline void getGlueTime(
625 static inline void getGlueSlope(
632 return getManager()->evalContext(thread).segment();
636 return getManager()->evalContext(thread).segment();
652 int match(
const char *
pattern)
const;
677 bool preserveExtrema,
679 bool delete_old_segments =
false);
686 void refit(
fpreal tolerance,
bool preserveExtrema );
687 void refit(
fpreal tolerance,
bool preserveExtrema,
689 bool delete_old_segments);
704 bool setKeys(
fpreal *new_key_values,
int num_keys,
706 bool smooth_slopes =
true,
707 bool clear =
false,
bool notify =
true);
710 bool isEmpty()
const;
711 int getNSegments()
const;
712 int getNKeys()
const;
713 int getNKeysBefore(
fpreal gtime )
const;
714 int getNKeysBeforeOrAt(
fpreal gtime )
const;
716 fpreal getKeyTime(
unsigned idx )
const;
718 unsigned getSegmentIdx(
fpreal local_time)
const;
722 CH_Segment *getNextSegment(
unsigned idx)
const;
723 CH_Segment *getPrevSegment(
unsigned idx)
const;
731 ? 0 : getSegment( (
unsigned)0 );
741 ? 0 : getSegment( (
unsigned)mySegments.entries()-1 );
744 int64 getMemoryUsage(
bool inclusive)
const;
749 bool adjust_and_update =
true);
751 bool getHaveCompiledExpressions()
const;
754 bool verify(
bool verify_tied_values);
761 void undoSnapshot(
CH_Channel *previous,
bool previousSnapshotCleared);
764 bool clearSnapshot();
782 void smoothAutoSlopesForSegments(
787 bool smooth_surrounding_segments =
false);
789 void smoothAutoSlopes(
CH_Segment *seg=NULL );
793 void setLayerScope(
bool on_off);
794 bool isLayerScoped()
const;
800 void putChFullKey(
fpreal gtime,
CH_FullKey const& key,
bool accel_ratios =
true );
814 void ensureEndSegmentCreated();
815 void updateEndSegment();
816 void destroyEndSegment();
818 bool isTwoSegChannelTimeDep()
const;
820 template <
typename T>
821 bool isTimeDependentSlowImpl(
int thread)
const;
827 friend class CH_BatchModifyScope;
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);
840 void deleteSegment(
unsigned idx);
842 int getNDisableSegments()
const
843 {
return myDisableSegments.entries(); }
844 CH_Segment *getDisableSegment(
unsigned idx)
const
846 return (idx < myDisableSegments.entries()) ?
847 myDisableSegments(idx) : 0;
854 int getDisableSegmentIndex(
fpreal ltime,
bool closest_prev)
const;
858 return (myDisableSegments.entries() > 0) ?
859 myDisableSegments(0) : 0;
863 return (myDisableSegments.entries() > 0)
864 ? myDisableSegments(myDisableSegments.entries()-1)
875 void removeDisableSegment(
int idx);
878 void deleteDisableSegment(
int idx);
880 void setPending(
bool on_off,
fpreal ltime );
881 void updatePendingStateToManager();
885 int isCooking()
const
889 void setCooking(
bool on_off)
895 void adjustSegments(
int begin_i,
int end_i,
899 CH_Segment *getFirstSegment(
bool no_disabling )
const;
900 CH_Segment *getLastSegment(
bool no_disabling )
const;
901 CH_Segment *getEndSegment(
bool no_disabling )
const;
904 enum chGetOrSampleReturn
906 Sampled, Get, FirstLast
908 chGetOrSampleReturn getOrSampleKey(
fpreal ltime,
CH_Key &key,
bool accel_ratio,
int thread );
919 bool setAllKeys(
fpreal *new_key_values,
int num_keys,
921 bool smooth_slopes,
bool notify);
946 unsigned char myFlags;
953 bool mySnapshotCleared;
962 if( idx<mySegments.entries() )
963 return mySegments(idx);
964 if( idx==(
unsigned)-1 || idx==mySegments.entries() )
966 UT_ASSERT(myEndSegment || mySegments.entries() == 0);
976 return myEndSegment ? 1 + mySegments.
entries() : 0;
982 return mySegments.
isEmpty() && !myEndSegment;
995 if( idx == mySegments.
entries() )
1016 return myName ==
"rx" || myName ==
"ry" || myName ==
"rz";
1048 SYSisLessOrEqual(lt, myRange.
max, myTol)
1049 : SYSisLess(lt, myRange.
max, myTol));
1057 SYSisGreaterOrEqual(lt, myRange.
min, myTol)
1058 : SYSisGreater(lt, myRange.
min, myTol));
1063 return (
unsigned)myI;
1068 return *(myChannel->
getSegment((
unsigned)myI));
1082 const bool ascending)
1101 if (SYSisLess(lt, myRange.
min, myTol))
1106 if (SYSisLessOrEqual(lt, myRange.
min, myTol))
1125 if (SYSisGreater(lt, myRange.
max, myTol))
1130 if (SYSisGreaterOrEqual(lt, myRange.
max, myTol))
1294 t1 = eval_channel->
getEnd();
1345 return isTwoSegChannelTimeDep();
1354 static inline size_t
1369 #endif // __CH_Channel_h__
const UT_StringHolder & getAlias() const
Iterator over an interval.
CH_ExprLanguage myRevExprLanguage
fpreal localTime(fpreal t) const
CH_ChannelBehavior getChannelRightType() const
unsigned getSegmentIdx(fpreal local_time) const
GLenum GLenum GLenum GLenum GLenum scale
static void getGlueTime(fpreal &t, fpreal &t0, fpreal &t1, fpreal &v0, fpreal &v1, int thread)
GA_API const UT_StringHolder accel
const UT_StringHolder & getDefaultString() const
CH_Segment * getEvaluationSegment(int thread)
bool isEndSegment() const
IntervalIter intervalIter(const UT_SuperIntervalR &range, const bool ascending=true) const
Const iterator over an interval.
GT_API const UT_StringHolder time
IMF_EXPORT IMATH_NAMESPACE::V3f direction(const IMATH_NAMESPACE::Box2i &dataWindow, const IMATH_NAMESPACE::V2f &pixelPosition)
fpreal globalTime(fpreal t) const
const GLuint GLenum const void * binary
void getFullPath(UT_StringHolder &path) const
bool isRotationChannel() const
GLsizei const GLchar *const * path
const CH_Segment * segment() const
void reverse(I begin, I end)
void swap(T &lhs, T &rhs)
void setIsTemporary(bool temp)
fpreal getInValue() const
CH_FullKey & operator=(CH_FullKey const &other)
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
const CH_Segment & segment() const
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
CH_Segment & segment() const
fpreal getInSlope() const
const CH_EvalContext & evalContext(int thread) const
fpreal getOutValue() const
const char * c_str() const
bool isChangeActive() const
class CH_API IntervalIter
bool hasOnlyOneSegment() const
unsigned length() const
Return length of string.
bool isTimeDependent() const
int canAccess(uint mask) const
static fpreal getGlueIV(int thread)
IntervalIter & operator--()
bool isPendingLocal(fpreal ltime) const
fpreal getDefaultValue() const
class CH_API ConstIntervalIter
ConstIntervalIter constIntervalIter(const UT_SuperIntervalR &range, const bool ascending=true) const
ConstIntervalIter & operator--()
UT_String myRevExpression
CH_Manager * CHgetManager()
ConstIntervalIter & operator++()
void setCollection(CH_Collection *chp)
const CH_Segment * getEvaluationSegment(int thread) const
GLboolean GLboolean GLboolean GLboolean a
fpreal getKeyTime(unsigned idx) const
void setDefaultValue(fpreal dv)
IntervalIter(const CH_Channel &ch, const UT_SuperIntervalR &range, bool reverse)
CH_Segment * getLastSegment() const
HUSD_API bool eval(VtValue &val, T &ret_val)
CH_Segment * getSegment(unsigned idx) const
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)
IntervalIter & operator++()
void setChangeActive(int state)
exint entries() const
Alias of size(). size() is preferred.
SYS_FORCE_INLINE bool isPending() const
CH_Collection * getCollection()
CH_ExprLanguage myExprLanguage
GLint GLint GLsizei GLint GLenum format
**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
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_Segment * getFirstSegment() const
CH_Manager * getManager() const
const UT_StringHolder & getName() const
CH_API void CHstretchSlopeAccel(fpreal xscale, fpreal yscale, fpreal &slope, fpreal &accel, bool accel_ratio)
void setAlias(const UT_StringHolder &s)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
const CH_Collection * getCollection() const
bool isTimeDependent() const
fpreal getOutSlope() const
void setDefaultString(const UT_StringHolder &dv)
fpreal getPendingEvalTime() const
#define UT_SWAPPER_CLASS(T)
fpreal getTolerance() const
fpreal getOutAccel() const
fpreal getInAccel() const
void getFullPath(UT_String &path) const
CH_API char CHvalueNames[2][CH_NUM_VALUES]
static void getGlueSlope(fpreal *m0, fpreal *m1, fpreal *a0, fpreal *a1, int thread)
CH_ChannelBehavior getChannelLeftType() const
ConstIntervalIter(const CH_Channel &ch, const UT_SuperIntervalR &range, const bool ascending)
SYS_FORCE_INLINE bool isPendingHold() const
bool contains(T arg, T tol=T(SYS_FTOLERANCE)) const
fpreal getTolerance() const
const CH_Channel * channel() const
bool isEmpty() const
Returns true iff there are no occupied elements in the array.
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.