svn merge -r41751:41779 ^/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Tue, 15 Nov 2011 02:05:32 +0000 (02:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 15 Nov 2011 02:05:32 +0000 (02:05 +0000)
51 files changed:
1  2 
CMakeLists.txt
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/BKE_paint.h
source/blender/blenkernel/intern/anim.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/customdata.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/particle.c
source/blender/blenlib/BLI_edgehash.h
source/blender/blenlib/BLI_math_geom.h
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/pbvh.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/armature/editarmature.c
source/blender/editors/armature/reeb.c
source/blender/editors/curve/editcurve.c
source/blender/editors/mesh/mesh_data.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/sculpt_paint/paint_vertex.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_snap.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_orientations.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_scene.c
source/blender/modifiers/intern/MOD_armature.c
source/blender/modifiers/intern/MOD_array.c
source/blender/modifiers/intern/MOD_boolean.c
source/blender/modifiers/intern/MOD_curve.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/modifiers/intern/MOD_hook.c
source/blender/modifiers/intern/MOD_lattice.c
source/blender/modifiers/intern/MOD_mirror.c
source/blender/modifiers/intern/MOD_smooth.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/render_texture.c
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

diff --cc CMakeLists.txt
Simple merge
@@@ -404,8 -346,8 +404,8 @@@ void DM_init_funcs(DerivedMesh *dm)
   * of vertices, edges and faces (doesn't allocate memory for them, just
   * sets up the custom data layers)
   */
 -void DM_init(DerivedMesh *dm, DerivedMeshType type,
 -             int numVerts, int numEdges, int numFaces);
 +void DM_init(DerivedMesh *dm, DerivedMeshType type, int numVerts, int numEdges, 
-            int numFaces, int numLoops, int numPolys);
++             int numFaces, int numLoops, int numPolys);
  
  /* utility function to initialise a DerivedMesh for the desired number
   * of vertices, edges and faces, with a layer setup copied from source
Simple merge
Simple merge
  #include "BKE_particle.h"
  #include "BKE_scene.h"
  #include "BKE_utildefines.h"
 +#include "BKE_tessmesh.h"
  #include "BKE_depsgraph.h"
  #include "BKE_anim.h"
+ #include "BKE_report.h"
  
  
  // XXX bad level call...
@@@ -101,99 -97,5 +101,99 @@@ void                              BLI_edgehashIterator_step               (Edg
        /* Determine if an iterator is done. */
  int                                   BLI_edgehashIterator_isDone             (EdgeHashIterator *ehi);
  
