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_ChannelRef.h"
17 #include "CH_EvalContextFwd.h"
18 #include "CH_ExprLanguage.h"
19 #include "CH_KeyState.h"
20 #include "CH_Types.h"
21 
22 #include <DEP/DEP_ContextOptions.h>
23 #include <UT/UT_Assert.h>
24 #include <UT/UT_Color.h>
25 #include <UT/UT_IntArray.h>
26 #include <UT/UT_Map.h>
27 #include <UT/UT_NonCopyable.h>
28 #include <UT/UT_Set.h>
29 #include <UT/UT_String.h>
30 #include <UT/UT_StringMap.h>
31 #include <UT/UT_StringArray.h>
32 #include <UT/UT_SuperInterval.h>
33 #include <UT/UT_Thread.h>
35 #include <UT/UT_TBBSpinLock.h>
36 #include <UT/UT_ValArray.h>
37 #include <SYS/SYS_Floor.h>
38 #include <SYS/SYS_Hash.h>
39 #include <SYS/SYS_Inline.h>
40 #include <SYS/SYS_Math.h>
41 #include <SYS/SYS_Types.h>
42 #include <iosfwd>
43 
44 class CH_Channel;
45 class CH_ChannelRef;
46 class CH_Collection;
47 class CH_ExprDefine;
48 class CH_Group;
49 class CH_LocalVariable;
50 class CH_Manager;
51 class chParamData;
52 class CH_ScopedChannels;
53 class CH_ScriptAccessManager;
54 class CH_Segment;
55 class CH_TimeGroup;
56 class DEP_MicroNode;
57 class UT_WorkBuffer;
58 
59 typedef bool (*CH_StringVarEvalFunc)(UT_String &val, int varid, int thread);
60 typedef bool (*CH_FloatVarEvalFunc)(fpreal &val, int varid, int thread);
61 typedef bool (*CH_IntVarEvalFunc)(int &val, int varid, int thread);
62 
64 {
65 public:
67  virtual UT_Color getChannelColor(const CH_Channel *channel) = 0;
68  virtual UT_Color getChannelColor(const CH_ChannelRef &channel_ref) = 0;
69 };
70 
72 {
73 public:
74  virtual ~CH_ChannelChanged(){}
75  virtual void changed() = 0;
76 };
77 
79 {
80 public:
81  virtual ~CH_FilterChanged(){}
82  virtual void changed(int type, void* fsc) = 0;
83  virtual void removed(void* fsc) = 0;
84 };
85 
87 {
88 public:
95 };
96 
97 
98 // CH_ScopedChannels holds the scope/display/layer/pinned flags
99 // for all the channels.
100 // The CH_Manager holds a list of scoped channels and we refer to that list
101 // as the Global Scoped Channels.
102 // The Animation Editor can pin its state to create and act on a disconnected
103 // list of channels.
105 {
106 public:
107  CH_ScopedChannels( CH_Manager *mgr, bool global=false );
108  virtual ~CH_ScopedChannels();
109 
110 
111  // these next two methods can be used to manipulate channel scope state
112  // using the full path of the channel. The correct behaviour will take
113  // place if the channel doesn't yet exist and so forth.
114  bool scopeChannelInternal(const CH_Channel *chp, bool on_off);
115  bool scopeChannelInternal(const CH_ChannelRef &chref, bool on_off);
116  void scopeChannel(const CH_ChannelRef &chref, bool on_off);
117  void scopeChannel(const char *full_chan_path, bool on_off);
118  void unscopeChannelsWithNodeId(int node_id, bool force=false);
119 
120  // this function should only be used by CH_Channel, CH_Collection, and here
121  void scopeChanged( unsigned flags, bool propagate=true );
122 
123  // these functions can be used by anyone
124  bool isChannelScoped(CH_Channel *chp) const;
125  bool isChannelScoped(const char *full_chan_path) const;
126  bool isChannelScoped(const CH_ChannelRef &chref) const;
127 
128  //
129  // Displayed Channels (within the scoped channels)
130  //
131  bool isChannelDisplayed(CH_Channel *chp) const;
132  bool isChannelDisplayed( const CH_ChannelRef &chref ) const;
133  bool isChannelDisplayed( const char *full_chan_path ) const;
134  void clearDisplayedChannels( bool propagate = true );
135  void displayAllScopedChannels( bool propagate = true );
136  void displaySelectedScopedChannels( bool propagate = true );
137 
138  void displayChannel( const CH_ChannelRef &chref,
139  bool propagate = true );
140  void displayChannel( const char *full_chan_path,
141  bool propagate = true );
142  void undisplayChannel( const CH_ChannelRef &chref,
143  bool propagate = true );
144  void undisplayChannel( const char *full_chan_path,
145  bool propagate = true );
146  void undisplayChannelsWithNodeId(int node_id, bool force=false);
147  //
148  // Selected Channels (within the scoped channels)
149  //
150  bool isChannelSelected( const CH_ChannelRef &chref ) const;
151  bool isChannelSelected( const char *full_chan_path ) const;
152  void clearSelectedChannels( bool propagate = true );
153  void selectAllScopedChannels(bool propagate = true );
154 
155  void selectChannel( const CH_ChannelRef &chref,
156  bool propagate = true );
157  void selectChannel( const char *full_chan_path,
158  bool propagate = true );
159  void deselectChannel( const CH_ChannelRef &chref,
160  bool propagate = true );
161  void deselectChannel( const char *full_chan_path,
162  bool propagate = true );
163 
164  //
165  // Pinned Channels (within the scoped channels)
166  //
167  void togglePinAllScopedChannels();
168  void togglePinScopedChannels( const CH_ChannelRefList &chanrefs );
169  void pinAllScopedChannels( bool propagate = true );
170  void unpinAllScopedChannels( bool propagate = true );
171  void pinSelectedChannels( bool propagate = true,
172  int operateOn = CH_SELECTED );
173  void unpinSelectedChannels( bool propagate = true,
174  int operateOn = CH_SELECTED );
175  void pinChannels( const CH_ChannelRefList &chanrefs,
176  bool propagate = true );
177  void unpinChannels( const CH_ChannelRefList &chanrefs,
178  bool propagate = true );
179  void pinChannel( const CH_ChannelRef &ref,
180  bool propagate = true );
181  void unpinChannel( const CH_ChannelRef &ref,
182  bool propagate = true );
183  void unpinChannelsWithNodeId(int node_id, bool force=false);
184  void clearPinnedChannels( bool propagate = true );
185 
186  //
187  // Scopped Layers
188  //
189  void clearLayerScope();
190  bool isLayerScoped(CH_Channel *chp) const;
191  bool isLayerScoped(const char *full_chan_path) const;
192  bool isLayerScoped(const CH_ChannelRef &chref) const;
193  void scopeLayer(const CH_ChannelRef &chref, bool on_off);
194  void scopeLayer(const char *full_chan_path, bool on_off);
195  bool scopeLayerInternal(CH_Channel *chp, bool on_off);
196  bool scopeLayerInternal(const CH_ChannelRef &chref, bool on_off);
197 
198  //
199  // Selected Layers (within the scoped layers)
200  //
201  bool isLayerSelected(const CH_ChannelRef &chref) const;
202  bool isLayerSelected(const char *full_chan_path) const;
203  void clearSelectedLayers(bool propagate = true);
204  void selectAllScopedLayers(bool propagate = true);
205 
206  void selectLayer(const CH_ChannelRef &chref, bool propagate=true);
207  void selectLayer(const char *full_chan_path, bool propagate=true);
208  void deselectLayer(const CH_ChannelRef &chref, bool propagate=true);
209  void deselectLayer(const char *full_chan_path, bool propagate=true);
210 
211  //
212  // Pinned Layers (within the scoped layers)
213  //
214  void togglePinAllScopedLayers();
215  void togglePinScopedLayers( const CH_ChannelRefList& chanrefs );
216  void pinAllScopedLayers( bool propagate = true );
217  void unpinAllScopedLayers( bool propagate = true );
218  void pinSelectedLayers( bool propagate = true,
219  int operateOn = CH_LAYER_SELECTED );
220  void unpinSelectedLayers( bool propagate = true,
221  int operateOn = CH_LAYER_SELECTED );
222  void pinLayer( const CH_ChannelRef& ref,
223  bool propagate = true );
224  void unpinLayer( const CH_ChannelRef& ref,
225  bool propagate = true );
226  void pinLayers( const CH_ChannelRefList& chanrefs,
227  bool propagate = true );
228  void unpinLayers( const CH_ChannelRefList& chanrefs,
229  bool propagate = true );
230  void clearPinnedLayers( bool propagate = true );
231 
232  //
233  // Displayed Layers (within the scoped layers)
234  bool isLayerDisplayed(CH_Channel *chp) const;
235  bool isLayerDisplayed( const CH_ChannelRef &chref ) const;
236  bool isLayerDisplayed( const char *full_chan_path ) const;
237  void clearDisplayedLayers( bool propagate = true );
238  void displayAllScopedLayers( bool propagate = true );
239  void displaySelectedScopedLayers( bool propagate = true );
240 
241  void displayLayer( const CH_ChannelRef &chref,
242  bool propagate = true );
243  void displayLayer( const char *full_chan_path,
244  bool propagate = true );
245  void undisplayLayer( const CH_ChannelRef &chref,
246  bool propagate = true );
247  void undisplayLayer( const char *full_chan_path,
248  bool propagate = true );
249 
250  // Graph Selected flag
251  bool isGraphSelected(CH_Channel *chp) const;
252  bool isGraphSelected( const CH_ChannelRef &chref ) const;
253  bool isGraphSelected( const char *full_chan_path ) const;
254  void clearGraphSelected( bool propagate = true );
255  void selectGraph( const CH_ChannelRef &chref,
256  bool propagate = true );
257  void selectGraph( const char *full_chan_path,
258  bool propagate = true );
259  void deselectGraph( const CH_ChannelRef &chref,
260  bool propagate = true );
261  void deselectGraph( const char *full_chan_path,
262  bool propagate = true );
263 
264  //
265  // Generic channel flag manipulation methods
266  //
267  void setChannelFlags( const CH_ChannelRef &chref,
268  unsigned flags,
269  bool on_off,
270  bool propagate = true );
271  unsigned getChannelFlags( const CH_ChannelRef &chref ) const;
272 
273  //
274  // Scoping functions
275  //
276  void clearChannelScope( bool clear_all_tables=false);
277 
278  // Returns scoped channels only (not scoped parameters)
279  void getScopedChannels(CH_ChannelList &channels, bool sorted=false);
280 
281  // Returns count of scoped channels AND scoped parameters
282  int getNumScopedChanRefs();
283 
284  // Returns count of scoped channels AND scoped parameters filtered or not
285  int getNumScopedChanRefs(bool filtered);
286 
287  // mask corresponds to flags in CH_ScopeMasks. Use 0 for mask to mean all
288  // scoped channel refs.
289  // Returns scoped channel AND scoped parameter refs
290  void getScopedChanRefs(CH_ChannelRefList &chanrefs,
291  unsigned mask = 0,
292  bool sorted=false) const;
293  void getSelectedScopedChanRefs(CH_ChannelRefList &chanrefs,
294  bool sorted=false, int operateOn=CH_SELECTED);
295 
296  void getScopedChannelsKeyFrames( UT_IntArray &frames,
297  int minframe, int maxframe);
298 
299  bool hasScopedChannels();
300 
302  { return myKeepChannelSelection; }
304  { myKeepChannelSelection = b;}
305 
307  {
308  FilterChannels = 0,
309  FilterAnimationLayers = 1,
310  };
311  enum
312  {
313  NumFilterType = 2,
314  };
315 
316  void setEnableFilter( FilterType filter_type, bool b)
317  { myEnableFilter[filter_type] = b; }
318  bool getEnableFilter( FilterType filter_type ) const
319  { return myEnableFilter[filter_type]; }
320 
321  void setFilter( FilterType filter_type, const UT_StringHolder &f)
322  { myFilter[filter_type] = f;}
323  const UT_StringHolder& getFilter(FilterType filter_type) const
324  { return myFilter[filter_type]; }
325 
326  void setFilterTranslates( bool b)
327  { myFilterTranlates = b;}
328  bool getFilterTranslates() const
329  { return myFilterTranlates; }
330 
331  void setFilterRotates( bool b)
332  { myFilterRotates = b;}
333  bool getFilterRotates() const
334  { return myFilterRotates; }
335 
336  void setFilterScales( bool b)
337  { myFilterScales = b;}
338  bool getFilterScales() const
339  { return myFilterScales; }
340 
341  void setFilterParmLabels( FilterType filter_type, bool b)
342  { myFilterParmLabels[filter_type] = b;}
343  bool getFilterParmLabels(FilterType filter_type ) const
344  { return myFilterParmLabels[filter_type]; }
345 
346  void setFilterFullNames( FilterType filter_type, bool b)
347  { myFilterFullNames[filter_type] = b;}
348  bool getFilterFullNames(FilterType filter_type) const
349  { return myFilterFullNames[filter_type]; }
350 
351  void setFilterDirty(FilterType filter_type);
352 
353 
354  void addDependentFilter(CH_FilterChanged *f);
355  void removeDependentFilter(CH_FilterChanged *f);
356  void triggerDependentFilters(int type);
357 
358  bool hasFilter() const;
359 private:
360  friend class CH_Manager;
361 
362  // Filtering functions
363  void filterChannels(CH_ChannelList &chns, FilterType filter_type) const;
364  void filterChannelRefs(CH_ChannelRefList &refs, FilterType filter_type) const;
365  void setupFilter(UT_String &ret, UT_StringArray &filter_tokens, FilterType filter_type) const;
366  bool filterChannelRef( const CH_ChannelRef &chref, FilterType filter_type, const UT_String &prefilter, const UT_StringArray &filter_tokens ) const;
367 
368  CH_ChannelRefTable myTable;
369  CH_ChannelRefTable myTableDisplayed;
370  CH_ChannelList mySorted;
371  bool myIsSorted;
372  bool myKeepChannelSelection;
373  mutable int myNumScopedChannels;
374  mutable int myTotalScopedChannels; // Unfiltered
375 
376  // Filter for Channels and Animation Layers
377  CH_ChannelList myFiltered[NumFilterType];
378  UT_StringHolder myFilter[NumFilterType];
379  bool myEnableFilter[NumFilterType];
380  bool myFilterParmLabels[NumFilterType];
381  bool myFilterFullNames[NumFilterType];
382  bool myIsFiltered[NumFilterType];
383  bool myFilterTranlates;
384  bool myFilterRotates;
385  bool myFilterScales;
386  bool myIsGlobal;
387 
388  CH_Manager *myManager;
389 
390  UT_Array<CH_FilterChanged*> myDependentFilters;
391 };
392 
394 {
395 public:
396  typedef enum {
397  //CH_ON_COLLISION_FAIL,
401  CH_ON_COLLISION_ASSERT
402  } CollisionBehaviour;
403 
404  typedef enum {
405  CH_EXPANSION_TYPE_EXPRESSION = 1,
406  CH_EXPANSION_TYPE_VARIABLE = 1 << 1,
407  CH_EXPANSION_TYPE_DEFAULT = CH_EXPANSION_TYPE_EXPRESSION |
408  CH_EXPANSION_TYPE_VARIABLE,
409  } ExpansionType;
410 
411  typedef enum {
415  } SlopeMode;
416 
417  typedef CollisionBehaviour (*CBCallback)( CH_Group *source,
418  CH_Group *target );
419 
420  CH_Manager(int initTheExpressionLibrary = 1);
421  virtual ~CH_Manager();
422 
423  /// @private
424  /// Called just before the CH_Manger will be deleted
425  virtual void aboutToDelete();
426 
427  // The following method is used to set the context to this manager.
429  {
430  UT_ASSERT( theManager );
431  return theManager;
432  }
433  static bool getContextExists() { return (bool)theManager; }
434  virtual void setContext();
435 
436  int condenseCommon(UT_String &path);
437 
438  void resetPlayback();
439 
440  void resetChannelOptions();
441  bool loadChannelOptions( const char *filename );
442  bool saveChannelOptions( const char *filename );
443 
444  void setDefaultExpression(const char *s)
445  {
446  if( s && *s )
447  myDefaultExpression.harden( s );
448  }
449  const char *getDefaultExpression() const
450  { return (const char *)myDefaultExpression; }
451  void setDefaultRotationExpression(const char *s)
452  {
453  if (s)
454  myDefaultRotationExpression.harden(s);
455  }
456  const char *getDefaultRotationExpression() const
457  { return (const char *)myDefaultRotationExpression;}
459  { myAutoSlope = m; }
461  { return myAutoSlope; }
463  { myDefaultSlope = slope; }
465  { return myDefaultSlope; }
466  void setAutoSplit(bool onoff)
467  { myAutoSplit = onoff; }
468  bool getAutoSplit() const
469  { return myAutoSplit; }
470  void setDefaultSplitExpression(const char *expr)
471  { myDefaultSplitExpression.harden(
472  expr ? expr : "" ); }
473  const char *getDefaultSplitExpression() const
474  { return (const char *)myDefaultSplitExpression; }
475 
476  void setHoldLastKey(bool onoff)
477  { myHoldLastKey = onoff; }
478  int getHoldLastKey() const
479  { return myHoldLastKey; }
480  const char *getChanCreateKeyExpression() const
481  { return (const char *)myChanCreateKeyExpression; }
482  void setChanCreateKeyExpression(const char *s)
483  { myChanCreateKeyExpression.harden(s ? s : ""); }
485  { return myAlwaysCommitKey; }
486  void setAlwaysCommitKeyChange( bool onoff )
487  { myAlwaysCommitKey = onoff; }
488 
489  // Scoping functions
490  // Deprecated and moved to CH_ScopedChannels
491  // With H16, we introduced the ability to lock animation editor scoped
492  // channels. The embedded animation layers and scoped channel listers can
493  // take a copy of CH_ScopedChannels and acts independtly of the global
494  // list. ChgetScopedChannels() returns the list of globally scoped
495  // channels.
496  SYS_DEPRECATED(16.0)
497  void clearChannelScope();
498 
499  // Returns scoped channels only (not scoped parameters)
500  SYS_DEPRECATED(16.0)
501  void getScopedChannels(CH_ChannelList &channels, bool sorted=false);
502 
503  // Returns count of scoped channels AND scoped parameters
504  SYS_DEPRECATED(16.0)
505  int getNumScopedChanRefs()
506  { return myScopedChannels.getNumScopedChanRefs(); }
507 
508  // mask corresponds to flags in CH_ScopeMasks. Use 0 for mask to mean all
509  // scoped channel refs.
510  // Returns scoped channel AND scoped parameter refs
511  SYS_DEPRECATED(16.0)
512  void getScopedChanRefs(CH_ChannelRefList &chanrefs,
513  unsigned mask = 0,
514  bool sorted=false) const;
515  SYS_DEPRECATED(16.0)
516  void getSelectedScopedChanRefs(CH_ChannelRefList &chanrefs,
517  bool sorted=false, int operateOn=CH_SELECTED);
518 
519  // utility functions for getting keyframe numbers:
520  // they return array of keyframes in the or scoped channes
521  // between minframe and maxframe, indexed relative to the start index
522  // The frames are unique and sorted in a ascending order.
523  SYS_DEPRECATED(16.0)
524  void getScopedChannelsKeyFrames( UT_IntArray &frames,
525  int minframe, int maxframe);
526 
527  // Useful method to group multiple scope change event notifications
528  // together.
529  void blockModifyScope(int on_off);
530 
531  // these next two methods can be used to manipulate channel scope state
532  // using the full path of the channel. The correct behaviour will take
533  // place if the channel doesn't yet exist and so forth.
534  SYS_DEPRECATED(16.0)
535  void scopeChannel(const CH_ChannelRef &chref, bool on_off);
536  SYS_DEPRECATED(16.0)
537  void scopeChannel(const char *full_chan_path, bool on_off);
538  SYS_DEPRECATED(16.0)
539  bool scopeChannelInternal(const CH_Channel *chp, bool on_off);
540  SYS_DEPRECATED(16.0)
541  bool scopeChannelInternal(const CH_ChannelRef &chref, bool on_off);
542 
543  virtual void getChannelsWithNodeId(CH_ChannelList &chans, int node_id) const;
544 
545  // this function should only be used by CH_Channel, CH_Collection, and here
546  SYS_DEPRECATED(16.0)
547  void scopeChanged( unsigned flags, bool propagate=true );
548 
549  // these functions can be used by anyone
550  SYS_DEPRECATED(16.0)
551  bool isChannelScoped(CH_Channel *chp) const;
552  SYS_DEPRECATED(16.0)
553  bool isChannelScoped(const char *full_chan_path) const;
554  SYS_DEPRECATED(16.0)
555  bool isChannelScoped(const CH_ChannelRef &chref) const;
556 
557  //
558  // Pending Channels
559  //
560  void clearPendingChannels();
561  void getPendingChannels(CH_ChannelList &channels) const;
562  bool hasPendingChannels() const;
563 
564  // addPendingChannel is intended to be used by CH_Channel/CH_Collection!
565  void addPendingChannel( CH_Channel *chp );
566  void removePendingChannel( CH_Channel *chp );
567 
568  //
569  // Displayed Channels (within the scoped channels)
570  //
571  SYS_DEPRECATED(16.0)
572  bool isChannelDisplayed(CH_Channel *chp) const;
573  SYS_DEPRECATED(16.0)
574  bool isChannelDisplayed( const CH_ChannelRef &chref ) const;
575  SYS_DEPRECATED(16.0)
576  bool isChannelDisplayed( const char *full_chan_path ) const;
577  SYS_DEPRECATED(16.0)
578  void clearDisplayedChannels( bool propagate = true );
579  SYS_DEPRECATED(16.0)
580  void displayAllScopedChannels( bool propagate = true );
581  SYS_DEPRECATED(16.0)
582  void displaySelectedScopedChannels( bool propagate = true );
583 
584  SYS_DEPRECATED(16.0)
585  void displayChannel( const CH_ChannelRef &chref,
586  bool propagate = true );
587  SYS_DEPRECATED(16.0)
588  void displayChannel( const char *full_chan_path,
589  bool propagate = true );
590  SYS_DEPRECATED(16.0)
591  void undisplayChannel( const CH_ChannelRef &chref,
592  bool propagate = true );
593  SYS_DEPRECATED(16.0)
594  void undisplayChannel( const char *full_chan_path,
595  bool propagate = true );
596 
597  //
598  // Selected Channels (within the scoped channels)
599  //
600  SYS_DEPRECATED(16.0)
601  bool isChannelSelected( const CH_ChannelRef &chref ) const;
602  SYS_DEPRECATED(16.0)
603  bool isChannelSelected( const char *full_chan_path ) const;
604  SYS_DEPRECATED(16.0)
605  void clearSelectedChannels( bool propagate = true );
606  SYS_DEPRECATED(16.0)
607  void selectAllScopedChannels(bool propagate = true );
608 
609  SYS_DEPRECATED(16.0)
610  void selectChannel( const CH_ChannelRef &chref,
611  bool propagate = true );
612  SYS_DEPRECATED(16.0)
613  void selectChannel( const char *full_chan_path,
614  bool propagate = true );
615  SYS_DEPRECATED(16.0)
616  void deselectChannel( const CH_ChannelRef &chref,
617  bool propagate = true );
618  SYS_DEPRECATED(16.0)
619  void deselectChannel( const char *full_chan_path,
620  bool propagate = true );
621 
622  //
623  // Pinned Channels (within the scoped channels)
624  //
625  SYS_DEPRECATED(16.0)
626  void togglePinAllScopedChannels();
627  SYS_DEPRECATED(16.0)
628  void togglePinScopedChannels( const CH_ChannelRefList &chanrefs );
629  SYS_DEPRECATED(16.0)
630  void pinAllScopedChannels( bool propagate = true );
631  SYS_DEPRECATED(16.0)
632  void unpinAllScopedChannels( bool propagate = true );
633  SYS_DEPRECATED(16.0)
634  void pinSelectedChannels( bool propagate = true,
635  int operateOn = CH_SELECTED );
636  SYS_DEPRECATED(16.0)
637  void unpinSelectedChannels( bool propagate = true,
638  int operateOn = CH_SELECTED );
639  SYS_DEPRECATED(16.0)
640  void pinChannels( const CH_ChannelRefList &chanrefs,
641  bool propagate = true );
642  SYS_DEPRECATED(16.0)
643  void unpinChannels( const CH_ChannelRefList &chanrefs,
644  bool propagate = true );
645  //
646  // Scopped Layers
647  //
648  SYS_DEPRECATED(16.0)
649  void clearLayerScope();
650  SYS_DEPRECATED(16.0)
651  bool isLayerScoped(CH_Channel *chp) const;
652  SYS_DEPRECATED(16.0)
653  bool isLayerScoped(const char *full_chan_path) const;
654  SYS_DEPRECATED(16.0)
655  bool isLayerScoped(const CH_ChannelRef &chref) const;
656  SYS_DEPRECATED(16.0)
657  void scopeLayer(const CH_ChannelRef &chref, bool on_off);
658  SYS_DEPRECATED(16.0)
659  void scopeLayer(const char *full_chan_path, bool on_off);
660  SYS_DEPRECATED(16.0)
661  bool scopeLayerInternal(CH_Channel *chp, bool on_off);
662  SYS_DEPRECATED(16.0)
663  bool scopeLayerInternal(const CH_ChannelRef &chref, bool on_off);
664 
665  //
666  // Selected Layers (within the scoped layers)
667  //
668  SYS_DEPRECATED(16.0)
669  bool isLayerSelected( const CH_ChannelRef &chref ) const;
670  SYS_DEPRECATED(16.0)
671  bool isLayerSelected( const char *full_chan_path ) const;
672  SYS_DEPRECATED(16.0)
673  void clearSelectedLayers( bool propagate = true );
674  SYS_DEPRECATED(16.0)
675  void selectAllScopedLayers(bool propagate = true );
676 
677  SYS_DEPRECATED(16.0)
678  void selectLayer( const CH_ChannelRef &chref, bool propagate = true );
679  SYS_DEPRECATED(16.0)
680  void selectLayer( const char *full_chan_path, bool propagate = true );
681  SYS_DEPRECATED(16.0)
682  void deselectLayer( const CH_ChannelRef &chref, bool propagate = true );
683  SYS_DEPRECATED(16.0)
684  void deselectLayer( const char *full_chan_path, bool propagate = true );
685 
686  //
687  // Pinned Layers (within the scoped layers)
688  //
689  SYS_DEPRECATED(16.0)
690  void togglePinAllScopedLayers();
691  SYS_DEPRECATED(16.0)
692  void togglePinScopedLayers( const CH_ChannelRefList &chanrefs );
693  SYS_DEPRECATED(16.0)
694  void pinAllScopedLayers( bool propagate = true );
695  SYS_DEPRECATED(16.0)
696  void unpinAllScopedLayers( bool propagate = true );
697  SYS_DEPRECATED(16.0)
698  void pinSelectedLayers( bool propagate = true, int operateOn = CH_LAYER_SELECTED );
699  SYS_DEPRECATED(16.0)
700  void unpinSelectedLayers( bool propagate = true, int operateOn = CH_LAYER_SELECTED );
701  SYS_DEPRECATED(16.0)
702  void pinLayers( const CH_ChannelRefList &chanrefs, bool propagate = true );
703  SYS_DEPRECATED(16.0)
704  void unpinLayers( const CH_ChannelRefList &chanrefs, bool propagate = true );
705 
706  //
707  // Displayed Layers (within the scoped layers)
708  SYS_DEPRECATED(16.0)
709  bool isLayerDisplayed(CH_Channel *chp) const;
710  SYS_DEPRECATED(16.0)
711  bool isLayerDisplayed( const CH_ChannelRef &chref ) const;
712  SYS_DEPRECATED(16.0)
713  bool isLayerDisplayed( const char *full_chan_path ) const;
714  SYS_DEPRECATED(16.0)
715  void clearDisplayedLayers( bool propagate = true );
716  SYS_DEPRECATED(16.0)
717  void displayAllScopedLayers( bool propagate = true );
718  SYS_DEPRECATED(16.0)
719  void displaySelectedScopedLayers( bool propagate = true );
720 
721  SYS_DEPRECATED(16.0)
722  void displayLayer( const CH_ChannelRef &chref,
723  bool propagate = true );
724  SYS_DEPRECATED(16.0)
725  void displayLayer( const char *full_chan_path,
726  bool propagate = true );
727  SYS_DEPRECATED(16.0)
728  void undisplayLayer( const CH_ChannelRef &chref,
729  bool propagate = true );
730  SYS_DEPRECATED(16.0)
731  void undisplayLayer( const char *full_chan_path,
732  bool propagate = true );
733  // Generic channel flag manipulation methods
734  SYS_DEPRECATED(16.0)
735  void setChannelFlags( const CH_ChannelRef &chref,
736  unsigned flags,
737  bool on_off,
738  bool propagate = true );
739  SYS_DEPRECATED(16.0)
740  unsigned getChannelFlags( const CH_ChannelRef &chref ) const;
741 
742  // Expand a string given a specific channel set (for locals). It's
743  // possible that the channel collection can be null, meaning local
744  // variables won't be picked up. The input string is expected to be an
745  // unexpanded string value using the old improper expression syntax. The
746  // method returns a mask with CH_EXPRTIME set if the string uses time
747  // dependent variables.
748  int expandString(const char *string, UT_String &expanded,
749  fpreal time, CH_Collection *local = 0,
750  int thread = 0,
751  int expansion_type = CH_EXPANSION_TYPE_DEFAULT,
753  context_options_stack = nullptr,
754  DEP_ContextOptionsReadHandle context_options =
756 
757  void buildStringOpDependencies( const char *str, void *ref_id,
758  CH_Collection *locals, int thread );
759 
760  /// Return true if the variable exists in the given string. The variable
761  /// may be in the form @c "$NAME" or "NAME". If @c expand_expressions is
762  /// true, any back-tick expressions will be expanded and the result scanned
763  /// for the variable.
764  bool scanForVariableInString(const char *variable,
765  const char *string) const;
766  bool changeStringOpRef( UT_String &str,
767  const char *new_fullpath,
768  const char *old_fullpath,
769  const char *old_cwd,
770  const char *chan_name,
771  const char *old_chan_name,
772  CH_Collection *locals,
773  int thread );
774 
775  // These functions evaluate expressions that have been specified using the
776  // old proper expression syntax.
777  fpreal evaluate(const char *expr, fpreal now,
778  CH_Collection *local=0, int *frame_dep=0,
779  int thread = 0,
782  context_options_stack = nullptr,
783  DEP_ContextOptionsReadHandle context_options =
784  DEP_ContextOptionsReadHandle());
785  int evaluateString(const char *expr, UT_String &result,
786  fpreal now, CH_Collection *local=0,
787  int thread = 0,
788  CH_ExprLanguage language = CH_OLD_EXPR_LANGUAGE,
790  context_options_stack = nullptr,
791  DEP_ContextOptionsReadHandle context_options =
792  DEP_ContextOptionsReadHandle());
793 
794  // Issue an expression evaluation error. 'err' is an index used for
795  // ev_GetErrorText(). NOTE: This will call ev_SetErrNo(EV_NOERROR, thread)!
796  static void evaluationError(int err, int thread, const char *path);
797 
798  // Global parameter management
799 
800  // This function tells us if we are in the process of setting a global
801  // param value. This is useful for differentiating between real node
802  // change events, and apparent node changes caused by setting a global
803  // param.
804  // If add_dependencies is set, the currently evaluating operator will have
805  // dependencies added for the global parameter. Disable this if you're
806  // just getting values for push/pop of values.
807  bool getIsSettingGlobalParam() const
808  { return (mySettingGlobalParam > 0); }
809  void getGlobalParamF(const char *token, CH_Collection *scope,
810  fpreal &result, fpreal def, int thread,
811  bool add_dependencies /*=true*/);
812  void getGlobalParamS(const char *token, CH_Collection *scope,
813  UT_String &result, const char *def,
814  int thread, bool add_dependencies /*=true*/);
815 
816  /// The AnyScope variants will start at the given scope and work upwards
817  /// until a global parameter is found. If none is found, they will
818  /// act like getGlobalParamF on the root scope.
819  void getGlobalParamAnyScopeF(const char *token, CH_Collection *scope,
820  fpreal &result, fpreal def, int thread,
821  bool add_dependencies /*=true*/);
822  void getGlobalParamAnyScopeS(const char *token, CH_Collection *scope,
823  UT_String &result, const char *def,
824  int thread, bool add_dependencies /*=true*/);
825 
826  int setGlobalFloatParam(const char *token,
827  fpreal val,
828  CH_Collection *&owner);
829  int setGlobalStringParam(const char *token,
830  const char *strval,
831  CH_Collection *&owner);
832 
833  int removeGlobalParamOwner(CH_Collection *owner);
834  void dumpGlobalParams(std::ostream &out) const;
835 
836  // The optional dependents set, if specified, will be populated with
837  // a set of the dependent CH_Collection(s).
838  void dirtyOrphanGlobalParamDependents(const char *token,
839  CH_Collection *scope,
840  bool recurse,
841  UT_Set<CH_Collection *> *dependents);
842 
843  // Like global params, simulation guide parameters need a flag so we
844  // know not to destroy interests and extra inputs when they are changed.
846  { return (mySettingGuideParam > 0); }
847 
848  static CH_KeyState getKeyState(fpreal gtime,
849  const CH_ChannelList &channels,
850  bool loose=false);
851 
852  // Channel Group Management
853  CH_Group *getTopGroup() const;
854  CH_Group *findGroup(const char *const_path, bool create = false,
855  CH_Group *head=0);
856  void findGroups( CH_GroupList &groups,
857  const char *pattern, bool minimal );
858  void findChannelsFromGroups( CH_ChannelList &channels,
859  const char *pattern );
860  void findChanRefsFromGroups( CH_ChannelRefList &chanrefs,
861  const char *pattern );
862  static bool makeGroupPathValid( UT_String &path );
863  static bool makeGroupNameValid( UT_String &path );
864 
865  CH_GroupList getSelectedGroups();
866  CH_Group *getCurrentGroup();
867  void updateGroupSelection(const CH_GroupList &groups,
868  void *by,
869  bool propagate = true);
870  void updateGroupSelectionFromScoped(void *by,
871  bool propagate = true);
872  void updateCurrentGroup(CH_Group *group,
873  void *by,
874  bool propagate = true);
875  void enforceLeafOnlyChannels(CH_Group *group,
876  const char *name="new_group");
877 
878  // RMB Group functions
879  CH_Group *createGroup(const char *const_path,
880  bool doRename = true, CH_Group *head=0);
881  void renameGroup(CH_Group *group, const char *newname);
882  void deleteGroup(CH_Group *group);
883 
884  // RMB Group* functions
885  void extractGroup( CH_Group *group, CollisionBehaviour cb );
886  CH_Group *collapseGroups( CH_GroupList const& groups,
887  const char *name );
888  void collapseChildren( CH_Group *parent );
889 
890  // TODO merge selected
891 
892  // Group -> Group functions
893  void copyIntoGroup( CH_Group *source, CH_Group *target,
894  CollisionBehaviour cb,
895  const char *new_name = 0 );
896  void moveIntoGroup( CH_Group *source, CH_Group *target,
897  CollisionBehaviour cb,
898  const char *new_name = 0 );
899  void addToGroup( CH_Group *source, CH_Group *target,
900  CollisionBehaviour cb );
901  void mergeWithGroup( CH_Group *source, CH_Group *target,
902  CollisionBehaviour cb );
903  // TODO remove shared channels?
904  // TODO replace group?
905 
906  // Channels -> Group functions implemented via G -> G
907  void channelCreated( const CH_Channel *chp );
908  void channelDeleted( const CH_Channel *chp );
909 
910  // save, load functions
911  void saveGroup(CH_Group *g, std::ostream &os, int binary);
912  CH_Group *loadGroup(UT_IStream &is);
913 
914 
915  // Returns true if there exists a situation in which the string can
916  // be expanded. Returns false if there is nothing in the string that
917  // indicates that it could be expanded.
918  static bool couldExpandString(const char *str);
919 
920  // Gets/Sets the default expression language.
922  { return myDefaultExprLanguage; }
924  { myDefaultExprLanguage = language; }
925 
926  // Checks if the given scoped channels list is the global one
928  { return p == &myScopedChannels; }
929 
930  // Access the global scoped channels
932  { return myScopedChannels; }
934  { return myScopedChannels; }
935 
936  // Time Group Management
937  void timeGroupsChanged();
938  void addTimeGroup(CH_TimeGroup *group,
939  bool doRename=true,
940  bool force=false);
941  void destroyTimeGroup(const CH_TimeGroup *group);
942  void destroyTimeGroup(int i);
943  void renameTimeGroup(CH_TimeGroup *group,
944  const char *newname,
945  bool force=false);
946  int getNTimeGroups() const {return myTimeGroups.entries();}
947  CH_TimeGroup *getTimeGroup(int i) { return myTimeGroups(i); }
948  const CH_TimeGroup *getTimeGroup(int i) const { return myTimeGroups(i); }
949  CH_TimeGroup *getTimeGroup(const char *name);
950  const CH_TimeGroup *getTimeGroup(const char *name) const;
951  int getTimeGroupIdx( const char *name ) const;
952 
953  /// Utility function to make a floating point number "nice" - i.e. only /
954  /// use N decimal places. Should only be used for frames/samples
955  /// (not time).
956  ///
957  /// Note that @c digits does @b not specify precision. It specifies
958  /// precision of decimals. The integer portion will be left at full
959  /// precision. For example: @code
960  /// niceNumber(12345.2, 1) == 12345;
961  /// niceNumber(1.23452e-14, 3) == 1.23e-14;
962  /// @endcode
963  /// Note that 6 digits is enough to hold a single precision float.
964  static fpreal niceNumber(fpreal num, int digits=6)
965  { return SYSniceNumber(num, digits); }
966 
967  // Utility function to find a frame separation that is an intelligent
968  // multiple/subdivision of the current frame rate, close to the
969  // initialSep parameter.
970  int niceFrameSeparation(fpreal initialSep,
971  int minimumSep = 1) const;
972 
973  // Stretching collections will stretch every channel of every collection
974  // based on the old time passed to us.
975  // The channels will be stretched to fit the new time
976  void stretchCollections(CH_Collection *from, fpreal ostart,
977  fpreal oend);
978 
979  static fpreal getDefaultFPS();
980  static fpreal getDefaultLength(fpreal fps);
981  static fpreal getDefaultLengthFrames(fpreal fps);
982  static int getDefaultChopMotionSamples();
983 
984  fpreal getNumSamples() const { return mySampleCount; }
985  void setRawNumSamples(int n);
986  fpreal getSamplesPerSec() const { return myFPS; }
987  void setSamplesPerSec(fpreal fps);
988  fpreal getSecsPerSample() const { return 1.0 / myFPS; }
989  void setRawSamplesPerSec(fpreal fps);
990  int getChopMotionSamples() const { return myChopMotionSamples; }
991  void setChopMotionSamples(int n);
992 
993  fpreal getGlobalStart() const { return myStart; }
994  fpreal getGlobalEnd() const { return myEnd; }
996  { return getFrame( myStart ); }
997  int getGlobalEndFrame() const
998  { return getFrame( myEnd ); }
999 
1000  void setGlobalTime(fpreal start, fpreal end);
1001 
1002  void setRawInterpolation(int state) { myRawInterpFlag = state; }
1003  int getRawInterpolation() { return myRawInterpFlag; }
1004 
1005  // CONVERSION
1006  fpreal getTolerance() const { return myTimeTolerance; }
1007  // sample -> time
1008  fpreal getTime(fpreal sample) const
1009  {
1010  return ((sample-1.0)/myFPS);
1011  }
1012  // time -> sample (for calculation)
1014  {
1015  return t*myFPS+1.0;
1016  }
1017  // time -> sample (for display)
1019  {
1020  return niceNumber(getSampleRaw(t));
1021  }
1022  // time -> sample (integer)
1023  int getFrame(fpreal t) const
1024  {
1025  return (int)SYSfloor(getSampleRaw(t+getTolerance()));
1026  }
1027  // sample-delta -> time-delta
1028  fpreal getTimeDelta(fpreal sample_delta) const
1029  {
1030  return sample_delta/myFPS;
1031  }
1032  // time-delta -> sample-delta
1033  fpreal getSampleDelta(fpreal time_delta) const
1034  {
1035  return time_delta*myFPS;
1036  }
1037  // time -> time (snapped to an integer frame)
1039  {
1040  return getTime( SYSrint( getSampleRaw(t) ) );
1041  }
1042 
1043  // frame -> frame (snapped to an integer frame)
1045  {
1046  return SYSrint(frame);
1047  }
1048  // say you have a key at frame 0.6 (base_time) and you are moving it with
1049  // snap to frame on, so you want to snap the amount you move the key so
1050  // that the key lands on the nearest frame. In this example, time_delta
1051  // would be rounded to numbers like: -1.6, -0.6, 0.4, 1.4. This function
1052  // does this. Note that the parameters and return value are in time not
1053  // frames as they were in the example.
1054  fpreal getSnapToFrameDelta(fpreal base_time, fpreal time_delta) const;
1055  // time -> bool (true if time is at an integer frame boundary)
1056  bool getIsAtFrame(fpreal t) const
1057  {
1058  fpreal snaptime;
1059 
1060  snaptime = getSnapToFrameTime( t );
1061  return SYSisEqual(t, snaptime, getTolerance());
1062  }
1063 
1064  // Get code in buf
1065  void getTimeCode(char *buf, fpreal t);
1066  // Return time from buf
1067  int setTimeCode(const char *buf, fpreal &t);
1068 
1069  void setTimeCodeOffset(fpreal t) { myTimeCodeOffset = t; }
1070  fpreal getTimeCodeOffset(fpreal ) const { return myTimeCodeOffset; }
1071 
1072  int getIntegerFrameFlag() const { return myIntegerFrames; }
1073  void setIntegerFrameFlag(int flag) { myIntegerFrames = flag; }
1074 
1075  int getRestrictRangeFlag() const { return myRestrictRange; }
1076  void setRestrictRangeFlag(int flag) { myRestrictRange = flag; }
1077 
1078  int getShowRangeFlag() const { return myShowRange; }
1079  void setShowRangeFlag(int flag) { myShowRange = flag; }
1080 
1081  int getShowTicksFlag() const { return myShowTicks; }
1082  void setShowTicksFlag(int flag) { myShowTicks = flag; }
1083 
1084  int getShowAudioFlag() const { return myShowAudio; }
1085  void setShowAudioFlag(int flag) { myShowAudio = flag; }
1086 
1087  int getShowKeysFlag() const { return myShowKeys; }
1088  void setShowKeysFlag(int flag) { myShowKeys = flag; }
1089 
1090  int getShowSimCacheFlag() const { return myShowSimCache; }
1091  void setShowSimCacheFlag(int flag) { myShowSimCache = flag; }
1092 
1093  fpreal getAudioLevel() const { return myAudioLevel; }
1094  void setAudioLevel(fpreal lvl) { myAudioLevel = lvl; }
1095 
1096  fpreal getUnitLength() const { return myUnitLength; }
1097  void setUnitLength(fpreal unitlength){ myUnitLength = unitlength; }
1098  fpreal getUnitMass() const { return myUnitMass; }
1099  void setUnitMass(fpreal unitmass) { myUnitMass = unitmass; }
1100  void parseUnitsString(const char *units,
1101  fpreal &distexp,
1102  fpreal &massexp) const;
1103  fpreal scaleToMKS(const char *fromunits) const;
1104  fpreal scaleFromMKS(const char *tounits) const;
1105 
1106  int getRealTimeFlag() const { return myRealTimePlay; }
1107  void setRealTimeFlag(int flag) { myRealTimePlay = flag; }
1108  fpreal getRealTimeFactor() const { return myRealTimeFactor; }
1109  void setRealTimeFactor(fpreal f) { myRealTimeFactor = f; }
1110  bool getRealTimeDisableSkip() const { return myRealTimeDisableSkip; }
1111  void setRealTimeDisableSkip(bool b) { myRealTimeDisableSkip = b; }
1112  fpreal getSampleStep() const { return mySampleStep; }
1113  void setSampleStep(fpreal s) { mySampleStep = s; }
1114 
1116  {
1117  start = myRangeStart;
1118  end = myRangeEnd;
1119  }
1121  {
1122  if (start > end) { myRangeEnd = start; myRangeStart = end; }
1123  else { myRangeEnd = end; myRangeStart = start; }
1124  }
1125 
1126  int getHoldFlag() const { return myHoldFlag; }
1127  void setHoldFlag( int flag ) { myHoldFlag = flag; }
1128 
1129  // I/O methods
1130  int saveChannels(const char *filename, bool binary, bool compiled,
1131  const CH_ChannelList &channels,
1132  bool displayed = false) const;
1133  int loadChannels(const char *filename,
1134  const char *src_pattern,
1135  const char *dest_pattern,
1136  bool use_range,
1137  const fpreal *tstart,
1138  const fpreal *tend,
1139  CH_CollectionList &parents,
1140  bool delete_keys = false,
1141  CH_ChannelRefList *displayed_parms = NULL);
1142  static bool readCHNFileHeader(UT_IStream &is, bool quiet,
1143  fpreal32 &version, int &binary,
1144  bool &is_fp64,
1145  fpreal64 &tstart, fpreal64 &tend);
1146  static bool skipCHNFileHeaderForCollection(UT_IStream &is, bool &is_fp64);
1147  static bool getFileType( const char *filename, int &raw, int &binary );
1148  static bool printFileInfo(std::ostream &os, const char *filename,
1149  CH_Collection *load_coll,
1150  bool print_segments=true );
1151 
1152  // Expression glue. Only call this if you know what you're really doing.
1153  void addExpressionDefine(CH_ExprDefine *def);
1154 
1155  // The following method should only be called by CH_Collection, so please
1156  // don't mess me up.
1158  {
1159  // We use thread-local storage for the eval
1160  // collection. This isn't because two
1161  // different collections can be evaluating
1162  // paramaters in different threads at the same
1163  // time, though it would be nice for that to be
1164  // possible one day. Instead, it's so that if
1165  // Houdini is evaluating a parameter at the
1166  // same time as a python script is running code
1167  // that checks for the currently evaluating
1168  // parameter (so it can add the appropriate
1169  // parm interests), that we don't add parm
1170  // interests when we shouldn't.
1171  evalContext(thread).myCollection = g;
1172  // Reset the other members to avoid stale ptrs
1173  evalContext(thread).myChannel = 0;
1174  evalContext(thread).mySegment = 0;
1175  evalContext(thread).myChannelName = 0;
1176  }
1177  // TODO: Make getEvalCollection() return a const pointer
1179  {
1180  // We use thread-local storage the eval
1181  // collection.
1182  //
1183  // If this is the first time this thread has
1184  // accessed the pointer it will be null.
1185  // That's exactly the behaviour we want.
1186  return evalContext(thread).myCollection;
1187  }
1188 
1189  // The CH_Manager needs a pointer to the channel collection for the
1190  // OP_Director. This is used to trigger events when channel and time
1191  // groups are modified.
1193  { myRootCollection = root; }
1195  { return myRootCollection; }
1196 
1197  virtual CH_ScriptAccessManager *getAccessManager(int /*thread*/)
1198  { return 0; }
1199 
1200  inline const CH_EvalContext &
1201  evalContext(int thread) const
1202  { return myEvalContext.getValueForThread(thread); }
1203 
1204  inline CH_EvalContext &
1206  { return myEvalContext.getValueForThread(thread); }
1207 
1208  inline const CH_Channel *getEvalChannel(int thread) const
1209  { return evalContext(thread).myChannel; }
1210  inline const CH_Segment *getEvalSegment(int thread) const
1211  { return evalContext(thread).mySegment; }
1212  inline const char *getEvalChannelName(int thread) const
1213  { return evalContext(thread).myChannelName; }
1214  inline const DEP_ContextOptionsStack *
1216  { return evalContext(thread).myContextOptionsStack; }
1219  { return evalContext(thread).myContextOptions; }
1220 
1221  /// Functions for obtaining and setting the current evaluation time
1222  // @{
1223  inline fpreal getEvaluateTime(int thread) const
1224  { return evalContext(thread).myTime; }
1225  inline void setEvaluateTime(fpreal time, int thread)
1226  { evalContext(thread).myTime = time; }
1227  // @}
1228 
1229  /// The following function only remains for backwards compatibility of
1230  /// HDK users. Calls to this function should be replaced with one of the
1231  /// following forms:
1232  /// getEvaluateTime(context.getThread()) -> inside cooking code path
1233  /// getEvaluateTime(thread) -> in expression functions
1234  /// CHgetEvalTime() -> else without thread variable
1235  SYS_DEPRECATED(11.1) fpreal getEvaluateTime() const
1236  { return getEvaluateTime(SYSgetSTID()); }
1237 
1238  //
1239  // These methods are usually only used by CH_Collection to evaluate
1240  // variables belonging to me...
1241  CH_LocalVariable *getLocalVariableTable() const;
1242  bool getVariableValue(UT_String &str, int i,
1243  int thread) const;
1244  bool getVariableValue(fpreal &val, int i,
1245  int thread) const;
1246 
1247  // Should only be called if the variable has flagged as CH_VARIABLE_INTVAL
1248  bool getVariableValue(int &val, int i, int thread) const;
1249 
1250  // getVariableString should really be protected, but can't do it.
1251  virtual bool getVariableString(const char *name,
1252  UT_String &value,
1253  int &timeDepend,
1254  int thread);
1255 
1256  // Function for adding new global variables with the HDK.
1257  int addVariable(const CH_LocalVariable &var,
1258  CH_StringVarEvalFunc strfunc,
1259  CH_FloatVarEvalFunc floatfunc,
1260  CH_IntVarEvalFunc intfunc) const;
1261 
1262  static void lookupVariable(const char *name, UT_String &val,
1263  int thread);
1264  static void lookupVariableNoThread(const char *name,
1265  UT_String &val);
1266  static void lookupExpression(const char *name, UT_String &val,
1267  int thread);
1268  static void lookupExpressionNoThread(const char *name,
1269  UT_String &val);
1270 
1271  // This should only be called by CH_Collection
1272  void removeParamDependency(CH_Collection *coll);
1273 
1274  /// Use this method to translate a channel reference to a channel pointer.
1275  /// May return NULL if the channel reference does not reference a valid
1276  /// channel.
1277  virtual CH_Channel *getChRefChannel(const CH_ChannelRef &r) const;
1278 
1279  /// Use this method to determine if the owner of the channel reference
1280  /// is exposed or not.
1281  virtual bool isOwnerExposed(const CH_ChannelRef &r) const;
1282 
1283  /// Use this method to build a channel reference from a channel pointer.
1284  virtual bool buildChanRef(CH_ChannelRef &r,
1285  const CH_Channel *chp) const;
1286 
1287  /// Use this method to build a channel reference from a channel path.
1288  virtual bool buildChanRef(CH_ChannelRef &r,
1289  const char *path) const;
1290 
1291  bool buildChannelRefs( CH_ChannelRefList &reflist,
1292  const CH_ChannelList &chlist );
1293 
1294  bool buildChannelRefs( CH_ChannelRefList &reflist,
1295  const UT_StringArray &chlist );
1296 
1297  /// Returns 0 if r1 and r2 are equal, returns -1 if r1 < r2 and
1298  /// returns 1 if r1 > r2.
1299  virtual int compareChanRefs(const CH_ChannelRef &r1,
1300  const CH_ChannelRef &r2) const;
1301 
1302  /// Returns 0 if r1 and r2 are equal, returns -1 if r1 < r2 and
1303  /// returns 1 if r1 > r2.
1304  virtual int compareLayerRefs(const CH_ChannelRef &r1,
1305  const CH_ChannelRef &r2) const;
1306 
1307  /// Use this method to get the full path of the channel referenced by r.
1308  virtual void getChanRefPath(const CH_ChannelRef &r,
1309  UT_String &path,
1310  bool use_alias=false) const;
1311 
1312  void changeReferencesToNodeId(int old_id, int new_id);
1313 
1314  /// This method will remove all references that this manager knows about
1315  /// channels belonging to node 'node_id'. After this method, scoped
1316  /// channels belonging to node_id will be removed, as will such channels
1317  /// in channel groups.
1318  void removeReferencesToNodeId(int node_id);
1319 
1320  void displayScope() const;
1321 
1322  // Find ChannelRef export location
1323  // Channel CHOP nodes have inputs that match directly to the exported
1324  // tracks. Given a Channel CHOP value param and index, find the export
1325  // location in the scene and return its ChannelRef If the input 'r' channel
1326  // ref is from a CHOP Channel Node, return the corresponding export in
1327  // 'out_export'.
1328  // Returns true if a valid Export was found
1329  virtual bool resolveChanRefExport(const CH_ChannelRef& r,
1330  CH_ChannelRef& out_export );
1331 
1332  /// Auto-Key all Tuples is a preference to key tuples together.
1333  bool getAutoKeyTuples() const
1334  { return myAutoKeyTuples; }
1335  void setAutoKeyTuples(bool b)
1336  { myAutoKeyTuples=b; }
1337 
1338  /// Auto-Scope when Creating Channel is a preference to set the auto-scope
1339  /// flag when creating a channel.
1341  { return mySetAutoScopeOnChannelCreate; }
1343  { mySetAutoScopeOnChannelCreate=b; }
1344 
1345  /// Include all the Animated Channels when building the scoped parameter
1346  /// list from selection
1348  { return myAutoScopeIncludeAnimated; }
1350  { myAutoScopeIncludeAnimated=b; }
1351 
1352  ///
1354  { return myFollowScopedChannelReferences; }
1356  { myFollowScopedChannelReferences=b; }
1357 
1358 
1359  //
1360  // Animation functions.
1361  //
1362  fpreal evalBezierFunc(int thread);
1363  fpreal evalConstantFunc(int thread);
1364  fpreal evalCubicFunc(int thread);
1365  fpreal evalCycleFunc(fpreal start_frame, fpreal end_frame,
1366  int thread);
1367  fpreal evalCycletFunc(fpreal start_frame, fpreal end_frame,
1368  int thread);
1369  fpreal evalCycleOffsetFunc(
1370  fpreal start_frame, fpreal end_frame, int thread);
1371  fpreal evalCycleOffsettFunc(
1372  fpreal start_frame, fpreal end_frame, int thread);
1373  fpreal evalEaseFunc(int thread);
1374  fpreal evalEaseinFunc(int thread);
1375  fpreal evalEaseinpFunc(fpreal ease_speed, int thread);
1376  fpreal evalEaseoutFunc(int thread);
1377  fpreal evalEaseoutpFunc(fpreal ease_speed, int thread);
1378  fpreal evalEasepFunc(fpreal ease_speed, int thread);
1379  fpreal evalLinearFunc(int thread);
1380  fpreal evalMatchFunc(int thread);
1381  fpreal evalMatchinFunc(int thread);
1382  fpreal evalMatchoutFunc(int thread);
1383  fpreal evalQcubicFunc(int thread);
1384  fpreal evalQlinearFunc(int thread);
1385  fpreal evalQuinticFunc(int thread);
1386  fpreal evalRepeatFunc(fpreal start_frame, fpreal end_frame,
1387  int thread);
1388  fpreal evalRepeattFunc(fpreal start_frame, fpreal end_frame,
1389  int thread);
1390  fpreal evalSplineFunc(int thread);
1391  fpreal evalVmatchFunc(int thread);
1392  fpreal evalVmatchinFunc(int thread);
1393  fpreal evalVmatchoutFunc(int thread);
1394 
1395  /// Include all the Child nodes when building the scoped parameter list
1396  /// from selection
1398  { return myAutoScopeIncludeChild; }
1400  { myAutoScopeIncludeChild=b; }
1401 
1402  /// Include all the Constraints nodes when building the scoped parameter
1403  /// list from selection
1405  { return myAutoScopeIncludeConstraints; }
1407  { myAutoScopeIncludeConstraints=b; }
1408 
1409  // Functions for accessing and controlling the default context option
1410  // values. These values are used by all OP_Context objects unless a
1411  // value is explicitly overridden on that context object. These functions
1412  // also manage the associated micro nodes and send notifications as
1413  // appropriate.
1415  { return myDefaultContextOptions; }
1416  DEP_MicroNode &getDefaultContextOptionMicroNode(
1417  const UT_StringHolder &opt);
1418  void setDefaultContextOption(
1419  const UT_StringHolder &opt,
1420  const UT_StringHolder &value);
1421  void setDefaultContextOption(
1422  const UT_StringHolder &opt,
1423  fpreal64 value);
1424  const UT_StringHolder &getDefaultContextOptionUiConfig(
1425  const UT_StringHolder &opt) const;
1426  void setDefaultContextOptionUiConfig(
1427  const UT_StringHolder &opt,
1428  const UT_StringHolder &ui_config);
1429  void removeDefaultContextOption(
1430  const UT_StringHolder &opt);
1431  void clearDefaultContextOptions();
1432  bool saveDefaultContextOptions(std::ostream &os) const;
1433  bool loadDefaultContextOptions(UT_IStream &is);
1434 
1435  void setChannelColorManager( CH_ChannelColorManager *mgr );
1436  CH_ChannelColorManager *channelColorManager();
1437 
1438  void setChannelChanged( CH_ChannelChanged *mgr );
1439  CH_ChannelChanged *getChannelChanged();
1440  void triggerChannelChanged();
1441 
1442  virtual bool getChannelAutoSelect(const CH_ChannelRef &chref) const
1443  { return true; }
1444 
1445  // Resolve channel labels and node path without exposing OP_Node*
1446  virtual bool getChRefLabelForUI(const CH_ChannelRef &r, UT_String &ret) const;
1447  virtual bool getChRefAlias(const CH_ChannelRef &r, UT_String &ret) const;
1448  virtual bool getChRefNodePath(const CH_ChannelRef &r, UT_String &ret) const;
1449 protected:
1450  void initExpressionLibrary();
1451 
1452  // Since this is possibly a base class, the library glue initialization has
1453  // to be done after the construction
1454  void initLibraryGlue();
1455 
1456 private:
1457  friend CH_ScopedChannels;
1458 
1459  void internalScopeChanged(unsigned flags,
1460  bool propagate=true );
1461 
1462  void handleGroupCollision(CH_Group *new_group,
1463  CH_Group *existing,
1464  CollisionBehaviour cb );
1465 
1466  void destroyContents();
1467  int internalSetGlobalParam(const char *token,
1468  fpreal val, const char *strval,
1469  CH_Collection *&owner);
1470  int setSingleGlobalParam(const char *token,
1471  fpreal val, const char *strvel,
1472  CH_Collection *&owner, CH_Collection *scope);
1473  void internalDirtyOrphanGlobalParamDependents(
1474  const char *token, CH_Collection *scope,
1475  UT_Set<CH_Collection *> *dependents);
1476  void stretchCollection(CH_Collection *grp,
1477  fpreal os, fpreal ns, fpreal stretch);
1478  void propagateDefaultContextOptionDirtied(
1479  const UT_StringHolder &opt);
1480 
1481  static char *chExprExpander(const char *str, int thread);
1482 
1483  class chParamKey
1484  {
1485  public:
1486  chParamKey(const UT_StringRef &token, CH_Collection *scope);
1487  bool operator==(const chParamKey &key) const;
1488  bool operator!=(const chParamKey &key) const
1489  { return !operator==(key); }
1490  SYS_HashType hash() const;
1491  const char *getToken() const
1492  { return myToken; }
1493  CH_Collection *getScope() const
1494  { return myScope; }
1495 
1496  struct Hasher
1497  {
1498  SYS_HashType operator()(const chParamKey &key) const
1499  { return key.hash(); }
1500  };
1501  private:
1502  UT_StringRef myToken;
1503  CH_Collection *myScope;
1504  };
1505 
1507 
1508  // Default Context Options for cooking nodes.
1509  DEP_ContextOptionsHandle myDefaultContextOptions;
1510  UT_StringMap<DEP_MicroNode *> myDefaultContextOptionMicroNodes;
1511  UT_TBBSpinLock myDefaultContextOptionMicroNodesLock;
1512  UT_StringMap<UT_StringHolder> myDefaultContextOptionUIs;
1513 
1514  CH_Group *myTopGroup;
1515  UT_StringArray mySelectedGroupPaths;
1516  UT_String myCurrentGroupPath;
1517  UT_ValArray<CH_TimeGroup *> myTimeGroups;
1518  CH_Collection *myRootCollection;
1519  fpreal mySampleCount;
1520  fpreal myFPS;
1521  fpreal myStart, myEnd;
1522 
1523  fpreal myRangeStart;
1524  fpreal myRangeEnd;
1525  fpreal myRealTimeFactor;
1526  fpreal mySampleStep;
1527  fpreal myTimeTolerance;
1528  fpreal myTimeCodeOffset;
1529 
1530  chParamData *findGlobalParam(const char *token,
1531  CH_Collection *scope);
1532  chParamData *findOrCreateGlobalParam(
1533  const char *token, CH_Collection *scope,
1534  fpreal fval, const char *sval);
1536  chParamData *myLastGlobalParam;
1537  int mySettingGlobalParam;
1538 
1539  int mySettingGuideParam;
1540 
1541  int myChopMotionSamples;
1542 
1543  unsigned myGroupsSorted:1,
1544  myIntegerFrames:1,
1545  myRealTimePlay:1,
1546  myRealTimeDisableSkip:1,
1547  myHoldFlag:1,
1548  myRestrictRange:1,
1549  myShowRange:1,
1550  myShowTicks:1,
1551  myShowAudio:1,
1552  myShowKeys:1,
1553  myShowSimCache:1,
1554  myAutoKeyTuples:1,
1555  mySetAutoScopeOnChannelCreate:1,
1556  myAutoScopeIncludeAnimated:1,
1557  myFollowScopedChannelReferences:1,
1558  myAutoScopeIncludeChild:1,
1559  myAutoScopeIncludeConstraints:1;
1560 
1561 
1562  short myRawInterpFlag;
1563 
1564  UT_String myDefaultExpression;
1565  UT_String myDefaultRotationExpression;
1566  bool myAutoSplit;
1567  UT_String myDefaultSplitExpression;
1568  SlopeMode myAutoSlope;
1569  fpreal myDefaultSlope;
1570  bool myHoldLastKey;
1571  // auto-commit value change when we are on a keyframe
1572  bool myAlwaysCommitKey;
1573  UT_String myChanCreateKeyExpression;
1574  fpreal myAudioLevel;
1575  fpreal myUnitLength;
1576  fpreal myUnitMass;
1577 
1578  CH_ScopedChannels myScopedChannels;
1579  UT_Array<CH_ScopedChannels*> myPinnedScopedChannels;
1580 
1581  UT_Set<CH_Channel *> myPendingChannelsTable;
1582 
1583  CH_ExprLanguage myDefaultExprLanguage;
1584 
1585  int myBlockModifyScope;
1586  unsigned myPendingScopeChange;
1587  bool myPendingChannelChanged;
1588 
1589  CH_ChannelColorManager *myChannelColorsManager;
1590  CH_ChannelChanged *myChannelChanged;
1591 
1592  static CH_Manager *theManager;
1593 
1596 };
1597 
1598 /// Push & restore the evaluation time (and optionally a channel collection)
1600 {
1601 public:
1603  int thread,
1604  fpreal time,
1605  CH_Collection *ch = nullptr,
1606  const DEP_ContextOptionsStack *context_options_stack = nullptr,
1607  DEP_ContextOptionsReadHandle context_options =
1609  : myContext(chman.evalContext(thread))
1610  , myCollection(nullptr)
1611  , myPopCollection(false)
1612  , myPopContextOptions(false)
1613  {
1614  myTime = myContext.myTime;
1615  myContext.myTime = time;
1616  if (ch)
1617  {
1618  myPopCollection = true;
1619  myCollection = myContext.myCollection;
1620  myContext.myCollection = ch;
1621  }
1622  if (!context_options.isNull())
1623  {
1624  myPopContextOptions = true;
1625  myContextOptionsStack = myContext.myContextOptionsStack;
1626  myContext.myContextOptionsStack = context_options_stack;
1627  myContextOptions = myContext.myContextOptions;
1628  myContext.myContextOptions = context_options;
1629  }
1630  }
1631 
1633  {
1634  myContext.myTime = myTime;
1635  if (myPopCollection)
1636  myContext.myCollection = myCollection;
1637  if (myPopContextOptions)
1638  {
1639  myContext.myContextOptionsStack = myContextOptionsStack;
1640  myContext.myContextOptions = myContextOptions;
1641  }
1642  }
1643 
1644 private:
1645  CH_EvalContext &myContext;
1646  CH_Collection *myCollection;
1647  const DEP_ContextOptionsStack *myContextOptionsStack;
1648  DEP_ContextOptionsReadHandle myContextOptions;
1649  fpreal myTime;
1650  bool myPopCollection;
1651  bool myPopContextOptions;
1652 
1653  friend class CH_Manager;
1654 };
1655 
1656 /// Push & restore a channel collection only. If the given collection is NULL,
1657 /// then the eval context is not modified.
1659 {
1660 public:
1661  CH_AutoEvalCollection(int thread, CH_Collection *collection = NULL)
1662  : myContext(CH_Manager::getContext()->evalContext(thread))
1663  {
1664  myCollection = myContext.myCollection;
1665  if (collection)
1666  myContext.myCollection = collection;
1667  }
1669  {
1670  return myContext.myCollection;
1671  }
1672  void set(CH_Collection *collection)
1673  {
1674  UT_ASSERT(collection);
1675  myContext.myCollection = collection;
1676  }
1678  {
1679  myContext.myCollection = myCollection;
1680  }
1681 
1682 private:
1683  CH_EvalContext &myContext;
1684  CH_Collection *myCollection;
1685 };
1686 
1687 // Small utility class to set the active layer contribution and reset it
1688 // The animation layer value and weight comes from CHOP_Layer extra tracks.
1689 // The active_layer_value and active_layer_weight tracks are used correctly
1690 // reapply values on the active layer channels.
1692 {
1693 public:
1696 
1697  // set the layer contribution for the lifespan of the object.
1698  void set(fpreal layer_value, fpreal layer_weight);
1699 
1700  // Apply the active layer contribution to input
1701  void apply(fpreal& v);
1702 
1703 private:
1704  bool myReset;
1705 };
1706 
1709 CH_API void CHsortChannelPaths( UT_StringArray &channel_paths );
1711 
1713  CH_CollectionList &collections );
1714 
1715 inline
1717 {
1718  return CH_Manager::getContext();
1719 }
1720 
1721 inline
1723 {
1725 }
1726 
1728 {
1730 }
1731 
1733 {
1734  return CH_Manager::getContext()->getEvaluateTime(thread);
1735 }
1736 
1737 CH_API extern fpreal CHgetTimeFromFrame(fpreal frame);
1738 CH_API extern int CHgetFrameFromTime(fpreal time);
1740 CH_API extern void CHbuildRange(int start, int end, UT_SuperIntervalR &r);
1741 
1742 /// The CHoutputChannelList functions output a formatted string
1743 /// representing the given channels. One version of the function takes a
1744 /// list of channels while the other takes a string array of full paths
1745 /// to channels. The given arrays may be modified (they might need sorting).
1746 CH_API extern void CHoutputChannelList(UT_WorkBuffer &info,
1748 CH_API extern void CHoutputChannelList(UT_WorkBuffer &info,
1749  UT_StringArray &channel_paths);
1750 
1751 CH_API extern void CHdisplayFlags( unsigned flags, std::ostream &s );
1752 
1753 #endif
fpreal getSampleDelta(fpreal time_delta) const
Definition: CH_Manager.h:1033
GLdouble s
Definition: glew.h:1390
fpreal getRealTimeFactor() const
Definition: CH_Manager.h:1108
CH_API void CHsortChannelRefs(CH_ChannelRefList &channels)
DEP_ContextOptionsHandle getDefaultContextOptions() const
Definition: CH_Manager.h:1414
Definition: UT_Set.h:58
GT_API const UT_StringHolder filename
bool getAutoScopeIncludeConstraints() const
Definition: CH_Manager.h:1404
const char * getEvalChannelName(int thread) const
Definition: CH_Manager.h:1212
fpreal getSnapToFrameTime(fpreal t) const
Definition: CH_Manager.h:1038
fpreal getSecsPerSample() const
Definition: CH_Manager.h:988
GLenum GLint ref
Definition: glew.h:1845
CH_API fpreal CHgetTimeFromFrame(fpreal frame)
#define SYS_DEPRECATED(__V__)
GLuint const GLchar * name
Definition: glew.h:1814
void setAutoScopeOnChannelCreate(bool b)
Definition: CH_Manager.h:1342
CH_API fpreal CHgetSampleFromTime(fpreal time)
virtual ~CH_ChannelColorManager()
Definition: CH_Manager.h:66
void setAutoScopeIncludeChild(bool b)
Definition: CH_Manager.h:1399
CH_ExprLanguage
const DEP_ContextOptionsStack * getEvalChannelContextOptionsStack(int thread) const
Definition: CH_Manager.h:1215
void setAutoScopeIncludeConstraints(bool b)
Definition: CH_Manager.h:1406
fpreal getUnitLength() const
Definition: CH_Manager.h:1096
GT_API const UT_StringHolder time
GLenum target
Definition: glew.h:2865
bool(* CH_StringVarEvalFunc)(UT_String &val, int varid, int thread)
Definition: CH_Manager.h:59
void setHoldFlag(int flag)
Definition: CH_Manager.h:1127
void setSampleStep(fpreal s)
Definition: CH_Manager.h:1113
GLuint const GLfloat * val
Definition: glew.h:2794
void setShowAudioFlag(int flag)
Definition: CH_Manager.h:1085
bool(* CH_IntVarEvalFunc)(int &val, int varid, int thread)
Definition: CH_Manager.h:61
GLenum GLsizei GLsizei GLsizei GLsizei GLbitfield flags
Definition: glew.h:2864
void setShowRangeFlag(int flag)
Definition: CH_Manager.h:1079
void setKeepChannelListSelection(bool b)
Definition: CH_Manager.h:303
bool getAutoScopeOnChannelCreate() const
Definition: CH_Manager.h:1340
void setFilterParmLabels(FilterType filter_type, bool b)
Definition: CH_Manager.h:341
void setFilterScales(bool b)
Definition: CH_Manager.h:336
void setSampleRange(fpreal start, fpreal end)
Definition: CH_Manager.h:1120
fpreal getSampleRaw(fpreal t) const
Definition: CH_Manager.h:1013
fpreal64 file_end
Definition: CH_Manager.h:93
const CH_TimeGroup * getTimeGroup(int i) const
Definition: CH_Manager.h:948
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:1044
GLsizei GLsizei GLchar * source
Definition: glew.h:1832
void setEvalCollection(CH_Collection *g, int thread)
Definition: CH_Manager.h:1157
int getShowSimCacheFlag() const
Definition: CH_Manager.h:1090
CH_KeyState
Definition: CH_KeyState.h:15
CH_API void CHsortChannelPaths(UT_StringArray &channel_paths)
CH_API void CHoutputChannelList(UT_WorkBuffer &info, CH_ChannelList &channels)
const GLdouble * m
Definition: glew.h:9124
bool getAutoScopeIncludeChild() const
Definition: CH_Manager.h:1397
Selectively extract and filter point data using a custom filter operator.
CH_API void CHbuildRange(int start, int end, UT_SuperIntervalR &r)
fpreal getTimeDelta(fpreal sample_delta) const
Definition: CH_Manager.h:1028
fpreal getTimeCodeOffset(fpreal) const
Definition: CH_Manager.h:1070
const GLdouble * v
Definition: glew.h:1391
bool getFilterParmLabels(FilterType filter_type) const
Definition: CH_Manager.h:343
bool getIsSettingGuideParam() const
Definition: CH_Manager.h:845
int getRealTimeFlag() const
Definition: CH_Manager.h:1106
GLenum GLint GLuint mask
Definition: glew.h:1845
void setEnableFilter(FilterType filter_type, bool b)
Definition: CH_Manager.h:316
fpreal64 load_end
Definition: CH_Manager.h:91
SYS_API fpreal64 SYSniceNumber(fpreal64 num, int digits=6)
void setShowSimCacheFlag(int flag)
Definition: CH_Manager.h:1091
GLsizei GLuint * groups
Definition: glew.h:2744
const CH_EvalContext & evalContext(int thread) const
Definition: CH_Manager.h:1201
int getHoldLastKey() const
Definition: CH_Manager.h:478
void setAutoScopeIncludeAnimated(bool b)
Definition: CH_Manager.h:1349
int getShowKeysFlag() const
Definition: CH_Manager.h:1087
fpreal getUnitMass() const
Definition: CH_Manager.h:1098
static bool getContextExists()
Definition: CH_Manager.h:433
void setUnitMass(fpreal unitmass)
Definition: CH_Manager.h:1099
bool getRealTimeDisableSkip() const
Definition: CH_Manager.h:1110
SlopeMode getAutoSlope() const
Definition: CH_Manager.h:460
void setChanCreateKeyExpression(const char *s)
Definition: CH_Manager.h:482
void setFollowScopedChannelReferences(bool b)
Definition: CH_Manager.h:1355
bool getFilterFullNames(FilterType filter_type) const
Definition: CH_Manager.h:348
int getGlobalEndFrame() const
Definition: CH_Manager.h:997
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
bool getFollowScopedChannelReferences() const
Definition: CH_Manager.h:1353
int getNTimeGroups() const
Definition: CH_Manager.h:946
void setDefaultSplitExpression(const char *expr)
Definition: CH_Manager.h:470
void getSampleRange(fpreal &start, fpreal &end)
Definition: CH_Manager.h:1115
int getFrame(fpreal t) const
Definition: CH_Manager.h:1023
fpreal getSampleStep() const
Definition: CH_Manager.h:1112
bool getFilterTranslates() const
Definition: CH_Manager.h:328
CH_API void CHsortLayerRefs(CH_ChannelRefList &channels)
bool getAutoScopeIncludeAnimated() const
Definition: CH_Manager.h:1347
int getRawInterpolation()
Definition: CH_Manager.h:1003
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:1602
bool getFilterScales() const
Definition: CH_Manager.h:338
CH_Manager * CHgetManager()
Definition: CH_Manager.h:1716
fpreal getGlobalStart() const
Definition: CH_Manager.h:993
GLclampf f
Definition: glew.h:3499
fpreal getSample(fpreal t) const
Definition: CH_Manager.h:1018
const UT_StringHolder & getFilter(FilterType filter_type) const
Definition: CH_Manager.h:323
int getIntegerFrameFlag() const
Definition: CH_Manager.h:1072
const CH_Segment * getEvalSegment(int thread) const
Definition: CH_Manager.h:1210
bool getAutoKeyTuples() const
Auto-Key all Tuples is a preference to key tuples together.
Definition: CH_Manager.h:1333
bool getEnableFilter(FilterType filter_type) const
Definition: CH_Manager.h:318
DEP_ContextOptionsReadHandle getEvalChannelContextOptions(int thread) const
Definition: CH_Manager.h:1218
void setRootCollection(CH_Collection *root)
Definition: CH_Manager.h:1192
fpreal getSamplesPerSec() const
Definition: CH_Manager.h:986
void setIntegerFrameFlag(int flag)
Definition: CH_Manager.h:1073
const GLuint GLenum const void * binary
Definition: glew.h:3502
void setShowTicksFlag(int flag)
Definition: CH_Manager.h:1082
int getRestrictRangeFlag() const
Definition: CH_Manager.h:1075
double fpreal64
Definition: SYS_Types.h:196
void setDefaultSlope(fpreal slope)
Definition: CH_Manager.h:462
GLuint GLuint end
Definition: glew.h:1253
void
Definition: png.h:1083
void setShowKeysFlag(int flag)
Definition: CH_Manager.h:1088
CH_EvalContext & evalContext(int thread)
Definition: CH_Manager.h:1205
CH_API void CHchannelsToCollections(CH_ChannelList const &channels, CH_CollectionList &collections)
const CH_Channel * getEvalChannel(int thread) const
Definition: CH_Manager.h:1208
GLsizei n
Definition: glew.h:4040
fpreal64 load_start
Definition: CH_Manager.h:90
void setRawInterpolation(int state)
Definition: CH_Manager.h:1002
CH_API void CHdisplayFlags(unsigned flags, std::ostream &s)
void setDefaultExpression(const char *s)
Definition: CH_Manager.h:444
fpreal getGlobalEnd() const
Definition: CH_Manager.h:994
void setDefaultExprLanguage(CH_ExprLanguage language)
Definition: CH_Manager.h:923
*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
SYS_API fpreal32 SYSfloor(fpreal32 val)
fpreal CHgetEvalTime()
Definition: CH_Manager.h:1727
fpreal getAudioLevel() const
Definition: CH_Manager.h:1093
CH_Collection * collection() const
Definition: CH_Manager.h:1668
CH_API int CHgetFrameFromTime(fpreal time)
void setAudioLevel(fpreal lvl)
Definition: CH_Manager.h:1094
CH_ExprLanguage getDefaultExprLanguage()
Definition: CH_Manager.h:921
void setAutoSlope(SlopeMode m)
Definition: CH_Manager.h:458
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1253
void setFilterFullNames(FilterType filter_type, bool b)
Definition: CH_Manager.h:346
fpreal32 SYSrint(fpreal32 val)
Definition: SYS_Floor.h:163
virtual ~CH_FilterChanged()
Definition: CH_Manager.h:81
fpreal getDefaultSlope() const
Definition: CH_Manager.h:464
static CH_Manager * getContext()
Definition: CH_Manager.h:428
GLuint start
Definition: glew.h:1253
int getShowAudioFlag() const
Definition: CH_Manager.h:1084
bool getIsAtFrame(fpreal t) const
Definition: CH_Manager.h:1056
int getShowRangeFlag() const
Definition: CH_Manager.h:1078
const char * getDefaultExpression() const
Definition: CH_Manager.h:449
GT_API const UT_StringHolder version
void setDefaultRotationExpression(const char *s)
Definition: CH_Manager.h:451
CH_AutoEvalCollection(int thread, CH_Collection *collection=NULL)
Definition: CH_Manager.h:1661
GLsizei const GLchar *const * path
Definition: glew.h:6461
const CH_ScopedChannels & getGlobalScopedChannels() const
Definition: CH_Manager.h:933
void setRealTimeDisableSkip(bool b)
Definition: CH_Manager.h:1111
bool full_replace
Definition: CH_Manager.h:94
GLdouble GLdouble GLdouble b
Definition: glew.h:9122
GLfloat GLfloat p
Definition: glew.h:16321
fpreal getEvaluateTime(int thread) const
Functions for obtaining and setting the current evaluation time.
Definition: CH_Manager.h:1223
CH_Collection * getEvalCollection(int thread) const
Definition: CH_Manager.h:1178
void setUnitLength(fpreal unitlength)
Definition: CH_Manager.h:1097
double fpreal
Definition: SYS_Types.h:276
bool getFilterRotates() const
Definition: CH_Manager.h:333
UT_COWReadHandle< DEP_ContextOptions > DEP_ContextOptionsReadHandle
void setRealTimeFactor(fpreal f)
Definition: CH_Manager.h:1109
void setAutoKeyTuples(bool b)
Definition: CH_Manager.h:1335
Push & restore the evaluation time (and optionally a channel collection)
Definition: CH_Manager.h:1599
SYS_API int SYSgetSTID()
int getChopMotionSamples() const
Definition: CH_Manager.h:990
CH_ScopedChannels & getGlobalScopedChannels()
Definition: CH_Manager.h:931
GLuint num
Definition: glew.h:2690
const char * getDefaultRotationExpression() const
Definition: CH_Manager.h:456
virtual ~CH_ChannelChanged()
Definition: CH_Manager.h:74
#define CH_API
Definition: CH_API.h:10
SYS_HashType operator()(const chParamKey &key) const
Definition: CH_Manager.h:1498
void setAlwaysCommitKeyChange(bool onoff)
Definition: CH_Manager.h:486
bool getAutoSplit() const
Definition: CH_Manager.h:468
void setHoldLastKey(bool onoff)
Definition: CH_Manager.h:476
GLdouble GLdouble GLdouble r
Definition: glew.h:1406
fpreal getNumSamples() const
Definition: CH_Manager.h:984
void setFilterRotates(bool b)
Definition: CH_Manager.h:331
virtual CH_ScriptAccessManager * getAccessManager(int)
Definition: CH_Manager.h:1197
void setTimeCodeOffset(fpreal t)
Definition: CH_Manager.h:1069
bool use_load_range
Definition: CH_Manager.h:89
bool getAlwaysCommitKeyChange() const
Definition: CH_Manager.h:484
void set(CH_Collection *collection)
Definition: CH_Manager.h:1672
GLuint64EXT * result
Definition: glew.h:14007
virtual bool getChannelAutoSelect(const CH_ChannelRef &chref) const
Definition: CH_Manager.h:1442
CH_TimeGroup * getTimeGroup(int i)
Definition: CH_Manager.h:947
CH_Collection * getRootCollection() const
Definition: CH_Manager.h:1194
bool getKeepChannelListSelection() const
Definition: CH_Manager.h:301
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:135
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
#define const
Definition: zconf.h:214
GLubyte * pattern
Definition: glew.h:5711
static fpreal niceNumber(fpreal num, int digits=6)
Definition: CH_Manager.h:964
int getHoldFlag() const
Definition: CH_Manager.h:1126
void setAutoSplit(bool onoff)
Definition: CH_Manager.h:466
void setFilterTranslates(bool b)
Definition: CH_Manager.h:326
GLenum GLuint GLsizei const GLchar * buf
Definition: glew.h:2580
GLenum GLenum variable
Definition: glew.h:13879
const char * getDefaultSplitExpression() const
Definition: CH_Manager.h:473
void setRealTimeFlag(int flag)
Definition: CH_Manager.h:1107
GLsizei const GLfloat * value
Definition: glew.h:1849
bool(* CH_FloatVarEvalFunc)(fpreal &val, int varid, int thread)
Definition: CH_Manager.h:60
void setEvaluateTime(fpreal time, int thread)
Functions for obtaining and setting the current evaluation time.
Definition: CH_Manager.h:1225
float fpreal32
Definition: SYS_Types.h:195
int getGlobalStartFrame() const
Definition: CH_Manager.h:995
GLdouble GLdouble t
Definition: glew.h:1398
fpreal getTolerance() const
Definition: CH_Manager.h:1006
fpreal getTime(fpreal sample) const
Definition: CH_Manager.h:1008
void setRestrictRangeFlag(int flag)
Definition: CH_Manager.h:1076
GLfloat units
Definition: glew.h:10289
void setFilter(FilterType filter_type, const UT_StringHolder &f)
Definition: CH_Manager.h:321
int getShowTicksFlag() const
Definition: CH_Manager.h:1081
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:1722
GLboolean GLuint group
Definition: glew.h:2745
GLboolean GLboolean g
Definition: glew.h:9477
fpreal64 file_start
Definition: CH_Manager.h:92
const char * getChanCreateKeyExpression() const
Definition: CH_Manager.h:480
bool isGlobalScopedChannels(CH_ScopedChannels *p)
Definition: CH_Manager.h:927