00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __MSS_FaceState_H__
00022 #define __MSS_FaceState_H__
00023
00024 #include "MSS_API.h"
00025 #include <UT/UT_Vector4.h>
00026 #include <UT/UT_Vector4Array.h>
00027 #include <MPI/MPI_CurvePoint.h>
00028 #include <MPI/MPI_FacePointParser.h>
00029 #include <MPI/MPI_CurveSnapInput.h>
00030 #include "MSS_SingleOpBaseState.h"
00031
00032 class BM_View;
00033 class SOP_Curve;
00034 class JEDI_View;
00035
00036 class MSS_API MSS_FaceStateFlags
00037 {
00038 public:
00039 MSS_FaceStateFlags() {
00040 freehand = 0;
00041 tempcurve = 0;
00042 extendfromstart = 0;
00043 updateinputs = 0;
00044 }
00045 unsigned freehand :1,
00046 tempcurve :1,
00047 extendfromstart :1,
00048 updateinputs :1;
00049
00050 };
00051
00052 class MSS_API MSS_FaceState : public MSS_SingleOpBaseState
00053 {
00054 public:
00055
00056 MSS_FaceState(JEDI_View &view, PI_StateTemplate &templ,
00057 BM_SceneManager *scene, const char *cursor);
00058 virtual ~MSS_FaceState(void);
00059
00060
00061
00062 static BM_State *ourConstructor(BM_View &view,
00063 PI_StateTemplate &templ,
00064 BM_SceneManager *scene);
00065 static PRM_Template ourTemplateList[];
00066
00067
00068 virtual const char *className() const;
00069
00070
00071 virtual int handleMouseEvent(UI_Event *event);
00072
00073 virtual void handleOpNodeChange(OP_Node &);
00074
00075
00076
00077 virtual int handleNodeDeleted(OP_Node &node);
00078
00079 protected:
00080
00081
00082 virtual int enter(BM_SimpleState::BM_EntryType how);
00083 virtual void exit (void);
00084
00085
00086 virtual void interrupt(BM_SimpleState * = 0);
00087 virtual void resume (BM_SimpleState * = 0);
00088
00089
00090 virtual int handleParameterEvent(UI_Event *event);
00091
00092 virtual int handleKeyTypeEvent(UI_Event *event,
00093 BM_Viewport &);
00094
00095
00096 virtual void setBuild(int yesNo);
00097
00098
00099 virtual void doGenerate();
00100
00101
00102 virtual void doRender(RE_Render *r, short x, short y, int ghost);
00103
00104 int curveClosed() { return (int)myFaceClosedVal; }
00105
00106
00107
00108 bool intersectRay(GU_Primitive *prim, UT_Vector3 &ray_orig,
00109 UT_Vector3 &ray_dir, UT_Vector3 &pos,
00110 float &u_real);
00111
00112
00113 void applyStateSettings();
00114 void undoStateSettings();
00115
00116 private:
00117 void updatePrompt();
00118
00119 SOP_Curve *getCurveSOP(void) const
00120 { return (SOP_Curve *)BM_SingleOpState::getNode(); }
00121
00122
00123
00124
00125 const GU_Detail *getReferenceGdp(int node_id = -1);
00126
00127 void updatePointsFromSOP();
00128 void updateFromSOP();
00129
00130
00131
00132 void addPoint(float *p);
00133 void delPoint();
00134
00135
00136
00137
00138
00139 bool insertPoint(UT_Vector3 &ray_orig,
00140 UT_Vector3 &ray_dir);
00141
00142
00143
00144
00145 void updateDependentPoints(const UT_Vector4 &delta,
00146 int index = 0);
00147
00148
00149
00150
00151 void deleteAllPoints(bool update_points = false);
00152
00153 void drawTempCurve(float *p);
00154 void endCurve();
00155 void prepareExtendFace(float *p);
00156
00157
00158 void calcValidIndex();
00159
00160 void updateEndpoints();
00161
00162
00163
00164 int getPointPIIdx();
00165
00166
00167 void convertAllReferences();
00168
00169
00170 void convertAllRelatives();
00171
00172
00173 void handleOpenCloseChange(UI_Event *event);
00174
00175
00176 void resetState();
00177
00178
00179
00180 UT_Vector4Array myPointList;
00181
00182
00183 MPI_FacePointParser myParser;
00184
00185 MPI_CurveSnapInput myInputMgr;
00186
00187
00188
00189
00190 int myValidIndex;
00191
00192
00193 UT_Vector4 myNextPoint;
00194
00195
00196
00197 UT_Vector4 myFirstPoint;
00198 UT_Vector4 myLastPoint;
00199
00200 MSS_FaceStateFlags myFlags;
00201
00202
00203 UI_Value myRelPointsVal;
00204 UI_Value myFaceClosedVal;
00205 };
00206
00207 #endif
00208