svn merge ^/trunk/blender -r46330:46335
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Mon, 7 May 2012 22:28:59 +0000 (22:28 +0000)
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>
Mon, 7 May 2012 22:28:59 +0000 (22:28 +0000)
21 files changed:
1  2 
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/collada/MeshImporter.cpp
source/blender/collada/SkinInfo.cpp
source/blender/editors/mesh/editmesh_utils.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_intern.h
source/blender/editors/object/object_ops.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_view3d/drawobject.c
source/blender/makesrna/intern/rna_curve.c
source/blender/modifiers/intern/MOD_uvproject.c

index 79bc7395d6ddc86e6dddf3cbc9d37d3c3bdc4a36,ffc33e3b86a53cda878569c5a746ddd2be150e2a..f431b21b78c6b2f3e1f172290c02f0c0bd05600a
@@@ -2857,57 -2816,23 +2860,57 @@@ void mesh_calc_poly_normal(MPoly *mpoly
  static void mesh_calc_ngon_normal_coords(MPoly *mpoly, MLoop *loopstart,
                                           const float (*vertex_coords)[3], float normal[3])
  {
 -      const int nverts = mpoly->totloop;
 -      float const *v_prev = vertex_coords[loopstart[nverts - 1].v];
 -      float const *v_curr = vertex_coords[loopstart->v];
 -      float n[3] = {0.0f};
 +
 +      const float *v1, *v2, *v3;
 +      double u[3], v[3], w[3];
 +      double n[3] = {0.0, 0.0, 0.0}, l;
        int i;
  
 -      /* Newell's Method */
 -      for (i = 0; i < nverts; v_prev = v_curr, v_curr = vertex_coords[loopstart[++i].v]) {
 -              add_newell_cross_v3_v3v3(n, v_prev, v_curr);
 +      for (i = 0; i < mpoly->totloop; i++) {
 +              v1 = (const float *)(vertex_coords + loopstart[i].v);
 +              v2 = (const float *)(vertex_coords + loopstart[(i+1)%mpoly->totloop].v);
 +              v3 = (const float *)(vertex_coords + loopstart[(i+2)%mpoly->totloop].v);
 +
 +              copy_v3db_v3fl(u, v1);
 +              copy_v3db_v3fl(v, v2);
 +              copy_v3db_v3fl(w, v3);
 +
 +              /*this fixes some weird numerical error*/
 +              if (i==0) {
 +                      u[0] += 0.0001f;
 +                      u[1] += 0.0001f;
 +                      u[2] += 0.0001f;
 +              }
 +
 +              n[0] += (u[1] - v[1]) * (u[2] + v[2]);
 +              n[1] += (u[2] - v[2]) * (u[0] + v[0]);
 +              n[2] += (u[0] - v[0]) * (u[1] + v[1]);
        }
  
 -      if (UNLIKELY(normalize_v3_v3(normal, n) == 0.0f)) {
 -              normal[2] = 1.0f; /* other axis set to 0.0 */
 +      l = n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
 +      l = sqrt(l);
 +
 +      if (l == 0.0) {
 +              normal[0] = 0.0f;
 +              normal[1] = 0.0f;
 +              normal[2] = 1.0f;
 +
 +              return;
 +      }
 +      else {
 +              l = 1.0f / l;
        }
 +
 +      n[0] *= l;
 +      n[1] *= l;
 +      n[2] *= l;
 +
 +      normal[0] = (float) n[0];
 +      normal[1] = (float) n[1];
 +      normal[2] = (float) n[2];
  }
  
- void mesh_calc_poly_normal_coords(MPoly *mpoly, MLoop *loopstart,
+ void BKE_mesh_calc_poly_normal_coords(MPoly *mpoly, MLoop *loopstart,
                             const float (*vertex_coords)[3], float no[3])
  {
        if (mpoly->totloop > 4) {
index 479b45b82a3459bbad7cc104a22f736eafc81212,7e27106a82f8d614c243de13e8b74d9ec0f965eb..04585b726f3b755df31ff5aa4073ad1f746e099b
@@@ -13383,14 -7399,32 +13383,14 @@@ static void do_versions(FileData *fd, L
                }
        }
        
 -      if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 4))
        {
                Lamp *la;
 -              Camera *cam;
 -              Curve *cu;
 -
                for (la= main->lamp.first; la; la= la->id.next) {
-                       if (la->shadow_frustum_size == 0.0)
+                       if (la->shadow_frustum_size == 0.0f)
                                la->shadow_frustum_size= 10.0f;
                }
 -
 -              for (cam = main->camera.first; cam; cam = cam->id.next) {
 -                      if (cam->flag & CAM_PANORAMA) {
 -                              cam->type = CAM_PANO;
 -                              cam->flag &= ~CAM_PANORAMA;
 -                      }
 -              }
 -
 -              for(cu= main->curve.first; cu; cu= cu->id.next) {
 -                      if(cu->bevfac2 == 0.0f) {
 -                              cu->bevfac1 = 0.0f;
 -                              cu->bevfac2 = 1.0f;
 -                      }
 -              }
        }
 -
 +      
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
  
index 5560a80f68ecbe9b4b56111705af5190fafaa889,9ce0ce6c3a2751227b0e250218bbea9dcdbc9240..f59dfbc5d3059d53ebdfa0d5f5d911823f24e1a3
@@@ -970,9 -976,7 +976,9 @@@ bool MeshImporter::write_geometry(cons
        
        read_faces(mesh, me, new_tris);
  
-       make_edges(me, 0);
+       BKE_mesh_make_edges(me, 0);
  
 +      mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
 +
        return true;
  }
Simple merge