HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_GeometryChannels.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: OP_GeometryChannels.h (C++)
7  *
8  * COMMENTS: OP_GeometryChannels is a channel collection used to
9  * store external channels collections which were created
10  * from geometry channels (channel primitives).
11  * This is used in order to scope geometry channels
12  * so that they appear in the global channel list, and can
13  * be modified in the animation editor, main playbar, etc.
14  * Geometry channel collections:
15  * - do not have a unique id: getUniqueId() returns -1
16  * - are always flagged as external
17  * - never have an owner node
18  * - relations between geometry channels and nodes are
19  * instead handled by the MOT_GeometryChannelsManager
20  */
21 
22 #ifndef __OP_GeometryChannels__
23 #define __OP_GeometryChannels__
24 
25 #include "OP_API.h"
26 #include "OP_Channels.h"
27 #include "OP_Types.h"
28 
29 #include <CH/CH_ChannelRef.h>
30 
31 #include <UT/UT_Map.h>
32 #include <UT/UT_Function.h>
33 #include <UT/UT_NonCopyable.h>
34 #include <UT/UT_Set.h>
35 #include <UT/UT_StringHolder.h>
36 #include <SYS/SYS_Types.h>
37 
38 class CH_Channel;
39 class CH_LocalVariable;
40 class CH_Manager;
41 class PRM_ParmList;
42 class PRM_PresetInfo;
43 class PRM_Template;
44 class PRM_Name;
45 class UT_String;
46 
48 {
49 public:
51  CH_LocalVariable *vars);
52 
53  ~OP_GeometryChannels() override;
54 
56 
57  int64 getMemoryUsage(bool inclusive) const override;
58 
59  /// Returns the name of this collection. OP_GeometryChannels stores
60  /// its own name, which is returned here. This overrides the behaviour
61  /// of OP_Channels, where the name of the collection is the name of the
62  /// associated node.
63  const UT_String &getName() const override { return myName; }
64  UT_StringHolder getFullPath() const override { return myName; }
65 
66  OP_Channels *castToOPChannels() override { return static_cast<OP_Channels *>(this); }
67  const OP_Channels *castToOPChannels() const override { return static_cast<const OP_Channels *>(this); }
68 
69  int addChannelsChangedCallback(OP_GeometryChannelsChangedCallback callback);
70  void removeChannelsChangedCallback(int id);
71 
72  void setChanged(CH_CHANGE_TYPE how, void *data = nullptr) override;
73 
74  void notifyActiveChannelChanges();
75  void notifyFinishedChannelChanges();
76 
77  void createParmList(void (*handler)(void *, CH_CHANGE_TYPE, int));
78  void destroyParmList();
79  PRM_ParmList *getParmList() const { return myParmList.get(); }
80 
81  void saveKeyFrameForUndo(CH_Channel *chp, fpreal gtime) override;
82  void saveForUndo(CH_Channel *chp);
83 
84  static void clearAllPendingUndoFlags();
85 
86  void clearCallbacks() { myCallbacks.clear(); }
87 
88 private:
89  void handleChannelChanged(CH_Channel *channel);
90 
91  static int theNextChannelsChangedCallbackId;
92  static UT_StringArray theUndoPendingQueue;
93 
94  UT_Set<CH_ChannelRef> myChangedChannels;
95  UT_Set<CH_Channel *> myActiveChangedChannels;
96 
97  UT_String myName;
98 
100 
101  UT_Array<PRM_Template> myParmTemplates;
102  UT_Array<PRM_Name> myParmNames;
103  UT_UniquePtr<PRM_PresetInfo> myPresetInfo;
104  UT_UniquePtr<PRM_ParmList> myParmList;
105 };
106 
107 #endif
virtual void setChanged(CH_CHANGE_TYPE how, void *data=0) override
const OP_Channels * castToOPChannels() const override
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
UT_Function< void(const CH_ChannelList &, OP_GeometryChannelsChangeType)> OP_GeometryChannelsChangedCallback
Definition: OP_Types.h:30
CH_CHANGE_TYPE
UT_StringHolder getFullPath() const override
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
long long int64
Definition: SYS_Types.h:116
const UT_String & getName() const override
int64 getMemoryUsage(bool inclusive) const override
GLuint const GLchar * name
Definition: glcorearb.h:786
void saveKeyFrameForUndo(CH_Channel *chp, fpreal gtime) override
fpreal64 fpreal
Definition: SYS_Types.h:277
#define OP_API
Definition: OP_API.h:10
PRM_ParmList * getParmList() const
OP_Channels * castToOPChannels() override
Definition: format.h:895