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