HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CHOP_Layer.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: CHOP_Math.h ( Channel Operator Library, C++)
7  *
8  * COMMENTS:
9  *
10  * Mix CHOP channels as relative animation layers.
11  */
12 
13 #ifndef __CHOP_Layer__
14 #define __CHOP_Layer__
15 
16 #include "CHOP_API.h"
17 #include "CHOP_Node.h"
18 #include <CL/CL_Align.h>
19 #include <UT/UT_Interrupt.h>
20 #include <SYS/SYS_Types.h>
21 
22 
23 class UT_String;
24 
25 #define CHOP_LAYER_ACTIVE_LAYER_INDEX 2
26 
28 {
29 public:
30 
31 
32  static OP_Node *myConstructor(OP_Network*, const char *, OP_Operator *);
33 
36  static PRM_Template myTemplateList[];
37  static CH_LocalVariable myVariableList[];
38 
39  OP_ERROR cookMyChop(OP_Context &context);
40 
41  // Returns the active layer parm
42  virtual bool findParmFromTrack(const OP_FollowChanRefsOptions& opt, const char *trackname, OP_NodeParmRefCycle &cycle, OP_Node *&node, PRM_Parm *&parm, int &vecidx);
43 
44  virtual void opChanged(OP_EventType reason, void *data);
45 
46  virtual bool scopedChannelsDirty();
47  virtual bool getActiveLayerContribution( const UT_String &track_name, fpreal t, fpreal &value, fpreal &weight);
48 
49 protected:
50 
51  CHOP_Layer(OP_Network *net, const char *name, OP_Operator *op);
52  virtual ~CHOP_Layer();
53 
54 private:
55 
56  enum LayerContrib
57  {
58  LayerContrib_ActiveValues,
59  LayerContrib_ActiveWeights,
60  LayerContrib_Full
61  };
62 
63  OP_ERROR internalCookMyChop(OP_Context &context, LayerContrib mode);
64 
65  void combineChannels(const CL_Clip *source, CL_TrackListC *tracks, UT_Array<int> *trackWeightIds, CL_Clip *dest, bool noop);
66  void combineCHOPs(CL_ClipListC &source);
67  static int updateChannelNames(void *data, int index, fpreal t, const PRM_Template * );
68  void cookWeights( const UT_Array<fpreal>& t);
69  CL_Track* dupTrackInfo(CL_Clip *dest, const CL_Track *track, int data_too );
70 
71 
72  int ACTIVE(void) const
73  { return evalInt("active", 0, 0); }
74 
75  int NLAYERS(void) const
76  { return evalInt("nlayers", 0, 0); }
77  fpreal WEIGHT(int i, fpreal t) const
78  { return evalFloatInst("weight#", &i, 0, t); }
79  bool MUTE(int i, fpreal t) const
80  { return evalIntInst("mute#", &i, 0, t)!=0; }
81  bool SOLO(int i, fpreal t) const
82  { return evalIntInst("solo#", &i, 0, t)!=0; }
83 
84  int myLastActive;
85  bool myInitClip;
86  LayerContrib myMode;
87  CL_Clip myWorkClip;
88  UT_Array<fpreal> myRawWeights;
89  UT_Array<fpreal> myWeights;
90 
91  // for interrupts..
92  UT_Interrupt *myBoss;
93  int myStop;
94 };
95 
96 #endif
97 
#define CHOP_API
Definition: CHOP_API.h:10
fpreal evalFloatInst(const char *name, const int *inst, int vi, fpreal t, int nestlevel=1) const
UT_ErrorSeverity
Definition: UT_Error.h:25
virtual void opChanged(OP_EventType reason, void *data=0)
png_uint_32 i
Definition: png.h:2877
virtual bool getActiveLayerContribution(const UT_String &track_name, fpreal t, fpreal &value, fpreal &weight)
Definition: OP_Node.h:2894
virtual OP_ERROR cookMyChop(OP_Context &context)=0
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
GLenum mode
Definition: glcorearb.h:98
virtual bool findParmFromTrack(const OP_FollowChanRefsOptions &opt, const char *trackname, OP_NodeParmRefCycle &cycle, OP_Node *&node, PRM_Parm *&parm, int &vecidx)
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
GLuint index
Definition: glcorearb.h:785
OP_EventType
Definition: OP_Value.h:22
static OP_TemplatePair myTemplatePair
Definition: CHOP_Layer.h:34
exint evalInt(int pi, int vi, fpreal t) const
static OP_VariablePair myVariablePair
Definition: CHOP_Layer.h:35
exint evalIntInst(const char *name, const int *inst, int vi, fpreal t, int nestlevel=1) const
virtual bool scopedChannelsDirty()