diff options
Diffstat (limited to 'source/blender/editors/transform/transform.h')
-rw-r--r-- | source/blender/editors/transform/transform.h | 112 |
1 files changed, 73 insertions, 39 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 08fe1e7676b..a551ef5008e 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -35,6 +35,7 @@ #include "ED_transform.h" #include "ED_numinput.h" +#include "ED_view3d.h" #include "DNA_listBase.h" @@ -52,12 +53,7 @@ struct Object; struct View3D; struct ScrArea; struct Scene; -struct bPose; struct bConstraint; -struct BezTriple; -struct wmOperatorType; -struct wmOperator; -struct wmWindowManager; struct wmKeyMap; struct wmKeyConfig; struct bContext; @@ -65,7 +61,6 @@ struct wmEvent; struct wmTimer; struct ARegion; struct ReportList; -struct SmallHash; typedef struct TransSnapPoint { struct TransSnapPoint *next, *prev; @@ -108,15 +103,15 @@ typedef struct TransCon { int imval[2]; /* initial mouse value for visual calculation */ /* the one in TransInfo is not garanty to stay the same (Rotates change it) */ int mode; /* Mode flags of the Constraint */ - void (*drawExtra)(struct TransInfo *); + void (*drawExtra)(struct TransInfo *t); /* For constraints that needs to draw differently from the other * uses this instead of the generic draw function */ - void (*applyVec)(struct TransInfo *, struct TransData *, float *, float *, float *); + void (*applyVec)(struct TransInfo *t, struct TransData *td, const float in[3], float out[3], float pvec[3]); /* Apply function pointer for linear vectorial transformation */ /* The last three parameters are pointers to the in/out/printable vectors */ - void (*applySize)(struct TransInfo *, struct TransData *, float [3][3]); + void (*applySize)(struct TransInfo *t, struct TransData *td, float smat[3][3]); /* Apply function pointer for size transformation */ - void (*applyRot)(struct TransInfo *, struct TransData *, float [3], float *); + void (*applyRot)(struct TransInfo *t, struct TransData *td, float vec[3], float *angle); /* Apply function pointer for rotation transformation */ } TransCon; @@ -143,6 +138,7 @@ typedef struct TransDataExtension { * namely when a bone is in "NoLocal" or "Hinge" mode)... */ float r_smtx[3][3]; /* Invers of previous one. */ int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */ + float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle; /* Original object transformation used for rigid bodies */ } TransDataExtension; typedef struct TransData2D { @@ -188,7 +184,7 @@ typedef struct TransDataNla { struct LinkNode; struct GHash; -typedef struct TransDataSlideVert { +typedef struct TransDataEdgeSlideVert { struct BMVert vup, vdown; struct BMVert origvert; @@ -201,10 +197,10 @@ typedef struct TransDataSlideVert { float upvec[3], downvec[3]; int loop_nr; -} TransDataSlideVert; +} TransDataEdgeSlideVert; -typedef struct SlideData { - TransDataSlideVert *sv; +typedef struct EdgeSlideData { + TransDataEdgeSlideVert *sv; int totsv; struct SmallHash vhash; @@ -214,15 +210,40 @@ typedef struct SlideData { struct BMEditMesh *em; /* flag that is set when origfaces is initialized */ - int origfaces_init; + bool origfaces_init; float perc; - int is_proportional; - int flipped_vtx; + bool is_proportional; + bool flipped_vtx; int curr_sv_index; -} SlideData; +} EdgeSlideData; + + +typedef struct TransDataVertSlideVert { + BMVert *v; + float co_orig_3d[3]; + float co_orig_2d[2]; + float (*co_link_orig_3d)[3]; + float (*co_link_orig_2d)[2]; + int co_link_tot; + int co_link_curr; +} TransDataVertSlideVert; + +typedef struct VertSlideData { + TransDataVertSlideVert *sv; + int totsv; + + struct BMEditMesh *em; + + float perc; + + bool is_proportional; + bool flipped_vtx; + + int curr_sv_index; +} VertSlideData; typedef struct TransData { float dist; /* Distance needed to affect element (for Proportionnal Editing) */ @@ -246,8 +267,8 @@ typedef struct TransData { } TransData; typedef struct MouseInput { - void (*apply)(struct TransInfo *, struct MouseInput *, const int [2], float [3]); - void (*post)(struct TransInfo *, float [3]); + void (*apply)(struct TransInfo *t, struct MouseInput *mi, const int mval[2], float output[3]); + void (*post)(struct TransInfo *t, float values[3]); int imval[2]; /* initial mouse position */ char precision; @@ -267,7 +288,7 @@ typedef struct TransInfo { float fac; /* factor for distance based transform */ int (*transform)(struct TransInfo *, const int *); /* transform function pointer */ - int (*handleEvent)(struct TransInfo *, struct wmEvent *); + int (*handleEvent)(struct TransInfo *, const struct wmEvent *); /* event handler function pointer RETURN 1 if redraw is needed */ int total; /* total number of transformed data */ TransData *data; /* transformed data (array) */ @@ -331,7 +352,9 @@ typedef struct TransInfo { struct Scene *scene; struct ToolSettings *settings; struct wmTimer *animtimer; + struct wmKeyMap *keymap; /* so we can do lookups for header text */ int mval[2]; /* current mouse position */ + float zfac; /* use for 3d view */ struct Object *obedit; void *draw_handle_apply; void *draw_handle_view; @@ -452,26 +475,28 @@ typedef struct TransInfo { #define POINT_INIT 4 #define MULTI_POINTS 8 -int initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, struct wmEvent *event, int mode); +int initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, const struct wmEvent *event, int mode); void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op); -int transformEvent(TransInfo *t, struct wmEvent *event); +int transformEvent(TransInfo *t, const struct wmEvent *event); void transformApply(struct bContext *C, TransInfo *t); int transformEnd(struct bContext *C, TransInfo *t); void setTransformViewMatrices(TransInfo *t); void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy); +void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag); void projectIntView(TransInfo *t, const float vec[3], int adr[2]); +void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV3DProjTest flag); void projectFloatView(TransInfo *t, const float vec[3], float adr[2]); void applyAspectRatio(TransInfo *t, float *vec); void removeAspectRatio(TransInfo *t, float *vec); void initWarp(TransInfo *t); -int handleEventWarp(TransInfo *t, struct wmEvent *event); +int handleEventWarp(TransInfo *t, const struct wmEvent *event); int Warp(TransInfo *t, const int mval[2]); void initShear(TransInfo *t); -int handleEventShear(TransInfo *t, struct wmEvent *event); +int handleEventShear(TransInfo *t, const struct wmEvent *event); int Shear(TransInfo *t, const int mval[2]); void initResize(TransInfo *t); @@ -508,7 +533,7 @@ void initPushPull(TransInfo *t); int PushPull(TransInfo *t, const int mval[2]); void initBevel(TransInfo *t); -int handleEventBevel(TransInfo *t, struct wmEvent *event); +int handleEventBevel(TransInfo *t, const struct wmEvent *event); int Bevel(TransInfo *t, const int mval[2]); void initBevelWeight(TransInfo *t); @@ -527,9 +552,13 @@ void initBoneRoll(TransInfo *t); int BoneRoll(TransInfo *t, const int mval[2]); void initEdgeSlide(TransInfo *t); -int handleEventEdgeSlide(TransInfo *t, struct wmEvent *event); +int handleEventEdgeSlide(TransInfo *t, const struct wmEvent *event); int EdgeSlide(TransInfo *t, const int mval[2]); +void initVertSlide(TransInfo *t); +int handleEventVertSlide(TransInfo *t, const struct wmEvent *event); +int VertSlide(TransInfo *t, const int mval[2]); + void initTimeTranslate(TransInfo *t); int TimeTranslate(TransInfo *t, const int mval[2]); @@ -630,7 +659,7 @@ void initSnapping(struct TransInfo *t, struct wmOperator *op); void applyProject(TransInfo *t); void applySnapping(TransInfo *t, float *vec); void resetSnapping(TransInfo *t); -int handleSnapping(TransInfo *t, struct wmEvent *event); +int handleSnapping(TransInfo *t, const struct wmEvent *event); void drawSnapping(const struct bContext *C, TransInfo *t); int usingSnappingNormal(TransInfo *t); int validSnappingNormal(TransInfo *t); @@ -653,27 +682,26 @@ typedef enum { INPUT_HORIZONTAL_ABSOLUTE, INPUT_VERTICAL_RATIO, INPUT_VERTICAL_ABSOLUTE, - INPUT_CUSTOM_RATIO + INPUT_CUSTOM_RATIO, + INPUT_CUSTOM_RATIO_FLIP } MouseInputMode; -void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], int mval[2]); +void initMouseInput(TransInfo *t, MouseInput *mi, const int center[2], const int mval[2]); void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode); -int handleMouseInput(struct TransInfo *t, struct MouseInput *mi, struct wmEvent *event); +int handleMouseInput(struct TransInfo *t, struct MouseInput *mi, const struct wmEvent *event); void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, const int mval[2], float output[3]); -void setCustomPoints(TransInfo *t, MouseInput *mi, int start[2], int end[2]); -void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3])); +void setCustomPoints(TransInfo *t, MouseInput *mi, const int start[2], const int end[2]); +void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float values[3])); /*********************** Generics ********************************/ -int initTransInfo(struct bContext *C, TransInfo *t, struct wmOperator *op, struct wmEvent *event); +int initTransInfo(struct bContext *C, TransInfo *t, struct wmOperator *op, const struct wmEvent *event); void postTrans (struct bContext *C, TransInfo *t); void resetTransRestrictions(TransInfo *t); void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options); -void drawNonPropEdge(const struct bContext *C, TransInfo *t); - /* DRAWLINE options flags */ #define DRAWLIGHT 1 @@ -715,8 +743,14 @@ void applyTransformOrientation(const struct bContext *C, float mat[3][3], char * int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3], int activeOnly); -void freeSlideTempFaces(SlideData *sld); -void freeSlideVerts(TransInfo *t); -void projectSVData(TransInfo *t, int final); +void freeEdgeSlideTempFaces(EdgeSlideData *sld); +void freeEdgeSlideVerts(TransInfo *t); +void projectEdgeSlideData(TransInfo *t, bool is_final); + +void freeVertSlideVerts(TransInfo *t); + + +/* TODO. transform_queries.c */ +bool checkUseLocalCenter_GraphEdit(TransInfo *t); #endif |