Free Electron
HoudiniBrush.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 //* derived from Houndini sample: MSS_CustomBrushState
8 
9 #ifndef __houdini_HoudiniBrush_h__
10 #define __houdini_HoudiniBrush_h__
11 
12 #include <MSS/MSS_SingleOpState.h>
13 
14 class JEDI_View;
15 
16 namespace fe
17 {
18 namespace ext
19 {
20 
21 /**************************************************************************//**
22  @brief Houdini Model State node
23 
24  @ingroup houdini
25 *//***************************************************************************/
27  public MSS_SingleOpState,
28  public MetaBrush
29 {
30  public:
31  HoudiniBrush(JEDI_View &a_rView,
32  PI_StateTemplate &a_rTemplate,
33  BM_SceneManager *a_pScene,
34  const char *a_pCursor=BM_DEFAULT_CURSOR);
35 
36 virtual ~HoudiniBrush(void);
37 
38 static int discoverBrushes(BM_ResourceManager *a_pManager);
39 
40  /// used by DM to create the state
41 static BM_State* construct(BM_View &a_rView,PI_StateTemplate &a_rTemplate,
42  BM_SceneManager *a_pScene);
43 
44  /// name and type of this class
45 virtual const char* className(void) const;
46 
47  protected:
48  /// called when the user enters the state
49 virtual int enter(BM_SimpleState::BM_EntryType a_how) override;
50 
51  /// called when the user leaves the state
52 virtual void exit(void) override;
53 
54  /// called when the user temporarily leaves the state
55  /// (mouse leaves the viewport)
56 virtual void interrupt(BM_SimpleState* a_pState=0) override;
57 
58  /// called when the user returns to the state after
59  /// leaving temporarily (mouse re-enters the viewport)
60 virtual void resume(BM_SimpleState* a_pState=0) override;
61 
62  /// respond to mouse events
63 virtual int handleMouseEvent(UI_Event* a_pEvent) override;
64 
65  /// respond to mouse wheel events
66 virtual int handleMouseWheelEvent(UI_Event* a_pEvent) override;
67 
68  /// respond to double mouse clicks (additional)
69 virtual bool handleDoubleClickEvent(UI_Event* a_pEvent) override;
70 
71  //* not since 16.5?
72 //virtual int handleArrowEvent(UI_Event* a_pEvent) override;
73 
74 virtual void handleGeoChangedEvent(UI_Event* a_pEvent) override;
75 
76  /// respond to keyboard events
77 virtual int handleKeyTypeEvent(int key,UI_Event* a_pEvent,
78  BM_Viewport& a_rViewport) override;
79 
80 virtual bool handleTransitoryKey(const UI_Event& a_rEvent,
81  int a_hotkey_id) override;
82 
83 virtual void handleEvent(UI_Event* a_pEvent);
84 
85  /// render the brush "cursor" geometry
86 virtual void doRender(RE_Render* a_pRender,int a_x,int a_y,
87  int a_ghost) override;
88 
89  //* before 12.5
90 //virtual void doRender(RE_Render* a_pRender,short a_x,short a_y,
91 // int a_ghost)
92 // { doRender(a_pRender,(int)a_x,(int)a_y,a_ghost); }
93 
94  /// set the prompt's text
95 virtual void updatePrompt(void);
96 
97  /// reposition the brush's guide geometry
98  void updateBrush(int a_x,int a_y);
99 
100  private:
101 static String scanForBrushNames(void);
102 
103  void eventStart(void);
104  void eventStop(void);
105  void drawStart(void);
106  void drawStop(void);
107 
108  void generateNoEvent(void);
109  void printEvent(const UI_Event* a_pEvent);
110  int handleAnyEvent(const UI_Event* a_pEvent);
111 
112  void brush(void);
113 
114  BWORD m_started;
115  BWORD m_doubleClick;
116  BWORD m_idleQueued;
117  BWORD m_exposed;
118  BWORD m_ortho;
119  Matrix<4,4,F64> m_projection;
120 
121  bool m_isBrushVisible;
122  GU_Detail m_gdp;
123  Real m_nearPlane;
124  Real m_farPlane;
125 };
126 
127 } /* namespace ext */
128 } /* namespace fe */
129 
130 #endif /* __houdini_HoudiniBrush_h__ */
virtual int handleKeyTypeEvent(int key, UI_Event *a_pEvent, BM_Viewport &a_rViewport) override
respond to keyboard events
Definition: HoudiniBrush.cc:714
virtual int handleMouseWheelEvent(UI_Event *a_pEvent) override
respond to mouse wheel events
Definition: HoudiniBrush.cc:678
static BM_State * construct(BM_View &a_rView, PI_StateTemplate &a_rTemplate, BM_SceneManager *a_pScene)
used by DM to create the state
Definition: HoudiniBrush.cc:188
virtual bool handleDoubleClickEvent(UI_Event *a_pEvent) override
respond to double mouse clicks (additional)
Definition: HoudiniBrush.cc:687
kernel
Definition: namespace.dox:3
virtual const char * className(void) const
name and type of this class
Definition: HoudiniBrush.cc:244
Common functionality of meta brushes for Houdini, Maya, etc.
Definition: MetaBrush.h:20
virtual int enter(BM_SimpleState::BM_EntryType a_how) override
called when the user enters the state
Definition: HoudiniBrush.cc:525
virtual int handleMouseEvent(UI_Event *a_pEvent) override
respond to mouse events
Definition: HoudiniBrush.cc:669
Automatically reference-counted string container.
Definition: String.h:128
virtual void exit(void) override
called when the user leaves the state
Definition: HoudiniBrush.cc:553
virtual void resume(BM_SimpleState *a_pState=0) override
called when the user returns to the state after leaving temporarily (mouse re-enters the viewport) ...
Definition: HoudiniBrush.cc:589
void updateBrush(int a_x, int a_y)
reposition the brush&#39;s guide geometry
Definition: HoudiniBrush.cc:1169
virtual void updatePrompt(void)
set the prompt&#39;s text
Definition: HoudiniBrush.cc:1144
virtual void doRender(RE_Render *a_pRender, int a_x, int a_y, int a_ghost) override
render the brush "cursor" geometry
Definition: HoudiniBrush.cc:1035
Houdini Model State node.
Definition: HoudiniBrush.h:26
virtual void interrupt(BM_SimpleState *a_pState=0) override
called when the user temporarily leaves the state (mouse leaves the viewport)
Definition: HoudiniBrush.cc:566