-       hash = EDGEHASH(v0,v1)%eh->nbuckets;
 +/**************inlined code************/
 +static unsigned int _ehash_hashsizes[]= {
 +      1, 3, 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 
 +      16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169, 
 +      4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 
 +      268435459
 +};
 +
 +#define EDGEHASH(v0,v1)               ((v0*39)^(v1*31))
 +
 +/***/
 +
 +typedef struct EdgeEntry EdgeEntry;
 +struct EdgeEntry {
 +      EdgeEntry *next;
 +      int v0, v1;
 +      void *val;
 +};
 +
 +struct EdgeHash {
 +      EdgeEntry **buckets;
 +      BLI_mempool *epool;
 +      int nbuckets, nentries, cursize;
 +};
 +
 +
 +BM_INLINE void BLI_edgehash_insert(EdgeHash *eh, int v0, int v1, void *val) {
 +      unsigned int hash;
 +      EdgeEntry *e= BLI_mempool_alloc(eh->epool);
 +
 +      if (v1<v0) {
 +              v0 ^= v1;
 +              v1 ^= v0;
 +              v0 ^= v1;
 +      }
-         if (++eh->nentries>eh->nbuckets*3) {
++      hash = EDGEHASH(v0,v1)%eh->nbuckets;
 +
 +      e->v0 = v0;
 +      e->v1 = v1;
 +      e->val = val;
 +      e->next= eh->buckets[hash];
 +      eh->buckets[hash]= e;
 +      
++      if (++eh->nentries>eh->nbuckets*3) {
 +              EdgeEntry *e, **old= eh->buckets;
 +              int i, nold= eh->nbuckets;
 +              
 +              eh->nbuckets= _ehash_hashsizes[++eh->cursize];
 +              eh->buckets= MEM_mallocN(eh->nbuckets*sizeof(*eh->buckets), "eh buckets");
 +              BMEMSET(eh->buckets, 0, eh->nbuckets*sizeof(*eh->buckets));
 +              
 +              for (i=0; i<nold; i++) {
 +                      for (e= old[i]; e;) {
 +                              EdgeEntry *n= e->next;
 +                              
 +                              hash= EDGEHASH(e->v0,e->v1)%eh->nbuckets;
 +                              e->next= eh->buckets[hash];
 +                              eh->buckets[hash]= e;
 +                              
 +                              e= n;
 +                      }
 +              }
 +              
 +              MEM_freeN(old);
 +      }
 +}
 +
 +BM_INLINE void** BLI_edgehash_lookup_p(EdgeHash *eh, int v0, int v1) {
 +      unsigned int hash;
 +      EdgeEntry *e;
 +
 +      if (v1<v0) {
 +              v0 ^= v1;
 +              v1 ^= v0;
 +              v0 ^= v1;
 +      }
 +      hash = EDGEHASH(v0,v1)%eh->nbuckets;
 +      for (e= eh->buckets[hash]; e; e= e->next)
 +              if (v0==e->v0 && v1==e->v1)
 +                      return &e->val;
 +      
 +      return NULL;
 +}
 +
 +BM_INLINE void* BLI_edgehash_lookup(EdgeHash *eh, int v0, int v1) {
 +      void **value_p = BLI_edgehash_lookup_p(eh,v0,v1);
 +
 +      return value_p?*value_p:NULL;
 +}
 +
 +BM_INLINE int BLI_edgehash_haskey(EdgeHash *eh, int v0, int v1) {
 +      return BLI_edgehash_lookup_p(eh, v0, v1)!=NULL;
 +}
 +
  #endif
  
Simple merge
@@@ -329,8 -281,9 +329,8 @@@ int ED_mesh_color_remove(bContext *C, O
        CustomDataLayer *cdl;
        int index;
  
-       index= CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL);
 -      index= CustomData_get_active_layer_index(data, CD_MCOL);
 -      cdl= (index == -1)? NULL: &data->layers[index];
++      index= CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL);
 +      cdl= (index == -1)? NULL: &me->ldata.layers[index];
  
        if(!cdl)
                return 0;
@@@ -512,18 -506,8 +517,19 @@@ static void interp_bilinear_grid(DMGrid
        interp_bilinear_quad_data(data, u, v, res);
  }
  
- static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm,  const int lvl, const int face_index, const float u, const float v, float co[3], float n[3])
+ static void get_ccgdm_data(DerivedMesh *lodm, DerivedMesh *hidm, const int *origindex,  const int lvl, const int face_index, const float u, const float v, float co[3], float n[3])
  {
 +#if 1 // BMESH_TODO
 +      (void)lodm;
 +      (void)hidm;
++      (void)origindex;
 +      (void)lvl;
 +      (void)face_index;
 +      (void)u;
 +      (void)v;
 +      (void)co;
 +      (void)n;
 +#else
        MFace mface;
        DMGridData **grid_data;
        float crn_x, crn_y;
@@@ -636,9 -619,23 +642,23 @@@ static void *init_heights_data(Multires
                height_data->ssdm= subsurf_make_derived_from_derived(bkr->lores_dm, &smd, 0, NULL, 0, 0, 0);
        }
  
 -      height_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX);
++      height_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
        return (void*)height_data;
  }
  
 -      normal_data->origindex= lodm->getFaceDataArray(lodm, CD_ORIGINDEX);
