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 true if any of the contained details have transparency.
82  bool hasTransparency() const;
83 
84 
85 
86 
87  // Global queries ------------
88 
89  /// Check if this geometry is enabled for display. This is not the same
90  /// thing as the display flag.
91  bool isEnabled() const;
92 
93  /// Is this object currently selected at the scene level.
94  bool isSelectedObject() const;
95 
96  /// Does this object belong to the secondary selection.
97  bool isSecondarySelected() const;
98 
99  /// Is this object the current object at the scene level. This implies that
100  /// it is also selected, but is the primary selected object for cases where
101  /// only one object can be chosen (such as when diving into an object with
102  /// multiple objects selected).
103  bool isCurrentObject() const;
104 
105  /// Does the object have a hint on it. Normally used to indicate a previous
106  /// selection or group.
107  bool isHintedObject() const;
108 
109  /// Is this object ghosted. When in SOPs, other objects are ghosted by
110  /// default.
111  bool isGhostedObject() const;
112 
113  /// Is this object doing point instancing of another geometry on its points.
114  bool isPointInstanced() const;
115 
116  /// Does this represent guide geometry (usually wireframe or unlit)
117  bool isGuide() const;
118 
119  /// Does this object have the xray-flag set, or the X-ray display option
120  /// set for its display set.
121  bool isXray() const;
122 
123  /// Does this geometry represent user-editable geometry (ie, not a light)
124  bool isGeometry() const;
125 
126  /// Is this geometry representing a templated SOP.
127  bool isTemplate() const;
128 
129  /// Is this geometry representing a selectable template SOP.
130  bool isSelectableTemplate() const;
131 
132  /// Set if the SOP is displayed, but not current.
133  bool isTargetOutput() const;
134 
135  /// Set if this SOP is the current SOP (primarily selected)
136  bool isCurrentOutput() const;
137 
138  /// Does this geometry vary over time.
139  bool isTimeDependent() const;
140 
141  /// Should this geometry highlight partial selections (points, prims, etc)
142  bool showPartialSelections(GUI_DisplayOption &disp_opt) const;
143 
144  /// Bitfield of the viewport types this geometry can appear in.
145  DM_ViewportType getViewportMask() const;
146 
147 
148  // Utility methods --------
149 
150  /// Return the bounding box of objects in the 3D viewport. May return false
151  /// if the detail is not enabled, or contains no geometry. 'rot' is an
152  /// option rotation matrix.
153  bool getBoundingBox3D(UT_BoundingBox &bbox,
154  const UT_Matrix3R *rot = NULL) const;
155 
156  void *look() { return myLook; }
157 
158  DM_GeoDetail() : myLook(nullptr) {}
159  DM_GeoDetail(const DM_GeoDetail &src) : myLook(src.myLook) {}
160  DM_GeoDetail(GUI_DetailLook *look) : myLook(look) {}
162  { myLook = src.myLook; return *this; }
163 private:
164  GUI_DetailLook *myLook;
165 };
166 
167 
168 
169 
170 
171 
172 #endif
173 
DM_GeoDetail(const DM_GeoDetail &src)
Definition: DM_GeoDetail.h:159
GA_API const UT_StringHolder rot
DM_GeoDetail & operator=(const DM_GeoDetail &src)
Definition: DM_GeoDetail.h:161
void * look()
Definition: DM_GeoDetail.h:156
#define DM_API
Definition: DM_API.h:10
DM_GeoDetail(GUI_DetailLook *look)
Definition: DM_GeoDetail.h:160
bool isValid() const
Definition: DM_GeoDetail.h:34
int DM_ViewportType
GLenum src
Definition: glcorearb.h:1793