Free Electron
MayaBrush.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 &mayaView);
30 
31 virtual void draw(M3dView &mayaView,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 &mayaEvent) override;
72 virtual void toolOffCleanup(void) override;
73 virtual MStatus doEnterRegion(MEvent &mayaEvent) override;
74 virtual MStatus doPress(MEvent &mayaEvent,
75  MHWRender::MUIDrawManager& drawManager,
76  const MHWRender::MFrameContext& frameContext)
77  override;
78 virtual MStatus doRelease(MEvent &mayaEvent,
79  MHWRender::MUIDrawManager& drawManager,
80  const MHWRender::MFrameContext& frameContext)
81  override;
82 virtual MStatus doDrag(MEvent &mayaEvent,
83  MHWRender::MUIDrawManager& drawManager,
84  const MHWRender::MFrameContext& frameContext)
85  override;
86 virtual MStatus doHold(MEvent &mayaEvent,
87  MHWRender::MUIDrawManager& drawManager,
88  const MHWRender::MFrameContext& frameContext)
89  override;
90 virtual MStatus doPtrMoved(MEvent &mayaEvent,
91  MHWRender::MUIDrawManager& drawManager,
92  const MHWRender::MFrameContext& frameContext)
93  override;
94 virtual MStatus drawFeedback(
95  MHWRender::MUIDrawManager& drawManager,
96  const MHWRender::MFrameContext& frameContext)
97  override;
98 virtual void deleteAction(void) override;
99 virtual void completeAction(void) override;
100 virtual void abortAction(void) override;
101 virtual bool processNumericalInput(const MDoubleArray& rValues,
102  const MIntArray& rFlags,
103  bool isAbsolute) override;
104 
105  void doMove(I32 a_mouseX,I32 a_mouseY);
106 
107 static void staticSetup(void);
108 static void idleAdjust(void);
109 
110 static MHWRender::MUIDrawManager* ms_pMUIDrawManager;
111 static MayaBrush* ms_pMayaBrush;
112 static MayaNode* ms_pCurrentNode;
113 static BWORD ms_mayaBrushCurrent;
114 static MCallbackId ms_commandCallback;
115 static MCallbackId ms_idleCallback;
116  MCallbackId m_updateCallback;
117 
118 static void updateManipulators(void* a_pData);
119 static void provokeRedraw(void);
120 
121  void brush(void);
122  void redraw(void);
123 
124  private:
125  void interpretMouse(MEvent& mayaEvent,
126  WindowEvent::State state);
127 
128  Matrix<4,4,Real> m_projection;
129 
130  I32 m_mouseX;
131  I32 m_mouseY;
132 };
133 
134 } /* namespace ext */
135 } /* namespace fe */
136 
137 #endif /* __maya_MayaBrush_h__ */
138 
Maya Tool.
Definition: MayaBrush.h:50
kernel
Definition: namespace.dox:3
State
Effect of change in a window event.
Definition: WindowEvent.h:194
Common functionality of meta brushes for Houdini, Maya, etc.
Definition: MetaBrush.h:20
Maya node.
Definition: MayaNode.h:20