HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CH_Bookmark.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 Bookmark (C++)
7  *
8  * COMMENTS: Bookmark which marks a frame range in the playback, allowing
9  * quickly jumping to relevant animation sequences
10  *
11  */
12 
13 #ifndef __CH_Bookmark_h__
14 #define __CH_Bookmark_h__
15 
16 #include "CH_API.h"
17 #include "CH_Types.h"
18 #include <UT/UT_Color.h>
19 #include <UT/UT_StringHolder.h>
20 #include <UT/UT_Options.h>
21 
23 public:
25  fpreal start,
26  fpreal end,
27  const UT_Color &color,
28  bool temporary = false);
29  ~CH_Bookmark();
30 
31  CH_Bookmark(const CH_Bookmark &other);
32  CH_Bookmark(CH_Bookmark &&other) = default;
33 
34  CH_Bookmark &operator=(const CH_Bookmark &other);
35  CH_Bookmark &operator=(CH_Bookmark &&other) = default;
36 
37  const UT_StringHolder &getName() const { return myName; }
38  void setName(const UT_StringHolder &name) { myName = name; }
39 
40  const UT_StringHolder &getComment() const { return myComment; }
41  void setComment(const UT_StringHolder &comment) { myComment = comment; }
42 
43  fpreal getStartTime() const { return myStart; }
44  void setStartTime(fpreal t) { myStart = t; }
45  fpreal getEndTime() const { return myEnd; }
46  void setEndTime(fpreal t) { myEnd = t; }
47  int getIndex() const;
48 
49  UT_Color getColor() const { return myColor; }
50  void setColor(const UT_Color &color) { myColor = color; }
51 
52  bool isVisible() const { return myVisible; }
53  void setVisible(bool visible) { myVisible = visible; }
54 
55  int64 sessionId() const { return myId; }
56 
57  void setTemporary(bool temporary) { myIsTemporary = temporary; }
58  bool isTemporary() const { return myIsTemporary; }
59 
60  void enable() { myEnabled = true; }
61  void disable() { myEnabled = false; }
62 
63  bool isEnabled() const { return myEnabled; }
64 
65  bool save(UT_JSONWriter &w) const;
66  bool load(UT_JSONParser &p);
67  bool loadOTIOFormat(UT_JSONParser &p);
68 
69  UT_Options &getMetadata() { return myMetadata; }
70  void setMetadata(const UT_Options &options) { myMetadata = options; }
71  void updateMetadata(const UT_Options &other) { myMetadata.merge(other); }
72 
73 private:
74  UT_StringHolder myName;
75  UT_StringHolder myComment;
76  UT_Color myColor;
77  fpreal myStart;
78  fpreal myEnd;
79 
80  // whether or not this bookmark is shown in the playbar, graph editor, and
81  // dopesheet
82  bool myVisible;
83 
84  // Whether or not this bookmark is temporary. Temporary bookmarks will not
85  // be saved out unless the include_temporary flag is set.
86  bool myIsTemporary;
87 
88  // Whether or not this bookmark is enabled. Disabled bookmarks are greyed
89  // out on the timeline.
90  bool myEnabled;
91 
92  // Ephemeral (per-session) id, used to help track bookmarks. This is more useful than
93  // the index into the CH_Manager's bookmark list, as that often changes when bookmarks
94  // are manipulated.
95  int64 myId;
96 
97  UT_Options myMetadata;
98 
99  static SYS_AtomicInt64 theNextId;
100 
101  static int64 nextId();
102 };
103 
104 #endif
void setTemporary(bool temporary)
Definition: CH_Bookmark.h:57
void setVisible(bool visible)
Definition: CH_Bookmark.h:53
fpreal getEndTime() const
Definition: CH_Bookmark.h:45
GLuint start
Definition: glcorearb.h:475
void setStartTime(fpreal t)
Definition: CH_Bookmark.h:44
void updateMetadata(const UT_Options &other)
Definition: CH_Bookmark.h:71
fpreal getStartTime() const
Definition: CH_Bookmark.h:43
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
int64 sessionId() const
Definition: CH_Bookmark.h:55
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
GLuint GLuint end
Definition: glcorearb.h:475
bool isTemporary() const
Definition: CH_Bookmark.h:58
void setName(const UT_StringHolder &name)
Definition: CH_Bookmark.h:38
long long int64
Definition: SYS_Types.h:116
GLuint const GLchar * name
Definition: glcorearb.h:786
void enable()
Definition: CH_Bookmark.h:60
void setMetadata(const UT_Options &options)
Definition: CH_Bookmark.h:70
bool isVisible() const
Definition: CH_Bookmark.h:52
GLdouble t
Definition: glad.h:2397
UT_Color getColor() const
Definition: CH_Bookmark.h:49
UT_Options & getMetadata()
Definition: CH_Bookmark.h:69
void setEndTime(fpreal t)
Definition: CH_Bookmark.h:46
A map of string to various well defined value types.
Definition: UT_Options.h:84
void disable()
Definition: CH_Bookmark.h:61
void setComment(const UT_StringHolder &comment)
Definition: CH_Bookmark.h:41
const UT_StringHolder & getComment() const
Definition: CH_Bookmark.h:40
GLuint color
Definition: glcorearb.h:1261
bool isEnabled() const
Definition: CH_Bookmark.h:63
fpreal64 fpreal
Definition: SYS_Types.h:277
#define CH_API
Definition: CH_API.h:10
LeafData & operator=(const LeafData &)=delete
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
const UT_StringHolder & getName() const
Definition: CH_Bookmark.h:37
void setColor(const UT_Color &color)
Definition: CH_Bookmark.h:50