HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OP_DopeBuffer.h
Go to the documentation of this file.
1 
2 /*
3  * PROPRIETARY INFORMATION. This software is proprietary to
4  * Side Effects Software Inc., and is not to be reproduced,
5  * transmitted, or disclosed in any way without written permission.
6  *
7  * NAME: OP_DopeBuffer.h (C++)
8  *
9  */
10 
11 #ifndef __OP_DopeBuffer_h__
12 #define __OP_DopeBuffer_h__
13 
14 #include "OP_API.h"
15 
16 #include <UT/UT_IStream.h>
17 #include <UT/UT_OFStream.h>
18 #include <UT/UT_String.h>
19 
20 #include "OP_Channels.h"
21 #include "OP_MultiChannel.h"
22 
23 // forward declaration
24 template<typename T> class UT_Array;
25 
27 {
28 public:
29  OP_DopeBuffer();
30  virtual ~OP_DopeBuffer();
31 
32  void clearAndDestroy();
33 
34  // frame_mask - parameter that masks which keys are copied from the rows
35  // If it is NULL, all keys are copied. If it is not NULL, this
36  // method copies only these keys from rows whose frame is specified
37  // in an int array (in frame_masks) corresponding to a given row.
38  // PRE:
39  // This parameter should contain arrays sorted in ascending order.
40  // All entries should have values no less than x1 and no greater than x2
41  void copyKeys(const OP_MultiChannelRefArray &rows,
42  int x1, int y1, int x2, int y2, int forceKeys = 0,
43  const UT_Array<UT_IntArray> *row_frame_masks =NULL,
44  bool clear_buffer = true,
45  const int row_frame_masks_offset = 0);
46  void cutKeys( const OP_MultiChannelRefArray &rows,
47  int x1, int y1, int x2, int y2, int forceKeys = 0);
48  static void deleteKeys(const OP_MultiChannelRefArray &rows,
49  int x1, int y1, int x2, int y2);
50  void replaceKeys(const OP_MultiChannelRefArray &rows,
51  int x1, int y1, int x2, int y2);
52 
53  void pasteKeys(const OP_MultiChannelRefArray &rows,
54  int x1, int y1 ) const;
55 
56  // An OP_DopeBuffer stores only displayed non-empty channels.
57  // The paste row order mode uses displayed index to resolve the channels.
58  void updateDisplayedIndexMap( const CH_ChannelRefList &displayed );
59  bool validDisplayedIndexMap() const;
60  bool lookupDisplayedIndexMap( int id, int &row_id, int &ch_id ) const;
61 
62  bool findFirstDisplayedRow(int &id, int &row_id, int & ch_id) const;
63  bool findLastDisplayedRow(int &id, int &row_id, int & ch_id) const;
64 
65  void print();
66  int save();
67  int load();
68 
69  const OP_MultiChannelRefArray & getRows() const { return myRows; }
70 
71  void getChannelList( CH_ChannelList &channels ) const;
72 
73  void getDimensions(int &x1, int &x2, int &numRows);
74  void getMaxDimensions(int &x1, int &x2, int &numRows);
75  void duplicate(OP_DopeBuffer &copy);
76 
77  // set the "window" of keyframes that we are interested in
78  void setStartEnd(int start, int end)
79  { myStartFrame = start, myEndFrame = end; }
80  int getStart() const { return myStartFrame; }
81  int getEnd() const { return myEndFrame; }
82 
83  CH_Channel * dupChannel(const CH_Channel &from);
84 
85  void setTargetChannel( const CH_Channel *target ) const;
86 
87  bool getRowFullPath( UT_String &ret, int i ) const;
88 
90  { return myPasteKeysMap; }
91 
92  // Flag to tell if the copyKeys call has been made using the current time because the
93  // selection was empty. We use this to avoid reselecting the paste keys.
94  void setCopyCurrentTime(bool b)
95  { myCopyCurrentTime=b; }
97  { return myCopyCurrentTime; }
98 
99 private:
100  // load and save the copy buffer.
101  int save(const char *filename);
102  int save(UT_OFStream &ofs);
103 
104  int load(const char *filename);
105  int load(UT_IFStream &ifs);
106 
107  void pasteChannelKeys( CH_Channel *from_chp,
108  CH_Channel *to_chp, int x1) const;
109 
110  OP_DopeBuffer( const OP_DopeBuffer &copy ); // not implemented
111  OP_DopeBuffer &operator=(const OP_DopeBuffer &copy );// not implemented
112 
113 private:
115  UT_Map<const CH_Channel*,int> myOriginalMap;
116  mutable UT_Map<const CH_Channel*,UT_Array<fpreal> > myPasteKeysMap;
117  UT_Array< std::pair<int,int> > myDisplayedToRow;
118  UT_StringArray myRowsFullPaths;
119 
120  OP_Channels myCollection;
121  int myStartFrame;
122  int myEndFrame;
123  bool myCopyCurrentTime;
124 };
125 
126 #endif
const UT_Map< const CH_Channel *, UT_Array< fpreal > > & getPasteKeysMap() const
Definition: OP_DopeBuffer.h:89
Unsorted map container.
Definition: UT_Map.h:83
GLuint start
Definition: glcorearb.h:474
int getStart() const
Definition: OP_DopeBuffer.h:80
png_uint_32 i
Definition: png.h:2877
GLuint GLuint end
Definition: glcorearb.h:474
GLenum target
Definition: glcorearb.h:1666
int getEnd() const
Definition: OP_DopeBuffer.h:81
Portable replacement for std::ofstream.
Definition: UT_OFStream.h:26
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
void setCopyCurrentTime(bool b)
Definition: OP_DopeBuffer.h:94
bool getCopyCurrentTime()
Definition: OP_DopeBuffer.h:96
const OP_MultiChannelRefArray & getRows() const
Definition: OP_DopeBuffer.h:69
void setStartEnd(int start, int end)
Definition: OP_DopeBuffer.h:78
#define OP_API
Definition: OP_API.h:10