HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DM_GeoDetail.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: DM_GeoDetail.h ( DM Library, C++)
7  *
8  * COMMENTS:
9  * Thin wrapper around a GUI_DetailLook to make it a simpler, safer
10  * interface.
11  */
12 #ifndef DM_GeoDetail_h
13 #define DM_GeoDetail_h
14 
15 #include "DM_API.h"
16 #include "DM_ViewportType.h"
17 
18 #include <UT/UT_BoundingBox.h>
19 #include <UT/UT_Matrix4.h>
20 #include <UT/UT_ValArray.h>
21 #include <UT/UT_String.h>
22 #include <UT/UT_Vector4.h>
23 #include <GU/GU_DetailHandle.h>
24 #include <GUI/GUI_DetailLook.h>
25 
26 class RE_Light;
27 class OP_Node;
28 class GR_DisplayOption;
29 class GUI_DisplayOption;
30 
32 {
33 public:
34  bool isValid() const { return myLook != NULL; }
35 
36  // Node queries ---
37 
38  /// The object this detail represents. May be NULL for guides.
39  OP_Node *getObject() const;
40 
41  /// The SOP this detail represents. May be NULL.
42  OP_Node *getSop() const;
43 
44 
45  // Per-detail queries --------
46 
47  /// Returns the number of details this geometry has. Generally 1, but
48  /// DOPs and guides can have more than 1.
49  int getNumDetails() const;
50 
51  /// Returns a detail handle for one of the details contained in this
52  /// geometry, where index is from 0 to getNumDetails()-1. The detail handle
53  /// may be NULL.
54  GU_ConstDetailHandle getDetailHandle(int detail_index) const;
55 
56  /// Get the transform of the detail at 'detail_index'.
57  UT_Matrix4D getDetailTransform(int detail_index) const;
58 
59  /// Get the world root position of the detail at 'detail_index'
60  UT_Vector4D getWorldPosition(int detail_index) const;
61 
62  /// Query if the detail is selected. This only applies to DOPs.
63  bool isDetailSelected(int detail_index) const;
64 
65  /// Returns a descriptive (printable) name of the detail at 'detail_index'.
66  UT_String getDescriptiveName(int detail_index) const;
67 
68  /// Returns a descriptive node path name of the detail at 'detail_index'.
69  UT_String getDescriptivePath(int detail_index) const;
70 
71 
72 
73  // Lighting queries ----
74 
75  /// Returns true if any of the contained details are lit.
76  bool areAnyLit() const;
77 
78  /// Returns true if any of the contained details are unlit.
79  bool areAnyUnlit() const;
80 
81  /// Returns an array of RE Light objects that are illuminating this
82  /// geometry. The RE_Light object contains a subset of lighting parameters
83  /// for GL display.
84  const UT_ValArray<RE_Light *> &getLights() const;
85 
86  /// Returns true if any of the contained details have transparency.
87  bool hasTransparency() const;
88 
89 
90 
91 
92  // Global queries ------------
93 
94  /// Check if this geometry is enabled for display. This is not the same
95  /// thing as the display flag.
96  bool isEnabled() const;
97 
98  /// Is this object currently selected at the scene level.
99  bool isSelectedObject() const;
100 
101  /// Does this object belong to the secondary selection.
102  bool isSecondarySelected() const;
103 
104  /// Is this object the current object at the scene level. This implies that
105  /// it is also selected, but is the primary selected object for cases where
106  /// only one object can be chosen (such as when diving into an object with
107  /// multiple objects selected).
108  bool isCurrentObject() const;
109 
110  /// Does the object have a hint on it. Normally used to indicate a previous
111  /// selection or group.
112  bool isHintedObject() const;
113 
114  /// Is this object ghosted. When in SOPs, other objects are ghosted by
115  /// default.
116  bool isGhostedObject() const;
117 
118  /// Is this object doing point instancing of another geometry on its points.
119  bool isPointInstanced() const;
120 
121  /// Does this represent guide geometry (usually wireframe or unlit)
122  bool isGuide() const;
123 
124  /// Does this object have the xray-flag set, or the X-ray display option
125  /// set for its display set.
126  bool isXray() const;
127 
128  /// Does this geometry represent user-editable geometry (ie, not a light)
129  bool isGeometry() const;
130 
131  /// Is this geometry representing a templated SOP.
132  bool isTemplate() const;
133 
134  /// Is this geometry representing a selectable template SOP.
135  bool isSelectableTemplate() const;
136 
137  /// Set if the SOP is displayed, but not current.
138  bool isTargetOutput() const;
139 
140  /// Set if this SOP is the current SOP (primarily selected)
141  bool isCurrentOutput() const;
142 
143  /// Does this geometry vary over time.
144  bool isTimeDependent() const;
145 
146  /// Should this geometry highlight partial selections (points, prims, etc)
147  bool showPartialSelections(GUI_DisplayOption &disp_opt) const;
148 
149  /// Bitfield of the viewport types this geometry can appear in.
150  DM_ViewportType getViewportMask() const;
151 
152 
153  // Utility methods --------
154 
155  /// Return the bounding box of objects in the 3D viewport. May return false
156  /// if the detail is not enabled, or contains no geometry. 'rot' is an
157  /// option rotation matrix.
158  bool getBoundingBox3D(UT_BoundingBox &bbox,
159  const UT_Matrix3R *rot = NULL) const;
160 
161  void *look() { return myLook; }
162 
163  DM_GeoDetail() : myLook(nullptr) {}
164  DM_GeoDetail(const DM_GeoDetail &src) : myLook(src.myLook) {}
165  DM_GeoDetail(GUI_DetailLook *look) : myLook(look) {}
167  { myLook = src.myLook; return *this; }
168 private:
169  GUI_DetailLook *myLook;
170 };
171 
172 
173 
174 
175 
176 
177 #endif
178 
DM_GeoDetail(const DM_GeoDetail &src)
Definition: DM_GeoDetail.h:164
GA_API const UT_StringHolder rot
DM_GeoDetail & operator=(const DM_GeoDetail &src)
Definition: DM_GeoDetail.h:166
void * look()
Definition: DM_GeoDetail.h:161
#define DM_API
Definition: DM_API.h:10
DM_GeoDetail(GUI_DetailLook *look)
Definition: DM_GeoDetail.h:165
bool isValid() const
Definition: DM_GeoDetail.h:34
int DM_ViewportType
GLenum src
Definition: glcorearb.h:1793