Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-10 23:43:45 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-11-10 23:43:45 +0300
commit37e4a311b0ad9da7177e50620efc3561e2dd7045 (patch)
tree8aea2cc851ab828ee040d601ed4c776283fd639a /source/blender/editors/object
parent4617bb68ba4b1c5ab459673fffd98bf7203bb4f2 (diff)
Math Lib
* Convert all code to use new functions. * Branch maintainers may want to skip this commit, and run this conversion script instead, if they use a lot of math functions in new code: http://www.pasteall.org/9052/python
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_add.c6
-rw-r--r--source/blender/editors/object/object_constraint.c20
-rw-r--r--source/blender/editors/object/object_edit.c12
-rw-r--r--source/blender/editors/object/object_hook.c46
-rw-r--r--source/blender/editors/object/object_modifier.c18
-rw-r--r--source/blender/editors/object/object_ops.c2
-rw-r--r--source/blender/editors/object/object_relations.c16
-rw-r--r--source/blender/editors/object/object_select.c4
-rw-r--r--source/blender/editors/object/object_shapekey.c2
-rw-r--r--source/blender/editors/object/object_transform.c88
10 files changed, 107 insertions, 107 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 5378ee47f89..61377d76c56 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -46,7 +46,7 @@
#include "DNA_view3d_types.h"
#include "DNA_vfont_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BKE_anim.h"
@@ -126,7 +126,7 @@ void ED_object_base_init_from_view(bContext *C, Base *base, int view_align)
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if(rv3d) {
rv3d->viewquat[0]= -rv3d->viewquat[0];
- QuatToEul(rv3d->viewquat, ob->rot);
+ quat_to_eul( ob->rot,rv3d->viewquat);
rv3d->viewquat[0]= -rv3d->viewquat[0];
}
}
@@ -928,7 +928,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
ob->disp.first= ob->disp.last= NULL;
ob->transflag &= ~OB_DUPLI;
- Mat4CpyMat4(ob->obmat, dob->mat);
+ copy_m4_m4(ob->obmat, dob->mat);
ED_object_apply_obmat(ob);
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 35b11571a61..2d98a284df0 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -33,7 +33,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_dynstr.h"
#include "DNA_action_types.h"
@@ -577,7 +577,7 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
float imat[4][4], tmat[4][4];
/* make copy of pchan's original pose-mat (for use later) */
- Mat4CpyMat4(pmat, pchan->pose_mat);
+ copy_m4_m4(pmat, pchan->pose_mat);
/* disable constraint for pose to be solved without it */
cinf= con->enforce;
@@ -590,9 +590,9 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
* pchan->pose_mat from the original pchan->pose_mat, thus determining
* the effect of the constraint
*/
- Mat4Invert(imat, pchan->pose_mat);
- Mat4MulMat4(tmat, imat, pmat);
- Mat4Invert(data->invmat, tmat);
+ invert_m4_m4(imat, pchan->pose_mat);
+ mul_m4_m4m4(tmat, imat, pmat);
+ invert_m4_m4(data->invmat, tmat);
/* recalculate pose with new inv-mat */
con->enforce= cinf;
@@ -604,10 +604,10 @@ static int childof_set_inverse_exec (bContext *C, wmOperator *op)
* NOTE: what_does_parent uses a static workob defined in object.c
*/
what_does_parent(scene, ob, &workob);
- Mat4Invert(data->invmat, workob.obmat);
+ invert_m4_m4(data->invmat, workob.obmat);
}
else
- Mat4One(data->invmat);
+ unit_m4(data->invmat);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -637,7 +637,7 @@ static int childof_clear_inverse_exec (bContext *C, wmOperator *op)
bChildOfConstraint *data= (bChildOfConstraint *)con->data;
/* simply clear the matrix */
- Mat4One(data->invmat);
+ unit_m4(data->invmat);
WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, ob);
@@ -1052,9 +1052,9 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o
* if adding a target for an IK Constraint
*/
if (con_type == CONSTRAINT_TYPE_KINEMATIC)
- VecMat4MulVecfl(obt->loc, obact->obmat, pchanact->pose_tail);
+ mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_tail);
else
- VecMat4MulVecfl(obt->loc, obact->obmat, pchanact->pose_head);
+ mul_v3_m4v3(obt->loc, obact->obmat, pchanact->pose_head);
}
else
VECCOPY(obt->loc, obact->obmat[3]);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 0cfdd914222..7bb345bf46c 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -67,7 +67,7 @@
#include "DNA_modifier_types.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_ghash.h"
#include "BLI_rand.h"
@@ -161,16 +161,16 @@ void ED_object_apply_obmat(Object *ob)
/* from obmat to loc rot size */
if(ob==NULL) return;
- Mat3CpyMat4(mat, ob->obmat);
+ copy_m3_m4(mat, ob->obmat);
VECCOPY(ob->loc, ob->obmat[3]);
- Mat3ToEul(mat, ob->rot);
- EulToMat3(ob->rot, tmat);
+ mat3_to_eul( ob->rot,mat);
+ eul_to_mat3( tmat,ob->rot);
- Mat3Inv(imat, tmat);
+ invert_m3_m3(imat, tmat);
- Mat3MulMat3(tmat, imat, mat);
+ mul_m3_m3m3(tmat, imat, mat);
ob->size[0]= tmat[0][0];
ob->size[1]= tmat[1][1];
diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c
index 22a6329a097..91aebc8b149 100644
--- a/source/blender/editors/object/object_hook.c
+++ b/source/blender/editors/object/object_hook.c
@@ -30,7 +30,7 @@
#include "MEM_guardedalloc.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
@@ -77,12 +77,12 @@ static int return_editmesh_indexar(EditMesh *em, int *tot, int **indexar, float
for(eve= em->verts.first; eve; eve= eve->next) {
if(eve->f & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, eve->co);
+ add_v3_v3v3(cent, cent, eve->co);
}
nr++;
}
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return totvert;
}
@@ -105,7 +105,7 @@ static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, floa
for(i=0; i<dvert->totweight; i++){
if(dvert->dw[i].def_nr == (obedit->actdef-1)) {
totvert++;
- VecAddf(cent, cent, eve->co);
+ add_v3_v3v3(cent, cent, eve->co);
}
}
}
@@ -113,7 +113,7 @@ static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, floa
if(totvert) {
bDeformGroup *defGroup = BLI_findlink(&obedit->defbase, obedit->actdef-1);
strcpy(name, defGroup->name);
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return 1;
}
}
@@ -170,14 +170,14 @@ static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar
if(bp->f1 & SELECT) {
if(bp->hide==0) {
*index= nr; index++;
- VecAddf(cent, cent, bp->vec);
+ add_v3_v3v3(cent, cent, bp->vec);
}
}
bp++;
nr++;
}
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return totvert;
}
@@ -243,17 +243,17 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
while(a--) {
if(bezt->f1 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bezt->vec[0]);
+ add_v3_v3v3(cent, cent, bezt->vec[0]);
}
nr++;
if(bezt->f2 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bezt->vec[1]);
+ add_v3_v3v3(cent, cent, bezt->vec[1]);
}
nr++;
if(bezt->f3 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bezt->vec[2]);
+ add_v3_v3v3(cent, cent, bezt->vec[2]);
}
nr++;
bezt++;
@@ -265,7 +265,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
while(a--) {
if(bp->f1 & SELECT) {
*index= nr; index++;
- VecAddf(cent, cent, bp->vec);
+ add_v3_v3v3(cent, cent, bp->vec);
}
nr++;
bp++;
@@ -273,7 +273,7 @@ static int return_editcurve_indexar(Object *obedit, int *tot, int **indexar, flo
}
}
- VecMulf(cent, 1.0f/(float)totvert);
+ mul_v3_fl(cent, 1.0f/(float)totvert);
return totvert;
}
@@ -465,7 +465,7 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
ob->lay= newbase->lay;
/* transform cent to global coords for loc */
- VecMat4MulVecfl(ob->loc, obedit->obmat, cent);
+ mul_v3_m4v3(ob->loc, obedit->obmat, cent);
/* restore, add_object sets active */
BASACT= base;
@@ -489,7 +489,7 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
hmd->object= ob;
hmd->indexar= indexar;
- VecCopyf(hmd->cent, cent);
+ copy_v3_v3(hmd->cent, cent);
hmd->totindex= tot;
BLI_strncpy(hmd->name, name, 32);
@@ -501,9 +501,9 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
where_is_object(scene, ob);
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
/* apparently this call goes from right to left... */
- Mat4MulSerie(hmd->parentinv, ob->imat, obedit->obmat, NULL,
+ mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL,
NULL, NULL, NULL, NULL, NULL);
}
}
@@ -520,9 +520,9 @@ void add_hook(Scene *scene, View3D *v3d, int mode)
// FIXME: this is now OBJECT_OT_hook_reset operator
where_is_object(scene, ob); /* ob is hook->parent */
- Mat4Invert(ob->imat, ob->obmat);
+ invert_m4_m4(ob->imat, ob->obmat);
/* this call goes from right to left... */
- Mat4MulSerie(hmd->parentinv, ob->imat, obedit->obmat, NULL,
+ mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL,
NULL, NULL, NULL, NULL, NULL);
}
@@ -577,8 +577,8 @@ void hookmenu(Scene *scene, View3D *v3d)
if (event==1) {
if(hmd->object) {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ invert_m4_m4(hmd->object->imat, hmd->object->obmat);
+ mul_serie_m4(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
changed= 1;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
@@ -589,14 +589,14 @@ void hookmenu(Scene *scene, View3D *v3d)
where_is_object(scene, ob);
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, ob->obmat);
+ invert_m3_m3(imat, bmat);
curs= give_cursor(scene, v3d);
hmd->cent[0]= curs[0]-ob->obmat[3][0];
hmd->cent[1]= curs[1]-ob->obmat[3][1];
hmd->cent[2]= curs[2]-ob->obmat[3][2];
- Mat3MulVecfl(imat, hmd->cent);
+ mul_m3_v3(imat, hmd->cent);
changed= 1;
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 0683cb6842f..f3588a91984 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -40,7 +40,7 @@
#include "DNA_object_force.h"
#include "DNA_scene_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BKE_action.h"
@@ -841,14 +841,14 @@ static int hook_reset_exec(bContext *C, wmOperator *op)
float imat[4][4], mat[4][4];
/* calculate the world-space matrix for the pose-channel target first, then carry on as usual */
- Mat4MulMat4(mat, pchan->pose_mat, hmd->object->obmat);
+ mul_m4_m4m4(mat, pchan->pose_mat, hmd->object->obmat);
- Mat4Invert(imat, mat);
- Mat4MulSerie(hmd->parentinv, imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ invert_m4_m4(imat, mat);
+ mul_serie_m4(hmd->parentinv, imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
}
else {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ invert_m4_m4(hmd->object->imat, hmd->object->obmat);
+ mul_serie_m4(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
}
}
@@ -879,11 +879,11 @@ static int hook_recenter_exec(bContext *C, wmOperator *op)
HookModifierData *hmd= ptr.data;
float bmat[3][3], imat[3][3];
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
+ copy_m3_m4(bmat, ob->obmat);
+ invert_m3_m3(imat, bmat);
VECSUB(hmd->cent, scene->cursor, ob->obmat[3]);
- Mat3MulVecfl(imat, hmd->cent);
+ mul_m3_v3(imat, hmd->cent);
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index ccb6e8cdea3..75a95323ce1 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -39,7 +39,7 @@
#include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BKE_context.h"
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index cbd1e1be8d5..95b874e7145 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -48,7 +48,7 @@
#include "DNA_view3d_types.h"
#include "DNA_world_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
@@ -221,7 +221,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
ob->partype= PARVERT1;
@@ -229,7 +229,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
/* inverse parent matrix */
what_does_parent(scene, ob, &workob);
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
}
}
@@ -451,7 +451,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
ED_object_apply_obmat(ob);
}
else if(type == 2)
- Mat4One(ob->parentinv);
+ unit_m4(ob->parentinv);
ob->recalc |= OB_RECALC;
}
@@ -617,7 +617,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
add_constraint_to_object(con, ob);
get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra - give_timeoffset(ob));
- VecSubf(vec, ob->obmat[3], cmat[3]);
+ sub_v3_v3v3(vec, ob->obmat[3], cmat[3]);
ob->loc[0] = vec[0];
ob->loc[1] = vec[1];
@@ -637,12 +637,12 @@ static int parent_set_exec(bContext *C, wmOperator *op)
ob->partype= PARSKEL;
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
else {
/* calculate inverse parent matrix */
what_does_parent(scene, ob, &workob);
- Mat4Invert(ob->parentinv, workob.obmat);
+ invert_m4_m4(ob->parentinv, workob.obmat);
}
ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA;
@@ -734,7 +734,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
}
else {
/* clear inverse matrix and also the object location */
- Mat4One(ob->parentinv);
+ unit_m4(ob->parentinv);
memset(ob->loc, 0, 3*sizeof(float));
/* set recalc flags */
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 47730496296..20f3ea3df9e 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -40,7 +40,7 @@
#include "DNA_scene_types.h"
#include "DNA_texture_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_listbase.h"
#include "BLI_rand.h"
#include "BLI_string.h"
@@ -524,7 +524,7 @@ static short select_grouped_color(bContext *C, Object *ob)
char changed = 0;
CTX_DATA_BEGIN(C, Base*, base, selectable_bases) {
- if (!(base->flag & SELECT) && (FloatCompare(base->object->col, ob->col, 0.005f))) {
+ if (!(base->flag & SELECT) && (compare_v3v3(base->object->col, ob->col, 0.005f))) {
ED_base_object_select(base, BA_SELECT);
changed = 1;
}
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index f52927a1a00..878c61aac48 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -37,7 +37,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "DNA_action_types.h"
#include "DNA_curve_types.h"
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 0c09e0a03de..48db13c0709 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -38,7 +38,7 @@
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
-#include "BLI_arithb.h"
+#include "BLI_math.h"
#include "BLI_editVert.h"
#include "BLI_listbase.h"
@@ -159,10 +159,10 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
if (ob->rotmode == ROT_MODE_QUAT) {
QUATCOPY(quat1, ob->quat);
- QuatToEul(ob->quat, oldeul);
+ quat_to_eul( oldeul,ob->quat);
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- AxisAngleToEulO(ob->rotAxis, ob->rotAngle, oldeul, EULER_ORDER_DEFAULT);
+ axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,ob->rotAxis, ob->rotAngle);
}
else {
VECCOPY(oldeul, ob->rot);
@@ -178,14 +178,14 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op)
eul[2]= oldeul[2];
if (ob->rotmode == ROT_MODE_QUAT) {
- EulToQuat(eul, ob->quat);
+ eul_to_quat( ob->quat,eul);
/* quaternions flip w sign to accumulate rotations correctly */
if ((quat1[0]<0.0f && ob->quat[0]>0.0f) || (quat1[0]>0.0f && ob->quat[0]<0.0f)) {
- QuatMulf(ob->quat, -1.0f);
+ mul_qt_fl(ob->quat, -1.0f);
}
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
- EulOToAxisAngle(eul, EULER_ORDER_DEFAULT, ob->rotAxis, &ob->rotAngle);
+ eulO_to_axis_angle( ob->rotAxis, &ob->rotAngle,eul, EULER_ORDER_DEFAULT);
}
else {
VECCOPY(ob->rot, eul);
@@ -290,12 +290,12 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op)
v1= ob->loc;
v3= ob->parentinv[3];
- Mat3CpyMat4(mat, ob->parentinv);
+ copy_m3_m4(mat, ob->parentinv);
VECCOPY(v3, v1);
v3[0]= -v3[0];
v3[1]= -v3[1];
v3[2]= -v3[2];
- Mat3MulVecfl(mat, v3);
+ mul_m3_v3(mat, v3);
}
ob->recalc |= OB_RECALC_OB;
}
@@ -338,7 +338,7 @@ static void ignore_parent_tx(Main *bmain, Scene *scene, Object *ob )
if(ob_child->parent == ob) {
ED_object_apply_obmat(ob_child);
what_does_parent(scene, ob_child, &workob);
- Mat4Invert(ob_child->parentinv, workob.obmat);
+ invert_m4_m4(ob_child->parentinv, workob.obmat);
}
}
}
@@ -402,20 +402,20 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else if(apply_rot)
object_rot_to_mat3(ob, rsmat);
else
- Mat3One(rsmat);
+ unit_m3(rsmat);
- Mat4CpyMat3(mat, rsmat);
+ copy_m4_m3(mat, rsmat);
/* calculate translation */
if(apply_loc) {
- VecCopyf(mat[3], ob->loc);
+ copy_v3_v3(mat[3], ob->loc);
if(!(apply_scale && apply_rot)) {
/* correct for scale and rotation that is still applied */
object_to_mat3(ob, obmat);
- Mat3Inv(iobmat, obmat);
- Mat3MulMat3(tmat, rsmat, iobmat);
- Mat3MulVecfl(tmat, mat[3]);
+ invert_m3_m3(iobmat, obmat);
+ mul_m3_m3m3(tmat, rsmat, iobmat);
+ mul_m3_v3(tmat, mat[3]);
}
}
@@ -426,7 +426,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
/* adjust data */
mvert= me->mvert;
for(a=0; a<me->totvert; a++, mvert++)
- Mat4MulVecfl(mat, mvert->co);
+ mul_m4_v3(mat, mvert->co);
if(me->key) {
KeyBlock *kb;
@@ -435,7 +435,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
float *fp= kb->data;
for(a=0; a<kb->totelem; a++, fp+=3)
- Mat4MulVecfl(mat, fp);
+ mul_m4_v3(mat, fp);
}
}
@@ -448,15 +448,15 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else if(ELEM(ob->type, OB_CURVE, OB_SURF)) {
cu= ob->data;
- scale = Mat3ToScalef(rsmat);
+ scale = mat3_to_scale(rsmat);
for(nu=cu->nurb.first; nu; nu=nu->next) {
if(nu->type == CU_BEZIER) {
a= nu->pntsu;
for(bezt= nu->bezt; a--; bezt++) {
- Mat4MulVecfl(mat, bezt->vec[0]);
- Mat4MulVecfl(mat, bezt->vec[1]);
- Mat4MulVecfl(mat, bezt->vec[2]);
+ mul_m4_v3(mat, bezt->vec[0]);
+ mul_m4_v3(mat, bezt->vec[1]);
+ mul_m4_v3(mat, bezt->vec[2]);
bezt->radius *= scale;
bezt++;
}
@@ -464,7 +464,7 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
else {
a= nu->pntsu*nu->pntsv;
for(bp= nu->bp; a--; bp++)
- Mat4MulVecfl(mat, bp->vec);
+ mul_m4_v3(mat, bp->vec);
}
}
}
@@ -503,8 +503,8 @@ static int visual_transform_apply_exec(bContext *C, wmOperator *op)
where_is_object(scene, ob);
VECCOPY(ob->loc, ob->obmat[3]);
- Mat4ToSize(ob->obmat, ob->size);
- Mat4ToEul(ob->obmat, ob->rot);
+ mat4_to_size( ob->size,ob->obmat);
+ mat4_to_eul( ob->rot,ob->obmat);
where_is_object(scene, ob);
@@ -709,7 +709,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
}
if(v3d->around==V3D_CENTROID) {
- VecMulf(cent, 1.0f/(float)total);
+ mul_v3_fl(cent, 1.0f/(float)total);
}
else {
cent[0]= (min[0]+max[0])/2.0f;
@@ -718,7 +718,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
}
for(eve= em->verts.first; eve; eve= eve->next) {
- VecSubf(eve->co, eve->co, cent);
+ sub_v3_v3v3(eve->co, eve->co, cent);
}
recalc_editnormals(em);
@@ -748,8 +748,8 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
} else {
if(centermode==2) {
VECCOPY(cent, give_cursor(scene, v3d));
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, cent);
+ invert_m4_m4(ob->imat, ob->obmat);
+ mul_m4_v3(ob->imat, cent);
} else {
INIT_MINMAX(min, max);
mvert= me->mvert;
@@ -764,7 +764,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
mvert= me->mvert;
for(a=0; a<me->totvert; a++, mvert++) {
- VecSubf(mvert->co, mvert->co, cent);
+ sub_v3_v3v3(mvert->co, mvert->co, cent);
}
if (me->key) {
@@ -773,7 +773,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
float *fp= kb->data;
for (a=0; a<kb->totelem; a++, fp+=3) {
- VecSubf(fp, fp, cent);
+ sub_v3_v3v3(fp, fp, cent);
}
}
}
@@ -781,10 +781,10 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
me->flag |= ME_ISDONE;
if(centermode) {
- Mat3CpyMat4(omat, ob->obmat);
+ copy_m3_m4(omat, ob->obmat);
VECCOPY(centn, cent);
- Mat3MulVecfl(omat, centn);
+ mul_m3_v3(omat, centn);
ob->loc[0]+= centn[0];
ob->loc[1]+= centn[1];
ob->loc[2]+= centn[2];
@@ -802,9 +802,9 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
ob_other->flag |= OB_DONE;
ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA;
- Mat3CpyMat4(omat, ob_other->obmat);
+ copy_m3_m4(omat, ob_other->obmat);
VECCOPY(centn, cent);
- Mat3MulVecfl(omat, centn);
+ mul_m3_v3(omat, centn);
ob_other->loc[0]+= centn[0];
ob_other->loc[1]+= centn[1];
ob_other->loc[2]+= centn[2];
@@ -815,7 +815,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
if(tme && (tme->flag & ME_ISDONE)==0) {
mvert= tme->mvert;
for(a=0; a<tme->totvert; a++, mvert++) {
- VecSubf(mvert->co, mvert->co, cent);
+ sub_v3_v3v3(mvert->co, mvert->co, cent);
}
if (tme->key) {
@@ -824,7 +824,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
float *fp= kb->data;
for (a=0; a<kb->totelem; a++, fp+=3) {
- VecSubf(fp, fp, cent);
+ sub_v3_v3v3(fp, fp, cent);
}
}
}
@@ -858,8 +858,8 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
} else {
if(centermode==2) {
VECCOPY(cent, give_cursor(scene, v3d));
- Mat4Invert(ob->imat, ob->obmat);
- Mat4MulVecfl(ob->imat, cent);
+ invert_m4_m4(ob->imat, ob->obmat);
+ mul_m4_v3(ob->imat, cent);
/* don't allow Z change if curve is 2D */
if( !( cu->flag & CU_3D ) )
@@ -884,23 +884,23 @@ static int object_center_set_exec(bContext *C, wmOperator *op)
if(nu->type == CU_BEZIER) {
a= nu->pntsu;
while (a--) {
- VecSubf(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent);
- VecSubf(nu->bezt[a].vec[1], nu->bezt[a].vec[1], cent);
- VecSubf(nu->bezt[a].vec[2], nu->bezt[a].vec[2], cent);
+ sub_v3_v3v3(nu->bezt[a].vec[0], nu->bezt[a].vec[0], cent);
+ sub_v3_v3v3(nu->bezt[a].vec[1], nu->bezt[a].vec[1], cent);
+ sub_v3_v3v3(nu->bezt[a].vec[2], nu->bezt[a].vec[2], cent);
}
}
else {
a= nu->pntsu*nu->pntsv;
while (a--)
- VecSubf(nu->bp[a].vec, nu->bp[a].vec, cent);
+ sub_v3_v3v3(nu->bp[a].vec, nu->bp[a].vec, cent);
}
nu= nu->next;
}
if(centermode && obedit==NULL) {
- Mat3CpyMat4(omat, ob->obmat);
+ copy_m3_m4(omat, ob->obmat);
- Mat3MulVecfl(omat, cent);
+ mul_m3_v3(omat, cent);
ob->loc[0]+= cent[0];
ob->loc[1]+= cent[1];
ob->loc[2]+= cent[2];