HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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) override;
40 
41  // Returns the active layer parm
42  bool findParmFromTrack(
43  const OP_FollowChanRefsOptions& opt,
44  const char *trackname,
45  OP_NodeParmRefCycle &cycle,
46  OP_Node *&node,
47  PRM_Parm *&parm,
48  int &vecidx) override;
49 
50  void opChanged(OP_EventType reason, void *data) override;
51 
52  bool scopedChannelsDirty() override;
54  const UT_String &track_name,
55  fpreal t,
56  fpreal &value,
57  fpreal &weight) override;
58 
59 protected:
60 
61  CHOP_Layer(OP_Network *net, const char *name, OP_Operator *op);
62  ~CHOP_Layer() override;
63 
64  void checkTimeDependencies(int do_parms=1, int do_inputs=1,
65  int do_extras=1 ) override;
66 
67 private:
68 
69  enum LayerContrib
70  {
71  LayerContrib_ActiveValues,
72  LayerContrib_ActiveWeights,
73  LayerContrib_Full
74  };
75 
76  OP_ERROR internalCookMyChop(OP_Context &context, LayerContrib mode);
77 
78  void combineChannels(const CL_Clip *source, CL_TrackListC *tracks, UT_Array<int> *trackWeightIds, CL_Clip *dest);
79  void combineCHOPs( const OP_Context &context, CL_ClipListC &source);
80  static int updateChannelNames(void *data, int index, fpreal t, const PRM_Template * );
81  void cookWeights( const UT_Array<fpreal>& t);
82  CL_Track* dupTrackInfo(CL_Clip *dest, const CL_Track *track, int data_too );
83 
84 
85  int ACTIVE() const
86  { return evalInt("active", 0, 0); }
87 
88  int NLAYERS() const
89  { return evalInt("nlayers", 0, 0); }
90  fpreal WEIGHT(int i, fpreal t) const
91  { return evalFloatInst("weight#", &i, 0, t); }
92  bool MUTE(int i, fpreal t) const
93  { return evalIntInst("mute#", &i, 0, t)!=0; }
94  bool SOLO(int i, fpreal t) const
95  { return evalIntInst("solo#", &i, 0, t)!=0; }
96 
97  int myLastActive;
98  bool myInitClip;
99  LayerContrib myMode;
100  CL_Clip myWorkClip;
101  UT_Array<fpreal> myRawWeights;
102  UT_Array<fpreal> myWeights;
103 
104  // for interrupts..
105  UT_Interrupt *myBoss;
106  int myStop;
107 };
108 
109 #endif
110 
#define CHOP_API
Definition: CHOP_API.h:10
UT_ErrorSeverity
Definition: UT_Error.h:25
void opChanged(OP_EventType reason, void *data=0) override
virtual bool getActiveLayerContribution(const UT_String &track_name, fpreal t, fpreal &value, fpreal &weight)
Definition: OP_Node.h:3122
virtual OP_ERROR cookMyChop(OP_Context &context)=0
bool findParmFromTrack(const OP_FollowChanRefsOptions &opt, const char *trackname, OP_NodeParmRefCycle &cycle, OP_Node *&node, PRM_Parm *&parm, int &vecidx) override
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
fpreal evalFloatInst(const UT_StringRef &name, const int *inst, int vi, fpreal t, int nestlevel=1) const
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble t
Definition: glad.h:2397
GLenum mode
Definition: glcorearb.h:99
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786
virtual void checkTimeDependencies(int do_parms=1, int do_inputs=1, int do_extras=1)
OP_EventType
Definition: OP_Value.h:22
static OP_TemplatePair myTemplatePair
Definition: CHOP_Layer.h:34
Definition: core.h:1131
exint evalInt(int pi, int vi, fpreal t) const
exint evalIntInst(const UT_StringRef &name, const int *inst, int vi, fpreal t, int nestlevel=1) const
static OP_VariablePair myVariablePair
Definition: CHOP_Layer.h:35
virtual bool scopedChannelsDirty()
Definition: format.h:895