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