diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-12-18 01:24:39 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-12-18 01:24:39 +0400 |
commit | 4a92ee2831ae2ae8bf96b116cb47ddcff1c36add (patch) | |
tree | 9b383957944fa9133fe0e6b3509fc49faaf2d72c /source/blender/editors/transform | |
parent | 40f215bbc998a43b991cbdf2fde6e836dc9fabf8 (diff) | |
parent | 74a112305932eff7c68c23c6df265e72de7195f8 (diff) |
Merged changes in the trunk up to revision 42692.
Diffstat (limited to 'source/blender/editors/transform')
7 files changed, 86 insertions, 75 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a8d88f08b48..f2387c278c4 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -376,7 +376,8 @@ static void viewRedrawPost(bContext *C, TransInfo *t) /* ************************** TRANSFORMATIONS **************************** */ -void BIF_selectOrientation(void) { +void BIF_selectOrientation(void) +{ #if 0 // TRANSFORM_FIX_ME short val; char *str_menu = BIF_menustringTransformOrientation("Orientation"); @@ -2547,7 +2548,8 @@ void initResize(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerResize(TransInfo *t, float vec[3], char *str) { +static void headerResize(TransInfo *t, float vec[3], char *str) +{ char tvec[60]; char *spos= str; if (hasNumInput(&t->num)) { @@ -2607,7 +2609,8 @@ static void TransMat3ToSize( float mat[][3], float smat[][3], float *size) } -static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) { +static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) +{ float tmat[3][3], smat[3][3], center[3]; float vec[3]; @@ -2904,7 +2907,8 @@ void initRotation(TransInfo *t) copy_v3_v3(t->axis_orig, t->axis); } -static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) { +static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) +{ float vec[3], totmat[3][3], smat[3][3]; float eul[3], fmat[3][3], quat[4]; float *center = t->center; @@ -3344,7 +3348,8 @@ void initTranslation(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerTranslation(TransInfo *t, float vec[3], char *str) { +static void headerTranslation(TransInfo *t, float vec[3], char *str) +{ char *spos= str; char tvec[60]; char distvec[20]; @@ -3418,7 +3423,8 @@ static void headerTranslation(TransInfo *t, float vec[3], char *str) { (void)spos; } -static void applyTranslation(TransInfo *t, float vec[3]) { +static void applyTranslation(TransInfo *t, float vec[3]) +{ TransData *td = t->data; float tvec[3]; int i; @@ -4099,7 +4105,8 @@ void initBoneSize(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerBoneSize(TransInfo *t, float vec[3], char *str) { +static void headerBoneSize(TransInfo *t, float vec[3], char *str) +{ char tvec[60]; if (hasNumInput(&t->num)) { outputNumInput(&(t->num), tvec); @@ -5302,7 +5309,8 @@ static void headerSeqSlide(TransInfo *t, float val[2], char *str) sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text); } -static void applySeqSlide(TransInfo *t, float val[2]) { +static void applySeqSlide(TransInfo *t, float val[2]) +{ TransData *td = t->data; int i; @@ -5826,7 +5834,8 @@ void initTimeScale(TransInfo *t) t->num.increment = t->snap[1]; } -static void headerTimeScale(TransInfo *t, char *str) { +static void headerTimeScale(TransInfo *t, char *str) +{ char tvec[60]; if (hasNumInput(&t->num)) @@ -5837,7 +5846,8 @@ static void headerTimeScale(TransInfo *t, char *str) { sprintf(str, "ScaleX: %s", &tvec[0]); } -static void applyTimeScale(TransInfo *t) { +static void applyTimeScale(TransInfo *t) +{ Scene *scene = t->scene; TransData *td = t->data; TransData2D *td2d = t->data2d; diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index bfb96149ed3..b88e57e1861 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -138,7 +138,8 @@ void constraintNumInput(TransInfo *t, float vec[3]) } } -static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) { +static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) +{ int i = 0; mul_m3_v3(t->con.imtx, vec); @@ -209,7 +210,8 @@ static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3]) } } -static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) { +static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) +{ float norm[3], vec[3], factor, angle; float t_con_center[3]; @@ -284,7 +286,8 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3 } } -static void planeProjection(TransInfo *t, float in[3], float out[3]) { +static void planeProjection(TransInfo *t, float in[3], float out[3]) +{ float vec[3], factor, norm[3]; add_v3_v3v3(vec, in, t->con.center); @@ -547,7 +550,8 @@ static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], /*--------------------- INTERNAL SETUP CALLS ------------------*/ -void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) { +void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) +{ strncpy(t->con.text + 1, text, 48); copy_m3_m3(t->con.mtx, space); t->con.mode = mode; @@ -562,7 +566,8 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) t->redraw = 1; } -void setLocalConstraint(TransInfo *t, int mode, const char text[]) { +void setLocalConstraint(TransInfo *t, int mode, const char text[]) +{ if (t->flag & T_EDIT) { float obmat[3][3]; copy_m3_m4(obmat, t->scene->obedit->obmat); @@ -596,7 +601,8 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) { ftext is a format string passed to sprintf. It will add the name of the orientation where %s is (logically). */ -void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) { +void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) +{ char text[40]; switch(orientation) { @@ -744,7 +750,8 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) } } -static void drawObjectConstraint(TransInfo *t) { +static void drawObjectConstraint(TransInfo *t) +{ int i; TransData * td = t->data; @@ -781,13 +788,15 @@ static void drawObjectConstraint(TransInfo *t) { /*--------------------- START / STOP CONSTRAINTS ---------------------- */ -void startConstraint(TransInfo *t) { +void startConstraint(TransInfo *t) +{ t->con.mode |= CON_APPLY; *t->con.text = ' '; t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max); } -void stopConstraint(TransInfo *t) { +void stopConstraint(TransInfo *t) +{ t->con.mode &= ~(CON_APPLY|CON_SELECT); *t->con.text = '\0'; t->num.idx_max = t->idx_max; @@ -836,7 +845,8 @@ void initSelectConstraint(TransInfo *t, float mtx[3][3]) t->con.applyRot = applyAxisConstraintRot; } -void selectConstraint(TransInfo *t) { +void selectConstraint(TransInfo *t) +{ if (t->con.mode & CON_SELECT) { setNearestAxis(t); startConstraint(t); @@ -970,7 +980,8 @@ void setNearestAxis(TransInfo *t) /*-------------- HELPER FUNCTIONS ----------------*/ -char constraintModeToChar(TransInfo *t) { +char constraintModeToChar(TransInfo *t) +{ if ((t->con.mode & CON_APPLY)==0) { return '\0'; } @@ -990,7 +1001,8 @@ char constraintModeToChar(TransInfo *t) { } -int isLockConstraint(TransInfo *t) { +int isLockConstraint(TransInfo *t) +{ int mode = t->con.mode; if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1)) diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 5527ab0d331..4b6c3a7031b 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -118,7 +118,8 @@ static short constraints_list_needinv(TransInfo *t, ListBase *list); /* ************************** Functions *************************** */ -static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) { +static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) +{ TransData *ihead = head; TransData *itail = tail; *temp = *head; @@ -165,7 +166,8 @@ static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, Tra } } -void sort_trans_data_dist(TransInfo *t) { +void sort_trans_data_dist(TransInfo *t) +{ TransData temp; TransData *start = t->data; int i = 1; @@ -294,7 +296,8 @@ static void createTransTexspace(TransInfo *t) /* ********************* edge (for crease) ***** */ -static void createTransEdge(TransInfo *t) { +static void createTransEdge(TransInfo *t) +{ EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh; TransData *td = NULL; EditEdge *eed; @@ -440,14 +443,14 @@ static short apply_targetless_ik(Object *ob) offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; mul_m4_v3(parchan->parent->pose_mat, rmat[3]); - mul_m4_m4m4(tmat, offs_bone, rmat); + mult_m4_m4m4(tmat, rmat, offs_bone); } else if(parchan->bone->flag & BONE_NO_SCALE) { - mul_m4_m4m4(tmat, offs_bone, parchan->parent->pose_mat); + mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone); normalize_m4(tmat); } else - mul_m4_m4m4(tmat, offs_bone, parchan->parent->pose_mat); + mult_m4_m4m4(tmat, parchan->parent->pose_mat, offs_bone); invert_m4_m4(imat, tmat); } @@ -458,7 +461,7 @@ static short apply_targetless_ik(Object *ob) invert_m4_m4(imat, tmat); } /* result matrix */ - mul_m4_m4m4(rmat, parchan->pose_mat, imat); + mult_m4_m4m4(rmat, imat, parchan->pose_mat); /* apply and decompose, doesn't work for constraints or non-uniform scale well */ { @@ -1325,7 +1328,8 @@ static void createTransMBallVerts(TransInfo *t) /* ********************* curve/surface ********* */ -static void calc_distanceCurveVerts(TransData *head, TransData *tail) { +static void calc_distanceCurveVerts(TransData *head, TransData *tail) +{ TransData *td, *td_near = NULL; for (td = head; td<=tail; td++) { if (td->flag & TD_SELECTED) { @@ -1370,7 +1374,8 @@ static void calc_distanceCurveVerts(TransData *head, TransData *tail) { } /* Utility function for getting the handle data from bezier's */ -static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) { +static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) +{ TransDataCurveHandleFlags *hdata; td->flag |= TD_BEZTRIPLE; hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data"); @@ -1919,8 +1924,8 @@ static void get_face_center(float *cent, EditMesh *em, EditVert *eve) } } -//way to overwrite what data is edited with transform -//static void VertsToTransData(TransData *td, EditVert *eve, BakeKey *key) +/* way to overwrite what data is edited with transform + * static void VertsToTransData(TransData *td, EditVert *eve, BakeKey *key) */ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert *eve) { td->flag = 0; @@ -1952,33 +1957,6 @@ static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert } } -#if 0 -static void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) { - BME_Vert *v; - BME_TransData *vtd; - TransData *tob; - int i; - - tob = t->data = MEM_callocN(td->len*sizeof(TransData), "TransObData(Bevel tool)"); - - for (i=0,v=bm->verts.first;v;v=v->next) { - if ( (vtd = BME_get_transdata(td,v)) ) { - tob->loc = vtd->loc; - tob->val = &vtd->factor; - copy_v3_v3(tob->iloc,vtd->co); - copy_v3_v3(tob->center,vtd->org); - copy_v3_v3(tob->axismtx[0],vtd->vec); - tob->axismtx[1][0] = vtd->max ? *vtd->max : 0; - tob++; - i++; - } - } - /* since td is a memarena, it can hold more transdata than actual elements - * (i.e. we can't depend on td->len to determine the number of actual elements) */ - t->total = i; -} -#endif - static void createTransEditVerts(bContext *C, TransInfo *t) { ToolSettings *ts = CTX_data_tool_settings(C); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index d0857958a4b..e7e1ee43c5d 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -171,7 +171,7 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) float obinv[4][4]; invert_m4_m4(obinv, mmd->mirror_ob->obmat); - mul_m4_m4m4(mtx, ob->obmat, obinv); + mult_m4_m4m4(mtx, obinv, ob->obmat); invert_m4_m4(imtx, mtx); } diff --git a/source/blender/editors/transform/transform_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index 63495d54cf1..5578ea754df 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -1564,7 +1564,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl rect.ymax= mval[1]+hotspot; setwinmatrixview3d(ar, v3d, &rect); - mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat); + mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); glSelectBuffer( 64, buffer); glRenderMode(GL_SELECT); @@ -1586,7 +1586,7 @@ static int manipulator_selectbuf(ScrArea *sa, ARegion *ar, const int mval[2], fl G.f &= ~G_PICKSEL; setwinmatrixview3d(ar, v3d, NULL); - mul_m4_m4m4(rv3d->persmat, rv3d->viewmat, rv3d->winmat); + mult_m4_m4m4(rv3d->persmat, rv3d->winmat, rv3d->viewmat); if(hits==1) return buffer[3]; else if(hits>1) { diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 7951fe0ee02..90f95bea696 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -632,7 +632,7 @@ void TRANSFORM_OT_warp(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_screenactive; - RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", 0, 1); + RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2); Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP); // XXX Warp axis? diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 9367826e102..3aa155fc8bb 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -127,7 +127,8 @@ void BIF_createTransformOrientation(bContext *C, ReportList *reports, char *name } } -TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) { +TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports), char *name, int overwrite) +{ Base *base = CTX_data_active_base(C); Object *ob; float mat[3][3]; @@ -150,7 +151,8 @@ TransformOrientation *createObjectSpace(bContext *C, ReportList *UNUSED(reports) return addMatrixSpace(C, mat, name, overwrite); } -TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *name, int overwrite) +{ float mat[3][3]; float normal[3], plane[3]; @@ -169,7 +171,8 @@ TransformOrientation *createBoneSpace(bContext *C, ReportList *reports, char *na return addMatrixSpace(C, mat, name, overwrite); } -TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) { +TransformOrientation *createMeshSpace(bContext *C, ReportList *reports, char *name, int overwrite) +{ float mat[3][3]; float normal[3], plane[3]; int type; @@ -267,7 +270,8 @@ int createSpaceNormalTangent(float mat[3][3], float normal[3], float tangent[3]) return 1; } -TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) { +TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], int overwrite) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts = NULL; @@ -294,7 +298,8 @@ TransformOrientation* addMatrixSpace(bContext *C, float mat[3][3], char name[], return ts; } -void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) { +void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int i; @@ -321,7 +326,8 @@ void BIF_removeTransformOrientation(bContext *C, TransformOrientation *target) { } } -void BIF_removeTransformOrientationIndex(bContext *C, int index) { +void BIF_removeTransformOrientationIndex(bContext *C, int index) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts= BLI_findlink(transform_spaces, index); @@ -344,7 +350,8 @@ void BIF_removeTransformOrientationIndex(bContext *C, int index) { } } -void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) { +void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; View3D *v3d = CTX_wm_view3d(C); TransformOrientation *ts; @@ -358,7 +365,8 @@ void BIF_selectTransformOrientation(bContext *C, TransformOrientation *target) { } } -void BIF_selectTransformOrientationValue(bContext *C, int orientation) { +void BIF_selectTransformOrientationValue(bContext *C, int orientation) +{ View3D *v3d = CTX_wm_view3d(C); if(v3d) /* currently using generic poll */ v3d->twmode = orientation; @@ -407,7 +415,8 @@ EnumPropertyItem *BIF_enumTransformOrientation(bContext *C) return item; } -const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) { +const char * BIF_menustringTransformOrientation(const bContext *C, const char *title) +{ const char* menu = IFACE_("%t|Global%x0|Local%x1|Gimbal%x4|Normal%x2|View%x3"); ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; @@ -429,7 +438,8 @@ const char * BIF_menustringTransformOrientation(const bContext *C, const char *t return str_menu; } -int BIF_countTransformOrientation(const bContext *C) { +int BIF_countTransformOrientation(const bContext *C) +{ ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; TransformOrientation *ts; int count = 0; @@ -441,7 +451,8 @@ int BIF_countTransformOrientation(const bContext *C) { return count; } -void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) { +void applyTransformOrientation(const bContext *C, float mat[3][3], char *name) +{ TransformOrientation *ts; View3D *v3d = CTX_wm_view3d(C); int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM); |