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