Cleanup: use mul_v3_mat3_m4v3
authorCampbell Barton <ideasman42@gmail.com>
Mon, 27 Apr 2015 13:23:04 +0000 (23:23 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 27 Apr 2015 15:18:50 +0000 (01:18 +1000)
source/blender/blenkernel/intern/object.c
source/blender/editors/mesh/editmesh_extrude.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/object/object_transform.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/transform/transform_snap.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/shadeinput.c

index f14f72614f44e160468ae2d87705a083b0837453..6f373ef0576c1bb9ff4ae789a4306df77cc0924a 100644 (file)
@@ -1769,8 +1769,7 @@ void BKE_object_make_proxy(Object *ob, Object *target, Object *gob)
                mul_m4_m4m4(ob->obmat, gob->obmat, target->obmat);
                if (gob->dup_group) { /* should always be true */
                        float tvec[3];
-                       copy_v3_v3(tvec, gob->dup_group->dupli_ofs);
-                       mul_mat3_m4_v3(ob->obmat, tvec);
+                       mul_v3_mat3_m4v3(tvec, ob->obmat, gob->dup_group->dupli_ofs);
                        sub_v3_v3(ob->obmat[3], tvec);
                }
                BKE_object_apply_mat4(ob, ob->obmat, false, true);
index 5c7efcc40da4a92d5a44600c7e2dcacfa67462ed..e8f9a76a873b13648727645787013749a3ed7f08 100644 (file)
@@ -574,8 +574,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, const w
                        mul_mat3_m4_v3(vc.obedit->imat, nor); /* local space */
 
                        /* correct the normal to be aligned on the view plane */
-                       copy_v3_v3(view_vec, vc.rv3d->viewinv[2]);
-                       mul_mat3_m4_v3(vc.obedit->imat, view_vec);
+                       mul_v3_mat3_m4v3(view_vec, vc.obedit->imat, vc.rv3d->viewinv[2]);
                        cross_v3_v3v3(cross, nor, view_vec);
                        cross_v3_v3v3(nor, view_vec, cross);
                        normalize_v3(nor);
index 4f8839005c9b9f59723eb56d6310e4261066807d..cfd0d3fdcf58cab1b6154ebf54776452f8ab41ad 100644 (file)
@@ -2876,8 +2876,7 @@ static void knife_recalc_projmat(KnifeTool_OpData *kcd)
        ED_view3d_ob_project_mat_get(kcd->ar->regiondata, kcd->ob, kcd->projmat);
        invert_m4_m4(kcd->projmat_inv, kcd->projmat);
 
-       copy_v3_v3(kcd->proj_zaxis, kcd->vc.rv3d->viewinv[2]);
-       mul_mat3_m4_v3(kcd->ob->imat, kcd->proj_zaxis);
+       mul_v3_mat3_m4v3(kcd->proj_zaxis, kcd->ob->imat, kcd->vc.rv3d->viewinv[2]);
        normalize_v3(kcd->proj_zaxis);
 
        kcd->is_ortho = ED_view3d_clip_range_get(kcd->vc.v3d, kcd->vc.rv3d,
index 92fe5ded4dd219cbd739a2e587575ea5da6d562c..340b662c0ef3871a37d15fbc8f831b5142ce7518 100644 (file)
@@ -939,8 +939,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
 
                                /* convert the offset to parent space */
                                BKE_object_to_mat4(ob, obmat);
-                               copy_v3_v3(centn, cent);
-                               mul_mat3_m4_v3(obmat, centn); /* omit translation part */
+                               mul_v3_mat3_m4v3(centn, obmat, cent); /* omit translation part */
 
                                add_v3_v3(ob->loc, centn);
 
@@ -970,8 +969,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
                                                ob_other->flag |= OB_DONE;
                                                DAG_id_tag_update(&ob_other->id, OB_RECALC_OB | OB_RECALC_DATA);
 
-                                               copy_v3_v3(centn, cent);
-                                               mul_mat3_m4_v3(ob_other->obmat, centn); /* omit translation part */
+                                               mul_v3_mat3_m4v3(centn, ob_other->obmat, cent); /* omit translation part */
                                                add_v3_v3(ob_other->loc, centn);
 
                                                BKE_object_where_is_calc(scene, ob_other);
index 24b814da44d88b42ca941cd57bb826e140e61fab..5b2ac50216a25e634a11f216373a3aadc38cbe83 100644 (file)
@@ -8021,9 +8021,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
                        /* don't show smoke before simulation starts, this could be made an option in the future */
                        if (smd->domain->fluid && CFRA >= smd->domain->point_cache[0]->startframe) {
                                /* get view vector */
-                               copy_v3_v3(viewnormal, rv3d->viewinv[2]);
                                invert_m4_m4(ob->imat, ob->obmat);
-                               mul_mat3_m4_v3(ob->imat, viewnormal);
+                               mul_v3_mat3_m4v3(viewnormal, ob->imat, rv3d->viewinv[2]);
                                normalize_v3(viewnormal);
 
                                /* set dynamic boundaries to draw the volume
index fd189e91141aba936508b796b0100428ceca91ae..e8a0f35c6b04f313ad14572b0011d7711891148f 100644 (file)
@@ -1400,11 +1400,8 @@ static bool snapArmature(short snap_mode, ARegion *ar, Object *ob, bArmature *ar
 
        invert_m4_m4(imat, obmat);
 
-       copy_v3_v3(ray_start_local, ray_start);
-       copy_v3_v3(ray_normal_local, ray_normal);
-       
-       mul_m4_v3(imat, ray_start_local);
-       mul_mat3_m4_v3(imat, ray_normal_local);
+       mul_v3_m4v3(ray_start_local, imat, ray_start);
+       mul_v3_mat3_m4v3(ray_normal_local, imat, ray_normal);
 
        if (arm->edbo) {
                EditBone *eBone;
@@ -1762,11 +1759,8 @@ static bool snapEmpty(short snap_mode, ARegion *ar, Object *ob, float obmat[4][4
 
        invert_m4_m4(imat, obmat);
 
-       copy_v3_v3(ray_start_local, ray_start);
-       copy_v3_v3(ray_normal_local, ray_normal);
-
-       mul_m4_v3(imat, ray_start_local);
-       mul_mat3_m4_v3(imat, ray_normal_local);
+       mul_v3_m4v3(ray_start_local, imat, ray_start);
+       mul_v3_mat3_m4v3(ray_normal_local, imat, ray_normal);
 
        switch (snap_mode) {
                case SCE_SNAP_MODE_VERTEX:
@@ -2111,12 +2105,8 @@ static bool peelDerivedMesh(Object *ob, DerivedMesh *dm, float obmat[4][4],
 
                transpose_m3_m4(timat, imat);
                
-               copy_v3_v3(ray_start_local, ray_start);
-               copy_v3_v3(ray_normal_local, ray_normal);
-               
-               mul_m4_v3(imat, ray_start_local);
-               mul_mat3_m4_v3(imat, ray_normal_local);
-               
+               mul_v3_m4v3(ray_start_local, imat, ray_start);
+               mul_v3_mat3_m4v3(ray_normal_local, imat, ray_normal);
                
                /* If number of vert is more than an arbitrary limit, 
                 * test against boundbox first
index d36ab46d14526de260758b84afc9cf78010db19a..87c886929d6c9a9dddaecfe97d4ca2bf321068c3 100644 (file)
@@ -1209,8 +1209,7 @@ static void particle_normal_ren(short ren_as, ParticleSettings *part, Render *re
                        sd->time = 0.0f;
                        sd->size = hasize;
 
-                       copy_v3_v3(vel, state->vel);
-                       mul_mat3_m4_v3(re->viewmat, vel);
+                       mul_v3_mat3_m4v3(vel, re->viewmat, state->vel);
                        normalize_v3(vel);
 
                        if (part->draw & PART_DRAW_VEL_LENGTH)
index 9ea7cb62c58544d429f098eeca44aca58cb273ce..5a5e67e1e436747b717ae1671f1948c0570b5015 100644 (file)
@@ -423,14 +423,11 @@ void shade_input_set_strand_texco(ShadeInput *shi, StrandRen *strand, StrandVert
                }
 
                if (texco & TEXCO_GLOB) {
-                       copy_v3_v3(shi->gl, shi->co);
-                       mul_m4_v3(R.viewinv, shi->gl);
+                       mul_v3_m4v3(shi->gl, R.viewinv, shi->co);
                        
                        if (shi->osatex) {
-                               copy_v3_v3(shi->dxgl, shi->dxco);
-                               mul_mat3_m4_v3(R.viewinv, shi->dxgl); 
-                               copy_v3_v3(shi->dygl, shi->dyco);
-                               mul_mat3_m4_v3(R.viewinv, shi->dygl);
+                               mul_v3_mat3_m4v3(shi->dxgl, R.viewinv, shi->dxco);
+                               mul_v3_mat3_m4v3(shi->dygl, R.viewinv, shi->dyco);
                        }
                }