00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __MSS_BrushBaseState_H__
00022 #define __MSS_BrushBaseState_H__
00023
00024 #include "MSS_API.h"
00025 #include <GU/GU_Detail.h>
00026 #include <GU/GU_RayIntersect.h>
00027 #include <SOP/SOP_BrushBase.h>
00028 #include <UT/UT_Vector2.h>
00029 #include "MSS_SingleOpState.h"
00030
00031 class UT_String;
00032 class UT_Matrix4;
00033 class PRM_Template;
00034 class DM_Workbench;
00035 class JEDI_View;
00036
00037 class MSS_API MSS_BrushBaseState : public MSS_SingleOpState
00038 {
00039 public:
00040
00041 MSS_BrushBaseState(JEDI_View &view, PI_StateTemplate &templ,
00042 BM_SceneManager *scene,
00043 const char *cursor = BM_DEFAULT_CURSOR);
00044 virtual ~MSS_BrushBaseState();
00045
00046
00047
00048 static BM_State *ourConstructor(BM_View &view, PI_StateTemplate &templ,
00049 BM_SceneManager *scene);
00050 static PRM_Template *ourTemplateList;
00051
00052
00053 virtual const char *className() const;
00054
00055
00056 virtual void restart();
00057
00058 virtual void handleOpNodeChange(OP_Node &node);
00059
00060 protected:
00061 virtual int enter(BM_SimpleState::BM_EntryType how);
00062 virtual void exit (void);
00063 virtual void interrupt(BM_SimpleState * = 0);
00064 virtual void resume (BM_SimpleState * = 0);
00065
00066
00067 virtual void setNode(OP_Node *node);
00068
00069
00070 virtual bool generateAllNodes();
00071
00072
00073
00074 virtual void doneSelecting(void);
00075
00076
00077 virtual int handleMouseEvent(UI_Event *event);
00078 virtual int handleKeyTypeEvent(UI_Event *event, BM_Viewport &);
00079 virtual int handleParameterEvent(UI_Event *event);
00080
00081
00082 virtual void doRender(RE_Render *r, short x, short y, int ghost);
00083
00084
00085 virtual SOP_BrushOp menuToBrushOp(const UI_Value &menuvalue) const;
00086
00087
00088
00089 virtual int nodeIdToReselectWithin() const;
00090
00091 UI_Value &getPrimaryVal () { return myPrimaryButtonVal; }
00092 UI_Value &getSecondaryVal() { return mySecondaryButtonVal; }
00093
00094 SOP_BrushBase *getBrushSOP() const
00095 { return (SOP_BrushBase*)BM_SingleOpState::getNode(); }
00096
00097 virtual void updatePrompt();
00098
00099 virtual bool forceVisualization() const { return true; }
00100
00101 virtual void enableVisualization();
00102 virtual void disableVisualization();
00103
00104 private:
00105 void handleBrushShapeChange (UI_Event *event);
00106 void handleBrushOrientChange(UI_Event *event);
00107 void handleAccumStencilChange(UI_Event *event);
00108 void handlePrimaryTieChange(UI_Event *event);
00109 void handleSecondaryTieChange(UI_Event *event);
00110
00111
00112
00113 void usePrimaryButton (void);
00114 void useSecondaryButton(void);
00115
00116 int sendRay( const UT_Vector2& screen_coord, bool isuv,
00117 float t, UT_Vector3 &rayorig,
00118 UT_Vector3 &hitpos,
00119 UT_Vector3 &dir, GU_RayInfo &hinfo,
00120 GEO_Point *&hitpt,
00121 float &scalehistory,
00122 int checkgeo);
00123
00124
00125 void orientCursor(float t, const UT_Vector3 &hitpos,
00126 const UT_Vector3 &nml,
00127 float scalehistory,
00128 bool isuv,
00129 const GEO_Primitive *prim,
00130 float u, float v);
00131
00132
00133
00134 void reorientCursor();
00135
00136
00137 SOP_BrushBase *mySavedBrushNode;
00138 GU_RayIntersect myRayIntersect;
00139 GU_Detail myBrushCursor;
00140 UT_Matrix4 myBrushCursorXform;
00141 bool myRenderBrushCursor;
00142 bool myBrushCursorIsUV;
00143 bool myOneHit;
00144 bool myLocatedFlag;
00145 UT_Vector2 myOldCoord;
00146
00147
00148 bool myResizingCursor;
00149 short myLastCursorX, myLastCursorY;
00150
00151
00152
00153
00154 bool myOldOrientValid;
00155 float myOldOrientT;
00156 UT_Vector3 myOldOrientHitPos;
00157 UT_Vector3 myOldOrientHitNml;
00158 float myOldOrientScaleHistory;
00159 bool myOldOrientIsUV;
00160 const GEO_Primitive *myOldOrientHitPrim;
00161 float myOldOrientHitU;
00162 float myOldOrientHitV;
00163
00164 UI_Value myPrimaryButtonVal;
00165 UI_Value mySecondaryButtonVal;
00166 UI_Value myBrushShapeVal;
00167 UI_Value myBrushOrientVal;
00168 UI_Value myAccumStencilVal;
00169 };
00170
00171 #endif