Free Electron
MayaBrush_opengl.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __maya_MayaBrush_h__
8 #define __maya_MayaBrush_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 class MayaNode;
16 
17 class MayaBrushManip: public MPxManipContainer
18 {
19 public:
20  MayaBrushManip(void);
21 virtual ~MayaBrushManip(void);
22 
23 static void* creator(void);
24 static MStatus initialize(void);
25 
26 virtual MStatus connectToDependNode(const MObject &node) override;
27 virtual MStatus createChildren(void) override;
28 
29 virtual void preDrawUI(const M3dView &view);
30 
31 virtual void draw(M3dView &view,const MDagPath &path,
32  M3dView::DisplayStyle style,
33  M3dView::DisplayStatus status) override;
34 
35 virtual void drawUI(MHWRender::MUIDrawManager& drawManager,
36  const MHWRender::MFrameContext& frameContext) const
37  override;
38 
39 static MTypeId m_id;
40 };
41 
42 /**************************************************************************//**
43  @brief Maya Tool
44 
45  Maya's parallel to the Houdini brush is a MPxContext tool.
46  The MayaContext singleton class provided by FE is not related.
47 
48  @ingroup maya
49 *//***************************************************************************/
50 class MayaBrush:
51  public MPxContext,
52  public MetaBrush
53 {
54  public:
55 
56  class Command: public MPxContextCommand
57  {
58  public:
59  Command(void) {}
60  virtual MPxContext* makeObj(void) { return new MayaBrush(); }
61  static void* creator(void) { return new MayaBrush::Command(); }
62  };
63 
64  MayaBrush(void);
65 virtual ~MayaBrush(void);
66 
67  using MPxContext::doPress;
68  using MPxContext::doRelease;
69  using MPxContext::doDrag;
70 
71 virtual void toolOnSetup(MEvent &event) override;
72 virtual void toolOffCleanup(void) override;
73 virtual MStatus doEnterRegion(MEvent &event) override;
74 virtual MStatus doPress(MEvent &event) override;
75 virtual MStatus doRelease(MEvent &event) override;
76 virtual MStatus doDrag(MEvent &event) override;
77 virtual void deleteAction(void) override;
78 virtual void completeAction(void) override;
79 virtual void abortAction(void) override;
80 virtual bool processNumericalInput(const MDoubleArray& rValues,
81  const MIntArray& rFlags,
82  bool isAbsolute) override;
83 
84  void doMove(I32 a_mouseX,I32 a_mouseY);
85 
86 static void staticSetup(void);
87 static void idleAdjust(void);
88 
89 static MayaBrush* ms_pMayaBrush;
90 static MayaNode* ms_pCurrentNode;
91 static BWORD ms_mayaBrushCurrent;
92 static MCallbackId ms_commandCallback;
93 static MCallbackId ms_idleCallback;
94  MCallbackId m_updateCallback;
95 
96 static void updateManipulators(void* a_pData);
97 static void provokeRedraw(void);
98 
99  void brush(void);
100  void redraw(void);
101 
102  private:
103  void interpretMouse(MEvent& mayaEvent,
104  WindowEvent::State state);
105 
106  Matrix<4,4,Real> m_projection;
107 
108  I32 m_mouseX;
109  I32 m_mouseY;
110 };
111 
112 } /* namespace ext */
113 } /* namespace fe */
114 
115 #endif /* __maya_MayaBrush_h__ */
116 
kernel
Definition: namespace.dox:3
State
Effect of change in a window event.
Definition: WindowEvent.h:194