Commit: aa8fafb569a7042d7ac2272a0f17d86a2b7059bf
Author: Bastien Montagne
Date:   Tue Sep 2 14:13:14 2014 +0200
Branches: temp_custom_loop_normals
https://developer.blender.org/rBaa8fafb569a7042d7ac2272a0f17d86a2b7059bf

Merge branch 'master' into temp_custom_loop_normals

Conflicts:
        source/blender/makesrna/intern/rna_mesh_api.c

===================================================================



===================================================================

diff --cc source/blender/makesrna/intern/rna_mesh_api.c
index a013a40,cc1f57d..49bf0f1
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@@ -153,106 -139,11 +153,108 @@@ static void rna_Mesh_calc_smooth_groups
                            r_group_total, use_bitflags);
  }
  
 +static void rna_Mesh_define_normals_split_custom_do(Mesh *mesh, float 
(*custom_loopnors)[3],
 +                                                    const float 
*custom_loopnors_factors,
 +                                                    bool use_current_clnors, 
const bool use_vertices)
 +{
 +      float (*polynors)[3];
 +      short (*clnors)[2];
 +      const int numloops = mesh->totloop;
 +      bool free_polynors = false;
 +
 +      if (CustomData_has_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL)) {
 +              clnors = CustomData_get_layer(&mesh->ldata, 
CD_CUSTOMLOOPNORMAL);
 +              memset(clnors, 0, sizeof(*clnors) * numloops);
 +      }
 +      else {
 +              clnors = CustomData_add_layer(&mesh->ldata, 
CD_CUSTOMLOOPNORMAL, CD_DEFAULT, NULL, numloops);
 +              use_current_clnors = false;
 +      }
 +
 +      if (CustomData_has_layer(&mesh->pdata, CD_NORMAL)) {
 +              polynors = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
 +      }
 +      else {
 +              polynors = MEM_mallocN(sizeof(float[3]) * mesh->totpoly, 
__func__);
 +              BKE_mesh_calc_normals_poly(mesh->mvert, mesh->totvert, 
mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
 +                                         polynors, false);
 +              free_polynors = true;
 +      }
 +
 +      if (use_vertices) {
 +              BKE_mesh_normals_loop_custom_from_vertices_set(mesh->mvert, 
custom_loopnors, custom_loopnors_factors,
 +                                                             mesh->totvert, 
mesh->medge, mesh->totedge,
 +                                                             mesh->mloop, 
mesh->totloop, mesh->mpoly,
 +                                                             (const float 
(*)[3])polynors, mesh->totpoly,
 +                                                             clnors, 
use_current_clnors);
 +      }
 +      else {
 +              BKE_mesh_normals_loop_custom_set(mesh->mvert, mesh->totvert, 
mesh->medge, mesh->totedge,
 +                                               mesh->mloop, custom_loopnors, 
custom_loopnors_factors, mesh->totloop,
 +                                               mesh->mpoly, (const float 
(*)[3])polynors, mesh->totpoly,
 +                                               clnors, use_current_clnors);
 +      }
 +
 +      if (free_polynors) {
 +              MEM_freeN(polynors);
 +      }
 +}
 +
 +static void rna_Mesh_define_normals_split_custom(Mesh *mesh, ReportList 
*reports, int normals_len, float *normals,
 +                                                 int factors_len, float 
*factors, int use_current_custom_normals)
 +{
 +      float (*loopnors)[3] = (float (*)[3])normals;
 +      const float *loopnors_factors = (const float *)factors;
 +      const int numloops = mesh->totloop;
 +
 +      if (normals_len != numloops * 3) {
 +              BKE_reportf(reports, RPT_ERROR,
 +                          "Mesh.define_normals_split_custom(): number of 
custom normals is not number of loops (%f / %d)",
 +                          (float)normals_len / 3.0f, numloops);
 +              return;
 +      }
 +      if (!ELEM(factors_len, numloops, 0)) {
 +              BKE_reportf(reports, RPT_ERROR,
 +                          "Mesh.define_normals_split_custom(): number of 
factors is not number of loops (%f / %d)",
 +                          (float)factors_len, numloops);
 +              return;
 +      }
 +
 +      rna_Mesh_define_normals_split_custom_do(mesh, loopnors, 
loopnors_factors, (bool)use_current_custom_normals, false);
 +}
 +
 +static void rna_Mesh_define_normals_split_custom_from_vertices(Mesh *mesh, 
ReportList *reports,
 +                                                               int 
normals_len, float *normals,
 +                                                               int 
factors_len, float *factors,
 +                                                               int 
use_current_custom_normals)
 +{
 +      float (*vertnors)[3] = (float (*)[3])normals;
 +      const float *vertnors_factors = (const float *)factors;
 +      const int numverts = mesh->totvert;
 +
 +      if (normals_len != numverts * 3) {
 +              BKE_reportf(reports, RPT_ERROR,
 +                          "Mesh.define_normals_split_custom_from_vertices(): "
 +                          "number of custom normals is not number of vertices 
(%f / %d)",
 +                          (float)normals_len / 3.0f, numverts);
 +              return;
 +      }
 +      if (!ELEM(factors_len, numverts, 0)) {
 +              BKE_reportf(reports, RPT_ERROR,
 +                          "Mesh.define_normals_split_custom_from_vertices(): "
 +                          "number of factors is not number of vertices (%f / 
%d)",
 +                          (float)factors_len, numverts);
 +              return;
 +      }
 +
 +      rna_Mesh_define_normals_split_custom_do(mesh, vertnors, 
vertnors_factors, (bool)use_current_custom_normals, true);
 +}
 +
- static void rna_Mesh_transform(Mesh *mesh, float *mat)
+ static void rna_Mesh_transform(Mesh *mesh, float *mat, int shape_keys)
  {
-       ED_mesh_transform(mesh, (float (*)[4])mat);
+       BKE_mesh_transform(mesh, (float (*)[4])mat, shape_keys);
+ 
+       DAG_id_tag_update(&mesh->id, 0);
  }
  
  #else

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to