All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
proxyDrawOverride.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXRUSDMAYAGL_PROXY_DRAW_OVERRIDE_H
25 #define PXRUSDMAYAGL_PROXY_DRAW_OVERRIDE_H
26 
28 
29 #include "pxr/pxr.h"
30 #include "pxrUsdMayaGL/api.h"
32 
33 #include <maya/MBoundingBox.h>
34 #include <maya/MDagPath.h>
35 #include <maya/MDrawContext.h>
36 #include <maya/MFrameContext.h>
37 #include <maya/MMatrix.h>
38 #include <maya/MObject.h>
39 #include <maya/MPoint.h>
40 #include <maya/MPxDrawOverride.h>
41 #include <maya/MSelectionContext.h>
42 #include <maya/MString.h>
43 #include <maya/MUserData.h>
44 #include <maya/MViewport2Renderer.h>
45 
46 
47 PXR_NAMESPACE_OPEN_SCOPE
48 
49 
50 class UsdMayaProxyDrawOverride : public MHWRender::MPxDrawOverride
51 {
52  public:
53  PXRUSDMAYAGL_API
54  static const MString drawDbClassification;
55 
56  PXRUSDMAYAGL_API
57  static MHWRender::MPxDrawOverride* Creator(const MObject& obj);
58 
59  PXRUSDMAYAGL_API
60  ~UsdMayaProxyDrawOverride() override;
61 
62  PXRUSDMAYAGL_API
63  MHWRender::DrawAPI supportedDrawAPIs() const override;
64 
65  PXRUSDMAYAGL_API
66  MMatrix transform(
67  const MDagPath& objPath,
68  const MDagPath& cameraPath) const override;
69 
70  PXRUSDMAYAGL_API
71  MBoundingBox boundingBox(
72  const MDagPath& objPath,
73  const MDagPath& cameraPath) const override;
74 
75  PXRUSDMAYAGL_API
76  bool isBounded(
77  const MDagPath& objPath,
78  const MDagPath& cameraPath) const override;
79 
80  PXRUSDMAYAGL_API
81  bool disableInternalBoundingBoxDraw() const override;
82 
83  PXRUSDMAYAGL_API
84  MUserData* prepareForDraw(
85  const MDagPath& objPath,
86  const MDagPath& cameraPath,
87  const MHWRender::MFrameContext& frameContext,
88  MUserData* oldData) override;
89 
90 #if MAYA_API_VERSION >= 20180000
91  PXRUSDMAYAGL_API
92  bool wantUserSelection() const override;
93 
94  PXRUSDMAYAGL_API
95  bool userSelect(
96  MHWRender::MSelectionInfo& selectionInfo,
97  const MHWRender::MDrawContext& context,
98  MPoint& hitPoint,
99  const MUserData* data) override;
100 #endif
101 
102  PXRUSDMAYAGL_API
103  static void draw(
104  const MHWRender::MDrawContext& context,
105  const MUserData* data);
106 
107  private:
108  UsdMayaProxyDrawOverride(const MObject& obj);
109 
110  UsdMayaProxyDrawOverride(const UsdMayaProxyDrawOverride&) = delete;
111  UsdMayaProxyDrawOverride& operator=(const UsdMayaProxyDrawOverride&) = delete;
112 
113  PxrMayaHdUsdProxyShapeAdapter _shapeAdapter;
114 };
115 
116 
117 PXR_NAMESPACE_CLOSE_SCOPE
118 
119 
120 #endif
Class to manage translation of USD proxy shape node data and viewport state for imaging with Hydra...