HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GUI_DetailLook.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: GUI_DetailLook.h ( GUI Library, C++)
7  *
8  * COMMENTS:
9  * A detail look encapsulates all of the data necessary to render a
10  * geometry in a viewport.
11  *
12  * The name is a holdover from when it was derived from UI_Rectangle.
13  */
14 
15 #ifndef __GUI_DetailLook__
16 #define __GUI_DetailLook__
17 
18 #include "GUI_API.h"
19 #include <UT/UT_Assert.h>
20 #include <UT/UT_Color.h>
21 #include <UT/UT_Map.h>
22 #include <UT/UT_Matrix4.h>
23 #include <UT/UT_BoundingBox.h>
24 #include <UT/UT_BoundingSphere.h>
25 #include <UT/UT_String.h>
26 #include <UT/UT_StringHolder.h>
27 #include <UI/UI_Value.h>
28 #include <GEO/GEO_PackedTypes.h>
29 #include <GU/GU_Detail.h>
30 #include <GU/GU_DetailHandle.h>
31 #include <OP/OP_Network.h>
32 #include <GR/GR_DisplayOption.h>
33 #include "GUI_DisplayOption.h"
34 #include "GUI_RenderCommon.h"
35 #include "GUI_VisInterface.h"
36 #include "GUI_GroupData.h"
38 
39 class RE_Render;
40 class RE_Light;
41 class RE_Material;
42 class RE_Geometry;
43 class SIM_Data;
44 class SIM_RootData;
45 class GUI_GeoRender;
46 class GU_Detail;
48 class gui_Instance;
49 class gui_GeoInstanceInfo;
50 class GUI_VisInterface;
51 
53 {
54 public:
56  const char *detail_name = NULL);
57  virtual ~GUI_DetailLook();
58 
59  virtual const char *className() const;
60 
61  virtual bool isObjectList() const { return false; }
62  virtual bool isDopGuide() const { return false; }
63 
64  const char *getName() const { return myDetailName; }
65  void setName(const char *name);
66 
67  void setInitialized() { myInitializedFlag = true; }
68  bool isInitialized() const { return myInitializedFlag; }
69 
70  // Find out which node our gdp represents, if any:
71  OP_Node *getObject() const; // inline, below
72  OP_Node *getSop() const; // inline, below
73  OP_Node *getShopsRelativeTo() const; // inline, below
74  int getVisualizedNodeId() const; // inline, below
75 
76  // Set to new object/sop pair. returns true if the object or sop was
77  // actually changed.
78  bool setObject(OP_Node *node);
79  bool setSop(OP_Node *node);
80 
81  // New Viewport codepaths
82 
83  // setupForRender() can be called in parallel. setup() methods are expected
84  // to do non-GL work, such as convexing, surfacing, point normal computation
85  virtual GUI_SetupResult setupForRender(const GUI_DisplayOption &opts,
86  bool show_selections,
87  GR_DecorationOverride selmask_dec,
88  GR_DecorationOverride &sel_dec);
89 
90  // This is a stripped down version of setupForRender() when the viewer is
91  // showing more than 1 viewport. The first viewport rendered does a full
92  // setupForRender(), and subsequent viewports do fastSetupForRender(), since
93  // many things do not change.
94  bool fastSetupForRender(GUI_DisplayOption &opts);
95 
96  // updateForRender() is called in serial. It does all the GL updating based
97  // on the precomputed results in setup().
98  void updateForRender(RE_Render *r,
99  GUI_DisplayOption &opts,
100  RE_LightList *lights,
101  GR_DecorationOverride selmask_dec,
102  const char *view_name,
103  const GR_FrustumList &view_frustums,
104  bool &needs_alpha,
105  bool normal_update,
106  GR_UpdateReason additional_reasons);
107 
108  void cleanupAfterRender(RE_Render *r);
109 
110  // called when this look is no longer displayed, but kept around for a short
111  // time in case it might be displayed in the future
112  void retire();
113  bool isRetired() const { return myRetiredFlag; };
114  void reactivateRetired();
115 
116  // called when temporarily hidden, such as as display flag off.
117  void hide();
118 
119  // appends the contained geometry objects to 'geos'.
120  void getGeometryRenders(UT_Array<GUI_GeoRender*> &geos,
122  int geo_index = -1);
123  void setSingleGeometryRender(OP_Node *node);
124  void resetGeometryRender();
125 
126  // Set selection data to be displayed with this geometry.
127  const UT_Array<GUI_GroupDataHandle> &getSelectData(int geo_index) const;
128  void addSelectData(GUI_GroupDataHandle select_data,
129  int geo_index);
130  void clearSelectData();
131  bool hasSelectData() const;
132 
133  // This method determines whether this detail look should be rendered
134  // for picking. It only checks if it is potentially pickable, but does
135  // not check if it currently being drawn. This only refers to the component
136  // level picking present in SOPs. For object picking, check the isPickable()
137  // flag on the getObject() node.
138  virtual bool isPickable() const;
139 
140  // This method checks if this detail look is even rendered given the
141  // specified display options.
142  virtual bool isVisible(const GUI_DisplayOption &dopt) const;
143 
144  // Returns true if any of the contained details are lit.
145  bool areAnyLit() const { return !isGuide(); }
146 
147  // returns true if any of the contained details are unlit.
148  bool areAnyUnlit() const { return myHasUnlitGeometry; }
149 
150  // returns true if any of the contained details have transparency.
151  bool hasTransparency() const;
152 
153  // returns true if any of the materials are reflective.
154  bool hasReflectiveMaterial() const;
155 
156  // returns a bitfield of decorations supported by all the GR_Primitives in
157  // this look.
158  int64 getPrimDecorMask() const { return myDecorMask; }
159 
160  // This look will not free the detail, it is up to the user
161  int setDetailHandle(GU_DetailHandle handle);
162  virtual int getNumDetailHandles() const; // inlined below
163  virtual GU_DetailHandle getDetailHandle(int i) const;
164  virtual UT_Matrix4D getDetailXform(int i) const;
165  virtual void appendDOPDataName(UT_String &str, int i,
166  bool descriptive) const;
167  virtual const SIM_Data *getDOPData(int i) const;
168  virtual const SIM_RootData *getDOPRootData(int i) const;
169  virtual bool getIsDetailTempSelected(int i) const;
170  // Get world space position
171  virtual UT_Vector4F getDetailPosition(int i) const;
172  virtual void getDetailName(UT_String &name, int i) const;
173  virtual void getDetailPath(UT_String &path, int i) const;
174  virtual void getDetailDescriptiveName(UT_String &name,
175  int i) const;
176  virtual void getDetailDescriptivePath(UT_String &path,
177  int i) const;
178  void signalNodeSelectionChanged(int i) const;
179 
180  virtual void setTempComponentSelection(
182  virtual GU_SelectionHandle getTempComponentSelection(int i) const;
183 
184  virtual void releaseAllTempComponentSelections();
185 
186  void setEnableDOPDisplay(bool enable)
187  { myEnableDOPDisplay = enable; }
188  bool getEnableDOPDisplay() const
189  { return myEnableDOPDisplay; }
190  void setIsChosenDopnet(bool ischosen)
191  { myIsChosenDopnet = ischosen; }
192  bool getIsChosenDopnet() const
193  { return myIsChosenDopnet; }
194 
195  bool hasUserSelection() const;
196 
197  void setLightArray(RE_Light *lights[], int nLights = 0);
198 
199  void setGlobalLightArray(const UT_ValArray<RE_Light *> &lts,
200  bool headlight);
201 
202  int getNumLights() const { return myLights.entries(); }
203  RE_Light *getLight(int i) const { return myLights(i); }
204  const UT_ValArray<RE_Light *> &getLights() const { return myLights; }
206  { return myEnabledLights; }
207 
208  static RE_Light *getGlobalHeadlight();
209 
210  // Do not instruct the following two methods to keep the caches unless
211  // you're really sure and know what you're doing.
212  void setUseWireColor(int c, bool clear_caches = true);
213  void setWireColor(const UT_Color &clr,
214  bool clear_caches = true);
215 
216  virtual UT_Color getWireColor(int node_id) const
217  { return myWireColor; }
218 
219  // Methods to manage the view matrix, the user may use any of the
220  // UT_Matrix4 methods to transform the matrix.
221  void setXform(const UT_Matrix4D &mat)
222  { myXform = mat; myXformDirty = true; }
224  { return myXform; }
226  { myPivot = pivot; }
227 
228  void setAllowShadingOpenCurves(bool val);
229  bool shadeOpenCurves() const
230  { return flag.shade_open_curves; }
231 
232  void setDisplayAsSubdiv(bool val);
233 
234  // Methods to handle the look of the detail drawn.
235  void copyFlagsFrom(const GUI_DetailLook *look);
236 
237  virtual void setDetailDisplay(bool display)
238  {
239  if(!flag.overrideDisplay)
240  {
241  if(flag.display != display)
242  myDisplaySetDirty= true;
243  flag.display = display;
244  }
245  }
246 
247  void setGeometry(bool enable) { flag.isGeometry = enable; }
248  void setShowAxes(bool show_axes) { flag.showAxes = show_axes; }
249  void setPicking(bool picking)
250  { flag.shouldPick = picking; }
251 
252  void setRender(bool render) { flag.render = render; }
253  void setTemplate(bool templated)
254  {
255  if(flag.templated!=templated)
256  myDisplaySetDirty=true;
257  flag.templated = templated;
258  }
259  void setFootprint(bool footprint)
260  { if(flag.footprinted!=footprint)
261  myDisplaySetDirty=true;
262  flag.footprinted = footprint; }
263  void setHighlight(bool highlight)
264  { myDisplaySetDirty |= (flag.highlighted != highlight);
265  flag.highlighted = highlight; }
266  void setXray(bool xray)
267  { flag.xray = xray; }
268  void setTargetOutput(bool target_output)
269  { if(flag.targetoutput !=target_output)
270  myDisplaySetDirty=true;
271  flag.targetoutput = target_output; }
272  void setCurrentOutput(bool current_output, bool clear_caches = false);
273  void setDrawLit(int onoff); // it's a bit more complicated now
274  void setDrawCookComponentSelection(bool enable);
275  void setSnappable(int onoff) { flag.snappable = onoff; }
276  void setSecondarySelection(int onoff);
277  void setObjSelection(bool obj_sel);
278  void setObjCurrent(bool obj_current);
279  void setObjSelectionHint(bool obj_sel_hint);
280  virtual void setObjGhost(bool obj_ghost, OP_Node *for_node);
281  void setWireframeOnly(bool wireframe_only)
282  { flag.wireframeOnly = wireframe_only; }
283  void setActiveModel(bool active_model)
284  {
285  if(flag.active_model != active_model)
286  {
287  myDisplaySetDirty = true;
288  flag.active_model = active_model;
289  }
290  }
291 
292  static void setUVObject(OP_Node *object);
293  bool isUVObject() const;
294 
295  void setOnionSkinning(int onion_skin_state);
296  bool isOnionSkinning() const { return flag.onion_skin; }
297  bool isOnionSkinDeformation() const { return flag.onion_skin_deform;}
298 
299  void onionSkinRender(RE_Render *r, GUI_DisplayOption &disp_opt,
300  int nsamples);
301 
302 
303  // Frustum culling is enabled by default.
304  void useFrustumCulling(bool frust_cull)
305  { flag.use_frustum_culling = frust_cull; }
306  bool usesFrustumCulling() const
307  { return flag.use_frustum_culling && !flag.onion_skin
308  && !myLastPointInstanceState &&
309  getUsesGeoRenderInstancing(); }
310 
311  virtual void applyBundleToDisplayedObjects( OP_Bundle *bdl, int object_vis_change_count);
312 
313  // The following methods allow the user to set the display flag while
314  // caching the old value, and resetting it back later.
315  virtual void setDisplaySavingPrevValue(int onoff)
316  {
317  flag.prevDisplay = flag.display;
318  flag.display = onoff;
319  flag.overrideDisplay = true;
320  }
321 
323  {
324  flag.display = flag.prevDisplay;
325  flag.overrideDisplay = false;
326  }
327 
328  // this is not the underlying node's display flag state.
329  bool isDetailDisplayOn() const; // inlined below
330 
331  bool getShowAxes() const { return flag.showAxes; }
332  bool isGeometry() const { return flag.isGeometry; }
333  bool isPickingOn() const { return flag.shouldPick; }
334  bool isRenderOn() const { return flag.render; }
335  bool isTemplated() const { return flag.templated; }
336  bool isFootprinted() const { return flag.footprinted; }
337  bool isHighlighted() const { return flag.highlighted; }
338  virtual bool isXray() const { return flag.xray || myIsXRay; }
339  bool isTargetOutput() const { return flag.targetoutput; }
340  bool isCurrentOutput() const { return flag.currentoutput; }
341  virtual bool isGuide() const { return false; }
342  virtual bool useWireColor(int node_id) const { return flag.usewireclr; }
343  bool drawLit() const { return flag.drawLit; }
344  bool displayAsSubdiv() { return flag.displayAsSubdiv; }
346  { return flag.drawCookComponentSelection; }
347  bool isSnappable() const { return flag.snappable; }
348  bool isSecondarySelection() const { return flag.secondarySelection; }
349  bool isObjSelection() const { return flag.objSelection; }
350  bool isObjCurrent() const { return flag.objCurrent; }
351  bool isObjSelectionHint() const { return flag.objSelectionHint; }
352  bool isObjGhost() const { return flag.objGhost; }
353  bool isWireframeOnly() const { return flag.wireframeOnly; }
354  bool isActiveModel() const { return flag.active_model; }
355  bool isPointInstanced() const { return myHasPointInstancing; }
356  bool hasInstanceFile() const { return myHasInstanceFile; }
357 
358  bool needsAlphaPass() const
359  { return flag.needsAlphaPass; }
360  void setNeedsAlphaPass(bool e)
361  { flag.needsAlphaPass = e; }
362 
363  // Flag as a deleted look, so that it can be deleted rather than cached.
364  void setIsDeleted() { flag.being_deleted = true; }
365  bool isDeleted() { return flag.being_deleted; }
366 
367  // Set information about which geometry groups to color.
368  const UT_StringHolder &showGroupMask() const;
369  void setShowGroupMask(const UT_StringHolder &mask);
370  GA_GroupType showGroupType() const;
371  void setShowGroupType(GA_GroupType group_type);
372  int showGroupColorVersion() const;
373  void setShowGroupColorVersion(int version);
374 
375  int getBoundingBox2D(UT_BoundingBox &bbox,
376  const char *name,
377  int use_vertex) const;
378  int getBoundingBox3D(UT_BoundingBox &bbox,
379  const UT_Matrix3R *rot) const;
380 
381  void setViewportMask(unsigned mask)
382  { myViewportMask = mask; }
383  unsigned int getViewportMask() const
384  { return myViewportMask; }
385 
386  static void setGlobalViewSerial(GUI_DisplayOption &disp,int serial, int id)
387  {
388  disp.common().setViewSerialNum(serial, id);
389  }
390 
391  // return the display set that this object belongs to.
393  {
394  if(!myDisplaySetDirty)
395  return myDisplaySet;
396  return privGetDisplaySetType();
397  }
398 
400  { return privGetDisplaySetType(); }
401 
402  void renderObjectName(RE_Render *r,
403  GUI_DisplayOption *dispopt);
404  virtual void renderOrQueueObjectAxes(UT_Vector3FArray &axes,
405  UT_Vector3FArray &pivots);
406  static void renderQueuedObjectAxes(RE_Render *r,
407  GUI_DisplayOption *dispopt,
408  const UT_Vector3FArray &axes,
409  const UT_Vector3FArray &pivots);
410 
411  // The global chosen dopnet is set to filter out the drawing of geometry
412  // flagged as originating from this dopnet.
413  static void setGlobalChosenDopnet(OP_Node *dopnet)
414  {
415  if( dopnet )
416  {
417  dopnet->getFullPath(ourChosenDopnetPath);
418  ourChosenDopnetPathLen = ourChosenDopnetPath.length();
419  }
420  else
421  {
422  ourChosenDopnetPath = 0;
423  ourChosenDopnetPathLen = 0;
424  }
425  }
426  static const char *getGlobalChosenDopnetPath()
427  {
428  return (const char *) ourChosenDopnetPath;
429  }
430 
431  static bool matchesChosenDopnetPath(const char *path)
432  {
433  if( ourChosenDopnetPathLen > 0 &&
434  !strncmp(ourChosenDopnetPath, path, ourChosenDopnetPathLen) &&
435  (path[ourChosenDopnetPathLen] == ':' ||
436  path[ourChosenDopnetPathLen] == '\0') )
437  return true;
438  return false;
439  }
440 
441  // Used to assign a temporary ID to the look.
442  void setLookID(int id) { myID = id; }
443  int getLookID() const { return myID; }
444 
445  // Get/Set the object's viewport LOD
446  GEO_ViewportLOD getObjectLOD() const { return myObjectLOD; }
448  { myObjectLOD = lod; }
449 
450  void useObjectMaterials(bool use_obj_mat);
451  bool getAssignedMaterials(UT_Array<OP_Node *> &nodes) const;
452 
453  virtual bool isTimeDependent(fpreal t);
454  bool areInstancesTimeDependent(fpreal t);
455  virtual int64 getVersion();
456  void bumpVersion() { myLookVersion++; }
457 
458  // The name of the actively rendering or updating viewport
459  static void setActiveViewport(const char *name);
460  // viewname (persp1)
461  static const char *getActiveViewport();
462  // viewname/Material setup
463  static const char *getActiveViewportMatString();
464 
465 
466  static void visibleViewportTypes(bool view_3d, bool view_2d);
467  static bool hasVisible3D();
468  static bool hasVisibleUV();
469 
470  static void visibleUVAttribs(UT_StringArray &attribs);
471  static const UT_StringArray &visibleUVAttribs();
472  static int64 visibleUVAttribSerial();
473 
474  enum { VIEW_3D = 0x1, VIEW_2D = 0x2 }; // for the masks
475  static void visibleViewportBoundaries(
476  bool bound_3d,
477  UT_StringArray &bound_3d_uvs,
479  static bool hasVisibleBoundaries();
480  static bool visible3DBoundary();
481  static const UT_StringArray &visible3DBoundariesInUV();
482  // uv name, view mask
483  static const UT_Array<UT_Pair<UT_StringHolder,int> > &visibleUVBoundaries();
484 
486  { return myActiveVisualizers; }
488  { return myActiveVisualizers.entries(); }
489  void appendActiveVisualizer(int vis_id)
490  { myActiveVisualizers.append(vis_id);
491  myCollectVisPrimitives.append(0); }
493  {
494  myActiveVisualizers.clear();
495  myCollectVisPrimitives.clear();
496  }
498  { return myCollectVisPrimitives(i); }
500  { myCollectVisPrimitives(i) = prim; }
501 
502  void checkForErrors();
503  int64 getNodeErrorID() const { return myOpErrorPosted; }
504 
505  void setRedrawValue(UI_Value *redraw)
506  { myRedrawValue = redraw; }
508  { if(myRedrawValue) myRedrawValue->changed(NULL); }
509 
510 protected:
511  void cacheNodePtrs();
512 
513  // Multi-object instancing
514  void initInstanceTable();
515  GUI_GeoRender *addInstance(GU_ConstDetailHandle cgdh,
516  const char *name,
517  const UT_Matrix4D &xform,
518  int64 version,
519  int instance_index,
520  int object_id,
521  int inst_object_id,
522  bool is_guide,
523  bool time_dep);
524  void finalizeInstanceTable();
525 
527 
528  bool createObjectInstance(const char *instance_path,
529  int64 base_version,
530  fpreal t,
531  gui_Instance &instance,
532  OBJ_Node *instancer,
534  bool rel_to_sop);
535  void markGeoForRemoval(GUI_GeoRender *gr);
536  void removeDeletedGeos();
537  int64 computeInstanceVersion(const GU_Detail *dtl);
538 
539  // Indicates whether instancing should be implemented using the
540  // GUI_GeoRender instancing capabilities. If false, GUI_GeoRenderShared
541  // objects are used to instance the geometry without true OGL instancing.
542  virtual bool getUsesGeoRenderInstancing() const
543  { return true; }
544 
545  // End multi-object instancing
546  GUI_SetupResult setupAllGeos(const GUI_DisplayOption &disp_opt,
547  bool show_selections,
548  GR_DecorationOverride selmask_dec,
549  GR_DecorationOverride &sel_dec);
550 
551  virtual GUI_GeoRender *getOrCreateGeometryRender(int index);
552 
553  void setXRayOverride(bool xray) { myIsXRay = xray; }
554 
559 
562 
563 private:
564  void generateObjectName(RE_Render *r,
565  GUI_DisplayOption *dispopt,
566  UT_String name,
567  int geo_index,
568  GR_DecorFontSize fontsize,
569  RE_Geometry &geo);
570  bool setupPointInstancing(bool show_selections,
571  GR_DecorationOverride selmask_dec,
572  GR_DecorationOverride &select_dec,
573  fpreal instance_fract,
574  int limit);
575  GUI_DisplaySetType privGetDisplaySetType() const;
576 
577  void updateInstancingStatus();
578  GUI_GeoRender * createGeoRender(int index,const char *opt_suffix=NULL);
579 
580  GUI_GeoRender *checkForDetailCaching(GUI_GeoRender *geo);
581  void freeCachedDetails();
582  void freeDeletedCachedDetails();
583 
584  int getNumOnionSkins() const;
585  const GU_DetailHandle &getOnionSkinDetail(int index) const;
586  GUI_SetupResult processSkins(const GUI_DisplayOption &dopt);
587  void addOnionSkin(OBJ_Node *obj, SOP_Node *sop,
588  fpreal skin_t, fpreal geo_t,
589  bool deforming,
590  bool is_pre_frame);
591  void clearOnionSkins();
592 
593  class GUI_DetailLookFlags
594  {
595  public:
596  GUI_DetailLookFlags()
597  {
598  showAxes = false;
599  render = true;
600  isGeometry = true;
601  shouldPick = true;
602  display = true;
603  templated = false;
604  footprinted = false;
605  highlighted = false;
606  xray = false;
607  targetoutput = false;
608  currentoutput = false;
609  usewireclr = false;
610  drawLit = true;
611  drawCookComponentSelection = true;
612  needsAlphaPass = false;
613  snappable = true;
614  secondarySelection = false;
615  objSelection = false;
616  objCurrent = false;
617  objSelectionHint = false;
618  objGhost = false;
619  wireframeOnly = false;
620  prevDisplay = true;
621  prevShouldPick = true;
622  overrideDisplay = false;
623  displayAsSubdiv = false;
624  shaders_used = false;
625  active_model = false;
626  being_deleted = false;
627  shade_open_curves = false;
628  onion_skin = false;
629  onion_skin_deform = false;
630  use_frustum_culling = true;
631  }
632 
633  bool showAxes:1, // draw the axes of the detail
634  isGeometry:1,
635  render:1, // render the detail
636  shouldPick:1,
637  display:1, // display the detail
638  templated:1,
639  footprinted:1,
640  highlighted:1, // Node has the highlight flag set
641  xray:1, // display wireframe within other geo
642  targetoutput:1, // display sop when in view current
643  // mode
644  currentoutput:1, // current sop when in view current
645  // mode and the display flag is on a
646  // different sop.
647  usewireclr:1, // Override default wire color
648  drawLit:1, // In shaded mode, draw shaded
649 drawCookComponentSelection:1, // Draw the GU cook component selection
650  needsAlphaPass:1, // requires a second pass
651  snappable:1, // is the detail snappable
652  secondarySelection:1, // Draw a secondary selection
653  objSelection:1, // object selection
654  objCurrent:1, // object current flag
655  objSelectionHint:1, // hint that object makes good selection
656  objGhost:1, // ghosted object
657  wireframeOnly:1, // draw in wireframe only
658  prevDisplay:1, // cached value of the previous value of the display flag.
659  prevShouldPick:1, // cached value of the previous value of the pick flag.
660  overrideDisplay:1, // don't allow changes to the display
661  displayAsSubdiv:1, // draw as subdivision.
662  shaders_used:1, // Shaders have been used on the object
663  active_model:1, // Use SOP-level display sets
664  being_deleted:1, // We are in the process of deletion
665  shade_open_curves:1, // Open curves are light-shaded
666  onion_skin:1, // Draw faded images before/after
667  onion_skin_deform:1, // Use deformation onion skinning
668  use_frustum_culling:1; // Frustum culling is allowed
669  };
670  GUI_DetailLookFlags flag;
671 
672  UT_StringHolder myShowGroupMask;
673  GA_GroupType myShowGroupType;
674  int myShowGroupColorVersion;
675  GU_DetailHandle myDetailHandle;
676  GUI_GUSelectionProxyHandle myTempComponentSelection;
677  UT_Array<GU_DetailHandle> myOnionSkinDetails;
678 
679  // Override the wireframe display color.
680  UT_Color myWireColor;
681 
682  int myObjectID;
683  int mySopID;
684  OP_Node *myCachedObject;
685  OP_Node *myCachedSop;
686  UT_String myDetailName;
687  int myID;
688  GEO_ViewportLOD myObjectLOD;
689  bool myIsXRay;
690  bool myIsOnionSkin;
691  UT_String myInstanceObjectRef;
692 
693  UT_ValArray<RE_Light *> myLights;
694  UT_ValArray<RE_Light *> myEnabledLights;
695 
696  unsigned int myViewportMask;
697  bool myEnableDOPDisplay;
698  bool myIsChosenDopnet;
699  bool myNullDetailFlag;
700  bool myRetiredFlag;
701  bool myInitializedFlag;
702 
703  mutable bool myDisplaySetDirty;
704  mutable GUI_DisplaySetType myDisplaySet;
705 
706  fpreal myPrevInstanceFract;
707  int myPrevInstanceLimit;
708  int myInstanceFractSerial;
709  int64 myPointInstanceVersion;
710  int myInstanceXformVersion;
711  int myInstanceObjectID;
712  bool myHasInstancing;
713  bool myHasPointInstancing;
714  bool myInstanceUseTransform;
715  bool myHasTransparentPrimitives;
716  bool myLastPointInstanceState;
717  bool myHasInstanceFile;
718  bool myXformDirty;
719  bool myDetailDirty;
720  UT_Matrix4D myXform;
721  UT_Vector3F myPivot;
722  int64 myOpErrorPosted;
723  int64 myLookVersion;
724 
725  // Variable geometry Instancing
727  int myGeoCountId;
728  const GU_Detail *myTempLastDetail;
729  GUI_GeoRender *myTempLastGeo;
730 
731  // Cached details for cached playback (ie cache SOP)
732  UT_Map<exint, GUI_GeoRender *> myCachedDetailTable;
733  bool myCachingDetails;
734  int64 myCacheSopID;
735  int64 myCacheSopSerial;
736 
737  bool myHasUnlitGeometry;
738  int64 myDecorMask;
739 
740  exint myVisUpdateTime; // last visualization-triggered
741  // update time (visualization
742  // clock measurement)
743  exint myVisUpdateVersion; // version at the time of last
744  // visualization-triggered
745  // update
746 
747  UT_IntArray myActiveVisualizers; // unique ids of visualizers
748  // currently active for look
749 
751  myCollectVisPrimitives;
752 
753  UT_Array<GUI_GeoRender *> myGeosToRemove;
754 
755  class gui_OnionSkinDetail
756  {
757  public:
758  gui_OnionSkinDetail(const GU_DetailHandle &dh)
759  : myDetail(dh), myRender(NULL), myUsedFlag(true)
760  {
761  myDetail.addPreserveRequest();
762  }
763  ~gui_OnionSkinDetail();
764 
765  GU_DetailHandle myDetail;
766  GUI_GeoRender *myRender;
767  bool myUsedFlag;
768  };
769  typedef UT_Map<exint, gui_OnionSkinDetail *> gui_OnionSkins;
770  gui_OnionSkins myOnionSkins;
771 
772  class gui_OnionSkinLayer
773  {
774  public:
775  gui_OnionSkinLayer(int id, fpreal t, const UT_Matrix4D &mat, bool pre)
776  : myDetailID(id), myTime(t), myRender(NULL),
777  myTransform(mat), myIsPreFrame(pre) {}
778 
779  int myDetailID;
780  fpreal myTime;
781  GUI_GeoRender *myRender;
782  UT_Matrix4D myTransform;
783  bool myIsPreFrame;
784  };
785  UT_Array<gui_OnionSkinLayer *> myOnionSkinLayers;
786 
787  class CachedDetailPos {
788  public:
789  CachedDetailPos()
790  : myPos(0,0,0,1)
791  , myCacheCount(-1)
792  , myUniqueId(-1)
793  {}
794 
795  CachedDetailPos(const GU_Detail *detail)
796  {
797  if(detail)
798  {
799  myCacheCount = detail->getMetaCacheCount();
800  myUniqueId = detail->getUniqueId();
801  }
802  }
803 
804  void computePosition(const GU_Detail *detail)
805  {
806  if(detail)
807  {
808  UT_BoundingBox bbox;
809  detail->getBBox(bbox, UT_Matrix4R::getIdentityMatrix());
810 
811  UT_Vector3 point3 = bbox.center();
812  myPos = UT_Vector4F(point3.x(), point3.y(), point3.z(), 1.0);
813  }
814  }
815 
816  bool operator==(const CachedDetailPos& p)
817  {
818  return myCacheCount == p.myCacheCount
819  && myUniqueId == p.myUniqueId;
820  }
821 
822  const UT_Vector4F& position() { return myPos; }
823 
824  private:
825  UT_Vector4F myPos;
826  int myCacheCount;
827  int myUniqueId;
828  };
829  // mutable because these are cached positions
830  mutable UT_ValArray<CachedDetailPos> myDetailPositions;
831 
832  static RE_Light *theHeadlight;
833 
834  static UT_String ourChosenDopnetPath;
835  static int ourChosenDopnetPathLen;
836  static bool ourPickDisplayListUsedFlag;
837 
838  UI_Value *myRedrawValue;
839 };
840 
841 inline int
843 {
844  return myNullDetailFlag ? 0 : 1;
845 }
846 
847 inline OP_Node *
849 {
850  if(myCachedObject)
851  return myCachedObject;
852  if(myObjectID != OP_INVALID_NODE_ID)
853  return OP_Node::lookupNode(myObjectID);
854  return NULL;
855 }
856 
857 inline OP_Node *
859 {
860  if(myCachedSop)
861  return myCachedSop;
862  if(mySopID != OP_INVALID_NODE_ID)
863  return OP_Node::lookupNode(mySopID);
864  return NULL;
865 }
866 
867 inline OP_Node *
869 {
870  OP_Node *node = getObject();
871  if(!node)
872  {
873  node = getSop();
874  if(node)
875  return node->getCreator();
876  }
877  return node;
878 }
879 
880 inline int
882 {
883  if (mySopID != OP_INVALID_NODE_ID)
884  return mySopID;
885  else
886  return myObjectID;
887 }
888 
889 inline bool
891 {
892  if(flag.display)
893  {
894  if((myObjectID == OP_INVALID_NODE_ID || OP_Node::lookupNode(myObjectID))
895  && (mySopID == OP_INVALID_NODE_ID || OP_Node::lookupNode(mySopID)))
896  return true;
897  UT_ASSERT_MSG(!"Stale GUI_DetailLook: ", myDetailName);
898  }
899  return false;
900 }
901 
902 
903 
904 #endif
static bool matchesChosenDopnetPath(const char *path)
virtual bool getUsesGeoRenderInstancing() const
int64 getNodeErrorID() const
void setTemplate(bool templated)
void setXray(bool xray)
const UT_ValArray< RE_Light * > & getLights() const
void setPivot(const UT_Vector3F &pivot)
bool usesFrustumCulling() const
bool areAnyLit() const
OP_Node * getObject() const
int getVersion(int version)
Definition: ImfVersion.h:116
virtual UT_Color getWireColor(int node_id) const
virtual bool isObjectList() const
bool getIsChosenDopnet() const
Unsorted map container.
Definition: UT_Map.h:83
bool isTemplated() const
void setNeedsAlphaPass(bool e)
void setCollectVisPrimitive(int i, GR_Primitive *prim)
GR_DecorationOverride
Definition: GR_Defines.h:194
int numActiveVisualizers() const
void setSnappable(int onoff)
bool hasInstanceFile() const
void setXform(const UT_Matrix4D &mat)
bool isPointInstanced() const
void setFootprint(bool footprint)
bool isDetailDisplayOn() const
bool drawLit() const
GLsizei const GLchar *const * path
Definition: glcorearb.h:3340
GA_API const UT_StringHolder rot
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
Definition: RE_Geometry.h:53
void setRedrawValue(UI_Value *redraw)
bool isInitialized() const
GLint GLuint mask
Definition: glcorearb.h:123
bool isFootprinted() const
bool isObjCurrent() const
bool displayAsSubdiv()
SYS_FORCE_INLINE T & x(void)
Definition: UT_Vector3.h:581
4D Vector class.
Definition: UT_Vector4.h:152
#define OP_INVALID_NODE_ID
Definition: OP_Node.h:196
OP_Network * getCreator() const
png_uint_32 i
Definition: png.h:2877
bool isWireframeOnly() const
GUI_DisplaySetType
Context specific display options for geometry states.
int getVisualizedNodeId() const
virtual void setDisplaySavingPrevValue(int onoff)
virtual bool useWireColor(int node_id) const
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
Definition: HDK_Image.dox:266
bool isSnappable() const
void setHighlight(bool highlight)
void setLookID(int id)
bool getEnableDOPDisplay() const
void setViewportMask(unsigned mask)
GLuint id
Definition: glcorearb.h:654
SYS_FORCE_INLINE T & z(void)
Definition: UT_Vector3.h:585
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
long long int64
Definition: SYS_Types.h:100
UT_Matrix4D getXform() const
bool getShowAxes() const
const char * getFullPath(UT_String &str) const
Definition: PRM_ParmOwner.h:47
void setPicking(bool picking)
void setViewSerialNum(int s, int id)
virtual bool isGuide() const
OP_Node * getSop() const
void setGeometry(bool enable)
UT_Array< GUI_GeoRender * > myStashedGeoRenderShared
int getLookID() const
bool isSecondarySelection() const
bool isObjGhost() const
UT_Vector3T< T > center() const
#define GUI_API
Definition: GUI_API.h:10
int64 exint
Definition: SYS_Types.h:109
const GR_CommonDispOption & common() const
static const UT_Matrix4T< fpreal > & getIdentityMatrix()
void setObjectLOD(GEO_ViewportLOD lod)
virtual bool isDopGuide() const
UT_Array< GUI_SetupResult > myOnionSkinSetupResults
void setRender(bool render)
RE_Light * getLight(int i) const
GR_DecorFontSize
Definition: GR_Defines.h:175
bool isHighlighted() const
virtual void resetOverrideUsingSavedValue()
GR_UpdateReason
Definition: GR_Defines.h:278
GUI_SetupResult
bool isOnionSkinning() const
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual int getNumDetailHandles() const
bool isPickingOn() const
void setTargetOutput(bool target_output)
bool isRenderOn() const
UT_Map< int, UT_Array< GUI_GroupDataHandle > > mySelectData
bool isGeometry() const
void setEnableDOPDisplay(bool enable)
static void setGlobalViewSerial(GUI_DisplayOption &disp, int serial, int id)
bool isActiveModel() const
exint getUniqueId() const
Definition: GA_Detail.h:117
virtual bool isXray() const
GUI_DisplaySetType getDisplaySetType() const
UT_Array< GUI_GeoRender * > myGeoRender
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
SYS_FORCE_INLINE T & y(void)
Definition: UT_Vector3.h:583
double fpreal
Definition: SYS_Types.h:263
GR_Primitive * getCollectVisPrimitive(int i)
bool isRetired() const
virtual void setDetailDisplay(bool display)
unsigned int getViewportMask() const
void setActiveModel(bool active_model)
OP_Node * getShopsRelativeTo() const
UT_Vector4T< fpreal32 > UT_Vector4F
GEO_ViewportLOD
void clearActiveVisualizers()
int getBBox(UT_BoundingBox *bbox, const GA_PrimitiveGroup *g=0) const
bool needsAlphaPass() const
GEO_ViewportLOD getObjectLOD() const
GA_GroupType
An ordinal enum for the different types of groups in GA.
Definition: GA_Types.h:138
GLuint index
Definition: glcorearb.h:785
bool isTargetOutput() const
void setXRayOverride(bool xray)
GLuint GLfloat * val
Definition: glcorearb.h:1607
bool isObjSelectionHint() const
GR_LightingPass
Definition: GR_Defines.h:122
int64 getMetaCacheCount() const
Definition: GA_Detail.h:2211
int64 getPrimDecorMask() const
GA_API const UT_StringHolder pivot
const UT_ValArray< RE_Light * > & getEnabledLights() const
void setInitialized()
bool drawCookComponentSelection() const
static OP_Node * lookupNode(int unique_id, bool include_proxy=false)
Definition: OP_Node.h:675
void setIsChosenDopnet(bool ischosen)
static void setGlobalChosenDopnet(OP_Node *dopnet)
void useFrustumCulling(bool frust_cull)
bool isOnionSkinDeformation() const
const UT_IntArray & getActiveVisualizers() const
GLboolean r
Definition: glcorearb.h:1221
bool areAnyUnlit() const
const char * getName() const
UT_Array< GUI_GeoRender * > myOnionSkinRenders
bool isObjSelection() const
static const char * getGlobalChosenDopnetPath()
png_infop png_uint_32 flag
Definition: png.h:2242
void setWireframeOnly(bool wireframe_only)
#define UT_ASSERT_MSG(ZZ, MM)
Definition: UT_Assert.h:105
void setShowAxes(bool show_axes)
bool isCurrentOutput() const
GLint lod
Definition: glcorearb.h:2764
UT_Array< GUI_SetupResult > mySetupResults
int getNumLights() const
void appendActiveVisualizer(int vis_id)
GUI_DisplaySetType updateDisplaySetType()
bool shadeOpenCurves() const