HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSS_SingleOpBaseState.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: MSS_SingleOpBaseState.h
7  *
8  * COMMENTS:
9  * Parent class for SOP custom states.
10  *
11  */
12 
13 #ifndef __MSS_SingleOpBaseState_H__
14 #define __MSS_SingleOpBaseState_H__
15 
16 #include "MSS_API.h"
17 #include <BM/BM_SingleOpState.h>
18 
19 class DM_Workbench;
20 class OP3D_View;
21 class JEDI_View;
22 
23 /// Parent class for SOP custom states.
25 {
26 public:
27  MSS_SingleOpBaseState(JEDI_View &view, PI_StateTemplate &templ,
28  BM_SceneManager *scene,
29  const char *cursor = BM_DEFAULT_CURSOR);
30  ~MSS_SingleOpBaseState() override;
31 
32  const char *className() const override;
33 
34 protected:
35  const char *getPresetTypeName() const override { return "MSS"; }
36 
37  /// Provide the node to work with. The criteria for which node to use will
38  /// be specific to each network type. This method does NOT overwrite
39  /// the myOpNode pointer.
40  OP_Node *getChosenOp() const override;
41 
42  /// Set the flags (display/current) of the given node:
43  void setNodeFlags(OP_Node &node) override;
44 
45  void getKeyResolveInfo(UI_KeyResolveInfo &info) override;
46 
47  /// Respond to keyboard events
48  int handleKeyTypeEvent(int key, UI_Event *event,
49  BM_Viewport &) override;
50 
51  // This depends on the secure selection button and
52  // whether a selector is active.
53  virtual bool isSelecting() const;
54  virtual bool needSelectMask() const { return true; }
55 
56  /// Map viewport coordinates to worldspace location and direction
57  void mapToWorld(float x, float y,
58  UT_Vector3 &dir, UT_Vector3 &rayorig);
59 
60  /// Transform a point from object to world space or world to object space.
61  void xformToWorldCoord(UT_Vector3 &p);
62  void xformToObjectCoord(UT_Vector3 &p);
63 
64  /// Transform a vector from object to world space or world to object space.
65  void xformToWorldVector(UT_Vector3 &v);
66  void xformToObjectVector(UT_Vector3 &v);
67 
68  /// Get worldspace to cameraspace transform
69  void getViewportTransform(UT_Matrix4 &xform);
70 
71  /// Get cameraspace to worldspace transform
72  void getViewportItransform(UT_Matrix4 &xform);
73 
74  /// Get the projection transform
75  void getViewportProjectionTransform(
76  UT_Matrix4 &xform) const;
77  /// Get the projection parameters. @see UT_Matrix4::perspective()
78  bool getViewportProjection(
79  fpreal &focal_length,
80  fpreal &horizontal_aperture,
81  bool &is_ortho,
82  fpreal &ortho_width,
83  fpreal &aspect_ratio,
84  fpreal &near_plane,
85  fpreal &far_plane
86  ) const;
87 
88  /// Get level of detail for the viewport
89  float getViewportLOD() const;
90 
91  /// Set the status bar text
92  void showPrompt(const char *msg);
93 
94  JEDI_View &viewer() { return (JEDI_View &)baseViewer(); }
95  const JEDI_View &viewer() const { return (JEDI_View &)baseViewer(); }
96 
97  DM_Workbench &workbench()
98  { return (DM_Workbench &)sceneManager(); }
99  const DM_Workbench &workbench() const
100  { return (DM_Workbench &)sceneManager(); }
101 
102  void interrupt(BM_SimpleState* state = 0) override;
103  void resume(BM_SimpleState* state = 0) override;
104 
105 private:
106 };
107 
108 #endif
virtual OP_Node * getChosenOp() const =0
const GLdouble * v
Definition: glcorearb.h:837
GLint y
Definition: glcorearb.h:103
#define MSS_API
Definition: MSS_API.h:10
struct _cl_event * event
Definition: glcorearb.h:2961
#define BM_DEFAULT_CURSOR
Definition: BM_OpState.h:38
void getKeyResolveInfo(UI_KeyResolveInfo &info) override
const DM_Workbench & workbench() const
Parent class for SOP custom states.
GLint GLenum GLint x
Definition: glcorearb.h:409
void resume(BM_SimpleState *=0) override
int handleKeyTypeEvent(int key, UI_Event *event, BM_Viewport &viewport) override
virtual bool needSelectMask() const
BM_SceneManager & sceneManager()
fpreal64 fpreal
Definition: SYS_Types.h:277
const char * getPresetTypeName() const override
BM_OpView & baseViewer()
Definition: BM_OpState.h:106
Definition: core.h:982
const char * className() const override
void interrupt(BM_SimpleState *=0) override
virtual void setNodeFlags(OP_Node &node)
const JEDI_View & viewer() const