HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CH_Manager.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: CH library (C++)
7  *
8  * COMMENTS: Manager of all channels for a world.
9  *
10  */
11 
12 #ifndef __CH_Manager_h__
13 #define __CH_Manager_h__
14 
15 #include "CH_API.h"
16 #include "CH_Bookmark.h"
17 #include "CH_ChannelRef.h"
18 #include "CH_EvalContextFwd.h"
19 #include "CH_ExprLanguage.h"
20 #include "CH_KeyState.h"
21 #include "CH_Tweener.h"
22 #include "CH_Types.h"
23 
25 #include <DEP/DEP_MicroNode.h>
26 #include <UT/UT_Assert.h>
27 #include <UT/UT_Color.h>
28 #include <UT/UT_Function.h>
29 #include <UT/UT_IntArray.h>
30 #include <UT/UT_Lock.h>
31 #include <UT/UT_Map.h>
32 #include <UT/UT_NonCopyable.h>
33 #include <UT/UT_ScopeExit.h>
34 #include <UT/UT_Set.h>
35 #include <UT/UT_SharedPtr.h>
36 #include <UT/UT_String.h>
37 #include <UT/UT_StringArray.h>
38 #include <UT/UT_StringMap.h>
39 #include <UT/UT_SuperInterval.h>
40 #include <UT/UT_TBBSpinLock.h>
41 #include <UT/UT_Thread.h>
43 #include <UT/UT_UniquePtr.h>
44 #include <UT/UT_ValArray.h>
45 #include <SYS/SYS_Floor.h>
46 #include <SYS/SYS_Hash.h>
47 #include <SYS/SYS_Inline.h>
48 #include <SYS/SYS_Math.h>
49 #include <SYS/SYS_Types.h>
50 #include <iosfwd>
51 
52 enum class CH_BookmarkEvent;
53 class CH_Channel;
54 class CH_ChannelRef;
55 class CH_Collection;
56 class CH_ExprDefine;
57 class CH_Group;
58 class CH_LocalVariable;
59 class CH_Manager;
60 class CH_Bookmark;
61 class chParamData;
62 class CH_ScopedChannels;
63 class CH_ScriptAccessManager;
64 class CH_Segment;
65 class CH_TimeGroup;
66 class CH_ScopeUndo;
67 class CH_UndoScopeChannels;
68 class UT_JSONParser;
69 class UT_JSONWriter;
70 class UT_WorkBuffer;
71 
72 typedef bool (*CH_StringVarEvalFunc)(UT_String &val, int varid, int thread);
73 typedef bool (*CH_FloatVarEvalFunc)(fpreal &val, int varid, int thread);
74 typedef bool (*CH_IntVarEvalFunc)(int &val, int varid, int thread);
77 
79 {
80 public:
84 
85  virtual UT_Color getChannelColor(const CH_Channel *channel) = 0;
86  virtual UT_Color getChannelColor(const CH_ChannelRef &channel_ref) = 0;
87 };
88 
90 {
91 public:
93  virtual ~CH_ChannelChanged(){}
94  UT_NON_COPYABLE(CH_ChannelChanged)
95 
96  virtual void changed() = 0;
97 };
98 
100 {
101 public:
108 };
109 
110 // CH_ScopedChannelsBase holds the scope/display/layer/pinned flags
111 // for all the channels.
113 {
114 public:
116 
117  // these next two methods can be used to manipulate channel scope state
118  // using the full path of the channel. The correct behaviour will take
119  // place if the channel doesn't yet exist and so forth.
120  bool scopeChannelInternal(const CH_Channel *chp, bool on_off);
121  bool scopeChannelInternal(const CH_ChannelRef &chref, bool on_off);
122  void scopeChannel(const CH_ChannelRef &chref, bool on_off);
123  void scopeChannel(const char *full_chan_path, bool on_off);
124  void unscopeChannelsWithNodeId(int node_id, bool force=false);
125 
126  // this function should only be used by CH_Channel, CH_Collection, and here
127  void scopeChanged( unsigned flags, bool propagate=true );
128  void scopeChanged(unsigned flags, bool propagate,
129  const int &reason);
130 
131  // these functions can be used by anyone
132  bool isChannelScoped(CH_Channel *chp) const;
133  bool isChannelScoped(const char *full_chan_path) const;
134  bool isChannelScoped(const CH_ChannelRef &chref) const;
135 
136  //
137  // Displayed Channels (within the scoped channels)
138  //
139  bool isChannelDisplayed(CH_Channel *chp) const;
140  bool isChannelDisplayed( const CH_ChannelRef &chref ) const;
141  bool isChannelDisplayed( const char *full_chan_path ) const;
142  void clearDisplayedChannels( bool propagate = true );
143  void displayAllScopedChannels( bool propagate = true );
144  void displaySelectedScopedChannels( bool propagate = true );
145 
146  void displayChannel( const CH_ChannelRef &chref,
147  bool propagate = true );
148  void displayChannel( const char *full_chan_path,
149  bool propagate = true );
150  void undisplayChannel( const CH_ChannelRef &chref,
151  bool propagate = true );
152  void undisplayChannel( const char *full_chan_path,
153  bool propagate = true );
154  void undisplayChannelsWithNodeId(int node_id, bool force=false);
155  //
156  // Selected Channels (within the scoped channels)
157  //
158  bool isChannelSelected( const CH_ChannelRef &chref ) const;
159  bool isChannelSelected( const char *full_chan_path ) const;
160  void clearSelectedChannels( bool propagate = true );
161  void selectAllScopedChannels(bool propagate = true );
162 
163  void selectChannel( const CH_ChannelRef &chref,
164  bool propagate = true );
165  void selectChannel( const char *full_chan_path,
166  bool propagate = true );
167  void deselectChannel( const CH_ChannelRef &chref,
168  bool propagate = true );
169  void deselectChannel( const char *full_chan_path,
170  bool propagate = true );
171 
172  //
173  // Pinned Channels (within the scoped channels)
174  //
175  void togglePinAllScopedChannels();
176  void togglePinScopedChannels( const CH_ChannelRefList &chanrefs );
177  void pinAllScopedChannels( bool propagate = true );
178  void unpinAllScopedChannels( bool propagate = true );
179  void pinSelectedChannels( bool propagate = true,
180  int operate_on = CH_SELECTED );
181  void unpinSelectedChannels( bool propagate = true,
182  int operate_on = CH_SELECTED );
183  void pinChannels( const CH_ChannelRefList &chanrefs,
184  bool propagate = true );
185  void unpinChannels( const CH_ChannelRefList &chanrefs,
186  bool propagate = true );
187  void pinChannel( const CH_ChannelRef &ref,
188  bool propagate = true );
189  void unpinChannel( const CH_ChannelRef &ref,
190  bool propagate = true );
191  void unpinChannelsWithNodeId(int node_id, bool force=false);
192  void clearPinnedChannels( bool propagate = true );
193 
194  //
195  // Scopped Layers
196  //
197  void clearLayerScope();
198  bool isLayerScoped(CH_Channel *chp) const;
199  bool isLayerScoped(const char *full_chan_path) const;
200  bool isLayerScoped(const CH_ChannelRef &chref) const;
201  void scopeLayer(const CH_ChannelRef &chref, bool on_off);
202  void scopeLayer(const char *full_chan_path, bool on_off);
203  bool scopeLayerInternal(CH_Channel *chp, bool on_off);
204  bool scopeLayerInternal(const CH_ChannelRef &chref, bool on_off);
205 
206  //
207  // Selected Layers (within the scoped layers)
208  //
209  bool isLayerSelected(const CH_ChannelRef &chref) const;
210  bool isLayerSelected(const char *full_chan_path) const;
211  void clearSelectedLayers(bool propagate = true);
212  void selectAllScopedLayers(bool propagate = true);
213 
214  void selectLayer(const CH_ChannelRef &chref, bool propagate=true);
215  void selectLayer(const char *full_chan_path, bool propagate=true);
216  void deselectLayer(const CH_ChannelRef &chref, bool propagate=true);
217  void deselectLayer(const char *full_chan_path, bool propagate=true);
218 
219  //
220  // Pinned Layers (within the scoped layers)
221  //
222  void togglePinAllScopedLayers();
223  void togglePinScopedLayers( const CH_ChannelRefList& chanrefs );
224  void pinAllScopedLayers( bool propagate = true );
225  void unpinAllScopedLayers( bool propagate = true );
226  void pinSelectedLayers( bool propagate = true,
227  int operate_on = CH_LAYER_SELECTED );
228  void unpinSelectedLayers( bool propagate = true,
229  int operate_on = CH_LAYER_SELECTED );
230  void pinLayer( const CH_ChannelRef& ref,
231  bool propagate = true );
232  void unpinLayer( const CH_ChannelRef& ref,
233  bool propagate = true );
234  void pinLayers( const CH_ChannelRefList& chanrefs,
235  bool propagate = true );
236  void unpinLayers( const CH_ChannelRefList& chanrefs,
237  bool propagate = true );
238  void clearPinnedLayers( bool propagate = true );
239 
240  //
241  // Displayed Layers (within the scoped layers)
242  bool isLayerDisplayed(CH_Channel *chp) const;
243  bool isLayerDisplayed( const CH_ChannelRef &chref ) const;
244  bool isLayerDisplayed( const char *full_chan_path ) const;
245  void clearDisplayedLayers( bool propagate = true );
246  void displayAllScopedLayers( bool propagate = true );
247  void displaySelectedScopedLayers( bool propagate = true );
248 
249  void displayLayer( const CH_ChannelRef &chref,
250  bool propagate = true );
251  void displayLayer( const char *full_chan_path,
252  bool propagate = true );
253  void undisplayLayer( const CH_ChannelRef &chref,
254  bool propagate = true );
255  void undisplayLayer( const char *full_chan_path,
256  bool propagate = true );
257 
258  // Graph Selected flag
259  bool isGraphSelected(CH_Channel *chp) const;
260  bool isGraphSelected( const CH_ChannelRef &chref ) const;
261  bool isGraphSelected( const char *full_chan_path ) const;
262  void clearGraphSelected( bool propagate = true );
263  void selectGraph( const CH_ChannelRef &chref,
264  bool propagate = true );
265  void selectGraph( const char *full_chan_path,
266  bool propagate = true );
267  void deselectGraph( const CH_ChannelRef &chref,
268  bool propagate = true );
269  void deselectGraph( const char *full_chan_path,
270  bool propagate = true );
271 
272  //
273  // Generic channel flag manipulation methods
274  //
275 
276  // Toggles on or off the bits active in flags argument.
277  void setChannelFlags( const CH_ChannelRef &chref,
278  unsigned flags,
279  bool on_off,
280  bool propagate = true );
281 
282  // Sets the flags unsigned value to flags argument.
283  void setAllChannelFlags( const CH_ChannelRef &chref,
284  unsigned flags,
285  bool propagate = true );
286 
287  // Returns the channel flags of chref.
288  unsigned getChannelFlags( const CH_ChannelRef &chref ) const;
289 
290  //
291  // Scoping functions
292  //
293  void clearChannelScope( bool clear_all_tables=false);
294 
295  // Returns scoped channels only (not scoped parameters)
296  void getScopedChannels(CH_ChannelList &channels, bool sorted=false);
297 
298  // Returns count of scoped channels AND scoped parameters
299  int getNumScopedChanRefs();
300 
301  // Returns count of scoped channels AND scoped parameters filtered or not
302  int getNumScopedChanRefs(bool filtered);
303 
304  // mask corresponds to flags in CH_ScopeMasks. Use 0 for mask to mean all
305  // scoped channel refs.
306  // Returns scoped channel AND scoped parameter refs
307  void getScopedChanRefs(CH_ChannelRefList &chanrefs,
308  unsigned mask = 0,
309  bool sorted=false) const;
310  void getSelectedScopedChanRefs(CH_ChannelRefList &chanrefs,
311  bool sorted=false, int operate_on=CH_SELECTED);
312 
313  void getScopedChannelsKeyFrames( UT_IntArray &frames,
314  int minframe, int maxframe);
315 
316  bool hasScopedChannels();
317 
319  {
320  FilterChannels = 0,
321  FilterAnimationLayers = 1,
322  };
323  enum
324  {
325  NumFilterType = 2,
326  };
327 
328  void setEnableFilter( FilterType filter_type, bool b)
329  { myEnableFilter[filter_type] = b; }
330  bool getEnableFilter( FilterType filter_type ) const
331  { return myEnableFilter[filter_type]; }
332 
333  void setFilter( FilterType filter_type, const UT_StringHolder &f)
334  { myFilter[filter_type] = f;}
335  const UT_StringHolder& getFilter(FilterType filter_type) const
336  { return myFilter[filter_type]; }
337 
338  void setFilterTranslates( bool b)
339  { myFilterTranlates = b;}
340  bool getFilterTranslates() const
341  { return myFilterTranlates; }
342 
343  void setFilterRotates( bool b)
344  { myFilterRotates = b;}
345  bool getFilterRotates() const
346  { return myFilterRotates; }
347 
348  void setFilterScales( bool b)
349  { myFilterScales = b;}
350  bool getFilterScales() const
351  { return myFilterScales; }
352 
353  void setFilterParmLabels( FilterType filter_type, bool b)
354  { myFilterParmLabels[filter_type] = b;}
355  bool getFilterParmLabels(FilterType filter_type ) const
356  { return myFilterParmLabels[filter_type]; }
357 
358  void setFilterFullNames( FilterType filter_type, bool b)
359  { myFilterFullNames[filter_type] = b;}
360  bool getFilterFullNames(FilterType filter_type) const
361  { return myFilterFullNames[filter_type]; }
362 
363  void setFilterDirty(FilterType filter_type, bool propagate=true);
364 
365  void setAllowExternal(bool allow) { myAllowExternal = allow; }
366  bool getAllowExternal() const { return myAllowExternal; }
367 
368  bool hasFilter() const;
369 
370  void clearInvalidChannels();
371 
372  void dirtySort(bool propagate=true);
373 
374 protected:
376  CH_Manager * ourManager() const { return myManager; }
377 
378 private:
379  friend class CH_Manager;
380 
381  // Filtering functions
382  void filterChannels(CH_ChannelList &chns, FilterType filter_type) const;
383  void filterChannelRefs(CH_ChannelRefList &refs, FilterType filter_type) const;
384  void setupFilter(UT_String &ret, UT_StringArray &filter_tokens, FilterType filter_type) const;
385  bool filterChannelRef( const CH_ChannelRef &chref, FilterType filter_type, const UT_String &prefilter, const UT_StringArray &filter_tokens ) const;
386 
387  CH_ChannelRefTable myTable;
388  CH_ChannelRefTable myTableDisplayed;
389  CH_ChannelList mySorted;
390  bool myIsSorted;
391  mutable int myNumScopedChannels;
392  mutable int myTotalScopedChannels; // Unfiltered
393 
394  // This wrapper is necessary to avoid gcc errors due to UT_Array having
395  // an explicit copy constructor and gcc seems to erroneously use copy-
396  // initialization instead of direct-initialization when synthesizing
397  // CH_ScopedChannelsBase's copy ctor.
398  struct ChannelListWrap
399  {
400  CH_ChannelList myList;
401  };
402 
403  // Filter for Channels and Animation Layers
404  ChannelListWrap myFiltered[NumFilterType];
405  UT_StringHolder myFilter[NumFilterType];
406  bool myEnableFilter[NumFilterType];
407  bool myFilterParmLabels[NumFilterType];
408  bool myFilterFullNames[NumFilterType];
409  bool myIsFiltered[NumFilterType];
410  bool myFilterTranlates;
411  bool myFilterRotates;
412  bool myFilterScales;
413 
414  // Note that we used to assert channels weren't external in most
415  // of the CH_ScopedChannelsBase methods, as they wouldn't work properly
416  // with building channel refs etc.
417  // Now, with geometry channels/channel primitives, we
418  // sometimes want to be able to scope these as external channels.
419  // We now check against this flag only when initially scoping channels.
420  // Other methods (isChannelScoped etc), no longer need to check whether the
421  // input is external or not, as buildChanRef and the remainder of the
422  // method will work as expected.
423  // This flag should be toggled on when first scoping external
424  // channels, then toggled back off afterwards. This ensures we don't
425  // globally scope external channels we don't mean to, such
426  // as the CHOPs fitCollection.
427  bool myAllowExternal;
428 
429  CH_Manager *myManager;
430 };
431 
432 // CH_ScopedChannels holds the scope/display/layer/pinned flags
433 // for all the channels.
434 // The CH_Manager holds a list of scoped channels and we refer to that list
435 // as the Global Scoped Channels.
436 // The Animation Editor can pin its state to create and act on a disconnected
437 // list of channels.
439 {
440 public:
441  CH_ScopedChannels(CH_Manager *mgr, bool global=false);
443 
444  // For some unfathomable reason, gcc will error out if the copy operators
445  // are not defined within the class
447  : CH_ScopedChannelsBase(src)
448  , myIsGlobal(src.myIsGlobal)
449  {
450  addInterest();
451  }
452 
453  // For some unfathomable reason, gcc will error out if the copy operators
454  // are not defined within the class
456  {
457  if (this != &src)
458  {
459  bool do_interest = (ourManager() != src.ourManager());
460  if (do_interest)
461  removeInterest();
463  if (do_interest)
464  addInterest()
465  );
466 
468  myIsGlobal = src.myIsGlobal;
469  }
470  return *this;
471  }
472 
474  CH_ScopedChannels &operator=(CH_ScopedChannels &&src) noexcept;
475 
476  void saveForUndo();
477 
478 private:
479  void removeInterest();
480  void addInterest();
481 private:
482  bool myIsGlobal;
483 };
484 
486 {
487 public:
488  typedef enum {
489  //CH_ON_COLLISION_FAIL,
493  CH_ON_COLLISION_ASSERT
494  } CollisionBehaviour;
495 
496  typedef enum {
497  CH_EXPANSION_TYPE_EXPRESSION = 1, // backtick expr expansions
498  CH_EXPANSION_TYPE_VARIABLE = 1 << 1, // $ variable expansions
499  CH_EXPANSION_TYPE_TILDE = 1 << 2, // ~ -> home directory
500  CH_EXPANSION_TYPE_NO_COMMENTS = 1 << 3, // No expand in // or /*
501  CH_EXPANSION_TYPE_NO_RAWSTRINGS = 1 << 4, // No expand in r"..."
502  CH_EXPANSION_TYPE_DEFAULT = CH_EXPANSION_TYPE_EXPRESSION |
503  CH_EXPANSION_TYPE_VARIABLE |
504  CH_EXPANSION_TYPE_TILDE,
505  } ExpansionType;
506 
507  typedef enum {
511  } SlopeMode;
512 
513  static constexpr int CH_SCOPE_REPLACED = 0;
514  static constexpr int CH_SCOPE_FILTERED = 1;
515 
516  typedef CollisionBehaviour (*CBCallback)( CH_Group *source,
517  CH_Group *target );
518 
519  CH_Manager(bool init_the_expression_library = true);
520  virtual ~CH_Manager();
521 
522  UT_NON_COPYABLE(CH_Manager)
523 
524  /// @private
525  /// Called just before the CH_Manger will be deleted
526  virtual void aboutToDelete();
527 
528  // The following method is used to set the context to this manager.
529  static CH_Manager *getContext()
530  {
531  UT_ASSERT( theManager );
532  return theManager;
533  }
534  static bool getContextExists() { return (bool)theManager; }
535  virtual void setContext();
536 
537  int condenseCommon(UT_String &path);
538 
539  void resetPlayback();
540 
541  void resetChannelOptions(bool notify = true);
542  bool loadChannelOptions( const char *filename );
543  bool saveChannelOptions( const char *filename );
544 
545  void setDefaultExpression(const char *s, bool notify = false);
546 
547  const char *getDefaultExpression() const
548  { return (const char *)myDefaultExpression; }
550  { return myShouldShowFakeAccelHandles; }
551  void setDefaultRotationExpression(const char *s)
552  {
553  if (s)
554  myDefaultRotationExpression.harden(s);
555  }
556  const char *getDefaultRotationExpression() const
557  { return (const char *)myDefaultRotationExpression;}
559  { myAutoSlope = m; }
561  { return myAutoSlope; }
563  { myDefaultSlope = slope; }
565  { return myDefaultSlope; }
566  void setAutoSplit(bool onoff);
567  bool getAutoSplit() const
568  { return myAutoSplit; }
569  void setDefaultSplitExpression(const char *expr);
570 
571  const char *getDefaultSplitExpression() const
572  { return (const char *)myDefaultSplitExpression; }
573 
574  void setHoldLastKey(bool onoff)
575  { myHoldLastKey = onoff; }
576  int getHoldLastKey() const
577  { return myHoldLastKey; }
578  const char *getChanCreateKeyExpression() const
579  { return (const char *)myChanCreateKeyExpression; }
580  void setChanCreateKeyExpression(const char *s)
581  { myChanCreateKeyExpression.harden(s ? s : ""); }
583  { return myAlwaysCommitKey; }
584  void setAlwaysCommitKeyChange( bool onoff )
585  { myAlwaysCommitKey = onoff; }
586 
587  // Scoping functions
588  // Deprecated and moved to CH_ScopedChannels
589  // With H16, we introduced the ability to lock animation editor scoped
590  // channels. The embedded animation layers and scoped channel listers can
591  // take a copy of CH_ScopedChannels and acts independtly of the global
592  // list. ChgetScopedChannels() returns the list of globally scoped
593  // channels.
594  SYS_DEPRECATED(16.0)
595  void clearChannelScope();
596 
597  // Returns scoped channels only (not scoped parameters)
598  SYS_DEPRECATED(16.0)
599  void getScopedChannels(CH_ChannelList &channels, bool sorted=false);
600 
601  // Returns count of scoped channels AND scoped parameters
602  SYS_DEPRECATED(16.0)
603  int getNumScopedChanRefs()
604  { return myScopedChannels.getNumScopedChanRefs(); }
605 
606  // mask corresponds to flags in CH_ScopeMasks. Use 0 for mask to mean all
607  // scoped channel refs.
608  // Returns scoped channel AND scoped parameter refs
609  SYS_DEPRECATED(16.0)
610  void getScopedChanRefs(CH_ChannelRefList &chanrefs,
611  unsigned mask = 0,
612  bool sorted=false) const;
613  SYS_DEPRECATED(16.0)
614  void getSelectedScopedChanRefs(CH_ChannelRefList &chanrefs,
615  bool sorted=false, int operate_on=CH_SELECTED);
616 
617  // utility functions for getting keyframe numbers:
618  // they return array of keyframes in the or scoped channes
619  // between minframe and maxframe, indexed relative to the start index
620  // The frames are unique and sorted in a ascending order.
621  SYS_DEPRECATED(16.0)
622  void getScopedChannelsKeyFrames( UT_IntArray &frames,
623  int minframe, int maxframe);
624 
625  // Useful method to group multiple scope change event notifications
626  // together.
627  void blockModifyScope(int on_off);
628 
629  // these next two methods can be used to manipulate channel scope state
630  // using the full path of the channel. The correct behaviour will take
631  // place if the channel doesn't yet exist and so forth.
632  SYS_DEPRECATED(16.0)
633  void scopeChannel(const CH_ChannelRef &chref, bool on_off);
634  SYS_DEPRECATED(16.0)
635  void scopeChannel(const char *full_chan_path, bool on_off);
636  SYS_DEPRECATED(16.0)
637  bool scopeChannelInternal(const CH_Channel *chp, bool on_off);
638  SYS_DEPRECATED(16.0)
639  bool scopeChannelInternal(const CH_ChannelRef &chref, bool on_off);
640 
641  virtual void getChannelsWithNodeId(CH_ChannelList &chans, int node_id) const;
642 
643  // this function should only be used by CH_Channel, CH_Collection, and here
644  SYS_DEPRECATED(16.0)
645  void scopeChanged( unsigned flags, bool propagate=true );
646 
647  // these functions can be used by anyone
648  SYS_DEPRECATED(16.0)
649  bool isChannelScoped(CH_Channel *chp) const;
650  SYS_DEPRECATED(16.0)
651  bool isChannelScoped(const char *full_chan_path) const;
652  SYS_DEPRECATED(16.0)
653  bool isChannelScoped(const CH_ChannelRef &chref) const;
654 
655  //
656  // Pending Channels
657  //
658  void clearPendingChannels();
659  void getPendingChannels(CH_ChannelList &channels) const;
660  bool hasPendingChannels() const;
661 
662  // addPendingChannel is intended to be used by CH_Channel/CH_Collection!
663  void addPendingChannel( CH_Channel *chp );
664  void removePendingChannel( CH_Channel *chp );
665 
666  //
667  // Displayed Channels (within the scoped channels)
668  //
669  SYS_DEPRECATED(16.0)
670  bool isChannelDisplayed(CH_Channel *chp) const;
671  SYS_DEPRECATED(16.0)
672  bool isChannelDisplayed( const CH_ChannelRef &chref ) const;
673  SYS_DEPRECATED(16.0)
674  bool isChannelDisplayed( const char *full_chan_path ) const;
675  SYS_DEPRECATED(16.0)
676  void clearDisplayedChannels( bool propagate = true );
677  SYS_DEPRECATED(16.0)
678  void displayAllScopedChannels( bool propagate = true );
679  SYS_DEPRECATED(16.0)
680  void displaySelectedScopedChannels( bool propagate = true );
681 
682  SYS_DEPRECATED(16.0)
683  void displayChannel( const CH_ChannelRef &chref,
684  bool propagate = true );
685  SYS_DEPRECATED(16.0)
686  void displayChannel( const char *full_chan_path,
687  bool propagate = true );
688  SYS_DEPRECATED(16.0)
689  void undisplayChannel( const CH_ChannelRef &chref,
690  bool propagate = true );
691  SYS_DEPRECATED(16.0)
692  void undisplayChannel( const char *full_chan_path,
693  bool propagate = true );
694 
695  //
696  // Selected Channels (within the scoped channels)
697  //
698  SYS_DEPRECATED(16.0)
699  bool isChannelSelected( const CH_ChannelRef &chref ) const;
700  SYS_DEPRECATED(16.0)
701  bool isChannelSelected( const char *full_chan_path ) const;
702  SYS_DEPRECATED(16.0)
703  void clearSelectedChannels( bool propagate = true );
704  SYS_DEPRECATED(16.0)
705  void selectAllScopedChannels(bool propagate = true );
706 
707  SYS_DEPRECATED(16.0)
708  void selectChannel( const CH_ChannelRef &chref,
709  bool propagate = true );
710  SYS_DEPRECATED(16.0)
711  void selectChannel( const char *full_chan_path,
712  bool propagate = true );
713  SYS_DEPRECATED(16.0)
714  void deselectChannel( const CH_ChannelRef &chref,
715  bool propagate = true );
716  SYS_DEPRECATED(16.0)
717  void deselectChannel( const char *full_chan_path,
718  bool propagate = true );
719 
720  //
721  // Pinned Channels (within the scoped channels)
722  //
723  SYS_DEPRECATED(16.0)
724  void togglePinAllScopedChannels();
725  SYS_DEPRECATED(16.0)
726  void togglePinScopedChannels( const CH_ChannelRefList &chanrefs );
727  SYS_DEPRECATED(16.0)
728  void pinAllScopedChannels( bool propagate = true );
729  SYS_DEPRECATED(16.0)
730  void unpinAllScopedChannels( bool propagate = true );
731  SYS_DEPRECATED(16.0)
732  void pinSelectedChannels( bool propagate = true,
733  int operate_on = CH_SELECTED );
734  SYS_DEPRECATED(16.0)
735  void unpinSelectedChannels( bool propagate = true,
736  int operate_on = CH_SELECTED );
737  SYS_DEPRECATED(16.0)
738  void pinChannels( const CH_ChannelRefList &chanrefs,
739  bool propagate = true );
740  SYS_DEPRECATED(16.0)
741  void unpinChannels( const CH_ChannelRefList &chanrefs,
742  bool propagate = true );
743  //
744  // Scopped Layers
745  //
746  SYS_DEPRECATED(16.0)
747  void clearLayerScope();
748  SYS_DEPRECATED(16.0)
749  bool isLayerScoped(CH_Channel *chp) const;
750  SYS_DEPRECATED(16.0)
751  bool isLayerScoped(const char *full_chan_path) const;
752  SYS_DEPRECATED(16.0)
753  bool isLayerScoped(const CH_ChannelRef &chref) const;
754  SYS_DEPRECATED(16.0)
755  void scopeLayer(const CH_ChannelRef &chref, bool on_off);
756  SYS_DEPRECATED(16.0)
757  void scopeLayer(const char *full_chan_path, bool on_off);
758  SYS_DEPRECATED(16.0)
759  bool scopeLayerInternal(CH_Channel *chp, bool on_off);
760  SYS_DEPRECATED(16.0)
761  bool scopeLayerInternal(const CH_ChannelRef &chref, bool on_off);
762 
763  //
764  // Selected Layers (within the scoped layers)
765  //
766  SYS_DEPRECATED(16.0)
767  bool isLayerSelected( const CH_ChannelRef &chref ) const;
768  SYS_DEPRECATED(16.0)
769  bool isLayerSelected( const char *full_chan_path ) const;
770  SYS_DEPRECATED(16.0)
771  void clearSelectedLayers( bool propagate = true );
772  SYS_DEPRECATED(16.0)
773  void selectAllScopedLayers(bool propagate = true );
774 
775  SYS_DEPRECATED(16.0)
776  void selectLayer( const CH_ChannelRef &chref, bool propagate = true );
777  SYS_DEPRECATED(16.0)
778  void selectLayer( const char *full_chan_path, bool propagate = true );
779  SYS_DEPRECATED(16.0)
780  void deselectLayer( const CH_ChannelRef &chref, bool propagate = true );
781  SYS_DEPRECATED(16.0)
782  void deselectLayer( const char *full_chan_path, bool propagate = true );
783 
784  //
785  // Pinned Layers (within the scoped layers)
786  //
787  SYS_DEPRECATED(16.0)
788  void togglePinAllScopedLayers();
789  SYS_DEPRECATED(16.0)
790  void togglePinScopedLayers( const CH_ChannelRefList &chanrefs );
791  SYS_DEPRECATED(16.0)
792  void pinAllScopedLayers( bool propagate = true );
793  SYS_DEPRECATED(16.0)
794  void unpinAllScopedLayers( bool propagate = true );
795  SYS_DEPRECATED(16.0)
796  void pinSelectedLayers( bool propagate = true, int operate_on = CH_LAYER_SELECTED );
797  SYS_DEPRECATED(16.0)
798  void unpinSelectedLayers( bool propagate = true, int operate_on = CH_LAYER_SELECTED );
799  SYS_DEPRECATED(16.0)
800  void pinLayers( const CH_ChannelRefList &chanrefs, bool propagate = true );
801  SYS_DEPRECATED(16.0)
802  void unpinLayers( const CH_ChannelRefList &chanrefs, bool propagate = true );
803 
804  //
805  // Displayed Layers (within the scoped layers)
806  SYS_DEPRECATED(16.0)
807  bool isLayerDisplayed(CH_Channel *chp) const;
808  SYS_DEPRECATED(16.0)
809  bool isLayerDisplayed( const CH_ChannelRef &chref ) const;
810  SYS_DEPRECATED(16.0)
811  bool isLayerDisplayed( const char *full_chan_path ) const;
812  SYS_DEPRECATED(16.0)
813  void clearDisplayedLayers( bool propagate = true );
814  SYS_DEPRECATED(16.0)
815  void displayAllScopedLayers( bool propagate = true );
816  SYS_DEPRECATED(16.0)
817  void displaySelectedScopedLayers( bool propagate = true );
818 
819  SYS_DEPRECATED(16.0)
820  void displayLayer( const CH_ChannelRef &chref,
821  bool propagate = true );
822  SYS_DEPRECATED(16.0)
823  void displayLayer( const char *full_chan_path,
824  bool propagate = true );
825  SYS_DEPRECATED(16.0)
826  void undisplayLayer( const CH_ChannelRef &chref,
827  bool propagate = true );
828  SYS_DEPRECATED(16.0)
829  void undisplayLayer( const char *full_chan_path,
830  bool propagate = true );
831  // Generic channel flag manipulation methods
832  SYS_DEPRECATED(16.0)
833  void setChannelFlags( const CH_ChannelRef &chref,
834  unsigned flags,
835  bool on_off,
836  bool propagate = true );
837  SYS_DEPRECATED(16.0)
838  unsigned getChannelFlags( const CH_ChannelRef &chref ) const;
839 
840  // Expand a string given a specific channel set (for locals). It's
841  // possible that the channel collection can be null, meaning local
842  // variables won't be picked up. The input string is expected to be an
843  // unexpanded string value using the old improper expression syntax. The
844  // method returns a mask with CH_EXPRTIME set if the string uses time
845  // dependent variables.
846  int expandString(const char *string, UT_String &expanded,
847  fpreal time, CH_Collection *local = nullptr,
848  int thread = 0,
849  int expansion_type = CH_EXPANSION_TYPE_DEFAULT,
851  context_options_stack = nullptr,
852  DEP_ContextOptionsReadHandle context_options =
854 
855  void buildStringOpDependencies( const char *str, void *ref_id,
856  CH_Collection *locals, int thread );
857 
858  /// Return true if the variable exists in the given string. The variable
859  /// may be in the form @c "$NAME" or "NAME". If @c expand_expressions is
860  /// true, any back-tick expressions will be expanded and the result scanned
861  /// for the variable.
862  bool scanForVariableInString(const char *variable,
863  const char *string) const;
864  bool changeStringOpRef( UT_String &str,
865  const char *new_fullpath,
866  const char *old_fullpath,
867  const char *old_cwd,
868  const char *chan_name,
869  const char *old_chan_name,
870  CH_Collection *locals,
871  int thread );
872 
873  // These functions evaluate expressions that have been specified using the
874  // old proper expression syntax.
875  fpreal evaluate(const char *expr, fpreal now,
876  CH_Collection *local=nullptr, int *frame_dep=nullptr,
877  int thread = 0,
880  context_options_stack = nullptr,
881  DEP_ContextOptionsReadHandle context_options =
882  DEP_ContextOptionsReadHandle());
883  int evaluateString(const char *expr, UT_StringHolder &result,
884  fpreal now, CH_Collection *local=nullptr,
885  int thread = 0,
886  CH_ExprLanguage language = CH_OLD_EXPR_LANGUAGE,
888  context_options_stack = nullptr,
889  DEP_ContextOptionsReadHandle context_options =
890  DEP_ContextOptionsReadHandle());
891 
892  // Issue an expression evaluation error. 'err' is an index used for
893  // ev_GetErrorText(). NOTE: This will call ev_SetErrNo(EV_NOERROR, thread)!
894  static void evaluationError(int err, int thread, const char *path);
895 
896  // Global parameter management
897 
898  // This function tells us if we are in the process of setting a global
899  // param value. This is useful for differentiating between real node
900  // change events, and apparent node changes caused by setting a global
901  // param.
902  // If add_dependencies is set, the currently evaluating operator will have
903  // dependencies added for the global parameter. Disable this if you're
904  // just getting values for push/pop of values.
905  bool getIsSettingGlobalParam() const
906  { return (mySettingGlobalParam > 0); }
907  void getGlobalParamF(const char *token, CH_Collection *scope,
908  fpreal &result, fpreal def, int thread,
909  bool add_dependencies /*=true*/);
910  void getGlobalParamS(const char *token, CH_Collection *scope,
911  UT_String &result, const char *def,
912  int thread, bool add_dependencies /*=true*/);
913 
914  /// The AnyScope variants will start at the given scope and work upwards
915  /// until a global parameter is found. If none is found, they will
916  /// act like getGlobalParamF on the root scope.
917  void getGlobalParamAnyScopeF(const char *token, CH_Collection *scope,
918  fpreal &result, fpreal def, int thread,
919  bool add_dependencies /*=true*/);
920  void getGlobalParamAnyScopeS(const char *token, CH_Collection *scope,
921  UT_String &result, const char *def,
922  int thread, bool add_dependencies /*=true*/);
923 
924  int setGlobalFloatParam(const char *token,
925  fpreal val,
926  CH_Collection *&owner);
927  int setGlobalStringParam(const char *token,
928  const char *strval,
929  CH_Collection *&owner);
930 
931  int removeGlobalParamOwner(CH_Collection *owner);
932  void dumpGlobalParams(std::ostream &out) const;
933 
934  // The optional dependents set, if specified, will be populated with
935  // a set of the dependent CH_Collection(s).
936  void dirtyOrphanGlobalParamDependents(const char *token,
937  CH_Collection *scope,
938  bool recurse,
939  UT_Set<CH_Collection *> *dependents);
940 
941  // Like global params, simulation guide parameters need a flag so we
942  // know not to destroy interests and extra inputs when they are changed.
944  { return (mySettingGuideParam > 0); }
945 
946  static CH_KeyState getKeyState(fpreal gtime,
947  const CH_ChannelList &channels,
948  bool loose=false);
949 
950  // Channel Group Management
951  CH_Group *getTopGroup() const;
952  CH_Group *findGroup(const char *const_path, bool create = false,
953  CH_Group *head = nullptr);
954  void findGroups( CH_GroupList &groups,
955  const char *pattern, bool minimal );
956  void findChannelsFromGroups( CH_ChannelList &channels,
957  const char *pattern );
958  void findChanRefsFromGroups( CH_ChannelRefList &chanrefs,
959  const char *pattern );
960  static bool makeGroupPathValid( UT_String &path );
961  static bool makeGroupNameValid( UT_String &path );
962 
963  CH_GroupList getSelectedGroups();
964  CH_Group *getCurrentGroup();
965  void updateGroupSelection(const CH_GroupList &groups,
966  void *by,
967  bool propagate = true);
968  void updateGroupSelectionFromScoped(void *by,
969  bool propagate = true);
970  void updateCurrentGroup(CH_Group *group,
971  void *by,
972  bool propagate = true);
973  void enforceLeafOnlyChannels(CH_Group *group,
974  const char *name="new_group");
975 
976  // RMB Group functions
977  CH_Group *createGroup(const char *const_path,
978  bool do_rename = true,
979  CH_Group *head = nullptr);
980  void renameGroup(CH_Group *group, const char *newname);
981  void deleteGroup(CH_Group *group);
982 
983  // RMB Group* functions
984  void extractGroup( CH_Group *group, CollisionBehaviour cb );
985  CH_Group *collapseGroups( CH_GroupList const& groups,
986  const char *name );
987  void collapseChildren( CH_Group *parent );
988 
989  // TODO merge selected
990 
991  // Group -> Group functions
992  void copyIntoGroup( CH_Group *source, CH_Group *target,
993  CollisionBehaviour cb,
994  const char *new_name = nullptr );
995  void moveIntoGroup( CH_Group *source, CH_Group *target,
996  CollisionBehaviour cb,
997  const char *new_name = nullptr );
998  void addToGroup( CH_Group *source, CH_Group *target,
999  CollisionBehaviour cb );
1000  void mergeWithGroup( CH_Group *source, CH_Group *target,
1001  CollisionBehaviour cb );
1002  // TODO remove shared channels?
1003  // TODO replace group?
1004 
1005  // Channels -> Group functions implemented via G -> G
1006  void channelCreated( const CH_Channel *chp );
1007  void channelDeleted( const CH_Channel *chp );
1008 
1009  // save, load functions
1010  void saveGroup(CH_Group *g, std::ostream &os, int binary);
1011  CH_Group *loadGroup(UT_IStream &is);
1012 
1013  bool saveBookmarks(UT_JSONWriter &w,
1014  bool include_temporary=false);
1015  bool saveBookmarks(UT_JSONWriter &w,
1016  const UT_Array<CH_Bookmark *> &bookmarks);
1017  bool loadBookmarks(UT_JSONParser &w,
1018  bool remove_existing = true);
1019 
1020 
1021  // Returns true if there exists a situation in which the string can
1022  // be expanded. Returns false if there is nothing in the string that
1023  // indicates that it could be expanded.
1024  static bool couldExpandString(const char *str);
1025 
1026  // Gets/Sets the default expression language.
1028  { return myDefaultExprLanguage; }
1030  { myDefaultExprLanguage = language; }
1031 
1032  // Checks if the given scoped channels list is the global one
1034  { return p == &myScopedChannels; }
1035 
1036  // Access the global scoped channels
1038  { return myScopedChannels; }
1040  { return myScopedChannels; }
1041 
1042  /// Access the scoped/pinned channels pointers from the global and pinned
1043  /// lists.
1044  UT_Array<CH_ScopedChannels*> getScopedChannelsList(
1045  bool include_global, bool include_pinned);
1046  UT_Array<const CH_ScopedChannels*> getScopedChannelsList(
1047  bool include_global, bool include_pinned) const;
1048 
1049  bool hasExternalCollection(const CH_Collection *collection) const;
1050 
1051  /// Scope an existing external collection. Must have been
1052  /// previously added to the channel manager.
1053  /// Acts only on the global scoped channels
1054  void scopeExternalCollection(CH_Collection *collection, bool on_off=true);
1055 
1056  /// Scope an existing external collection. Must have been
1057  /// previously added to the channel manager.
1058  /// Act on a list of scoped channels.
1059  void scopeExternalCollection(const UT_Array<CH_ScopedChannels *> &scopes, CH_Collection *collection, bool on_off=true);
1060 
1061  /// Return a pointer to the external collection, or nullptr
1062  /// if the associated collection doesn't exist/hasn't been
1063  /// added
1064  CH_Collection *getExternalCollection(const UT_StringHolder &name) const;
1065 
1066  /// Returns an external channel given a collection and a channel name.
1067  CH_Channel *getExternalChannel(const char *collection,
1068  const char *name) const;
1069 
1070  /// Returns an external channel from a collection name and channel name
1071  /// separated by a '/'.
1072  CH_Channel *findExternalChannel(const UT_StringHolder &path);
1073 
1074  /// Appends channels the channel list when the full path matches the pattern.
1075  /// The pattern must have a '/' to separate the collection matching and the
1076  /// channel name matching. Use "*/*" to get everything, "_Base/*" for all the
1077  /// channels of the _Base collection.
1078  /// Returns the number of entries added.
1079  exint globExternalChannels(
1080  const UT_StringHolder &pattern,
1081  CH_ChannelList &chans);
1082 
1084  const
1085  { return myExternalCollections; }
1086 
1087  // Time Group Management
1088  void timeGroupsChanged();
1089  void addTimeGroup(CH_TimeGroup *group,
1090  bool do_rename=true,
1091  bool force=false);
1092  void destroyTimeGroup(const CH_TimeGroup *group);
1093  void destroyTimeGroup(int i);
1094  void renameTimeGroup(CH_TimeGroup *group,
1095  const char *newname,
1096  bool force=false);
1097  int getNTimeGroups() const {return myTimeGroups.entries();}
1098  CH_TimeGroup *getTimeGroup(int i) { return myTimeGroups(i); }
1099  const CH_TimeGroup *getTimeGroup(int i) const { return myTimeGroups(i); }
1100  CH_TimeGroup *getTimeGroup(const char *name);
1101  const CH_TimeGroup *getTimeGroup(const char *name) const;
1102  int getTimeGroupIdx( const char *name ) const;
1103 
1104 
1105  // Bookmark Management
1106  void bookmarksChanged(
1107  CH_BookmarkEvent action,
1108  int64 bookmark_id);
1109 
1111  { return myBookmarksMicroNode; }
1112  /// Add a new bookmark, returning the index at which it was added.
1113  int addBookmark(UT_UniquePtr<CH_Bookmark> &&bookmark,
1114  bool create_undo = true);
1115 
1116  /// Moves the given bookmark to be sorted within the bookmark array.
1117  /// Assumes that the given bookmark is already in the array, and
1118  /// that all other bookmarks are already sorted
1119  /// @param bookmark Bookmark to be sorted
1120  /// @paaram notify If true, and the bookmark changed, sets
1121  /// myBookmarksMicroNode to dirty
1122  int sortBookmark(CH_Bookmark *bookmark,
1123  bool notify = true);
1124 
1125  void destroyBookmark(int index, bool create_undo = true,
1126  bool notify = true);
1127  void destroyBookmarks(
1128  const UT_Array<CH_Bookmark *> &bookmarks,
1129  bool create_undo = true,
1130  bool notify = true);
1131 
1132  void destroyBookmark(CH_Bookmark *bookmark,
1133  bool create_undo = true,
1134  bool notify = true);
1135 
1136  /// Adjust the sample range to match that of the given bookmark
1137  /// If store_previous_range is true, stores the current sample range
1138  /// so that it can be restored later.
1139  void frameBookmark(int index,
1140  bool store_previous_range = true);
1141 
1142  void frameBookmark(CH_Bookmark *bookmark,
1143  bool store_previous_range = true);
1144 
1145  void clearBookmarks();
1146 
1147  CH_Bookmark *getMostRecentBookmark() const;
1148  CH_Bookmark *getLeastRecentBookmark() const;
1149  /// Marks the given bookmark as most recently used, bumping it to the
1150  /// end of the most-recently-used array
1151  void setMostRecentBookmark(CH_Bookmark *bookmark);
1152  /// Marks the given bookmark as least recently used, bumping it to the
1153  /// start of the most-recently-used array
1154  void setLeastRecentBookmark(CH_Bookmark *bookmark);
1155 
1156  /// If there is an actively framed bookmark
1157  /// (sample range == bookmark range), returns the index of that bookmark,
1158  /// otherwise, returns -1
1159  CH_Bookmark *getFramedBookmark() const;
1160  int getFramedBookmarkIndex() const;
1161  int getNBookmarks() const { return myBookmarks.entries(); }
1162  /// Given a bookmark, return its index in the bookmark list, or -1 if
1163  /// the bookmark is not in the list
1164  int getBookmarkIndex(CH_Bookmark *bookmark);
1165  CH_Bookmark *getBookmark(int i) { return myBookmarks(i).get(); }
1166  const CH_Bookmark *getBookmark(int i) const
1167  { return myBookmarks(i).get(); }
1168 
1169  CH_Bookmark *getBookmarkBySessionId(int64 bookmark_id) const;
1170 
1171  /// Given an input array of bookmark session ids, returns
1172  /// an array of matching bookmark objects. Any invalid ids will be returned
1173  /// as nullptr in the output array.
1174  UT_Array<CH_Bookmark *> getBookmarksBySessionIds(
1175  const UT_Array<int64> &ids) const;
1176 
1178  { return myRecentBookmarks; }
1179 
1180  /// Utility function to make a floating point number "nice" - i.e. only /
1181  /// use N decimal places after the decimal point.
1182  /// Should only be used for frames/samples (not time in seconds).
1183  static inline fpreal niceNumber(fpreal num, int digits=6);
1184 
1185  // Utility function to find a frame separation that is an intelligent
1186  // multiple/subdivision of the current frame rate, close to the
1187  // initialSep parameter.
1188  int niceFrameSeparation(fpreal initial_sep,
1189  int minimum_sep = 1) const;
1190 
1191  // Stretching collections will stretch every channel of every collection
1192  // based on the old time passed to us.
1193  // The channels will be stretched to fit the new time
1194  void stretchCollections(CH_Collection *from, fpreal ostart,
1195  fpreal oend);
1196 
1197  /// Updates start and end time of collections to preserve key frames based
1198  /// on the previous fps
1199  void preserveCollectionKeyframes(CH_Collection *grp, fpreal old_fps);
1200 
1201  /// Shifts all collections by the given time_delta
1202  void shiftCollections(CH_Collection *grp, fpreal time_delta);
1203 
1204  static fpreal getDefaultFPS();
1205  static fpreal getDefaultLength(fpreal fps);
1206  static fpreal getDefaultLengthFrames(fpreal fps);
1207  static int getDefaultChopMotionSamples();
1208 
1209  fpreal getNumSamples() const { return mySampleCount; }
1210  void setRawNumSamples(int n, bool notify = true);
1211  fpreal getSamplesPerSec() const { return myFPS; }
1212  void setSamplesPerSec(fpreal fps, bool notify = true);
1213  fpreal getSecsPerSample() const { return 1.0 / myFPS; }
1214  void setRawSamplesPerSec(fpreal fps, bool notify = true);
1215  int getChopMotionSamples() const { return myChopMotionSamples; }
1216  void setChopMotionSamples(int n, bool notify = true);
1217 
1218  fpreal getGlobalStart() const { return myStart; }
1219  fpreal getGlobalEnd() const { return myEnd; }
1221  { return getFrame( myStart ); }
1222  int getGlobalEndFrame() const
1223  { return getFrame( myEnd ); }
1224 
1225  void setGlobalTime(fpreal start, fpreal end, bool notify = true);
1226  /// Set the start time directly. End time will be adjusted according to the
1227  /// sample count and fps
1228  void setGlobalStart(fpreal start, bool notify = true);
1229 
1230  void setRawInterpolation(int state) { myRawInterpFlag = state; }
1231  int getRawInterpolation() { return myRawInterpFlag; }
1232 
1233  // CONVERSION
1234  fpreal getTolerance() const { return myTimeTolerance; }
1235  fpreal getFrameTolerance() const { return 1.0F / fpreal(CH_SAMPLES_PER_FRAME); }
1236  // sample -> time
1237  fpreal getTime(fpreal sample) const
1238  {
1239  return ((sample-1.0)/myFPS);
1240  }
1241  // time -> sample (for calculation)
1243  {
1244  return t*myFPS+1.0;
1245  }
1246  // time -> sample (for display)
1248  {
1249  return niceNumber(getSampleRaw(t));
1250  }
1251  // time -> sample (integer)
1252  int getFrame(fpreal t) const
1253  {
1254  return (int)SYSfloor(getSampleRaw(t+getTolerance()));
1255  }
1256  // sample-delta -> time-delta
1257  fpreal getTimeDelta(fpreal sample_delta) const
1258  {
1259  return sample_delta/myFPS;
1260  }
1261  // time-delta -> sample-delta
1262  fpreal getSampleDelta(fpreal time_delta) const
1263  {
1264  return time_delta*myFPS;
1265  }
1266  // time -> time (snapped to an integer frame)
1268  {
1269  return getTime( SYSrint( getSampleRaw(t) ) );
1270  }
1271 
1272  // time -> time (snapped to a subframe)
1274  {
1275  return getTime(getSnapSubsample(getSampleRaw(t)));
1276  }
1277 
1278  // frame -> frame (snapped to an integer frame)
1279  // see also SI_Dopesheet::getSnapSample()
1281  {
1282  return SYSrint(frame);
1283  }
1284 
1285  /// Snaps a frame to aligns with the sample step
1286  /// (taking the start frame into account)
1287  // see also SI_Dopesheet::getSnapSubsample()
1289  {
1290  return SYSrint((frame - getGlobalStartFrame())
1291  * (1.0 / mySampleStep))
1292  * mySampleStep + getGlobalStartFrame();
1293  }
1294  // say you have a key at frame 0.6 (base_time) and you are moving it with
1295  // snap to frame on, so you want to snap the amount you move the key so
1296  // that the key lands on the nearest frame. In this example, time_delta
1297  // would be rounded to numbers like: -1.6, -0.6, 0.4, 1.4. This function
1298  // does this. Note that the parameters and return value are in time not
1299  // frames as they were in the example.
1300  fpreal getSnapToFrameDelta(fpreal base_time, fpreal time_delta) const;
1301  // time -> bool (true if time is at an integer frame boundary)
1302  bool getIsAtFrame(fpreal t) const
1303  {
1304  fpreal snaptime;
1305 
1306  snaptime = getSnapToFrameTime( t );
1307  return SYSisEqual(t, snaptime, getTolerance());
1308  }
1309 
1310  // Get code in buf
1311  void getTimeCode(char *buf, fpreal t);
1312  // Return time from buf
1313  int setTimeCode(const char *buf, fpreal &t);
1314 
1315  void setTimeCodeOffset(fpreal t) { myTimeCodeOffset = t; }
1316  fpreal getTimeCodeOffset(fpreal ) const { return myTimeCodeOffset; }
1317 
1318  int getIntegerFrameFlag() const { return myIntegerFrames; }
1319  void setIntegerFrameFlag(int flag, bool notify = true);
1320 
1321  int getRestrictRangeFlag() const { return myRestrictRange; }
1322  void setRestrictRangeFlag(int flag, bool notify = true);
1323 
1324  int getShowRangeFlag() const { return myShowRange; }
1325  void setShowRangeFlag(int flag, bool notify = true);
1326 
1327  int getShowTicksFlag() const { return myShowTicks; }
1328  void setShowTicksFlag(int flag, bool notify = true);
1329 
1330  int getShowAudioFlag() const { return myShowAudio; }
1331  void setShowAudioFlag(int flag, bool notify = true);
1332 
1333  int getShowKeysFlag() const { return myShowKeys; }
1334  void setShowKeysFlag(int flag, bool notify = true);
1335 
1336  int getShowBookmarksFlag() const { return myShowBookmarks; }
1337  void setShowBookmarksFlag(int flag, bool notify = true);
1338 
1339  int getShowSimCacheFlag() const { return myShowSimCache; }
1340  void setShowSimCacheFlag(int flag, bool notify = true, bool pref = false);
1341 
1342  int getShowAnimCacheFlag() const { return myShowAnimCache; }
1343  void setShowAnimCacheFlag(int flag, bool notify = true, bool pref = false);
1344 
1345  int getShowAnimBarFlag() const { return myShowAnimBar; }
1346  void setShowAnimBarFlag(int flag, bool notify = true);
1347 
1348  fpreal getAudioLevel() const { return myAudioLevel; }
1349  void setAudioLevel(fpreal lvl) { myAudioLevel = lvl; }
1350 
1351  fpreal getUnitLength() const { return myUnitLength; }
1352  void setUnitLength(fpreal unitlength){ myUnitLength = unitlength; }
1353  fpreal getUnitMass() const { return myUnitMass; }
1354  void setUnitMass(fpreal unitmass) { myUnitMass = unitmass; }
1355  void parseUnitsString(const char *units,
1356  fpreal &distexp,
1357  fpreal &massexp) const;
1358  fpreal scaleToMKS(const char *fromunits) const;
1359  fpreal scaleFromMKS(const char *tounits) const;
1360 
1361  int getRealTimeFlag() const { return myRealTimePlay; }
1362  void setRealTimeFlag(int flag, bool notify = true);
1363  fpreal getRealTimeFactor() const { return myRealTimeFactor; }
1364  void setRealTimeFactor(fpreal f, bool notify = true);
1365  bool getRealTimeDisableSkip() const { return myRealTimeDisableSkip; }
1366  void setRealTimeDisableSkip(bool b, bool notify = true);
1367  fpreal getSampleStep() const { return mySampleStep; }
1368  void setSampleStep(fpreal s, bool notify = true);
1369 
1371  {
1372  start = myRangeStart;
1373  end = myRangeEnd;
1374  }
1375  void setSampleRange(fpreal start, fpreal end, bool notify = true);
1376 
1377  int getHoldFlag() const { return myHoldFlag; }
1378  void setHoldFlag( int flag ) { myHoldFlag = flag; }
1379 
1380  // I/O methods
1381  int saveChannels(const char *filename, bool binary, bool compiled,
1382  const CH_ChannelList &channels,
1383  bool displayed = false) const;
1384  int loadChannels(const char *filename,
1385  const char *src_pattern,
1386  const char *dest_pattern,
1387  bool use_range,
1388  const fpreal *tstart,
1389  const fpreal *tend,
1390  CH_CollectionList &parents,
1391  bool delete_keys = false,
1392  CH_ChannelRefList *displayed_parms = nullptr);
1393  static bool readCHNFileHeader(UT_IStream &is, bool quiet,
1394  fpreal32 &version, int &binary,
1395  bool &is_fp64,
1396  fpreal64 &tstart, fpreal64 &tend);
1397  static bool skipCHNFileHeaderForCollection(UT_IStream &is, bool &is_fp64);
1398  static bool getFileType( const char *filename, int &raw, int &binary );
1399  static bool printFileInfo(std::ostream &os, const char *filename,
1400  CH_Collection *load_coll,
1401  bool print_segments=true );
1402 
1403  // Expression glue. Only call this if you know what you're really doing.
1404  void addExpressionDefine(CH_ExprDefine *def);
1405 
1406  // The following method should only be called by CH_Collection, so please
1407  // don't mess me up.
1409  {
1410  // We use thread-local storage for the eval
1411  // collection. This isn't because two
1412  // different collections can be evaluating
1413  // paramaters in different threads at the same
1414  // time, though it would be nice for that to be
1415  // possible one day. Instead, it's so that if
1416  // Houdini is evaluating a parameter at the
1417  // same time as a python script is running code
1418  // that checks for the currently evaluating
1419  // parameter (so it can add the appropriate
1420  // parm interests), that we don't add parm
1421  // interests when we shouldn't.
1422  evalContext(thread).myCollection = g;
1423  // Reset the other members to avoid stale ptrs
1424  evalContext(thread).myChannel = nullptr;
1425  evalContext(thread).mySegment = nullptr;
1426  evalContext(thread).myChannelName = nullptr;
1427  }
1428  // TODO: Make getEvalCollection() return a const pointer
1430  {
1431  // We use thread-local storage the eval
1432  // collection.
1433  //
1434  // If this is the first time this thread has
1435  // accessed the pointer it will be null.
1436  // That's exactly the behaviour we want.
1437  return evalContext(thread).myCollection;
1438  }
1439 
1440  // The CH_Manager needs a pointer to the channel collection for the
1441  // OP_Director. This is used to trigger events when channel and time
1442  // groups are modified.
1444  { myRootCollection = root; }
1446  { return myRootCollection; }
1447 
1448  virtual CH_ScriptAccessManager *getAccessManager(int /*thread*/)
1449  { return nullptr; }
1450 
1451  inline const CH_EvalContext &
1452  evalContext(int thread) const
1453  { return myEvalContext.getValueForThread(thread); }
1454 
1455  inline CH_EvalContext &
1457  { return myEvalContext.getValueForThread(thread); }
1458 
1459  inline const CH_Channel *getEvalChannel(int thread) const
1460  { return evalContext(thread).myChannel; }
1461  inline const CH_Segment *getEvalSegment(int thread) const
1462  { return evalContext(thread).mySegment; }
1463  inline const char *getEvalChannelName(int thread) const
1464  { return evalContext(thread).myChannelName; }
1465  inline const DEP_ContextOptionsStack *
1467  { return evalContext(thread).myContextOptionsStack; }
1470  { return evalContext(thread).myContextOptions; }
1471 
1472  /// Functions for obtaining and setting the current evaluation time
1473  // @{
1474  inline fpreal getEvaluateTime(int thread) const
1475  { return evalContext(thread).time(); }
1476  inline void setEvaluateTime(fpreal time, int thread)
1477  { evalContext(thread).setTime(time); }
1478  inline void setEvaluateTime(SYS_Flicks fl, int thread)
1479  { evalContext(thread).setFlicks(fl); }
1480  // @}
1481 
1482  /// The following function only remains for backwards compatibility of
1483  /// HDK users. Calls to this function should be replaced with one of the
1484  /// following forms:
1485  /// getEvaluateTime(context.getThread()) -> inside cooking code path
1486  /// getEvaluateTime(thread) -> in expression functions
1487  /// CHgetEvalTime() -> else without thread variable
1488  SYS_DEPRECATED(11.1) fpreal getEvaluateTime() const
1489  { return getEvaluateTime(SYSgetSTID()); }
1490 
1491  //
1492  // These methods are usually only used by CH_Collection to evaluate
1493  // variables belonging to me...
1494  CH_LocalVariable *getLocalVariableTable() const;
1495  bool getVariableValue(UT_String &str, int i,
1496  int thread) const;
1497  bool getVariableValue(fpreal &val, int i,
1498  int thread) const;
1499 
1500  // Should only be called if the variable has flagged as CH_VARIABLE_INTVAL
1501  bool getVariableValue(int &val, int i, int thread) const;
1502 
1503  // getVariableString should really be protected, but can't do it.
1504  virtual bool getVariableString(const char *name,
1505  UT_String &value,
1506  int &time_depend,
1507  int thread);
1508 
1509  // Function for adding new global variables with the HDK.
1510  int addVariable(const CH_LocalVariable &var,
1511  CH_StringVarEvalFunc strfunc,
1512  CH_FloatVarEvalFunc floatfunc,
1513  CH_IntVarEvalFunc intfunc) const;
1514 
1515  static void lookupVariable(const char *name, UT_String &val,
1516  int thread);
1517  static void lookupVariableNoThread(const char *name,
1518  UT_String &val);
1519  static void lookupExpression(const char *name, UT_String &val,
1520  int thread);
1521  static void lookupExpressionNoThread(const char *name,
1522  UT_String &val);
1523 
1524  // This should only be called by CH_Collection
1525  void removeParamDependency(CH_Collection *coll);
1526 
1527  /// Use this method to translate a channel reference to a channel pointer.
1528  /// May return NULL if the channel reference does not reference a valid
1529  /// channel.
1530  virtual CH_Channel *getChRefChannel(const CH_ChannelRef &r) const;
1531 
1532  /// Use this method to determine if the owner of the channel reference
1533  /// is exposed or not.
1534  virtual bool isOwnerExposed(const CH_ChannelRef &r) const;
1535 
1536  /// Use this method to build a channel reference from a channel pointer.
1537  virtual bool buildChanRef(CH_ChannelRef &r,
1538  const CH_Channel *chp) const;
1539 
1540  /// Use this method to build a channel reference from a channel path.
1541  virtual bool buildChanRef(CH_ChannelRef &r,
1542  const char *path) const;
1543 
1544  bool buildChannelRefs( CH_ChannelRefList &reflist,
1545  const CH_ChannelList &chlist );
1546 
1547  bool buildChannelRefs( CH_ChannelRefList &reflist,
1548  const UT_StringArray &chlist );
1549 
1550  /// Returns 0 if r1 and r2 are equal, returns -1 if r1 < r2 and
1551  /// returns 1 if r1 > r2.
1552  virtual int compareChanRefs(const CH_ChannelRef &r1,
1553  const CH_ChannelRef &r2) const;
1554 
1555  /// Returns 0 if r1 and r2 are equal, returns -1 if r1 < r2 and
1556  /// returns 1 if r1 > r2.
1557  virtual int compareLayerRefs(const CH_ChannelRef &r1,
1558  const CH_ChannelRef &r2) const;
1559 
1560  /// Use this method to get the full path of the channel referenced by r.
1561  virtual void getChanRefPath(const CH_ChannelRef &r,
1562  UT_String &path,
1563  bool use_alias=false) const;
1564 
1565  virtual bool isChanRefValid( const CH_ChannelRef &chref) const;
1566 
1567  void changeReferencesToNodeId(int old_id, int new_id);
1568 
1569  /// This method will remove all references that this manager knows about
1570  /// channels belonging to node 'node_id'. After this method, scoped
1571  /// channels belonging to node_id will be removed, as will such channels
1572  /// in channel groups.
1573  void removeReferencesToNodeId(int node_id);
1574 
1575  void displayScope() const;
1576 
1577  // Find ChannelRef export location
1578  // Channel CHOP nodes have inputs that match directly to the exported
1579  // tracks. Given a Channel CHOP value param and index, find the export
1580  // location in the scene and return its ChannelRef If the input 'r' channel
1581  // ref is from a CHOP Channel Node, return the corresponding export in
1582  // 'out_export'.
1583  // Returns true if a valid Export was found
1584  virtual bool resolveChanRefExport(const CH_ChannelRef& r,
1585  CH_ChannelRef& out_export );
1586 
1587  /// Auto-Key all Tuples is a preference to key tuples together.
1588  bool getAutoKeyTuples() const
1589  { return myAutoKeyTuples; }
1590  void setAutoKeyTuples(bool b)
1591  { myAutoKeyTuples=b; }
1592 
1593  /// Auto-Scope when Creating Channel is a preference to set the auto-scope
1594  /// flag when creating a channel.
1596  { return mySetAutoScopeOnChannelCreate; }
1598  { mySetAutoScopeOnChannelCreate=b; }
1599 
1600  /// Keep Channel List Selection is a preference to remember the display flag
1601  /// of channels when they are unscoped
1603  { return myKeepChannelSelection; }
1605  { myKeepChannelSelection=b; }
1606 
1607  /// Include all the Animated Channels when building the scoped parameter
1608  /// list from selection
1610  { return myAutoScopeIncludeAnimated; }
1612  { myAutoScopeIncludeAnimated=b; }
1613 
1614  ///
1616  { return myFollowScopedChannelReferences; }
1618  { myFollowScopedChannelReferences=b; }
1619 
1620 
1621  //
1622  // Animation functions.
1623  //
1624  fpreal evalBezierFunc(int thread);
1625  fpreal evalConstantFunc(int thread);
1626  fpreal evalCubicFunc(int thread);
1627  fpreal evalCycleFunc(fpreal start_frame, fpreal end_frame,
1628  int thread);
1629  fpreal evalCycletFunc(fpreal start_frame, fpreal end_frame,
1630  int thread);
1631  fpreal evalCycleOffsetFunc(
1632  fpreal start_frame, fpreal end_frame, int thread);
1633  fpreal evalCycleOffsettFunc(
1634  fpreal start_frame, fpreal end_frame, int thread);
1635  fpreal evalEaseFunc(int thread);
1636  fpreal evalEaseinFunc(int thread);
1637  fpreal evalEaseinpFunc(fpreal ease_speed, int thread);
1638  fpreal evalEaseoutFunc(int thread);
1639  fpreal evalEaseoutpFunc(fpreal ease_speed, int thread);
1640  fpreal evalEasepFunc(fpreal ease_speed, int thread);
1641  fpreal evalLinearFunc(int thread);
1642  fpreal evalMatchFunc(int thread);
1643  fpreal evalMatchinFunc(int thread);
1644  fpreal evalMatchoutFunc(int thread);
1645  fpreal evalQcubicFunc(int thread);
1646  fpreal evalQlinearFunc(int thread);
1647  fpreal evalQuinticFunc(int thread);
1648  fpreal evalRepeatFunc(fpreal start_frame, fpreal end_frame,
1649  int thread);
1650  fpreal evalRepeattFunc(fpreal start_frame, fpreal end_frame,
1651  int thread);
1652  fpreal evalSplineFunc(int thread);
1653  fpreal evalVmatchFunc(int thread);
1654  fpreal evalVmatchinFunc(int thread);
1655  fpreal evalVmatchoutFunc(int thread);
1656 
1657  /// Include all the Child nodes when building the scoped parameter list
1658  /// from selection
1660  { return myAutoScopeIncludeChild; }
1662  { myAutoScopeIncludeChild=b; }
1663 
1664  /// Include all the Constraints nodes when building the scoped parameter
1665  /// list from selection
1667  { return myAutoScopeIncludeConstraints; }
1669  { myAutoScopeIncludeConstraints=b; }
1670 
1671  // Functions for accessing and controlling the default context option
1672  // values. These values are used by all OP_Context objects unless a
1673  // value is explicitly overridden on that context object. These functions
1674  // also manage the associated micro nodes and send notifications as
1675  // appropriate.
1677  { return myDefaultContextOptions; }
1678  DEP_MicroNode &getDefaultContextOptionMicroNode(
1679  const UT_StringRef &opt);
1680  bool shouldSetGlobalContextOptionDependency(
1681  const UT_StringRef &opt,
1682  const DEP_ContextOptionsReadHandle &options);
1683  void addContextOptionDependency(
1684  const UT_StringRef &opt,
1685  bool set_dependency_on_global,
1686  DEP_MicroNode &depnode);
1687  void setDefaultContextOption(
1688  const UT_StringHolder &opt,
1689  const UT_StringHolder &value,
1690  bool create_undo);
1691  void setDefaultContextOption(
1692  const UT_StringHolder &opt,
1693  fpreal64 value,
1694  bool create_undo);
1695  const UT_StringHolder &getDefaultContextOptionUiConfig(
1696  const UT_StringHolder &opt) const;
1697  void setDefaultContextOptionUiConfig(
1698  const UT_StringHolder &opt,
1699  const UT_StringHolder &ui_config);
1700  void removeDefaultContextOption(
1701  const UT_StringHolder &opt,
1702  bool create_undo);
1703  void clearDefaultContextOptions(bool create_undo);
1704  bool saveDefaultContextOptions(std::ostream &os) const;
1705  bool loadDefaultContextOptions(UT_IStream &is);
1706  int addDefaultContextOptionCallback(
1708  void removeDefaultContextOptionCallback(int id);
1709  bool isAutomaticContextOption(
1710  const UT_StringHolder &opt) const;
1711  bool isAutomaticContextOptionOverridden(
1712  const UT_StringHolder &opt) const;
1713  void pushRopCookContextOptions();
1714  void pushRopCookContextOptions(bool ropcook,
1715  fpreal fstart,
1716  fpreal fend,
1717  fpreal finc,
1718  const UT_StringHolder &ropname,
1719  const UT_StringHolder &roppath);
1720  void resetRopCookContextOptions();
1721  void updateRopCookContextOptions(bool ropcook,
1722  fpreal fstart,
1723  fpreal fend,
1724  fpreal finc,
1725  const UT_StringHolder &ropname,
1726  const UT_StringHolder &roppath);
1727  void popRopCookContextOptions();
1728 
1729  void setChannelColorManager( CH_ChannelColorManager *mgr );
1730  CH_ChannelColorManager *channelColorManager();
1731 
1732  void setChannelChanged( CH_ChannelChanged *mgr );
1733  CH_ChannelChanged *getChannelChanged();
1734  void triggerChannelChanged();
1735 
1736  CH_Tweener *getChannelTweener() { return &myChannelTweener; }
1737 
1738  virtual bool getChannelAutoSelect(const CH_ChannelRef &chref) const
1739  { return true; }
1740 
1741  // Resolve channel labels and node path without exposing OP_Node*
1742  virtual bool getChRefLabelForUI(const CH_ChannelRef &r, UT_String &ret) const;
1743  virtual bool getChRefAlias(const CH_ChannelRef &r, UT_String &ret) const;
1744  virtual bool getChRefNodePath(const CH_ChannelRef &r, UT_String &ret) const;
1745 
1747  { return myIgnoreUpdateScopeFlag; }
1748  void setIgnoreUpdateScopeFlag( bool onoff )
1749  { myIgnoreUpdateScopeFlag = onoff; }
1750 
1751  static int getSimpleSegmentTypeFromExpression(const char *expr);
1752 
1753  // The following four methods are overridden by the OP_CommandManager,
1754  // and allow for tracking when channels are being actively modified
1755  // (such as by dragging in the animation editor).
1756  // See the comment in OP_CommandManager for more info.
1757  virtual void beginChannelChanges() {}
1758  virtual void channelsChanged() {}
1759  virtual void endChannelChanges() {}
1760  virtual bool channelsBeingChanged() { return false; }
1761 
1762 protected:
1763  void setTolerance(fpreal tol);
1764 
1765  void initExpressionLibrary();
1766 
1767  // Since this is possibly a base class, the library glue initialization has
1768  // to be done after the construction
1769  void initLibraryGlue();
1770 
1771  /// Add and take ownership of an external channel collection, such
1772  /// as geometry channels passed in by the MOT_GeometryChannelsManager
1773  /// Returns a pointer to the added collection.
1774  /// Should only be called by the OP_CommandManager
1775  CH_Collection *addExternalCollection(
1776  UT_UniquePtr<CH_Collection> &&collection);
1777 
1778  void destroyExternalCollection(
1779  const UT_StringHolder &name);
1780 
1781 private:
1782  friend CH_ScopedChannelsBase;
1783  friend CH_ScopedChannels;
1784 
1785  void internalScopeChanged(unsigned flags,
1786  bool propagate=true,
1787  const int &reason = CH_SCOPE_REPLACED);
1788 
1789  void playbackChanged();
1790 
1791  void handleGroupCollision(CH_Group *new_group,
1792  CH_Group *existing,
1793  CollisionBehaviour cb );
1794 
1795  void destroyContents();
1796  int internalSetGlobalParam(const char *token,
1797  fpreal val, const char *strval,
1798  CH_Collection *&owner);
1799  int setSingleGlobalParam(const char *token,
1800  fpreal val, const char *strvel,
1801  CH_Collection *&owner, CH_Collection *scope);
1802  void internalDirtyOrphanGlobalParamDependents(
1803  const char *token, CH_Collection *scope,
1804  UT_Set<CH_Collection *> *dependents);
1805  void stretchCollection(CH_Collection *grp,
1806  fpreal os, fpreal ns, fpreal stretch);
1807  void propagateDefaultContextOptionDirtied(
1808  const UT_StringHolder &opt);
1809 
1810  static char *chExprExpander(const char *str, int thread);
1811 
1812  class chParamKey
1813  {
1814  public:
1815  chParamKey(const UT_StringRef &token, CH_Collection *scope);
1816  bool operator==(const chParamKey &key) const;
1817  bool operator!=(const chParamKey &key) const
1818  { return !operator==(key); }
1819  SYS_HashType hash() const;
1820  const char *getToken() const
1821  { return myToken; }
1822  CH_Collection *getScope() const
1823  { return myScope; }
1824 
1825  struct Hasher
1826  {
1827  SYS_HashType operator()(const chParamKey &key) const
1828  { return key.hash(); }
1829  };
1830  private:
1831  UT_StringRef myToken;
1832  CH_Collection *myScope;
1833  };
1834 
1836 
1837  // Default Context Options for cooking nodes.
1838  DEP_ContextOptionsHandle myDefaultContextOptions;
1839  UT_StringMap<DEP_MicroNode *> myDefaultContextOptionMicroNodes;
1840  UT_TBBSpinLock myDefaultContextOptionMicroNodesLock;
1841  UT_StringMap<UT_StringHolder> myDefaultContextOptionUIs;
1842 
1843  CH_Group *myTopGroup;
1844  UT_StringArray mySelectedGroupPaths;
1845  UT_String myCurrentGroupPath;
1846  UT_ValArray<CH_TimeGroup *> myTimeGroups;
1847 
1848  // List of bookmarks, sorted by start time.
1849  // NOTE that any operation that changes this array, or the order of it
1850  // MUST also update the myRecentBookmarks array
1852 
1853  // Bookmarks sorted by least to most recently used/interacted with,
1854  // as indices into the myBookmarks list
1855  UT_Array<exint> myRecentBookmarks;
1856 
1857  // Stored frame range to restore after zooming in/out from a bookmark
1858  fpreal myStoredStart;
1859  fpreal myStoredEnd;
1860 
1861  DEP_MicroNode myBookmarksMicroNode;
1862 
1863  UT_StringMap<UT_UniquePtr<CH_Collection>> myExternalCollections;
1864 
1865  CH_Collection *myRootCollection;
1866  fpreal mySampleCount;
1867  fpreal myFPS;
1868  fpreal myStart, myEnd;
1869 
1870  fpreal myRangeStart;
1871  fpreal myRangeEnd;
1872  fpreal myRealTimeFactor;
1873  fpreal mySampleStep;
1874  fpreal myTimeTolerance;
1875  fpreal myTimeCodeOffset;
1876 
1877  chParamData *findGlobalParam(const char *token,
1878  CH_Collection *scope);
1879  chParamData *findOrCreateGlobalParam(
1880  const char *token, CH_Collection *scope,
1881  fpreal fval, const char *sval);
1883  int mySettingGlobalParam;
1884 
1885  int mySettingGuideParam;
1886 
1887  int myChopMotionSamples;
1888 
1889  unsigned myGroupsSorted:1,
1890  myIntegerFrames:1,
1891  myRealTimePlay:1,
1892  myRealTimeDisableSkip:1,
1893  myHoldFlag:1,
1894  myRestrictRange:1,
1895  myShowRange:1,
1896  myShowTicks:1,
1897  myShowAudio:1,
1898  myShowKeys:1,
1899  myShowBookmarks:1,
1900  myShowSimCache:1,
1901  myShowSimCachePref:1,
1902  myShowAnimCache:1,
1903  myShowAnimCachePref:1,
1904  myShowAnimBar:1,
1905  myAutoKeyTuples:1,
1906  mySetAutoScopeOnChannelCreate:1,
1907  myKeepChannelSelection:1,
1908  myAutoScopeIncludeAnimated:1,
1909  myFollowScopedChannelReferences:1,
1910  myAutoScopeIncludeChild:1,
1911  myAutoScopeIncludeConstraints:1;
1912 
1913  short myRawInterpFlag;
1914 
1915  UT_String myDefaultExpression;
1916  bool myShouldShowFakeAccelHandles;
1917  UT_String myDefaultRotationExpression;
1918  bool myAutoSplit;
1919  UT_String myDefaultSplitExpression;
1920  SlopeMode myAutoSlope;
1921  fpreal myDefaultSlope;
1922  bool myHoldLastKey;
1923  // auto-commit value change when we are on a keyframe
1924  bool myAlwaysCommitKey;
1925  UT_String myChanCreateKeyExpression;
1926  fpreal myAudioLevel;
1927  fpreal myUnitLength;
1928  fpreal myUnitMass;
1929 
1930  CH_ScopedChannels myScopedChannels;
1931  UT_Array<CH_ScopedChannels*> myPinnedScopedChannels;
1932 
1933  UT_Set<CH_Channel *> myPendingChannelsTable;
1934 
1935  CH_ExprLanguage myDefaultExprLanguage;
1936 
1937  int myBlockModifyScope;
1938  unsigned myPendingScopeChange;
1939  bool myPendingChannelChanged;
1940 
1941  CH_ChannelColorManager *myChannelColorsManager;
1942  CH_ChannelChanged *myChannelChanged;
1943 
1944  CH_Tweener myChannelTweener;
1945 
1947  myDefaultContextOptionCallbacks;
1948  int myNextDefaultContextOptionCallbackId;
1949 
1950  bool myIgnoreUpdateScopeFlag;
1951 
1952  mutable UT_Lock myPendingChannelsLock;
1953 
1954  static CH_Manager *theManager;
1955 
1956  // Drives the precision of floating point times. 1000 means a frame can be
1957  // split into 1000 sub frames. Before H15.0, it was set to 100. This was
1958  // problematic when refitting curves with a very high sampling rate.
1959  static constexpr exint CH_SAMPLES_PER_FRAME = 1000;
1960 
1963  friend class CH_UndoScopeChannels;
1964  friend class CH_ScopeUndo;
1965 };
1966 
1967 /// Push & restore the evaluation time (and optionally a channel collection)
1969 {
1970 public:
1972  int thread,
1973  fpreal time,
1974  CH_Collection *ch = nullptr,
1975  const DEP_ContextOptionsStack *context_options_stack = nullptr,
1976  DEP_ContextOptionsReadHandle context_options =
1978  : myContext(chman.evalContext(thread))
1979  , myCollection(nullptr)
1980  , myPopCollection(false)
1981  , myPopContextOptions(false)
1982  {
1983 #if defined(CH_USE_FLICKS)
1984  myFlicks = myContext.flicks();
1985 #else
1986  mySeconds = myContext.time();
1987 #endif
1988  myContext.setTime(time);
1989  if (ch)
1990  {
1991  myPopCollection = true;
1992  myCollection = myContext.myCollection;
1993  myContext.myCollection = ch;
1994  }
1995  if (!context_options.isNull())
1996  {
1997  myPopContextOptions = true;
1998  myContextOptionsStack = myContext.myContextOptionsStack;
1999  myContext.myContextOptionsStack = context_options_stack;
2000  myContextOptions = myContext.myContextOptions;
2001  myContext.myContextOptions = context_options;
2002  }
2003  }
2004 
2006  {
2007 #if defined(CH_USE_FLICKS)
2008  myContext.setFlicks(myFlicks);
2009 #else
2010  myContext.setTime(mySeconds);
2011 #endif
2012  if (myPopCollection)
2013  myContext.myCollection = myCollection;
2014  if (myPopContextOptions)
2015  {
2016  myContext.myContextOptionsStack = myContextOptionsStack;
2017  myContext.myContextOptions = myContextOptions;
2018  }
2019  }
2020 
2022 
2023 private:
2024  CH_EvalContext &myContext;
2025  CH_Collection *myCollection;
2026  const DEP_ContextOptionsStack *myContextOptionsStack;
2027  DEP_ContextOptionsReadHandle myContextOptions;
2028 #if defined(CH_USE_FLICKS)
2029  SYS_Flicks myFlicks;
2030 #else
2031  fpreal64 mySeconds;
2032 #endif
2033  bool myPopCollection;
2034  bool myPopContextOptions;
2035 
2036  friend class CH_Manager;
2037 };
2038 
2039 /// Push & restore a channel collection only. If the given collection is NULL,
2040 /// then the eval context is not modified.
2042 {
2043 public:
2044  CH_AutoEvalCollection(int thread, CH_Collection *collection = nullptr)
2045  : myContext(CH_Manager::getContext()->evalContext(thread))
2046  {
2047  myCollection = myContext.myCollection;
2048  if (collection)
2049  myContext.myCollection = collection;
2050  }
2052  {
2053  return myContext.myCollection;
2054  }
2055  void set(CH_Collection *collection)
2056  {
2057  UT_ASSERT(collection);
2058  myContext.myCollection = collection;
2059  }
2061  {
2062  myContext.myCollection = myCollection;
2063  }
2064 
2066 
2067 private:
2068  CH_EvalContext &myContext;
2069  CH_Collection *myCollection;
2070 };
2071 
2072 // Small utility class to set the active layer contribution and reset it
2073 // The animation layer value and weight comes from CHOP_Layer extra tracks.
2074 // The active_layer_value and active_layer_weight tracks are used correctly
2075 // reapply values on the active layer channels.
2077 {
2078 public:
2079  CH_ActiveLayerContrib();
2080  ~CH_ActiveLayerContrib();
2081 
2082  UT_NON_COPYABLE(CH_ActiveLayerContrib)
2083 
2084  // set the layer contribution for the lifespan of the object.
2085  void set(fpreal layer_value, fpreal layer_weight);
2086 
2087  // Apply the active layer contribution to input
2088  void apply(fpreal& v);
2089 
2090 private:
2091  bool myReset;
2092 };
2093 
2095 {
2096 public:
2099 
2101 
2102 private:
2103  bool myRestore;
2104 };
2105 
2106 
2107 // Single Parm Vec undo information
2109 {
2110 public:
2112  : myOwner(owner), myChanRef(ref), myFlags(flags)
2113  {}
2114 
2115  // Check if the owner pointer is still valid.
2116  bool checkPtr() const;
2117 
2118  // Apply the flags to the owner
2119  void applyFlags();
2120 
2121  // Query the CH_Manager global and pinned channels lists for undo information
2122  // about a parameter. vec_index must match the CH_ChannelRef.
2123  static void appendScopeUndo(UT_Array<CH_ScopeUndo> &undos, const CH_ChannelRef &ref);
2124 
2127  unsigned myFlags;
2128 };
2129 
2131 {
2132 public:
2135 
2136  void optionSet(const UT_StringHolder &opt);
2137 
2138 private:
2139  UT_StringSet &myOptions;
2140 };
2141 
2144 CH_API void CHsortChannelPaths( UT_StringArray &channel_paths );
2146 
2148  CH_CollectionList &collections );
2149 
2150 inline
2152 {
2153  return CH_Manager::getContext();
2154 }
2155 
2156 inline fpreal
2158 {
2159  fpreal scale = SYSpow(fpreal(10.0), fpreal(digits));
2160  return (SYSrint(num * scale) / scale);
2161 }
2162 
2163 inline
2165 {
2167 }
2168 
2170 {
2172 }
2173 
2174 inline fpreal CHgetEvalTime(int thread)
2175 {
2176  return CH_Manager::getContext()->getEvaluateTime(thread);
2177 }
2178 
2179 /// Returns the time given a floating point frame.
2180 CH_API extern fpreal CHgetTimeFromFrame(fpreal frame);
2181 
2182 /// Returns an integer frame given a time.
2183 /// Returns 1 if time is 0.0.
2184 /// This was marked deprecated because it wasn't clear it was retrurning
2185 /// a clamped integer frame number.
2186 /// Use CHgetIntegerFrameFromTime() if you want an integer frame number.
2187 /// Use CHgetSampleFromTime() if you want a floating point frame number.
2188 SYS_DEPRECATED_REPLACE(21.0, "CHgetIntegerFrameFromTime")
2189 CH_API extern int CHgetFrameFromTime(fpreal time);
2190 
2191 /// Returns an integer frame given a time.
2192 /// Returns 1 if time is 0.0.
2193 CH_API extern int CHgetIntegerFrameFromTime(fpreal time);
2194 
2195 /// Returns a floating point frame given a time.
2196 /// In CH_Manager a Sample is a non-integer frame.
2197 /// In CH_Manager a Frame is an integer frame.
2198 /// Returns 1.0 if time is 0.0.
2200 
2201 /// Builds a UT_SuperIntervalR given integer start and end frames.
2202 CH_API extern void CHbuildRange(int start, int end, UT_SuperIntervalR &r);
2203 
2204 /// The CHoutputChannelList functions output a formatted string
2205 /// representing the given channels. One version of the function takes a
2206 /// list of channels while the other takes a string array of full paths
2207 /// to channels. The given arrays may be modified (they might need sorting).
2208 CH_API extern void CHoutputChannelList(UT_WorkBuffer &info,
2210 CH_API extern void CHoutputChannelList(UT_WorkBuffer &info,
2211  UT_StringArray &channel_paths);
2212 
2213 CH_API extern void CHdisplayFlags( unsigned flags, std::ostream &s );
2214 
2215 #endif
fpreal getSampleDelta(fpreal time_delta) const
Definition: CH_Manager.h:1262
CH_ScopedChannelsBase(CH_Manager *mgr)
fpreal getRealTimeFactor() const
Definition: CH_Manager.h:1363
bool SYSisEqual(const UT_Vector2T< T > &a, const UT_Vector2T< T > &b, S tol)
Componentwise equality.
Definition: UT_Vector2.h:677
void setFilterRotates(bool b)
Definition: CH_Manager.h:343
CH_API void CHsortChannelRefs(CH_ChannelRefList &channels)
int getShowAnimCacheFlag() const
Definition: CH_Manager.h:1342
CE_API bool evaluate(const CE_OSDRefinement &topo, const CE_OSDEvaluator &eval, const cl::Buffer &coarse, const CE_OSDPatchCoords &patch_coords, const CE_FloatArray *refined_data, cl::Buffer &out, cl::Buffer *du, cl::Buffer *dv)
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
GLbitfield flags
Definition: glcorearb.h:1596
DEP_ContextOptionsHandle getDefaultContextOptions() const
Definition: CH_Manager.h:1676
Definition: UT_Set.h:58
fpreal getSnapToSubframeTime(fpreal t) const
Definition: CH_Manager.h:1273
GT_API const UT_StringHolder filename
bool getAutoScopeIncludeConstraints() const
Definition: CH_Manager.h:1666
#define UT_AT_SCOPE_EXIT(...)
Definition: UT_ScopeExit.h:95
const char * getEvalChannelName(int thread) const
Definition: CH_Manager.h:1463
fpreal getSnapToFrameTime(fpreal t) const
Definition: CH_Manager.h:1267
fpreal getSecsPerSample() const
Definition: CH_Manager.h:1213
CH_ScopedChannels(const CH_ScopedChannels &src)
Definition: CH_Manager.h:446
CH_API fpreal CHgetTimeFromFrame(fpreal frame)
Returns the time given a floating point frame.
bool isGlobalScopedChannels(CH_ScopedChannelsBase *p)
Definition: CH_Manager.h:1033
#define SYS_DEPRECATED(__V__)
void setAutoScopeOnChannelCreate(bool b)
Definition: CH_Manager.h:1597
CH_API fpreal CHgetSampleFromTime(fpreal time)
SYS_FORCE_INLINE CH_Manager * ourManager() const
Definition: CH_Manager.h:376
virtual ~CH_ChannelColorManager()
Definition: CH_Manager.h:82
void setAutoScopeIncludeChild(bool b)
Definition: CH_Manager.h:1661
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
Definition: thread.h:632
CH_ExprLanguage
const DEP_ContextOptionsStack * getEvalChannelContextOptionsStack(int thread) const
Definition: CH_Manager.h:1466
friend class CH_Manager
Definition: CH_Manager.h:379
void setEnableFilter(FilterType filter_type, bool b)
Definition: CH_Manager.h:328
void
Definition: png.h:1083
void setAutoScopeIncludeConstraints(bool b)
Definition: CH_Manager.h:1668
fpreal getUnitLength() const
Definition: CH_Manager.h:1351
GT_API const UT_StringHolder time
const GLdouble * v
Definition: glcorearb.h:837
bool(* CH_StringVarEvalFunc)(UT_String &val, int varid, int thread)
Definition: CH_Manager.h:72
void setHoldFlag(int flag)
Definition: CH_Manager.h:1378
GLuint start
Definition: glcorearb.h:475
GLsizei const GLfloat * value
Definition: glcorearb.h:824
bool(* CH_IntVarEvalFunc)(int &val, int varid, int thread)
Definition: CH_Manager.h:74
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void setFilterParmLabels(FilterType filter_type, bool b)
Definition: CH_Manager.h:353
bool getKeepChannelListSelection() const
Definition: CH_Manager.h:1602
const UT_StringMap< UT_UniquePtr< CH_Collection > > & getExternalCollections() const
Definition: CH_Manager.h:1083
GLboolean GLboolean g
Definition: glcorearb.h:1222
bool getAutoScopeOnChannelCreate() const
Definition: CH_Manager.h:1595
int64 exint
Definition: SYS_Types.h:125
fpreal getSampleRaw(fpreal t) const
Definition: CH_Manager.h:1242
fpreal64 file_end
Definition: CH_Manager.h:106
const CH_TimeGroup * getTimeGroup(int i) const
Definition: CH_Manager.h:1099
GLdouble s
Definition: glad.h:3009
std::size_t SYS_HashType
Define the type for hash values.
Definition: SYS_Hash.h:19
fpreal getSnapSample(fpreal frame) const
Definition: CH_Manager.h:1280
void setEvalCollection(CH_Collection *g, int thread)
Definition: CH_Manager.h:1408
int getShowSimCacheFlag() const
Definition: CH_Manager.h:1339
bool getFilterFullNames(FilterType filter_type) const
Definition: CH_Manager.h:360
CH_KeyState
Definition: CH_KeyState.h:15
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
CH_API void CHsortChannelPaths(UT_StringArray &channel_paths)
CH_API void CHoutputChannelList(UT_WorkBuffer &info, CH_ChannelList &channels)
void setFilterScales(bool b)
Definition: CH_Manager.h:348
bool getAutoScopeIncludeChild() const
Definition: CH_Manager.h:1659
Selectively extract and filter point data using a custom filter operator.
CH_API void CHbuildRange(int start, int end, UT_SuperIntervalR &r)
Builds a UT_SuperIntervalR given integer start and end frames.
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:39
fpreal getTimeDelta(fpreal sample_delta) const
Definition: CH_Manager.h:1257
fpreal getTimeCodeOffset(fpreal) const
Definition: CH_Manager.h:1316
CH_Tweener * getChannelTweener()
Definition: CH_Manager.h:1736
void setFilter(FilterType filter_type, const UT_StringHolder &f)
Definition: CH_Manager.h:333
**But if you need a result
Definition: thread.h:622
bool getEnableFilter(FilterType filter_type) const
Definition: CH_Manager.h:330
bool getIsSettingGuideParam() const
Definition: CH_Manager.h:943
int getRealTimeFlag() const
Definition: CH_Manager.h:1361
CH_ScopeUndo(CH_ScopedChannels *owner, const CH_ChannelRef &ref, unsigned flags)
Definition: CH_Manager.h:2111
UT_Function< void(const UT_StringHolder &)> CH_DefaultContextOptionCallback
Definition: CH_Manager.h:76
fpreal64 load_end
Definition: CH_Manager.h:104
fpreal getSnapSubsample(fpreal frame) const
Definition: CH_Manager.h:1288
bool shouldShowFakeAccelHandles() const
Definition: CH_Manager.h:549
float fpreal32
Definition: SYS_Types.h:200
const CH_EvalContext & evalContext(int thread) const
Definition: CH_Manager.h:1452
int getHoldLastKey() const
Definition: CH_Manager.h:576
void setAutoScopeIncludeAnimated(bool b)
Definition: CH_Manager.h:1611
int getShowKeysFlag() const
Definition: CH_Manager.h:1333
virtual void beginChannelChanges()
Definition: CH_Manager.h:1757
OutGridT const XformOp bool bool
fpreal getUnitMass() const
Definition: CH_Manager.h:1353
static bool getContextExists()
Definition: CH_Manager.h:534
void setUnitMass(fpreal unitmass)
Definition: CH_Manager.h:1354
bool getRealTimeDisableSkip() const
Definition: CH_Manager.h:1365
SlopeMode getAutoSlope() const
Definition: CH_Manager.h:560
virtual void channelsChanged()
Definition: CH_Manager.h:1758
DEP_MicroNode & getBookmarksMicroNode()
Definition: CH_Manager.h:1110
void setChanCreateKeyExpression(const char *s)
Definition: CH_Manager.h:580
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
void setFollowScopedChannelReferences(bool b)
Definition: CH_Manager.h:1617
CH_ChannelRef myChanRef
Definition: CH_Manager.h:2126
double fpreal64
Definition: SYS_Types.h:201
CH_AutoEvalCollection(int thread, CH_Collection *collection=nullptr)
Definition: CH_Manager.h:2044
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
int getGlobalEndFrame() const
Definition: CH_Manager.h:1222
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
virtual void endChannelChanges()
Definition: CH_Manager.h:1759
GA_API const UT_StringHolder scale
bool getFollowScopedChannelReferences() const
Definition: CH_Manager.h:1615
int getNTimeGroups() const
Definition: CH_Manager.h:1097
CH_Bookmark * getBookmark(int i)
Definition: CH_Manager.h:1165
void getSampleRange(fpreal &start, fpreal &end)
Definition: CH_Manager.h:1370
GLdouble n
Definition: glcorearb.h:2008
int getFrame(fpreal t) const
Definition: CH_Manager.h:1252
GLfloat f
Definition: glcorearb.h:1926
fpreal getSampleStep() const
Definition: CH_Manager.h:1367
CH_API void CHsortLayerRefs(CH_ChannelRefList &channels)
int getShowBookmarksFlag() const
Definition: CH_Manager.h:1336
bool getAutoScopeIncludeAnimated() const
Definition: CH_Manager.h:1609
int getRawInterpolation()
Definition: CH_Manager.h:1231
CH_AutoEvaluateTime(CH_Manager &chman, int thread, fpreal time, CH_Collection *ch=nullptr, const DEP_ContextOptionsStack *context_options_stack=nullptr, DEP_ContextOptionsReadHandle context_options=DEP_ContextOptionsReadHandle())
Definition: CH_Manager.h:1971
CH_Manager * CHgetManager()
Definition: CH_Manager.h:2151
fpreal getGlobalStart() const
Definition: CH_Manager.h:1218
fpreal getSample(fpreal t) const
Definition: CH_Manager.h:1247
CH_ScopedChannels & operator=(const CH_ScopedChannels &src)
Definition: CH_Manager.h:455
int getIntegerFrameFlag() const
Definition: CH_Manager.h:1318
GLint ref
Definition: glcorearb.h:124
const CH_Segment * getEvalSegment(int thread) const
Definition: CH_Manager.h:1461
bool getAutoKeyTuples() const
Auto-Key all Tuples is a preference to key tuples together.
Definition: CH_Manager.h:1588
DEP_ContextOptionsReadHandle getEvalChannelContextOptions(int thread) const
Definition: CH_Manager.h:1469
void setRootCollection(CH_Collection *root)
Definition: CH_Manager.h:1443
fpreal getSamplesPerSec() const
Definition: CH_Manager.h:1211
const CH_Bookmark * getBookmark(int i) const
Definition: CH_Manager.h:1166
constexpr auto set(type rhs) -> int
Definition: core.h:610
int getRestrictRangeFlag() const
Definition: CH_Manager.h:1321
void setDefaultSlope(fpreal slope)
Definition: CH_Manager.h:562
unsigned myFlags
Definition: CH_Manager.h:2127
int getNBookmarks() const
Definition: CH_Manager.h:1161
GLuint GLuint end
Definition: glcorearb.h:475
#define SYS_FORCE_INLINE
Definition: SYS_Inline.h:45
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
void setEvaluateTime(SYS_Flicks fl, int thread)
Functions for obtaining and setting the current evaluation time.
Definition: CH_Manager.h:1478
void setAllowExternal(bool allow)
Definition: CH_Manager.h:365
CH_EvalContext & evalContext(int thread)
Definition: CH_Manager.h:1456
SYS_API fpreal32 SYSfloor(const fpreal32 val)
CH_API void CHchannelsToCollections(CH_ChannelList const &channels, CH_CollectionList &collections)
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLint GLuint mask
Definition: glcorearb.h:124
const CH_Channel * getEvalChannel(int thread) const
Definition: CH_Manager.h:1459
#define checkPtr(ptr, msg)
Definition: CudaUtils.h:41
fpreal64 load_start
Definition: CH_Manager.h:103
void setRawInterpolation(int state)
Definition: CH_Manager.h:1230
CH_API void CHdisplayFlags(unsigned flags, std::ostream &s)
void setFilterFullNames(FilterType filter_type, bool b)
Definition: CH_Manager.h:358
long long int64
Definition: SYS_Types.h:116
GLenum target
Definition: glcorearb.h:1667
fpreal getGlobalEnd() const
Definition: CH_Manager.h:1219
void setDefaultExprLanguage(CH_ExprLanguage language)
Definition: CH_Manager.h:1029
bool getIgnoreUpdateScopeFlag() const
Definition: CH_Manager.h:1746
fpreal CHgetEvalTime()
Definition: CH_Manager.h:2169
fpreal getAudioLevel() const
Definition: CH_Manager.h:1348
GLuint const GLchar * name
Definition: glcorearb.h:786
CH_Collection * collection() const
Definition: CH_Manager.h:2051
CH_API int CHgetFrameFromTime(fpreal time)
void setAudioLevel(fpreal lvl)
Definition: CH_Manager.h:1349
GLushort pattern
Definition: glad.h:2583
CH_ExprLanguage getDefaultExprLanguage()
Definition: CH_Manager.h:1027
const UT_StringHolder & getFilter(FilterType filter_type) const
Definition: CH_Manager.h:335
void setAutoSlope(SlopeMode m)
Definition: CH_Manager.h:558
std::function< T > UT_Function
Definition: UT_Function.h:37
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
bool getAllowExternal() const
Definition: CH_Manager.h:366
SYS_FORCE_INLINE UT_StringHolder getToken(Add enum_value)
Definition: SOP_Add.proto.h:35
fpreal getDefaultSlope() const
Definition: CH_Manager.h:564
static CH_Manager * getContext()
Definition: CH_Manager.h:529
int getShowAnimBarFlag() const
Definition: CH_Manager.h:1345
GLdouble t
Definition: glad.h:2397
int getShowAudioFlag() const
Definition: CH_Manager.h:1330
bool getIsAtFrame(fpreal t) const
Definition: CH_Manager.h:1302
int getShowRangeFlag() const
Definition: CH_Manager.h:1324
const char * getDefaultExpression() const
Definition: CH_Manager.h:547
GT_API const UT_StringHolder version
void setDefaultRotationExpression(const char *s)
Definition: CH_Manager.h:551
util::flicks SYS_Flicks
Definition: SYS_Flicks.h:18
GLfloat units
Definition: glcorearb.h:408
const CH_ScopedChannels & getGlobalScopedChannels() const
Definition: CH_Manager.h:1039
bool full_replace
Definition: CH_Manager.h:107
CH_ScopedChannels * myOwner
Definition: CH_Manager.h:2125
fpreal getEvaluateTime(int thread) const
Functions for obtaining and setting the current evaluation time.
Definition: CH_Manager.h:1474
CH_Collection * getEvalCollection(int thread) const
Definition: CH_Manager.h:1429
**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
void setUnitLength(fpreal unitlength)
Definition: CH_Manager.h:1352
bool getFilterTranslates() const
Definition: CH_Manager.h:340
UT_COWReadHandle< DEP_ContextOptions > DEP_ContextOptionsReadHandle
static fpreal niceNumber(fpreal num, int digits=6)
Definition: CH_Manager.h:2157
void setAutoKeyTuples(bool b)
Definition: CH_Manager.h:1590
Push & restore the evaluation time (and optionally a channel collection)
Definition: CH_Manager.h:1968
SYS_API int SYSgetSTID()
int getChopMotionSamples() const
Definition: CH_Manager.h:1215
CH_ScopedChannels & getGlobalScopedChannels()
Definition: CH_Manager.h:1037
SIM_API const UT_StringHolder force
const char * getDefaultRotationExpression() const
Definition: CH_Manager.h:556
virtual ~CH_ChannelChanged()
Definition: CH_Manager.h:93
fpreal64 fpreal
Definition: SYS_Types.h:283
#define CH_API
Definition: CH_API.h:10
SYS_HashType operator()(const chParamKey &key) const
Definition: CH_Manager.h:1827
LeafData & operator=(const LeafData &)=delete
void setAlwaysCommitKeyChange(bool onoff)
Definition: CH_Manager.h:584
bool getAutoSplit() const
Definition: CH_Manager.h:567
GLuint index
Definition: glcorearb.h:786
void setHoldLastKey(bool onoff)
Definition: CH_Manager.h:574
bool getFilterRotates() const
Definition: CH_Manager.h:345
GLuint GLfloat * val
Definition: glcorearb.h:1608
fpreal getNumSamples() const
Definition: CH_Manager.h:1209
virtual CH_ScriptAccessManager * getAccessManager(int)
Definition: CH_Manager.h:1448
void setTimeCodeOffset(fpreal t)
Definition: CH_Manager.h:1315
bool use_load_range
Definition: CH_Manager.h:102
void setKeepChannelListSelection(bool b)
Definition: CH_Manager.h:1604
bool getAlwaysCommitKeyChange() const
Definition: CH_Manager.h:582
void set(CH_Collection *collection)
Definition: CH_Manager.h:2055
virtual bool channelsBeingChanged()
Definition: CH_Manager.h:1760
fpreal32 SYSrint(const fpreal32 val)
Definition: SYS_Floor.h:164
virtual bool getChannelAutoSelect(const CH_ChannelRef &chref) const
Definition: CH_Manager.h:1738
CH_TimeGroup * getTimeGroup(int i)
Definition: CH_Manager.h:1098
CH_Collection * getRootCollection() const
Definition: CH_Manager.h:1445
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
bool getFilterParmLabels(FilterType filter_type) const
Definition: CH_Manager.h:355
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:165
GLboolean r
Definition: glcorearb.h:1222
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
fpreal getFrameTolerance() const
Definition: CH_Manager.h:1235
bool getFilterScales() const
Definition: CH_Manager.h:350
const UT_Array< exint > & getBookmarksOrderByRecentUsage()
Definition: CH_Manager.h:1177
int getHoldFlag() const
Definition: CH_Manager.h:1377
const char * getDefaultSplitExpression() const
Definition: CH_Manager.h:571
GLuint * ids
Definition: glcorearb.h:652
void setIgnoreUpdateScopeFlag(bool onoff)
Definition: CH_Manager.h:1748
bool(* CH_FloatVarEvalFunc)(fpreal &val, int varid, int thread)
Definition: CH_Manager.h:73
void setEvaluateTime(fpreal time, int thread)
Functions for obtaining and setting the current evaluation time.
Definition: CH_Manager.h:1476
CH_API int CHgetIntegerFrameFromTime(fpreal time)
state
Definition: core.h:2289
int getGlobalStartFrame() const
Definition: CH_Manager.h:1220
fpreal getTolerance() const
Definition: CH_Manager.h:1234
fpreal getTime(fpreal sample) const
Definition: CH_Manager.h:1237
void setFilterTranslates(bool b)
Definition: CH_Manager.h:338
int getShowTicksFlag() const
Definition: CH_Manager.h:1327
CH_API void CHsortChannels(CH_ChannelList &channels)
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
CH_ScopedChannels & CHgetScopedChannels()
Definition: CH_Manager.h:2164
fpreal64 file_start
Definition: CH_Manager.h:105
GLenum src
Definition: glcorearb.h:1793
const char * getChanCreateKeyExpression() const
Definition: CH_Manager.h:578