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  const VIS_Visualizer*getVisualizer() const;
69  int getTypeId() const;
70  PRM_ParmList *getParmList();
71  VIS_Handle getHandle();
72 
73  int getUniqueId() const;
74  VIS_TableRef getTableRef() const;
75  int getIndex() const;
76 
77  const char *getName() const;
78  const char *getLabel() const;
79  const char *getIcon() const;
80 
81  // Scene Geometry Activation:
82  bool actsOnUnselected() const;
83  bool actsOnSelected() const;
84  bool actsOnGhosted() const;
85 
86  // Model Geometry Activation:
87  bool actsOnDisplayed() const;
88  bool actsOnCurrent() const;
89  bool actsOnTemplated() const;
90 
91  bool showInToolbar() const;
92 
93  VIS_VisualizerScope getScope() const;
94 
95  void saveToOptions(UT_Options &options) const;
96  bool save(std::ostream &os) const;
97 
98  void loadFromOptions(UT_Options &options);
99  bool load(UT_IStream &is);
100 
101 
102  uint32 getFlags(uint32 mask) const;
103  void setFlags(uint32 mask, bool onoff);
104 
105  uint32 getVisualizerFlags(uint32 mask) const;
106  void setVisualizerFlags(uint32 mask, bool onoff);
107 
108  DEP_MicroNode *getMicroNode() { return &myMicroNode; }
109  VIS_Table *getTable() { return myTable; }
110  const VIS_Table *getTable() const { return myTable; }
111 
112  exint getUpdateRequestTime() const;
113  exint getRefineRequestTime() const;
114 
115  void setActOnUnselected(bool active);
116  void setActOnSelected(bool active);
117  void setActOnGhosted(bool active);
118  void setActOnDisplayed(bool active);
119  void setActOnCurrent(bool active);
120  void setActOnTemplated(bool active);
121  void setShowInToolbar(bool show);
122 
123  void setParmMicroNodeInputs(DEP_MicroNode *data,
125 
126  void armActiveParmMicroNode(bool enabled);
127  void armDataParmMicroNode(bool enabled);
128 
129 
130  bool isActiveParmMicroNodeArmed();
131  bool isDataParmMicroNodeArmed();
132 
133  void handleActiveParmChange();
134  void handleDataParmChange();
135  bool isActive(VIS_Context context);
136 
137  static int registerMount(VIS_Mount *mnt);
138 
139  // Lookup the mount from the handle in constant time.
140  static VIS_Mount *lookupHandleMount(VIS_Handle vh);
141 
142 private:
143  friend class VIS_Table;
144  friend class VIS_Manager;
145 
146  VIS_Mount(VIS_Table *table, VIS_Visualizer *vis,
147  const char *name = NULL, int index = -1,
148  const char *label = NULL, const char *icon = NULL);
149 
150  VIS_Mount(const VIS_Mount &src);
151 
152  void init(VIS_Visualizer *vis = NULL);
153  VIS_Mount *duplicate(bool deep_copy = false) const;
154 
155  void setIndex(int index);
156  void setName(const char* name);
157  void setLabel(const char* label);
158  void setIcon(const char* name);
159 
160  void setScope(VIS_VisualizerScope scope);
161  void setVisualizer(VIS_Visualizer* vis);
162 
163  void refreshUpdateRequestTime();
164  void refreshRefineRequestTime();
165 
166  void setTable(VIS_Table *mtable) { myTable = mtable; }
167 
168  bool bumpName(bool label_too = false);
169 
170  int getContextKey(VIS_Context context);
171  bool activate(VIS_Context context, bool active);
172  void resetActiveState();
173  int getNumActiveContexts();
174  int getNumContexts();
175 
176  UT_JSONWriter *getJSONWriter();
177 
178  static
179  VIS_MountPtrArray theVisualizerMounts;
180 
181 
182 
183 
184  VIS_Visualizer *myVisualizer; // the visualizer object
185 
186  uint32 myFlags; // mount flags
187 
188  VIS_VisualizerScope myScope; // visualizer scope
189 
190  VIS_Table *myTable; // table to which this mount belongs
191  int myIndex; // index in table
192  int myUniqueId; // global mount unique id
193 
194  UT_String myName;
195  UT_String myLabel;
196  UT_String myIcon;
197 
198  bool myAutoLabel;
199 
200  std::stringstream myWriterSStream;
201  UT_JSONWriter *myJSONWriter;
202 
203  VIS_MountMicroNode myMicroNode; // dirtied to indicated change in
204  // mount or visualizer
205 
206  /// Latest update or refine request time
207  exint myUpdateRequestTime;
208  exint myRefineRequestTime;
209 
210  UT_IntArray myIsActiveInContext;
211  int myNumActiveContexts;
212 
213  struct ActiveParmMNode: public VIS_MicroNode
214  {
215  ActiveParmMNode(VIS_Mount *mount) { myMount = mount; }
216  void becameDirty(DEP_MicroNode &src,
217  const DEP_PropagateData &data) override
218  {
219  myMount->handleActiveParmChange();
220  }
221 
222  private:
223  VIS_Mount *myMount;
224  };
225 
226  struct DataParmMNode: public VIS_MicroNode
227  {
228  DataParmMNode(VIS_Mount *mount) { myMount = mount; }
229  void becameDirty(DEP_MicroNode &src,
230  const DEP_PropagateData &data) override
231  {
232  myMount->handleDataParmChange();
233  }
234 
235  private:
236  VIS_Mount *myMount;
237  };
238 
239  ActiveParmMNode myActiveParmMNode;
240  DataParmMNode myDataParmMNode;
241 };
242 
243 
244 
245 
246 
247 
248 #endif
void handleActiveParmChange()
DEP_MicroNode * getMicroNode()
Definition: VIS_Mount.h:108
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:104
void handleDataParmChange()
void getOutputs(DEP_MicroNodeList &outputs) const override
VIS_Table * getTable()
Definition: VIS_Mount.h:109
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
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
const VIS_Table * getTable() const
Definition: VIS_Mount.h:110
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:179
Definition: format.h:1821
GLenum src
Definition: glcorearb.h:1793