HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VIS_Mount.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: VIS_Mount.h ( GR Library, C++)
7  *
8  * COMMENTS:
9  * A VIS_Mount specifies the location, scope and other local settings
10  * pertinent to the installation location of a visualizer.
11  */
12 
13 #ifndef __VIS_Mount__
14 #define __VIS_Mount__
15 
16 #include "VIS_API.h"
17 #include "VIS_Defines.h"
18 
19 #include <PRM/PRM_ParmList.h>
20 #include <PRM/PRM_Template.h>
21 
22 #include <UT/UT_Array.h>
23 #include <UT/UT_JSONParser.h>
24 #include <UT/UT_JSONWriter.h>
25 #include <UT/UT_Options.h>
26 
27 #include <sstream>
28 
29 
30 class VIS_Visualizer;
31 class VIS_Handle;
32 class VIS_Mount;
33 class VIS_Table;
34 
35 
36 #define VIS_TOKEN_SCOPE "scope"
37 #define VIS_TOKEN_NAME "name"
38 #define VIS_TOKEN_LABEL "label"
39 #define VIS_TOKEN_ICON "icon"
40 #define VIS_TOKEN_FLAGS "flags"
41 #define VIS_TOKEN_TYPE "type"
42 #define VIS_TOKEN_PARMS "parameters"
43 
45 
46 // MicroNode for passing modifications to the visualizer's parmlist to
47 // the relevant mount table micronode.
49 {
50 public:
51  VIS_MountMicroNode(VIS_Mount *mnt) : myMount(mnt) {}
52 
53  void getInputs(DEP_MicroNodeList &inputs) const override;
54  void getOutputs(DEP_MicroNodeList &outputs) const override;
55  int getIndex();
56 
57 private:
58  VIS_Mount *myMount;
59 };
60 
62 {
63 public:
64  VIS_Mount(VIS_Visualizer *vis = NULL);
65  ~VIS_Mount();
66 
67  VIS_Visualizer *getVisualizer();
68  int getTypeId();
69  PRM_ParmList *getParmList();
70  VIS_Handle getHandle();
71 
72  int getUniqueId() const;
73  VIS_TableRef getTableRef() const;
74  int getIndex() const;
75 
76  const char *getName() const;
77  const char *getLabel() const;
78  const char *getIcon() const;
79 
80  // Scene Geometry Activation:
81  bool actsOnUnselected() const;
82  bool actsOnSelected() const;
83  bool actsOnGhosted() const;
84 
85  // Model Geometry Activation:
86  bool actsOnDisplayed() const;
87  bool actsOnCurrent() const;
88  bool actsOnTemplated() const;
89 
90  bool showInToolbar() const;
91 
92  VIS_VisualizerScope getScope() const;
93 
94  void saveToOptions(UT_Options &options) const;
95  bool save(std::ostream &os) const;
96 
97  void loadFromOptions(UT_Options &options);
98  bool load(UT_IStream &is);
99 
100 
101  uint32 getFlags(uint32 mask) const;
102  void setFlags(uint32 mask, bool onoff);
103 
104  uint32 getVisualizerFlags(uint32 mask) const;
105  void setVisualizerFlags(uint32 mask, bool onoff);
106 
107  DEP_MicroNode *getMicroNode() { return &myMicroNode; }
108  VIS_Table *getTable() { return myTable; }
109 
110  exint getUpdateRequestTime() const;
111  exint getRefineRequestTime() const;
112 
113  void setActOnUnselected(bool active);
114  void setActOnSelected(bool active);
115  void setActOnGhosted(bool active);
116  void setActOnDisplayed(bool active);
117  void setActOnCurrent(bool active);
118  void setActOnTemplated(bool active);
119  void setShowInToolbar(bool show);
120 
121  void setParmMicroNodeInputs(DEP_MicroNode *data,
122  DEP_MicroNode *active);
123 
124  void armActiveParmMicroNode(bool enabled);
125  void armDataParmMicroNode(bool enabled);
126 
127 
128  bool isActiveParmMicroNodeArmed();
129  bool isDataParmMicroNodeArmed();
130 
131  void handleActiveParmChange();
132  void handleDataParmChange();
133  bool isActive(VIS_Context context);
134 
135  static int registerMount(VIS_Mount *mnt);
136 
137  // Lookup the mount from the handle in constant time.
138  static VIS_Mount *lookupHandleMount(VIS_Handle vh);
139 
140 private:
141  friend class VIS_Table;
142  friend class VIS_Manager;
143 
144  VIS_Mount(VIS_Table *table, VIS_Visualizer *vis,
145  const char *name = NULL, int index = -1,
146  const char *label = NULL, const char *icon = NULL);
147 
148  VIS_Mount(const VIS_Mount &src);
149 
150  void init(VIS_Visualizer *vis = NULL);
151  VIS_Mount *duplicate(bool deep_copy = false) const;
152 
153  void setIndex(int index);
154  void setName(const char* name);
155  void setLabel(const char* label);
156  void setIcon(const char* name);
157 
158  void setScope(VIS_VisualizerScope scope);
159  void setVisualizer(VIS_Visualizer* vis);
160 
161  void refreshUpdateRequestTime();
162  void refreshRefineRequestTime();
163 
164  void setTable(VIS_Table *mtable) { myTable = mtable; }
165 
166  bool bumpName(bool label_too = false);
167 
168  int getContextKey(VIS_Context context);
169  bool activate(VIS_Context context, bool active);
170  void resetActiveState();
171  int getNumActiveContexts();
172  int getNumContexts();
173 
174  UT_JSONWriter *getJSONWriter();
175 
176  static
177  VIS_MountPtrArray theVisualizerMounts;
178 
179 
180 
181 
182  VIS_Visualizer *myVisualizer; // the visualizer object
183 
184  uint32 myFlags; // mount flags
185 
186  VIS_VisualizerScope myScope; // visualizer scope
187 
188  VIS_Table *myTable; // table to which this mount belongs
189  int myIndex; // index in table
190  int myUniqueId; // global mount unique id
191 
192  UT_String myName;
193  UT_String myLabel;
194  UT_String myIcon;
195 
196  bool myAutoLabel;
197 
198  std::stringstream myWriterSStream;
199  UT_JSONWriter *myJSONWriter;
200 
201  VIS_MountMicroNode myMicroNode; // dirtied to indicated change in
202  // mount or visualizer
203 
204  /// Latest update or refine request time
205  exint myUpdateRequestTime;
206  exint myRefineRequestTime;
207 
208  UT_IntArray myIsActiveInContext;
209  int myNumActiveContexts;
210 
211  struct ActiveParmMNode: public VIS_MicroNode
212  {
213  ActiveParmMNode(VIS_Mount *mount) { myMount = mount; }
214  void becameDirty(DEP_MicroNode &src,
215  const DEP_PropagateData &data) override
216  {
217  myMount->handleActiveParmChange();
218  }
219 
220  private:
221  VIS_Mount *myMount;
222  };
223 
224  struct DataParmMNode: public VIS_MicroNode
225  {
226  DataParmMNode(VIS_Mount *mount) { myMount = mount; }
227  void becameDirty(DEP_MicroNode &src,
228  const DEP_PropagateData &data) override
229  {
230  myMount->handleDataParmChange();
231  }
232 
233  private:
234  VIS_Mount *myMount;
235  };
236 
237  ActiveParmMNode myActiveParmMNode;
238  DataParmMNode myDataParmMNode;
239 };
240 
241 
242 
243 
244 
245 
246 #endif
void handleActiveParmChange()
DEP_MicroNode * getMicroNode()
Definition: VIS_Mount.h:107
VIS_MountMicroNode(VIS_Mount *mnt)
Definition: VIS_Mount.h:51
GLuint GLsizei const GLchar * label
Definition: glcorearb.h:2545
VIS_VisualizerScope
Definition: VIS_Defines.h:169
int64 exint
Definition: SYS_Types.h:125
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glcorearb.h:2539
UT_Array< VIS_Mount * > VIS_MountPtrArray
Definition: VIS_Mount.h:44
int getFlags(int version)
Definition: ImfVersion.h:87
void handleDataParmChange()
void getOutputs(DEP_MicroNodeList &outputs) const override
VIS_Table * getTable()
Definition: VIS_Mount.h:108
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
GLint GLuint mask
Definition: glcorearb.h:124
#define VIS_API
Definition: VIS_API.h:10
GLuint const GLchar * name
Definition: glcorearb.h:786
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
A map of string to various well defined value types.
Definition: UT_Options.h:84
GLuint index
Definition: glcorearb.h:786
Propagation info for a dep micro node.
Definition: DEP_MicroNode.h:36
unsigned int uint32
Definition: SYS_Types.h:40
void getInputs(DEP_MicroNodeList &inputs) const override
void activate(GridOrTree &, const typename GridOrTree::ValueType &value, const typename GridOrTree::ValueType &tolerance=zeroVal< typename GridOrTree::ValueType >(), const bool threaded=true)
Mark as active any inactive tiles or voxels in the given grid or tree whose values are equal to value...
Definition: Activate.h:175
Definition: format.h:895
GLenum src
Definition: glcorearb.h:1793