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