+ static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
+ {
+       MNormalBakeData *normal_data;
+       DerivedMesh *lodm= bkr->lores_dm;
+       normal_data= MEM_callocN(sizeof(MNormalBakeData), "MultiresBake normalData");
++      normal_data->origindex= lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
+       return (void*)normal_data;
+ }
  static void apply_heights_data(void *bake_data)
  {
        MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
@@@ -777,16 -760,6 +794,17 @@@ static void apply_tangmat_callback(Deri
                                     const int face_index, const int lvl, const float st[2],
                                     float tangmat[3][3], const int x, const int y)
  {
 +#if 1 // BMESH_TODO
 +      (void)lores_dm;
 +      (void)hires_dm;
++      (void)bake_data;
 +      (void)face_index;
 +      (void)lvl;
 +      (void)st;
 +      (void)tangmat;
 +      (void)y;
 +      (void)x;
 +#else
        MTFace *mtface= CustomData_get_layer(&lores_dm->faceData, CD_MTFACE);
        MFace mface;
        Image *ima= mtface[face_index].tpage;
@@@ -2394,42 -2314,8 +2394,41 @@@ typedef struct VPaintData 
        int *indexar;
        float *vertexcosnos;
        float vpimat[3][3];
 +      
 +      /*mpoly -> mface mapping*/
 +      MemArena *arena;
 +      ListBase *polyfacemap;
  } VPaintData;
  
- static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me,
-                                     Object *ob, Scene *scene)
++static void vpaint_build_poly_facemap(struct VPaintData *vd, Mesh *me)
 +{
 +      MFace *mf;
 +      polyfacemap_e *e;
 +      int *origIndex;
 +      int i;
 +
 +      vd->arena = BLI_memarena_new(1<<13, "vpaint tmp");
 +      BLI_memarena_use_calloc(vd->arena);
 +
 +      vd->polyfacemap = BLI_memarena_alloc(vd->arena, sizeof(ListBase)*me->totpoly);
 +
 +      origIndex = CustomData_get_layer(&me->fdata, CD_POLYINDEX);
 +      mf = me->mface;
 +
 +      if (!origIndex)
 +              return;
 +
 +      for (i=0; i<me->totface; i++, mf++, origIndex++) {
 +              if (*origIndex == ORIGINDEX_NONE)
 +                      continue;
 +
 +              e = BLI_memarena_alloc(vd->arena, sizeof(polyfacemap_e));
 +              e->facenr = i;
 +              
 +              BLI_addtail(&vd->polyfacemap[*origIndex], e);
 +      }
 +}
 +
  static int vpaint_stroke_test_start(bContext *C, struct wmOperator *op, wmEvent *UNUSED(event))
  {
        ToolSettings *ts= CTX_data_tool_settings(C);
        vpd->vertexcosnos= mesh_get_mapped_verts_nors(vpd->vc.scene, ob);
        vpd->indexar= get_indexarray(me);
        vpd->paintcol= vpaint_get_current_col(vp);
-       vpaint_build_poly_facemap(vpd, me, ob, scene);
++      vpaint_build_poly_facemap(vpd, me);
        
        /* for filtering */
 -      copy_vpaint_prev(vp, (unsigned int *)me->mcol, me->totface);
 +      copy_vpaint_prev(vp, (unsigned int *)me->mloopcol, me->totloop);
        
        /* some old cruft to sort out later */
        mul_m4_m4m4(mat, ob->obmat, vpd->vc.rv3d->viewmat);
@@@ -2019,14 -1936,29 +2019,15 @@@ static void rna_def_mesh(BlenderRNA *br
        RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
        RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);     
        RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 -      
 -      prop= RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
 -      RNA_def_property_array(prop, 3);
 -      RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
 -      RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
 -      RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", "rna_Mesh_texspace_size_set", NULL);
 -      RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
 +      */
        
        /* not supported yet
-        prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
-        RNA_def_property_float(prop, NULL, "rot");
-        RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
-        RNA_def_property_editable_func(prop, texspace_editable);
-        RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/
+       prop= RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+       RNA_def_property_float(prop, NULL, "rot");
+       RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
+       RNA_def_property_editable_func(prop, texspace_editable);
+       RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+       */
 -      
 -      /* materials */
 -      prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
 -      RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
 -      RNA_def_property_struct_type(prop, "Material");
 -      RNA_def_property_ui_text(prop, "Materials", "");
 -      RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
 -      RNA_def_property_collection_funcs(prop, 0, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
  
        /* Mesh Draw Options for Edit Mode*/
        
@@@ -166,10 -166,10 +166,10 @@@ static void deformMatricesEM
        ArmatureModifierData *amd = (ArmatureModifierData*) md;
        DerivedMesh *dm = derivedData;
  
 -      if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
 +      if(!derivedData) dm = CDDM_from_BMEditMesh(editData, ob->data, 0);
  
        armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
-                                 amd->deformflag, NULL, amd->defgrp_name);
+                             amd->deformflag, NULL, amd->defgrp_name);
  
        if(!derivedData) dm->release(dm);
  }