diff options
Diffstat (limited to 'source/blender/blenkernel/intern')
37 files changed, 242 insertions, 370 deletions
diff --git a/source/blender/blenkernel/intern/BME_Customdata.c b/source/blender/blenkernel/intern/BME_Customdata.c index d8a6b66d5bb..1087b3a873c 100644 --- a/source/blender/blenkernel/intern/BME_Customdata.c +++ b/source/blender/blenkernel/intern/BME_Customdata.c @@ -36,9 +36,9 @@ #include <string.h> +#include "MEM_guardedalloc.h" #include "BKE_bmeshCustomData.h" #include "bmesh_private.h" -#include "MEM_guardedalloc.h" /********************* Layer type information **********************/ typedef struct BME_LayerTypeInfo { diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 663fbb89b4e..de7b962e38a 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1407,8 +1407,7 @@ static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, Object *ob, /* following Mesh convention; we use vertex coordinate itself * for normal in this case */ if (normalize_v3(no)==0.0) { - VECCOPY(no, vertexCos[i]); - normalize_v3(no); + normalize_v3_v3(no, vertexCos[i]); } } } @@ -2590,9 +2589,7 @@ void DM_add_tangent_layer(DerivedMesh *dm) for(j=0; j<len; j++) { vtang= find_vertex_tangent(vtangents[mf_vi[j]], mtface ? tf->uv[j] : uv[j]); - - VECCOPY(tangent[j], vtang); - normalize_v3(tangent[j]); + normalize_v3_v3(tangent[j], vtang); } } diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 89c637d8192..e27e3b2cd3f 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -40,7 +40,6 @@ #include "BLI_math.h" #include "BLI_rand.h" - #include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_group_types.h" @@ -49,7 +48,6 @@ #include "DNA_scene_types.h" #include "DNA_vfont_types.h" -//(INCLUDE_LINT)#include "BKE_anim.h" #include "BKE_curve.h" #include "BKE_DerivedMesh.h" #include "BKE_depsgraph.h" @@ -66,7 +64,6 @@ #include "BKE_utildefines.h" #include "BKE_depsgraph.h" -#include "ED_curve.h" /* for ED_curve_nurbs */ // XXX bad level call... diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index b86be371d66..41821f34ba8 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1283,9 +1283,8 @@ void vec_roll_to_mat3(float *vec, float roll, float mat[][3]) float nor[3], axis[3], target[3]={0,1,0}; float theta; float rMatrix[3][3], bMatrix[3][3]; - - VECCOPY (nor, vec); - normalize_v3(nor); + + normalize_v3_v3(nor, vec); /* Find Axis & Amount for bone matrix*/ cross_v3_v3v3(axis,target,nor); diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 82602a6951d..7ae65d0113a 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -659,9 +659,9 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti /* attack if in range */ if(closest_dist <= bbd->part->boids->range + pa->size + enemy_pa->size) { float damage = BLI_frand(); - float enemy_dir[3] = {bbd->wanted_co[0],bbd->wanted_co[1],bbd->wanted_co[2]}; + float enemy_dir[3]; - normalize_v3(enemy_dir); + normalize_v3_v3(enemy_dir, bbd->wanted_co); /* fight mode */ bbd->wanted_speed = 0.0f; @@ -786,8 +786,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro if(hit.index>=0) { t = hit.dist/col.ray_len; interp_v3_v3v3(ground_co, col.co1, col.co2, t); - VECCOPY(ground_nor, col.nor); - normalize_v3(ground_nor); + normalize_v3_v3(ground_nor, col.nor); return col.hit_ob; } else { @@ -1115,8 +1114,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) } VECCOPY(old_dir, pa->prev_state.ave); - VECCOPY(wanted_dir, bbd->wanted_co); - new_speed = normalize_v3(wanted_dir); + new_speed = normalize_v3_v3(wanted_dir, bbd->wanted_co); /* first check if we have valid direction we want to go towards */ if(new_speed == 0.0f) { @@ -1356,8 +1354,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* save direction to state.ave unless the boid is falling */ /* (boids can't effect their direction when falling) */ if(bpa->data.mode!=eBoidMode_Falling && len_v3(pa->state.vel) > 0.1*pa->size) { - VECCOPY(pa->state.ave, pa->state.vel); - normalize_v3(pa->state.ave); + normalize_v3_v3(pa->state.ave, pa->state.vel); } /* apply damping */ diff --git a/source/blender/blenkernel/intern/booleanops_mesh.c b/source/blender/blenkernel/intern/booleanops_mesh.c index 431e51cf149..dd595fc98b6 100644 --- a/source/blender/blenkernel/intern/booleanops_mesh.c +++ b/source/blender/blenkernel/intern/booleanops_mesh.c @@ -30,7 +30,6 @@ */ #include "CSG_BooleanOps.h" -#include "MEM_guardedalloc.h" diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 905515914b4..71a43994363 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -39,7 +39,6 @@ #include "DNA_windowmanager_types.h" #include "WM_types.h" -#include "WM_api.h" #include "RNA_access.h" diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index fb1e8c00991..ca81e216006 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1777,14 +1777,10 @@ void CDDM_calc_normals(DerivedMesh *dm) for(i = 0; i < numVerts; i++, mv++) { float *no = temp_nors[i]; - if (normalize_v3(no) == 0.0) { - VECCOPY(no, mv->co); - normalize_v3(no); - } + if (normalize_v3(no) == 0.0) + normalize_v3_v3(no, mv->co); - mv->no[0] = (short)(no[0] * 32767.0); - mv->no[1] = (short)(no[1] * 32767.0); - mv->no[2] = (short)(no[2] * 32767.0); + normal_float_to_short_v3(mv->no, no); } MEM_freeN(temp_nors); diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c index 3a9c15f654c..af12d23b2c2 100644 --- a/source/blender/blenkernel/intern/collision.c +++ b/source/blender/blenkernel/intern/collision.c @@ -691,8 +691,7 @@ CollPair* cloth_collision ( ModifierData *md1, ModifierData *md2, BVHTreeOverlap if ( distance <= ( epsilon1 + epsilon2 + ALMOST_ZERO ) ) { - VECCOPY ( collpair->normal, collpair->vector ); - normalize_v3( collpair->normal ); + normalize_v3_v3( collpair->normal, collpair->vector ); collpair->distance = distance; collpair->flag = 0; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index aae70c055d0..b415484c1c1 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -256,7 +256,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4 /* construct offs_bone the same way it is done in armature.c */ copy_m4_m3(offs_bone, pchan->bone->bone_mat); - VECCOPY(offs_bone[3], pchan->bone->head); + copy_v3_v3(offs_bone[3], pchan->bone->head); offs_bone[3][1]+= pchan->bone->parent->length; if (pchan->bone->flag & BONE_HINGE) { @@ -267,7 +267,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4 copy_m4_m4(tmat, pchan->bone->parent->arm_mat); /* the location of actual parent transform */ - VECCOPY(tmat[3], offs_bone[3]); + copy_v3_v3(tmat[3], offs_bone[3]); offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; mul_m4_v3(pchan->parent->pose_mat, tmat[3]); @@ -309,7 +309,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4 /* construct offs_bone the same way it is done in armature.c */ copy_m4_m3(offs_bone, pchan->bone->bone_mat); - VECCOPY(offs_bone[3], pchan->bone->head); + copy_v3_v3(offs_bone[3], pchan->bone->head); offs_bone[3][1]+= pchan->bone->parent->length; if (pchan->bone->flag & BONE_HINGE) { @@ -320,8 +320,8 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4 copy_m4_m4(tmat, pchan->bone->parent->arm_mat); /* the location of actual parent transform */ - VECCOPY(tmat[3], offs_bone[3]); - offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f; + copy_v3_v3(tmat[3], offs_bone[3]); + zero_v3(offs_bone[3]); mul_m4_v3(pchan->parent->pose_mat, tmat[3]); mul_m4_m4m4(diff_mat, offs_bone, tmat); @@ -400,7 +400,7 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, f DerivedMesh *dm = NULL; Mesh *me= ob->data; EditMesh *em = BKE_mesh_get_editmesh(me); - float vec[3] = {0.0f, 0.0f, 0.0f}, tvec[3]; + float vec[3] = {0.0f, 0.0f, 0.0f}; float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3]; float imat[3][3], tmat[3][3]; int dgroup; @@ -477,9 +477,9 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, f mul_m3_v3(tmat, normal); normalize_v3(normal); - VECCOPY(plane, tmat[1]); + copy_v3_v3(plane, tmat[1]); - VECCOPY(tmat[2], normal); + copy_v3_v3(tmat[2], normal); cross_v3_v3v3(tmat[0], normal, plane); cross_v3_v3v3(tmat[1], tmat[2], tmat[0]); @@ -488,8 +488,7 @@ static void contarget_get_mesh_mat (Scene *scene, Object *ob, char *substring, f /* apply the average coordinate as the new location */ - mul_v3_m4v3(tvec, ob->obmat, vec); - VECCOPY(mat[3], tvec); + mul_v3_m4v3(mat[3], ob->obmat, vec); } } @@ -554,7 +553,7 @@ static void contarget_get_lattice_mat (Object *ob, char *substring, float mat[][ mul_v3_m4v3(tvec, ob->obmat, vec); /* copy new location to matrix */ - VECCOPY(mat[3], tvec); + copy_v3_v3(mat[3], tvec); } /* generic function to get the appropriate matrix for most target cases */ @@ -819,11 +818,11 @@ static void childof_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta copy_m4_m4(invmat, data->invmat); /* extract components of both matrices */ - VECCOPY(loc, ct->matrix[3]); + copy_v3_v3(loc, ct->matrix[3]); mat4_to_eulO(eul, ct->rotOrder, ct->matrix); mat4_to_size(size, ct->matrix); - VECCOPY(loco, invmat[3]); + copy_v3_v3(loco, invmat[3]); mat4_to_eulO(eulo, cob->rotOrder, invmat); mat4_to_size(sizo, invmat); @@ -940,9 +939,8 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh float right[3]; float neg = -1; int right_index; - - copy_v3_v3(n, vec); - if (normalize_v3(n) == 0.0) { + + if (normalize_v3_v3(n, vec) == 0.0) { n[0] = 0.0; n[1] = 0.0; n[2] = 1.0; @@ -953,9 +951,7 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh /* n specifies the transformation of the track axis */ if (flags & TARGET_Z_UP) { /* target Z axis is the global up axis */ - u[0] = target_up[0]; - u[1] = target_up[1]; - u[2] = target_up[2]; + copy_v3_v3(u, target_up); } else { /* world Z axis is the global up axis */ @@ -988,20 +984,13 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh m[right_index][1] = neg * right[1]; m[right_index][2] = neg * right[2]; - m[upflag][0] = proj[0]; - m[upflag][1] = proj[1]; - m[upflag][2] = proj[2]; + copy_v3_v3(m[upflag], proj); - m[axis][0] = n[0]; - m[axis][1] = n[1]; - m[axis][2] = n[2]; + copy_v3_v3(m[axis], n); } /* identity matrix - don't do anything if the two axes are the same */ else { - m[0][0]= m[1][1]= m[2][2]= 1.0; - m[0][1]= m[0][2]= 0.0; - m[1][0]= m[1][2]= 0.0; - m[2][0]= m[2][1]= 0.0; + unit_m3(m); } } @@ -1264,7 +1253,7 @@ static void followpath_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr copy_m4_m4(totmat, rmat); } - VECCOPY(totmat[3], vec); + copy_v3_v3(totmat[3], vec); mul_serie_m4(ct->matrix, ct->tar->obmat, totmat, NULL, NULL, NULL, NULL, NULL, NULL); } @@ -1383,7 +1372,7 @@ static void rotlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t float eul[3]; float size[3]; - VECCOPY(loc, cob->matrix[3]); + copy_v3_v3(loc, cob->matrix[3]); mat4_to_size(size, cob->matrix); mat4_to_eulO(eul, cob->rotOrder, cob->matrix); @@ -1544,7 +1533,7 @@ static void loclike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta float offset[3] = {0.0f, 0.0f, 0.0f}; if (data->flag & LOCLIKE_OFFSET) - VECCOPY(offset, cob->matrix[3]); + copy_v3_v3(offset, cob->matrix[3]); if (data->flag & LOCLIKE_X) { cob->matrix[3][0] = ct->matrix[3][0]; @@ -1636,7 +1625,7 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta float eul[3], obeul[3]; float size[3]; - VECCOPY(loc, cob->matrix[3]); + copy_v3_v3(loc, cob->matrix[3]); mat4_to_size(size, cob->matrix); /* to allow compatible rotations, must get both rotations in the order of the owner... */ @@ -2138,7 +2127,7 @@ static void actcon_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstraint } else { /* extract location */ - VECCOPY(vec, tempmat[3]); + copy_v3_v3(vec, tempmat[3]); axis= data->type - 20; } @@ -2294,10 +2283,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(totmat[1]); /* the x axis is fixed */ - totmat[0][0] = cob->matrix[0][0]; - totmat[0][1] = cob->matrix[0][1]; - totmat[0][2] = cob->matrix[0][2]; - normalize_v3(totmat[0]); + normalize_v3_v3(totmat[0], cob->matrix[0]); /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); @@ -2311,10 +2297,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(totmat[2]); /* the x axis is fixed */ - totmat[0][0] = cob->matrix[0][0]; - totmat[0][1] = cob->matrix[0][1]; - totmat[0][2] = cob->matrix[0][2]; - normalize_v3(totmat[0]); + normalize_v3_v3(totmat[0], cob->matrix[0]); /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); @@ -2329,10 +2312,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * negate_v3(totmat[1]); /* the x axis is fixed */ - totmat[0][0] = cob->matrix[0][0]; - totmat[0][1] = cob->matrix[0][1]; - totmat[0][2] = cob->matrix[0][2]; - normalize_v3(totmat[0]); + normalize_v3_v3(totmat[0], cob->matrix[0]); /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); @@ -2347,10 +2327,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * negate_v3(totmat[2]); /* the x axis is fixed */ - totmat[0][0] = cob->matrix[0][0]; - totmat[0][1] = cob->matrix[0][1]; - totmat[0][2] = cob->matrix[0][2]; - normalize_v3(totmat[0]); + normalize_v3_v3(totmat[0], cob->matrix[0]); /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); @@ -2358,9 +2335,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * break; default: { - totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0; - totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0; - totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1; + unit_m3(totmat); } break; } @@ -2377,11 +2352,8 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(totmat[0]); /* the y axis is fixed */ - totmat[1][0] = cob->matrix[1][0]; - totmat[1][1] = cob->matrix[1][1]; - totmat[1][2] = cob->matrix[1][2]; - normalize_v3(totmat[1]); - + normalize_v3_v3(totmat[1], cob->matrix[1]); + /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); } @@ -2394,10 +2366,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(totmat[2]); /* the y axis is fixed */ - totmat[1][0] = cob->matrix[1][0]; - totmat[1][1] = cob->matrix[1][1]; - totmat[1][2] = cob->matrix[1][2]; - normalize_v3(totmat[1]); + normalize_v3_v3(totmat[1], cob->matrix[1]); /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); @@ -2412,10 +2381,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * negate_v3(totmat[0]); /* the y axis is fixed */ - totmat[1][0] = cob->matrix[1][0]; - totmat[1][1] = cob->matrix[1][1]; - totmat[1][2] = cob->matrix[1][2]; - normalize_v3(totmat[1]); + normalize_v3_v3(totmat[1], cob->matrix[1]); /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[2], totmat[0], totmat[1]); @@ -2430,10 +2396,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * negate_v3(totmat[2]); /* the y axis is fixed */ - totmat[1][0] = cob->matrix[1][0]; - totmat[1][1] = cob->matrix[1][1]; - totmat[1][2] = cob->matrix[1][2]; - normalize_v3(totmat[1]); + normalize_v3_v3(totmat[1], cob->matrix[1]); /* the z axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); @@ -2441,9 +2404,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * break; default: { - totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0; - totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0; - totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1; + unit_m3(totmat); } break; } @@ -2460,10 +2421,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(totmat[0]); /* the z axis is fixed */ - totmat[2][0] = cob->matrix[2][0]; - totmat[2][1] = cob->matrix[2][1]; - totmat[2][2] = cob->matrix[2][2]; - normalize_v3(totmat[2]); + normalize_v3_v3(totmat[2], cob->matrix[2]); /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); @@ -2477,10 +2435,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(totmat[1]); /* the z axis is fixed */ - totmat[2][0] = cob->matrix[2][0]; - totmat[2][1] = cob->matrix[2][1]; - totmat[2][2] = cob->matrix[2][2]; - normalize_v3(totmat[2]); + normalize_v3_v3(totmat[2], cob->matrix[2]); /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); @@ -2495,10 +2450,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * negate_v3(totmat[0]); /* the z axis is fixed */ - totmat[2][0] = cob->matrix[2][0]; - totmat[2][1] = cob->matrix[2][1]; - totmat[2][2] = cob->matrix[2][2]; - normalize_v3(totmat[2]); + normalize_v3_v3(totmat[2], cob->matrix[2]); /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[1], totmat[2], totmat[0]); @@ -2513,10 +2465,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * negate_v3(totmat[1]); /* the z axis is fixed */ - totmat[2][0] = cob->matrix[2][0]; - totmat[2][1] = cob->matrix[2][1]; - totmat[2][2] = cob->matrix[2][2]; - normalize_v3(totmat[2]); + normalize_v3_v3(totmat[2], cob->matrix[2]); /* the x axis gets mapped onto a third orthogonal vector */ cross_v3_v3v3(totmat[0], totmat[1], totmat[2]); @@ -2524,9 +2473,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * break; default: { - totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0; - totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0; - totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1; + unit_m3(totmat); } break; } @@ -2534,19 +2481,13 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * break; default: { - totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0; - totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0; - totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1; + unit_m3(totmat); } break; } /* Block to keep matrix heading */ - tmpmat[0][0] = cob->matrix[0][0];tmpmat[0][1] = cob->matrix[0][1];tmpmat[0][2] = cob->matrix[0][2]; - tmpmat[1][0] = cob->matrix[1][0];tmpmat[1][1] = cob->matrix[1][1];tmpmat[1][2] = cob->matrix[1][2]; - tmpmat[2][0] = cob->matrix[2][0];tmpmat[2][1] = cob->matrix[2][1];tmpmat[2][2] = cob->matrix[2][2]; - normalize_v3(tmpmat[0]); - normalize_v3(tmpmat[1]); - normalize_v3(tmpmat[2]); + copy_m3_m4(tmpmat, cob->matrix); + normalize_m3(tmpmat); invert_m3_m3(invmat, tmpmat); mul_m3_m3m3(tmpmat, totmat, invmat); totmat[0][0] = tmpmat[0][0];totmat[0][1] = tmpmat[0][1];totmat[0][2] = tmpmat[0][2]; @@ -2559,9 +2500,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * totmat[1][0],totmat[1][1],totmat[1][2], totmat[2][0],totmat[2][1],totmat[2][2]); if (mdet==0) { - totmat[0][0] = 1;totmat[0][1] = 0;totmat[0][2] = 0; - totmat[1][0] = 0;totmat[1][1] = 1;totmat[1][2] = 0; - totmat[2][0] = 0;totmat[2][1] = 0;totmat[2][2] = 1; + unit_m3(totmat); } /* apply out transformaton to the object */ @@ -2689,7 +2628,7 @@ static void distlimit_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * interp_v3_v3v3(dvec, ct->matrix[3], cob->matrix[3], sfac); /* copy new vector onto owner */ - VECCOPY(cob->matrix[3], dvec); + copy_v3_v3(cob->matrix[3], dvec); } } } @@ -2772,16 +2711,10 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * mat4_to_size(size, cob->matrix); /* store X orientation before destroying obmat */ - xx[0] = cob->matrix[0][0]; - xx[1] = cob->matrix[0][1]; - xx[2] = cob->matrix[0][2]; - normalize_v3(xx); + normalize_v3_v3(xx, cob->matrix[0]); /* store Z orientation before destroying obmat */ - zz[0] = cob->matrix[2][0]; - zz[1] = cob->matrix[2][1]; - zz[2] = cob->matrix[2][2]; - normalize_v3(zz); + normalize_v3_v3(zz, cob->matrix[2]); sub_v3_v3v3(vec, cob->matrix[3], ct->matrix[3]); vec[0] /= size[0]; @@ -2836,9 +2769,7 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(vec); /* new Y aligns object target connection*/ - totmat[1][0] = -vec[0]; - totmat[1][1] = -vec[1]; - totmat[1][2] = -vec[2]; + negate_v3_v3(totmat[1], vec); switch (data->plane) { case PLANE_X: /* build new Z vector */ @@ -2847,16 +2778,11 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(orth); /* new Z*/ - totmat[2][0] = orth[0]; - totmat[2][1] = orth[1]; - totmat[2][2] = orth[2]; + copy_v3_v3(totmat[2], orth); /* we decided to keep X plane*/ cross_v3_v3v3(xx, orth, vec); - normalize_v3(xx); - totmat[0][0] = xx[0]; - totmat[0][1] = xx[1]; - totmat[0][2] = xx[2]; + normalize_v3_v3(totmat[0], xx); break; case PLANE_Z: /* build new X vector */ @@ -2865,16 +2791,11 @@ static void stretchto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * normalize_v3(orth); /* new X */ - totmat[0][0] = -orth[0]; - totmat[0][1] = -orth[1]; - totmat[0][2] = -orth[2]; + negate_v3_v3(totmat[0], orth); /* we decided to keep Z */ cross_v3_v3v3(zz, orth, vec); - normalize_v3(zz); - totmat[2][0] = zz[0]; - totmat[2][1] = zz[1]; - totmat[2][2] = zz[2]; + normalize_v3_v3(totmat[2], zz); break; } /* switch (data->plane) */ @@ -3006,10 +2927,10 @@ static void minmax_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *tar obmat[3][index] = tarmat[3][index] + data->offset; if (data->flag & MINMAX_STICKY) { if (data->flag & MINMAX_STUCK) { - VECCOPY(obmat[3], data->cache); + copy_v3_v3(obmat[3], data->cache); } else { - VECCOPY(data->cache, obmat[3]); + copy_v3_v3(data->cache, obmat[3]); data->flag |= MINMAX_STUCK; } } @@ -3019,7 +2940,7 @@ static void minmax_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *tar copy_m4_m4(cob->matrix, tmat); } else { - VECCOPY(cob->matrix[3], obmat[3]); + copy_v3_v3(cob->matrix[3], obmat[3]); } } else { @@ -3174,7 +3095,7 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta copy_m4_m4(obmat, cob->matrix); unit_m4(targetMatrix); - VECCOPY(ownLoc, obmat[3]); + copy_v3_v3(ownLoc, obmat[3]); INIT_MINMAX(curveMin, curveMax) minmax_object(ct->tar, curveMin, curveMax); @@ -3263,14 +3184,14 @@ static void clampto_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta /* 3. position on curve */ if (where_on_path(ct->tar, curvetime, vec, dir, NULL, NULL, NULL) ) { unit_m4(totmat); - VECCOPY(totmat[3], vec); + copy_v3_v3(totmat[3], vec); mul_serie_m4(targetMatrix, ct->tar->obmat, totmat, NULL, NULL, NULL, NULL, NULL, NULL); } } /* obtain final object position */ - VECCOPY(cob->matrix[3], targetMatrix[3]); + copy_v3_v3(cob->matrix[3], targetMatrix[3]); } } @@ -3362,7 +3283,7 @@ static void transform_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * } /* extract components of owner's matrix */ - VECCOPY(loc, cob->matrix[3]); + copy_v3_v3(loc, cob->matrix[3]); mat4_to_eulO(eul, cob->rotOrder, cob->matrix); mat4_to_size(size, cob->matrix); @@ -3556,7 +3477,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr fail = TRUE; break; } - VECCOPY(co, hit.co); + copy_v3_v3(co, hit.co); break; } @@ -3572,7 +3493,7 @@ static void shrinkwrap_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstr /* co is in local object coordinates, change it to global and update target position */ mul_m4_v3(cob->matrix, co); - VECCOPY(ct->matrix[3], co); + copy_v3_v3(ct->matrix[3], co); } } } @@ -3584,7 +3505,7 @@ static void shrinkwrap_evaluate (bConstraint *con, bConstraintOb *cob, ListBase /* only evaluate if there is a target */ if (VALID_CONS_TARGET(ct)) { - VECCOPY(cob->matrix[3], ct->matrix[3]); + copy_v3_v3(cob->matrix[3], ct->matrix[3]); } } @@ -3668,23 +3589,23 @@ static void damptrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * * - the normalisation step at the end should take care of any unwanted scaling * left over in the 3x3 matrix we used */ - VECCOPY(obvec, track_dir_vecs[data->trackflag]); + copy_v3_v3(obvec, track_dir_vecs[data->trackflag]); mul_mat3_m4_v3(cob->matrix, obvec); if (normalize_v3(obvec) == 0.0f) { /* exceptional case - just use the track vector as appropriate */ - VECCOPY(obvec, track_dir_vecs[data->trackflag]); + copy_v3_v3(obvec, track_dir_vecs[data->trackflag]); } /* find the (unit) direction vector going from the owner to the target */ - VECCOPY(obloc, cob->matrix[3]); + copy_v3_v3(obloc, cob->matrix[3]); sub_v3_v3v3(tarvec, ct->matrix[3], obloc); if (normalize_v3(tarvec) == 0.0f) { /* the target is sitting on the owner, so just make them use the same direction vectors */ // FIXME: or would it be better to use the pure direction vector? - VECCOPY(tarvec, obvec); - //VECCOPY(tarvec, track_dir_vecs[data->trackflag]); + copy_v3_v3(tarvec, obvec); + //copy_v3_v3(tarvec, track_dir_vecs[data->trackflag]); } /* determine the axis-angle rotation, which represents the smallest possible rotation @@ -3712,7 +3633,7 @@ static void damptrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase * mul_m4_m3m4(tmat, rmat, cob->matrix); // m1, m3, m2 copy_m4_m4(cob->matrix, tmat); - VECCOPY(cob->matrix[3], obloc); + copy_v3_v3(cob->matrix[3], obloc); } } @@ -3907,7 +3828,7 @@ static void pivotcon_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *t } else { /* directly use the 'offset' specified as an absolute position instead */ - VECCOPY(pivot, data->offset); + copy_v3_v3(pivot, data->offset); } } diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 1f8360324d5..382c0690ae3 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -41,6 +41,8 @@ #include "DNA_screen_types.h" #include "DNA_windowmanager_types.h" +#include "MEM_guardedalloc.h" + #include "BLI_ghash.h" #include "BKE_animsys.h" @@ -59,13 +61,7 @@ #include "BKE_scene.h" #include "BKE_screen.h" -#include "MEM_guardedalloc.h" - -#ifndef DISABLE_PYTHON -#include "BPY_extern.h" -#endif - - #include "depsgraph_private.h" +#include "depsgraph_private.h" /* Queue and stack operations for dag traversal * @@ -2180,7 +2176,7 @@ void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay) dag_object_time_update_flags(scene->camera); /* and store the info in groupobject */ - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { for(go= group->gobject.first; go; go= go->next) { go->recalc= go->ob->recalc; diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 5f55814341b..6f6d405dd90 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -662,8 +662,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin where_is_object_time(eff->scene, ob, cfra); /* use z-axis as normal*/ - VECCOPY(efd->nor, ob->obmat[2]); - normalize_v3(efd->nor); + normalize_v3_v3(efd->nor, ob->obmat[2]); /* for vortex the shape chooses between old / new force */ if(eff->pd && eff->pd->shape == PFIELD_SHAPE_PLANE) { @@ -707,8 +706,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin else { /* for some effectors we need the object center every time */ sub_v3_v3v3(efd->vec_to_point2, point->loc, eff->ob->obmat[3]); - VECCOPY(efd->nor2, eff->ob->obmat[2]); - normalize_v3(efd->nor2); + normalize_v3_v3(efd->nor2, eff->ob->obmat[2]); } } diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index 8a6f0af87d1..04ce6c39694 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -50,7 +50,6 @@ #include "BKE_global.h" #include "BKE_modifier.h" #include "BKE_mesh.h" -#include "BKE_pointcache.h" #include "BKE_utildefines.h" // headers for fluidsim bobj meshes diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 3271749643a..124e6365777 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -43,10 +43,6 @@ #include "BKE_idprop.h" #include "BKE_utildefines.h" -#ifndef DISABLE_PYTHON -#include "BPY_extern.h" /* for BPY_eval_driver() */ -#endif - #define SMALL -1.0e-10 #define SELECT 1 diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index 6377a6f6ccd..bdf203119c3 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -69,21 +69,22 @@ void free_group_objects(Group *group) void unlink_group(Group *group) { + Main *bmain= G.main; Material *ma; Object *ob; Scene *sce; SceneRenderLayer *srl; ParticleSystem *psys; - for(ma= G.main->mat.first; ma; ma= ma->id.next) { + for(ma= bmain->mat.first; ma; ma= ma->id.next) { if(ma->group==group) ma->group= NULL; } - for(ma= G.main->mat.first; ma; ma= ma->id.next) { + for(ma= bmain->mat.first; ma; ma= ma->id.next) { if(ma->group==group) ma->group= NULL; } - for (sce= G.main->scene.first; sce; sce= sce->id.next) { + for (sce= bmain->scene.first; sce; sce= sce->id.next) { Base *base= sce->base.first; /* ensure objects are not in this group */ @@ -100,7 +101,7 @@ void unlink_group(Group *group) } } - for(ob= G.main->object.first; ob; ob= ob->id.next) { + for(ob= bmain->object.first; ob; ob= ob->id.next) { bActionStrip *strip; if(ob->dup_group==group) { diff --git a/source/blender/blenkernel/intern/implicit.c b/source/blender/blenkernel/intern/implicit.c index d544174b0d4..158f964a846 100644 --- a/source/blender/blenkernel/intern/implicit.c +++ b/source/blender/blenkernel/intern/implicit.c @@ -1626,9 +1626,8 @@ static void cloth_calc_force(ClothModifierData *clmd, float frame, lfVector *lF, CalcFloat4(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],lX[mfaces[i].v4],triunnormal); else CalcFloat(lX[mfaces[i].v1],lX[mfaces[i].v2],lX[mfaces[i].v3],triunnormal); - - VECCOPY(trinormal, triunnormal); - normalize_v3(trinormal); + + normalize_v3_v3(trinormal, triunnormal); // add wind from v1 VECCOPY(tmp, trinormal); diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 6b79a7b4d62..9774e97f69b 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -56,10 +56,6 @@ #include "BKE_node.h" #include "BKE_utildefines.h" -#ifndef DISABLE_PYTHON -#include "BPY_extern.h" -#endif - #include "GPU_material.h" /* used in UI and render */ @@ -236,6 +232,7 @@ Material *copy_material(Material *ma) void make_local_material(Material *ma) { + Main *bmain= G.main; Object *ob; Mesh *me; Curve *cu; @@ -261,7 +258,7 @@ void make_local_material(Material *ma) } /* test objects */ - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if(ob->mat) { for(a=0; a<ob->totcol; a++) { @@ -274,7 +271,7 @@ void make_local_material(Material *ma) ob= ob->id.next; } /* test meshes */ - me= G.main->mesh.first; + me= bmain->mesh.first; while(me) { if(me->mat) { for(a=0; a<me->totcol; a++) { @@ -287,7 +284,7 @@ void make_local_material(Material *ma) me= me->id.next; } /* test curves */ - cu= G.main->curve.first; + cu= bmain->curve.first; while(cu) { if(cu->mat) { for(a=0; a<cu->totcol; a++) { @@ -300,7 +297,7 @@ void make_local_material(Material *ma) cu= cu->id.next; } /* test mballs */ - mb= G.main->mball.first; + mb= bmain->mball.first; while(mb) { if(mb->mat) { for(a=0; a<mb->totcol; a++) { @@ -329,7 +326,7 @@ void make_local_material(Material *ma) man->id.us= 0; /* do objects */ - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if(ob->mat) { for(a=0; a<ob->totcol; a++) { @@ -345,7 +342,7 @@ void make_local_material(Material *ma) ob= ob->id.next; } /* do meshes */ - me= G.main->mesh.first; + me= bmain->mesh.first; while(me) { if(me->mat) { for(a=0; a<me->totcol; a++) { @@ -361,7 +358,7 @@ void make_local_material(Material *ma) me= me->id.next; } /* do curves */ - cu= G.main->curve.first; + cu= bmain->curve.first; while(cu) { if(cu->mat) { for(a=0; a<cu->totcol; a++) { @@ -377,7 +374,7 @@ void make_local_material(Material *ma) cu= cu->id.next; } /* do mballs */ - mb= G.main->mball.first; + mb= bmain->mball.first; while(mb) { if(mb->mat) { for(a=0; a<mb->totcol; a++) { diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 7129ecb1d55..94131fdbe9d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -265,6 +265,7 @@ void make_local_tface(Mesh *me) void make_local_mesh(Mesh *me) { + Main *bmain= G.main; Object *ob; Mesh *men; int local=0, lib=0; @@ -285,7 +286,7 @@ void make_local_mesh(Mesh *me) return; } - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if( me==get_mesh(ob) ) { if(ob->id.lib) lib= 1; @@ -306,7 +307,7 @@ void make_local_mesh(Mesh *me) men= copy_mesh(me); men->id.us= 0; - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if( me==get_mesh(ob) ) { if(ob->id.lib==0) { @@ -925,6 +926,7 @@ int nurbs_to_mdata_customdb(Object *ob, ListBase *dispbase, MVert **allvert, int /* this may fail replacing ob->data, be sure to check ob->type */ void nurbs_to_mesh(Object *ob) { + Main *bmain= G.main; Object *ob1; DerivedMesh *dm= ob->derivedFinal; Mesh *me; @@ -967,13 +969,13 @@ void nurbs_to_mesh(Object *ob) cu->totcol= 0; if(ob->data) { - free_libblock(&G.main->curve, ob->data); + free_libblock(&bmain->curve, ob->data); } ob->data= me; ob->type= OB_MESH; /* other users */ - ob1= G.main->object.first; + ob1= bmain->object.first; while(ob1) { if(ob1->data==cu) { ob1->type= OB_MESH; @@ -1234,14 +1236,10 @@ void mesh_calc_normals(MVert *mverts, int numVerts, MFace *mfaces, int numFaces, MVert *mv= &mverts[i]; float *no= tnorms[i]; - if (normalize_v3(no)==0.0) { - VECCOPY(no, mv->co); - normalize_v3(no); - } + if (normalize_v3(no)==0.0) + normalize_v3_v3(no, mv->co); - mv->no[0]= (short)(no[0]*32767.0); - mv->no[1]= (short)(no[1]*32767.0); - mv->no[2]= (short)(no[2]*32767.0); + normal_float_to_short_v3(mv->no, no); } MEM_freeN(tnorms); diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index ea118e4a53c..63f0f1fa091 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -34,16 +34,18 @@ * */ -#include "stddef.h" -#include "string.h" -#include "stdarg.h" -#include "math.h" -#include "float.h" +#include <stddef.h> +#include <string.h> +#include <stdarg.h> +#include <math.h> +#include <float.h> #include "DNA_armature_types.h" #include "DNA_object_types.h" #include "DNA_meshdata_types.h" +#include "MEM_guardedalloc.h" + #include "BKE_bmesh.h" #include "BKE_cloth.h" #include "BKE_key.h" diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index ea30b33655f..9dca0fa82e4 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -45,7 +45,6 @@ #include "PIL_time.h" -#include "MEM_guardedalloc.h" #include "CMP_node.h" #include "intern/CMP_util.h" /* stupid include path... */ diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 115cfac7627..b43cf72b94b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -322,6 +322,7 @@ static void unlink_object__unlinkModifierLinks(void *userData, Object *ob, Objec void unlink_object(Scene *scene, Object *ob) { + Main *bmain= G.main; Object *obt; Material *mat; World *wrld; @@ -343,7 +344,7 @@ void unlink_object(Scene *scene, Object *ob) /* check all objects: parents en bevels and fields, also from libraries */ // FIXME: need to check all animation blocks (drivers) - obt= G.main->object.first; + obt= bmain->object.first; while(obt) { if(obt->proxy==ob) obt->proxy= NULL; @@ -517,7 +518,7 @@ void unlink_object(Scene *scene, Object *ob) } /* materials */ - mat= G.main->mat.first; + mat= bmain->mat.first; while(mat) { for(a=0; a<MAX_MTEX; a++) { @@ -531,7 +532,7 @@ void unlink_object(Scene *scene, Object *ob) } /* textures */ - tex= G.main->tex.first; + tex= bmain->tex.first; while(tex) { if(tex->env) { if(tex->env->object == ob) tex->env->object= NULL; @@ -540,7 +541,7 @@ void unlink_object(Scene *scene, Object *ob) } /* worlds */ - wrld= G.main->world.first; + wrld= bmain->world.first; while(wrld) { if(wrld->id.lib==NULL) { for(a=0; a<MAX_MTEX; a++) { @@ -553,7 +554,7 @@ void unlink_object(Scene *scene, Object *ob) } /* scenes */ - sce= G.main->scene.first; + sce= bmain->scene.first; while(sce) { if(sce->id.lib==NULL) { if(sce->camera==ob) sce->camera= NULL; @@ -585,7 +586,7 @@ void unlink_object(Scene *scene, Object *ob) #if 0 // XXX old animation system /* ipos */ - ipo= G.main->ipo.first; + ipo= bmain->ipo.first; while(ipo) { if(ipo->id.lib==NULL) { IpoCurve *icu; @@ -599,7 +600,7 @@ void unlink_object(Scene *scene, Object *ob) #endif // XXX old animation system /* screens */ - sc= G.main->screen.first; + sc= bmain->screen.first; while(sc) { ScrArea *sa= sc->areabase.first; while(sa) { @@ -664,14 +665,14 @@ void unlink_object(Scene *scene, Object *ob) } /* groups */ - group= G.main->group.first; + group= bmain->group.first; while(group) { rem_from_group(group, ob, NULL, NULL); group= group->id.next; } /* cameras */ - camera= G.main->camera.first; + camera= bmain->camera.first; while(camera) { if (camera->dof_ob==ob) { camera->dof_ob = NULL; @@ -725,6 +726,7 @@ Camera *copy_camera(Camera *cam) void make_local_camera(Camera *cam) { + Main *bmain= G.main; Object *ob; Camera *camn; int local=0, lib=0; @@ -742,7 +744,7 @@ void make_local_camera(Camera *cam) return; } - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if(ob->data==cam) { if(ob->id.lib) lib= 1; @@ -760,7 +762,7 @@ void make_local_camera(Camera *cam) camn= copy_camera(cam); camn->id.us= 0; - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if(ob->data==cam) { @@ -873,6 +875,7 @@ Lamp *copy_lamp(Lamp *la) void make_local_lamp(Lamp *la) { + Main *bmain= G.main; Object *ob; Lamp *lan; int local=0, lib=0; @@ -890,7 +893,7 @@ void make_local_lamp(Lamp *la) return; } - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if(ob->data==la) { if(ob->id.lib) lib= 1; @@ -908,7 +911,7 @@ void make_local_lamp(Lamp *la) lan= copy_lamp(la); lan->id.us= 0; - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if(ob->data==la) { @@ -1366,6 +1369,7 @@ void expand_local_object(Object *ob) void make_local_object(Object *ob) { + Main *bmain= G.main; Object *obn; Scene *sce; Base *base; @@ -1387,7 +1391,7 @@ void make_local_object(Object *ob) } else { - sce= G.main->scene.first; + sce= bmain->scene.first; while(sce) { base= sce->base.first; while(base) { @@ -1410,7 +1414,7 @@ void make_local_object(Object *ob) obn= copy_object(ob); obn->id.us= 0; - sce= G.main->scene.first; + sce= bmain->scene.first; while(sce) { if(sce->id.lib==0) { base= sce->base.first; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 3343df6b8a7..ffb99c10c40 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -25,7 +25,6 @@ * ***** END GPL LICENSE BLOCK ***** */ -#include "MEM_guardedalloc.h" #include "DNA_object_types.h" #include "DNA_mesh_types.h" diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 7b3638f0e33..681c48b0cf8 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -624,8 +624,7 @@ static float psys_render_projected_area(ParticleSystem *psys, float *center, flo mul_m4_v4(data->viewmat, co); /* compute two vectors orthogonal to view vector */ - VECCOPY(view, co); - normalize_v3(view); + normalize_v3_v3(view, co); ortho_basis_v3v3_v3( ortho1, ortho2,view); /* compute on screen minification */ @@ -1923,8 +1922,7 @@ static void do_prekink(ParticleKey *state, ParticleKey *par, float *par_rot, flo mul_qt_v3(q2,z_vec); VECSUB(vec_from_par,state->co,par->co); - VECCOPY(vec_one,vec_from_par); - radius=normalize_v3(vec_one); + radius= normalize_v3_v3(vec_one, vec_from_par); inp_y=dot_v3v3(y_vec,vec_one); inp_z=dot_v3v3(z_vec,vec_one); @@ -2929,8 +2927,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) if(k == 1) { /* calculate initial tangent for incremental rotations */ VECSUB(tangent, ca->co, (ca - 1)->co); - VECCOPY(prev_tangent, tangent); - normalize_v3(prev_tangent); + normalize_v3_v3(prev_tangent, tangent); /* First rotation is based on emitting face orientation. */ /* This is way better than having flipping rotations resulting */ @@ -3106,8 +3103,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf if(k == 1) { /* calculate initial tangent for incremental rotations */ VECSUB(tangent, ca->co, (ca - 1)->co); - VECCOPY(prev_tangent, tangent); - normalize_v3(prev_tangent); + normalize_v3_v3(prev_tangent, tangent); /* First rotation is based on emitting face orientation. */ /* This is way better than having flipping rotations resulting */ @@ -4371,20 +4367,14 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] onevec[bb->align]=1.0f; if(bb->lock && (bb->align == PART_BB_VIEW)) { - VECCOPY(xvec, bb->ob->obmat[0]); - normalize_v3(xvec); - - VECCOPY(yvec, bb->ob->obmat[1]); - normalize_v3(yvec); - - VECCOPY(zvec, bb->ob->obmat[2]); - normalize_v3(zvec); + normalize_v3_v3(xvec, bb->ob->obmat[0]); + normalize_v3_v3(yvec, bb->ob->obmat[1]); + normalize_v3_v3(zvec, bb->ob->obmat[2]); } else if(bb->align == PART_BB_VEL) { float temp[3]; - VECCOPY(temp, bb->vel); - normalize_v3(temp); + normalize_v3_v3(temp, bb->vel); VECSUB(zvec, bb->ob->obmat[3], bb->vec); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 9b9c3ff16b6..cfbab609f37 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1729,8 +1729,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, mul_qt_v3(rot, vtan); mul_qt_v3(rot, utan); - VECCOPY(p_vel, state.vel); - speed=normalize_v3(p_vel); + speed= normalize_v3_v3(p_vel, state.vel); mul_v3_fl(p_vel, dot_v3v3(r_vel, p_vel)); VECSUB(p_vel, r_vel, p_vel); normalize_v3(p_vel); @@ -1871,18 +1870,15 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, /* *emitter object orientation */ if(part->ob_vel[0]!=0.0) { - VECCOPY(vec, ob->obmat[0]); - normalize_v3(vec); + normalize_v3_v3(vec, ob->obmat[0]); VECADDFAC(vel, vel, vec, part->ob_vel[0]); } if(part->ob_vel[1]!=0.0) { - VECCOPY(vec, ob->obmat[1]); - normalize_v3(vec); + normalize_v3_v3(vec, ob->obmat[1]); VECADDFAC(vel, vel, vec, part->ob_vel[1]); } if(part->ob_vel[2]!=0.0) { - VECCOPY(vec, ob->obmat[2]); - normalize_v3(vec); + normalize_v3_v3(vec, ob->obmat[2]); VECADDFAC(vel, vel, vec, part->ob_vel[2]); } diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 6cf49808ec7..a35e40d7cf7 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2240,7 +2240,7 @@ void BKE_ptcache_remove(void) static int CONTINUE_PHYSICS = 0; -void BKE_ptcache_set_continue_physics(Scene *scene, int enable) +void BKE_ptcache_set_continue_physics(Main *bmain, Scene *scene, int enable) { Object *ob; @@ -2248,7 +2248,7 @@ void BKE_ptcache_set_continue_physics(Scene *scene, int enable) CONTINUE_PHYSICS = enable; if(CONTINUE_PHYSICS == 0) { - for(ob=G.main->object.first; ob; ob=ob->id.next) + for(ob=bmain->object.first; ob; ob=ob->id.next) if(BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_OUTDATED)) DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 95705ea8c05..8793c412d7d 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -38,7 +38,6 @@ #else #include <io.h> #endif -#include "MEM_guardedalloc.h" #include "DNA_anim_types.h" #include "DNA_group_types.h" @@ -47,6 +46,8 @@ #include "DNA_screen_types.h" #include "DNA_sequence_types.h" +#include "MEM_guardedalloc.h" + #include "BKE_anim.h" #include "BKE_animsys.h" #include "BKE_depsgraph.h" @@ -68,10 +69,6 @@ //XXX #include "BIF_previewrender.h" //XXX #include "BIF_editseq.h" -#ifndef DISABLE_PYTHON -#include "BPY_extern.h" -#endif - #include "BLI_math.h" #include "BLI_blenlib.h" @@ -320,11 +317,12 @@ void free_scene(Scene *sce) Scene *add_scene(char *name) { + Main *bmain= G.main; Scene *sce; ParticleEditSettings *pset; int a; - sce= alloc_libblock(&G.main->scene, ID_SCE, name); + sce= alloc_libblock(&bmain->scene, ID_SCE, name); sce->lay= sce->layact= 1; sce->r.mode= R_GAMMA|R_OSA|R_SHADOW|R_SSS|R_ENVMAP|R_RAYTRACE; @@ -586,7 +584,7 @@ void unlink_scene(Main *bmain, Scene *sce, Scene *newsce) sce1->set= NULL; /* check all sequences */ - clear_scene_in_allseqs(sce); + clear_scene_in_allseqs(bmain, sce); /* check render layer nodes in other scenes */ clear_scene_in_nodes(bmain, sce); diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index a8140cb815d..6f1d32898f9 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -42,10 +42,6 @@ #include "BKE_screen.h" -#ifndef DISABLE_PYTHON -#include "BPY_extern.h" -#endif - /* ************ Spacetype/regiontype handling ************** */ /* keep global; this has to be accessible outside of windowmanager */ diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 1e1ace0f758..461cb075bb0 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -41,6 +41,7 @@ #include "DNA_anim_types.h" #include "BKE_fcurve.h" +#include "BKE_main.h" #include "BKE_plugin_types.h" #include "BKE_sequencer.h" #include "BKE_texture.h" @@ -272,7 +273,7 @@ static ImBuf * IMB_cast_away_list(ImBuf * i) } static struct ImBuf * do_plugin_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -523,7 +524,7 @@ static void do_alphaover_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_alphaover_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -695,7 +696,7 @@ static void do_alphaunder_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf* do_alphaunder_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -820,7 +821,7 @@ void do_cross_effect_float(float facf0, float facf1, int x, int y, /* carefull: also used by speed effect! */ static struct ImBuf* do_cross_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -1087,7 +1088,7 @@ static void do_gammacross_effect_float(float facf0, float facf1, } static struct ImBuf * do_gammacross_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -1205,7 +1206,7 @@ static void do_add_effect_float(float facf0, float facf1, int x, int y, } } -static struct ImBuf * do_add_effect(Scene *scene, Sequence *seq, float cfra, +static struct ImBuf * do_add_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -1322,7 +1323,7 @@ static void do_sub_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_sub_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -1536,7 +1537,7 @@ static void do_mul_effect_float(float facf0, float facf1, int x, int y, } static struct ImBuf * do_mul_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -1992,7 +1993,7 @@ static void do_wipe_effect_float(Sequence *seq, float facf0, float facf1, } static struct ImBuf * do_wipe_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -2143,7 +2144,7 @@ static void do_transform(Scene *scene, Sequence *seq, float facf0, int x, int y, static struct ImBuf * do_transform_effect( - Scene *scene, Sequence *seq,float cfra, + Main *bmain, Scene *scene, Sequence *seq,float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -2661,7 +2662,7 @@ static void do_glow_effect_float(Sequence *seq, float facf0, float facf1, } static struct ImBuf * do_glow_effect( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -2722,7 +2723,7 @@ static int early_out_color(struct Sequence *seq, } static struct ImBuf * do_solid_color( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -2818,7 +2819,7 @@ static int early_out_multicam(struct Sequence *seq, float facf0, float facf1) } static struct ImBuf * do_multicam( - Scene *scene, Sequence *seq, float cfra, + Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, struct ImBuf *ibuf1, struct ImBuf *ibuf2, @@ -2842,7 +2843,7 @@ static struct ImBuf * do_multicam( return 0; } - i = give_ibuf_seqbase(scene, x, y, cfra, seq->multicam_source, + i = give_ibuf_seqbase(bmain, scene, x, y, cfra, seq->multicam_source, preview_render_size, seqbasep); if (!i) { return 0; @@ -3122,7 +3123,7 @@ static void get_default_fac_fade(struct Sequence *seq, float cfra, *facf1 /= seq->len; } -static struct ImBuf * do_overdrop_effect(Scene *scene, Sequence *seq, float cfra, +static struct ImBuf * do_overdrop_effect(Main *bmain, Scene *scene, Sequence *seq, float cfra, float facf0, float facf1, int x, int y, int preview_render_size, diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 866f907ef9e..b20bb111cb4 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -554,7 +554,7 @@ void calc_sequence(Scene *scene, Sequence *seq) } /* note: caller should run calc_sequence(scene, seq) after */ -void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) +void reload_sequence_new_file(Main *bmain, Scene *scene, Sequence * seq, int lock_range) { char str[FILE_MAXDIR+FILE_MAXFILE]; int prev_startdisp, prev_enddisp; @@ -621,7 +621,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range) seq->strip->len = seq->len; } else if (seq->type == SEQ_SCENE) { /* 'seq->scenenr' should be replaced with something more reliable */ - Scene * sce = G.main->scene.first; + Scene * sce = bmain->scene.first; int nr = 1; while(sce) { @@ -710,12 +710,12 @@ static int clear_scene_in_allseqs_cb(Sequence *seq, void *arg_pt) return 1; } -void clear_scene_in_allseqs(Scene *scene) +void clear_scene_in_allseqs(Main *bmain, Scene *scene) { Scene *scene_iter; /* when a scene is deleted: test all seqs */ - for(scene_iter= G.main->scene.first; scene_iter; scene_iter= scene_iter->id.next) { + for(scene_iter= bmain->scene.first; scene_iter; scene_iter= scene_iter->id.next) { if(scene_iter != scene && scene_iter->ed) { seqbase_recursive_apply(&scene_iter->ed->seqbase, clear_scene_in_allseqs_cb, scene); } @@ -1659,17 +1659,17 @@ static void copy_to_ibuf_still(Sequence * seq, float nr, ********************************************************************** */ static ImBuf* seq_render_strip_stack( - Scene *scene, + Main *bmain, Scene *scene, ListBase *seqbasep, float cfra, int chanshown, int render_size, int seqrectx, int seqrecty); -static ImBuf * seq_render_strip(Scene *scene, Sequence * seq, float cfra, +static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float cfra, int render_size, int seqrectx, int seqrecty); static ImBuf* seq_render_effect_strip_impl( - Scene *scene, float cfra, Sequence *seq, int render_size, + Main *bmain, Scene *scene, float cfra, Sequence *seq, int render_size, int seqrectx, int seqrecty) { float fac, facf; @@ -1707,7 +1707,7 @@ static ImBuf* seq_render_effect_strip_impl( early_out = sh.early_out(seq, fac, facf); if (early_out == -1) { /* no input needed */ - out = sh.execute(scene, seq, cfra, fac, facf, + out = sh.execute(bmain, scene, seq, cfra, fac, facf, seqrectx, seqrecty, render_size, 0, 0, 0); goto finish; @@ -1722,7 +1722,7 @@ static ImBuf* seq_render_effect_strip_impl( break; case 1: if (seq->seq1) { - ibuf[0] = seq_render_strip(scene, seq->seq1, cfra, + ibuf[0] = seq_render_strip(bmain, scene, seq->seq1, cfra, render_size, seqrectx, seqrecty); } @@ -1737,7 +1737,7 @@ static ImBuf* seq_render_effect_strip_impl( goto finish; case 2: if (seq->seq2) { - ibuf[1] = seq_render_strip(scene, seq->seq2, cfra, + ibuf[1] = seq_render_strip(bmain, scene, seq->seq2, cfra, render_size, seqrectx, seqrecty); } @@ -1755,19 +1755,19 @@ static ImBuf* seq_render_effect_strip_impl( } if (seq->seq1) { - ibuf[0] = seq_render_strip(scene, seq->seq1, cfra, + ibuf[0] = seq_render_strip(bmain, scene, seq->seq1, cfra, render_size, seqrectx, seqrecty); } if (seq->seq2) { - ibuf[1] = seq_render_strip(scene, seq->seq2, cfra, + ibuf[1] = seq_render_strip(bmain, scene, seq->seq2, cfra, render_size, seqrectx, seqrecty); } if (seq->seq3) { - ibuf[2] = seq_render_strip(scene, seq->seq3, cfra, + ibuf[2] = seq_render_strip(bmain, scene, seq->seq3, cfra, render_size, seqrectx, seqrecty); } @@ -1776,7 +1776,7 @@ static ImBuf* seq_render_effect_strip_impl( goto finish; } - out = sh.execute(scene, seq, cfra, fac, facf, seqrectx, seqrecty, + out = sh.execute(bmain, scene, seq, cfra, fac, facf, seqrectx, seqrecty, render_size, ibuf[0], ibuf[1], ibuf[2]); @@ -1795,7 +1795,7 @@ finish: static ImBuf * seq_render_scene_strip_impl( - Scene * scene, Sequence * seq, float nr, int seqrectx, int seqrecty) + Main *bmain, Scene * scene, Sequence * seq, float nr, int seqrectx, int seqrecty) { ImBuf * ibuf = 0; float frame= seq->sfra + nr + seq->anim_startofs; @@ -1851,7 +1851,7 @@ static ImBuf * seq_render_scene_strip_impl( if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) { /* opengl offscreen render */ - scene_update_for_newframe(G.main, seq->scene, seq->scene->lay); + scene_update_for_newframe(bmain, seq->scene, seq->scene->lay); ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, scene->r.seq_prev_type); } @@ -1864,7 +1864,7 @@ static ImBuf * seq_render_scene_strip_impl( else re= RE_NewRender(sce->id.name); - RE_BlenderFrame(re, G.main, sce, NULL, sce->lay, frame); + RE_BlenderFrame(re, bmain, sce, NULL, sce->lay, frame); RE_AcquireResultImage(re, &rres); @@ -1904,7 +1904,7 @@ static ImBuf * seq_render_scene_strip_impl( return ibuf; } -static ImBuf * seq_render_strip(Scene *scene, Sequence * seq, float cfra, +static ImBuf * seq_render_strip(Main *bmain, Scene *scene, Sequence * seq, float cfra, int render_size, int seqrectx, int seqrecty) { @@ -1929,7 +1929,7 @@ static ImBuf * seq_render_strip(Scene *scene, Sequence * seq, float cfra, if(!ibuf && seq->seqbase.first) { meta_ibuf = seq_render_strip_stack( - scene, + bmain, scene, &seq->seqbase, seq->start + nr, 0, render_size, seqrectx, seqrecty); } @@ -1961,7 +1961,7 @@ static ImBuf * seq_render_strip(Scene *scene, Sequence * seq, float cfra, /* weeek! */ f_cfra = seq->start + s->frameMap[(int) nr]; - child_ibuf = seq_render_strip(scene, seq->seq1, f_cfra, + child_ibuf = seq_render_strip(bmain, scene, seq->seq1, f_cfra, render_size, seqrectx, seqrecty); } @@ -1985,7 +1985,7 @@ static ImBuf * seq_render_strip(Scene *scene, Sequence * seq, float cfra, if(ibuf == 0) { ibuf = seq_render_effect_strip_impl( - scene, cfra, seq, render_size, + bmain, scene, cfra, seq, render_size, seqrectx, seqrecty); } } else if(seq->type == SEQ_IMAGE) { @@ -2061,7 +2061,7 @@ static ImBuf * seq_render_strip(Scene *scene, Sequence * seq, float cfra, } if (ibuf == 0) { - ibuf = seq_render_scene_strip_impl(scene, seq, nr, + ibuf = seq_render_scene_strip_impl(bmain, scene, seq, nr, seqrectx, seqrecty); copy_to_ibuf_still(seq, nr, ibuf); @@ -2129,7 +2129,7 @@ static int seq_get_early_out_for_blend_mode(Sequence * seq) } static ImBuf* seq_render_strip_stack( - Scene *scene, ListBase *seqbasep, float cfra, int chanshown, + Main *bmain, Scene *scene, ListBase *seqbasep, float cfra, int chanshown, int render_size, int seqrectx, int seqrecty) { Sequence* seq_arr[MAXSEQ+1]; @@ -2161,7 +2161,7 @@ static ImBuf* seq_render_strip_stack( } if(count == 1) { - out = seq_render_strip(scene, seq_arr[0], + out = seq_render_strip(bmain, scene, seq_arr[0], cfra, render_size, seqrectx, seqrecty); seq_stripelem_cache_put( @@ -2185,7 +2185,7 @@ static ImBuf* seq_render_strip_stack( break; } if (seq->blend_mode == SEQ_BLEND_REPLACE) { - out = seq_render_strip(scene, seq, cfra, + out = seq_render_strip(bmain, scene, seq, cfra, render_size, seqrectx, seqrecty); break; @@ -2196,7 +2196,7 @@ static ImBuf* seq_render_strip_stack( switch (early_out) { case -1: case 2: - out = seq_render_strip(scene, seq, cfra, + out = seq_render_strip(bmain, scene, seq, cfra, render_size, seqrectx, seqrecty); break; @@ -2209,7 +2209,7 @@ static ImBuf* seq_render_strip_stack( break; case 0: if (i == 0) { - out = seq_render_strip(scene, seq, cfra, + out = seq_render_strip(bmain, scene, seq, cfra, render_size, seqrectx, seqrecty); } @@ -2234,7 +2234,7 @@ static ImBuf* seq_render_strip_stack( if (seq_get_early_out_for_blend_mode(seq) == 0) { struct SeqEffectHandle sh = get_sequence_blend(seq); ImBuf * ibuf1 = out; - ImBuf * ibuf2 = seq_render_strip(scene, seq, cfra, + ImBuf * ibuf2 = seq_render_strip(bmain, scene, seq, cfra, render_size, seqrectx, seqrecty); @@ -2246,11 +2246,11 @@ static ImBuf* seq_render_strip_stack( int y= seqrecty; if (swap_input) { - out = sh.execute(scene, seq, cfra, + out = sh.execute(bmain, scene, seq, cfra, facf, facf, x, y, render_size, ibuf2, ibuf1, 0); } else { - out = sh.execute(scene, seq, cfra, + out = sh.execute(bmain, scene, seq, cfra, facf, facf, x, y, render_size, ibuf1, ibuf2, 0); } @@ -2272,7 +2272,7 @@ static ImBuf* seq_render_strip_stack( * you have to free after usage! */ -ImBuf *give_ibuf_seq(Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size) +ImBuf *give_ibuf_seq(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size) { Editing *ed= seq_give_editing(scene, FALSE); int count; @@ -2289,18 +2289,18 @@ ImBuf *give_ibuf_seq(Scene *scene, int rectx, int recty, int cfra, int chanshown } return seq_render_strip_stack( - scene, seqbasep, cfra, chanshown, render_size, rectx, recty); + bmain, scene, seqbasep, cfra, chanshown, render_size, rectx, recty); } -ImBuf *give_ibuf_seqbase(struct Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size, ListBase *seqbasep) +ImBuf *give_ibuf_seqbase(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size, ListBase *seqbasep) { - return seq_render_strip_stack(scene, seqbasep, cfra, chanshown, render_size, rectx, recty); + return seq_render_strip_stack(bmain, scene, seqbasep, cfra, chanshown, render_size, rectx, recty); } -ImBuf *give_ibuf_seq_direct(Scene *scene, int rectx, int recty, int cfra, int render_size, Sequence *seq) +ImBuf *give_ibuf_seq_direct(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int render_size, Sequence *seq) { - return seq_render_strip(scene, seq, cfra, render_size, rectx, recty); + return seq_render_strip(bmain, scene, seq, cfra, render_size, rectx, recty); } #if 0 @@ -2566,13 +2566,13 @@ static void seq_wait_for_prefetch_ready() } #endif -ImBuf *give_ibuf_seq_threaded(Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size) +ImBuf *give_ibuf_seq_threaded(Main *bmain, Scene *scene, int rectx, int recty, int cfra, int chanshown, int render_size) { PrefetchQueueElem *e = NULL; int found_something = FALSE; if (seq_thread_shutdown) { - return give_ibuf_seq(scene, rectx, recty, cfra, chanshown, render_size); + return give_ibuf_seq(bmain, scene, rectx, recty, cfra, chanshown, render_size); } while (!e) { diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index bddfeb049a8..01652aaa713 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -51,7 +51,6 @@ #include "BLI_math.h" #include "BLI_editVert.h" -#include "MEM_guardedalloc.h" /* Util macros */ diff --git a/source/blender/blenkernel/intern/sketch.c b/source/blender/blenkernel/intern/sketch.c index 33871f78864..7e39cdd1196 100644 --- a/source/blender/blenkernel/intern/sketch.c +++ b/source/blender/blenkernel/intern/sketch.c @@ -72,8 +72,7 @@ void sk_initPoint(SK_Point *pt, SK_DrawData *dd, float *no) { if (no) { - VECCOPY(pt->no, no); - normalize_v3(pt->no); + normalize_v3_v3(pt->no, no); } else { diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 97eb3aa866c..11012843131 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -37,8 +37,8 @@ #include <float.h> #include <math.h> -#include "stdio.h" -#include "string.h" /* memset */ +#include <stdio.h> +#include <string.h> /* memset */ #include "BLI_linklist.h" #include "BLI_rand.h" diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index b8e824ce3d5..98a50eee146 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2032,8 +2032,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3], VECCOPY(vel,avel); if (ci) *intrusion /= ci; if (deflected){ - VECCOPY(facenormal,force); - normalize_v3(facenormal); + normalize_v3_v3(facenormal, force); } return deflected; } diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index c8f5eb9b187..19bc853276a 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -174,10 +174,11 @@ void free_text(Text *text) Text *add_empty_text(char *name) { + Main *bmain= G.main; Text *ta; TextLine *tmp; - ta= alloc_libblock(&G.main->text, ID_TXT, name); + ta= alloc_libblock(&bmain->text, ID_TXT, name); ta->id.us= 1; ta->name= NULL; @@ -326,6 +327,7 @@ int reopen_text(Text *text) Text *add_text(char *file, const char *relpath) { + Main *bmain= G.main; FILE *fp; int i, llen, len, res; unsigned char *buffer; @@ -341,7 +343,7 @@ Text *add_text(char *file, const char *relpath) fp= fopen(str, "r"); if(fp==NULL) return NULL; - ta= alloc_libblock(&G.main->text, ID_TXT, BLI_path_basename(str)); + ta= alloc_libblock(&bmain->text, ID_TXT, BLI_path_basename(str)); ta->id.us= 1; ta->lines.first= ta->lines.last= NULL; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index fe5abbd0868..9075c64d286 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -602,9 +602,10 @@ void tex_set_type(Tex *tex, int type) Tex *add_texture(const char *name) { + Main *bmain= G.main; Tex *tex; - tex= alloc_libblock(&G.main->tex, ID_TE, name); + tex= alloc_libblock(&bmain->tex, ID_TE, name); default_tex(tex); @@ -726,6 +727,7 @@ Tex *copy_texture(Tex *tex) void make_local_texture(Tex *tex) { + Main *bmain= G.main; Tex *texn; Material *ma; World *wrld; @@ -755,7 +757,7 @@ void make_local_texture(Tex *tex) return; } - ma= G.main->mat.first; + ma= bmain->mat.first; while(ma) { for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a] && ma->mtex[a]->tex==tex) { @@ -765,7 +767,7 @@ void make_local_texture(Tex *tex) } ma= ma->id.next; } - la= G.main->lamp.first; + la= bmain->lamp.first; while(la) { for(a=0; a<MAX_MTEX; a++) { if(la->mtex[a] && la->mtex[a]->tex==tex) { @@ -775,7 +777,7 @@ void make_local_texture(Tex *tex) } la= la->id.next; } - wrld= G.main->world.first; + wrld= bmain->world.first; while(wrld) { for(a=0; a<MAX_MTEX; a++) { if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) { @@ -785,7 +787,7 @@ void make_local_texture(Tex *tex) } wrld= wrld->id.next; } - br= G.main->brush.first; + br= bmain->brush.first; while(br) { if(br->mtex.tex==tex) { if(br->id.lib) lib= 1; @@ -803,7 +805,7 @@ void make_local_texture(Tex *tex) texn= copy_texture(tex); texn->id.us= 0; - ma= G.main->mat.first; + ma= bmain->mat.first; while(ma) { for(a=0; a<MAX_MTEX; a++) { if(ma->mtex[a] && ma->mtex[a]->tex==tex) { @@ -816,7 +818,7 @@ void make_local_texture(Tex *tex) } ma= ma->id.next; } - la= G.main->lamp.first; + la= bmain->lamp.first; while(la) { for(a=0; a<MAX_MTEX; a++) { if(la->mtex[a] && la->mtex[a]->tex==tex) { @@ -829,7 +831,7 @@ void make_local_texture(Tex *tex) } la= la->id.next; } - wrld= G.main->world.first; + wrld= bmain->world.first; while(wrld) { for(a=0; a<MAX_MTEX; a++) { if(wrld->mtex[a] && wrld->mtex[a]->tex==tex) { @@ -842,7 +844,7 @@ void make_local_texture(Tex *tex) } wrld= wrld->id.next; } - br= G.main->brush.first; + br= bmain->brush.first; while(br) { if(br->mtex.tex==tex) { if(br->id.lib==0) { @@ -860,6 +862,7 @@ void make_local_texture(Tex *tex) void autotexname(Tex *tex) { + Main *bmain= G.main; char texstr[20][15]= {"None" , "Clouds" , "Wood", "Marble", "Magic" , "Blend", "Stucci", "Noise" , "Image", "Plugin", "EnvMap" , "Musgrave", "Voronoi", "DistNoise", "Point Density", "Voxel Data", "", "", "", ""}; @@ -868,7 +871,7 @@ void autotexname(Tex *tex) if(tex) { if(tex->use_nodes) { - new_id(&G.main->tex, (ID *)tex, "Noddy"); + new_id(&bmain->tex, (ID *)tex, "Noddy"); } else if(tex->type==TEX_IMAGE) { @@ -878,12 +881,12 @@ void autotexname(Tex *tex) BLI_splitdirstring(di, fi); strcpy(di, "I."); strcat(di, fi); - new_id(&G.main->tex, (ID *)tex, di); + new_id(&bmain->tex, (ID *)tex, di); } - else new_id(&G.main->tex, (ID *)tex, texstr[tex->type]); + else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } - else if(tex->type==TEX_PLUGIN && tex->plugin) new_id(&G.main->tex, (ID *)tex, tex->plugin->pname); - else new_id(&G.main->tex, (ID *)tex, texstr[tex->type]); + else if(tex->type==TEX_PLUGIN && tex->plugin) new_id(&bmain->tex, (ID *)tex, tex->plugin->pname); + else new_id(&bmain->tex, (ID *)tex, texstr[tex->type]); } } diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c index 1d1b5ec16f7..42df92443f3 100644 --- a/source/blender/blenkernel/intern/world.c +++ b/source/blender/blenkernel/intern/world.c @@ -44,10 +44,6 @@ #include "BKE_main.h" #include "BKE_icons.h" -#ifndef DISABLE_PYTHON -#include "BPY_extern.h" -#endif - void free_world(World *wrld) { MTex *mtex; @@ -69,9 +65,10 @@ void free_world(World *wrld) World *add_world(char *name) { + Main *bmain= G.main; World *wrld; - wrld= alloc_libblock(&G.main->world, ID_WO, name); + wrld= alloc_libblock(&bmain->world, ID_WO, name); wrld->horr= 0.05f; wrld->horg= 0.05f; @@ -129,6 +126,7 @@ World *copy_world(World *wrld) void make_local_world(World *wrld) { + Main *bmain= G.main; Scene *sce; World *wrldn; int local=0, lib=0; @@ -146,7 +144,7 @@ void make_local_world(World *wrld) return; } - sce= G.main->scene.first; + sce= bmain->scene.first; while(sce) { if(sce->world==wrld) { if(sce->id.lib) lib= 1; @@ -164,7 +162,7 @@ void make_local_world(World *wrld) wrldn= copy_world(wrld); wrldn->id.us= 0; - sce= G.main->scene.first; + sce= bmain->scene.first; while(sce) { if(sce->world==wrld) { if(sce->id.lib==0) { diff --git a/source/blender/blenkernel/intern/writeframeserver.c b/source/blender/blenkernel/intern/writeframeserver.c index 0ec8837c0e7..b0c05c31fa1 100644 --- a/source/blender/blenkernel/intern/writeframeserver.c +++ b/source/blender/blenkernel/intern/writeframeserver.c @@ -45,7 +45,6 @@ #include <stdlib.h> -#include "MEM_guardedalloc.h" #include "DNA_userdef_types.h" #include "BKE_global.h" |